Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@ if(NOT DEFINED PROJECT_VERSION)
set(PROJECT_VERSION 1.0.0)
endif()

# Check for and warn if running under Rosetta
if(APPLE)
execute_process(
COMMAND sysctl -in sysctl.proc_translated
OUTPUT_VARIABLE MACOS_TRANSLATED
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)

if(MACOS_TRANSLATED)
message(
WARNING
"CMake is running under Rosetta. "
"This may cause the project to be built for x86_64 instead of arm64. "
"Run CMake natively under Apple Silicon or explicitly pass "
"-DCMAKE_OSX_ARCHITECTURES=arm64"
)
endif()
endif()

project(mcpp VERSION ${PROJECT_VERSION})

set(CMAKE_CXX_STANDARD 17)
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ git clone https://github.com/rozukke/mcpp.git && cd mcpp
cmake -B build && cd build
sudo make install
```

On an M-series Mac, you may encounter: `found architecture 'x86_64', required architecture 'arm64'`.
This means `cmake` is running under Rosetta. You can fix this by adding `-DCMAKE_OSX_ARCHITECTURES=arm64` after `cmake -B build`.
But you should fix the root cause by ensuring your `cmake` or `brew` installs are not the intel x86 versions.

- After doing this, the library should be accessible via a `#include <mcpp/mcpp.h>` directive.
- When compiling code using the library, use the flag `-lmcpp` for Makefiles or `target_link_libraries(your_executable mcpp)` for CMake.

Expand Down
Loading