Skip to content

Commit 5ef0c65

Browse files
committed
macOS: make sure that we build our new static library using the correct architecture.
1 parent 4b29f46 commit 5ef0c65

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

cmake/staticlibrary/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ foreach(LIBRARY ${LIBRARIES})
4848
list(APPEND OBJECT_FILES ${OBJ_FILES})
4949
endforeach()
5050

51+
# Specify the target architecture.
52+
53+
if(APPLE)
54+
if("${TARGET_ARCHITECTURE}" STREQUAL "Intel")
55+
set(CMAKE_OSX_ARCHITECTURES x86_64)
56+
else()
57+
set(CMAKE_OSX_ARCHITECTURES arm64)
58+
endif()
59+
endif()
60+
5161
# Create a new static library for libOpenCOR.
5262

5363
add_library(${CMAKE_PROJECT_NAME} STATIC

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ if( NOT EMSCRIPTEN
433433
CMAKE_ARGS
434434
-DPREBUILT_DIR=${PREBUILT_DIR}
435435
-DLIBOPENCOR_STATIC_LIBRARY=$<TARGET_FILE:${CMAKE_PROJECT_NAME}>
436+
-DTARGET_ARCHITECTURE=${LIBOPENCOR_TARGET_ARCHITECTURE}
436437
INSTALL_COMMAND
437438
""
438439
DEPENDS

0 commit comments

Comments
 (0)