diff --git a/CMakeLists.txt b/CMakeLists.txt index 4dfc7b170..6e965723d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,11 +42,21 @@ CMAKE_DEPENDENT_OPTION(USE_WIIUSE "Support for wiimote input devices" ON "NOT SERVER_ONLY;NOT CYGWIN" OFF) if(APPLE AND NOT IOS) - list(APPEND CMAKE_PREFIX_PATH /usr/local/opt) - include_directories(/usr/local/opt/openssl@1.1/include/) - include_directories(/usr/local/opt/openssl@1.1/include/openssl/) - include_directories(/usr/local/opt/freetype/include/freetype2/) - include_directories(/usr/local/opt/harfbuzz/include/harfbuzz/) + if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm") + set(ARCHFLAGS "arm64") + list(APPEND CMAKE_PREFIX_PATH /opt/homebrew/opt) + include_directories(/opt/homebrew/opt/openssl@1.1/include/) + include_directories(/opt/homebrew/opt/openssl@1.1/include/openssl/) + include_directories(/opt/homebrew/opt/freetype/include/freetype2/) + include_directories(/opt/homebrew/opt/harfbuzz/include/harfbuzz/) + else() + set(ARCHFLAGS "${CMAKE_SYSTEM_PROCESSOR}") + list(APPEND CMAKE_PREFIX_PATH /usr/local/opt) + include_directories(/usr/local/opt/openssl@1.1/include/) + include_directories(/usr/local/opt/openssl@1.1/include/openssl/) + include_directories(/usr/local/opt/freetype/include/freetype2/) + include_directories(/usr/local/opt/harfbuzz/include/harfbuzz/) + endif() endif() if (IOS) @@ -317,8 +327,8 @@ endif() include_directories(${STK_SOURCE_DIR}) if(APPLE AND NOT IOS) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch x86_64") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch x86_64 -F/Library/Frameworks") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch ${ARCHFLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch ${ARCHFLAGS} -F/Library/Frameworks") elseif(MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") # Enable multi-processor compilation (faster) endif() diff --git a/lib/angelscript/projects/cmake/CMakeLists.txt b/lib/angelscript/projects/cmake/CMakeLists.txt index 371908627..2e041bab7 100644 --- a/lib/angelscript/projects/cmake/CMakeLists.txt +++ b/lib/angelscript/projects/cmake/CMakeLists.txt @@ -116,7 +116,7 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^arm") enable_language(ASM) if(CMAKE_ASM_COMPILER_WORKS) set(ANGELSCRIPT_SOURCE ${ANGELSCRIPT_SOURCE} ../../source/as_callfunc_arm.cpp ../../source/as_callfunc_arm_gcc.S) - if (NOT IOS) + if (NOT APPLE) set_property(SOURCE ../../source/as_callfunc_arm_gcc.S APPEND PROPERTY COMPILE_FLAGS " -Wa,-mimplicit-it=always") endif() else() diff --git a/lib/bullet/CMakeLists.txt b/lib/bullet/CMakeLists.txt index 49a539956..34176e251 100644 --- a/lib/bullet/CMakeLists.txt +++ b/lib/bullet/CMakeLists.txt @@ -3,8 +3,8 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/) if(APPLE AND NOT IOS) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch x86_64") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch x86_64 -F/Library/Frameworks") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch ${ARCHFLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch ${ARCHFLAGS} -F/Library/Frameworks") endif() # libbulletmath diff --git a/lib/enet/CMakeLists.txt b/lib/enet/CMakeLists.txt index 517012038..43632ec3a 100644 --- a/lib/enet/CMakeLists.txt +++ b/lib/enet/CMakeLists.txt @@ -25,8 +25,8 @@ else() endif() if(APPLE AND NOT IOS) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch x86_64") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch x86_64 -F/Library/Frameworks") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch ${ARCHFLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch ${ARCHFLAGS} -F/Library/Frameworks") endif() if(HAS_FCNTL) diff --git a/lib/irrlicht/CMakeLists.txt b/lib/irrlicht/CMakeLists.txt index b594b3374..99158498e 100644 --- a/lib/irrlicht/CMakeLists.txt +++ b/lib/irrlicht/CMakeLists.txt @@ -29,8 +29,8 @@ endif() if(APPLE AND NOT IOS) include_directories("${CMAKE_CURRENT_SOURCE_DIR}/source/Irrlicht/MacOSX" "${CMAKE_CURRENT_SOURCE_DIR}/source/Irrlicht") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch x86_64") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch x86_64 -F/Library/Frameworks") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch ${ARCHFLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch ${ARCHFLAGS} -F/Library/Frameworks") endif() add_definitions(-DNDEBUG=1 -DIRRLICHT_EXPORTS=1 -DPNG_THREAD_UNSAFE_OK -DPNG_NO_MMX_CODE -DPNG_NO_MNG_FEATURES)