Skip to content

Commit

Permalink
Merge pull request #102 from Pedro-Beirao/master
Browse files Browse the repository at this point in the history
Allow compilation of universal MacOS binaries
  • Loading branch information
kraflab authored Mar 3, 2022
2 parents 891639c + bf4793a commit 36d2906
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
12 changes: 7 additions & 5 deletions prboom2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ include(GNUInstallDirs)

# Automated dependencies discovery, mostly needed for MSVC
target_architecture(TARGET_ARCH)
if(${TARGET_ARCH} MATCHES "i386")
set(DEPENDENCY_SUFFIX x86)
elseif(${TARGET_ARCH} MATCHES "x86_64")
set(DEPENDENCY_SUFFIX x64)
endif()
foreach(target ${TARGET_ARCH})
if(${target} MATCHES "i386")
set(DEPENDENCY_SUFFIX x86)
elseif(${target} MATCHES "x86_64")
set(DEPENDENCY_SUFFIX x64)
endif()
endforeach()
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../dependencies_${DEPENDENCY_SUFFIX}")

set(PACKAGE_NAME "${PROJECT_NAME}")
Expand Down
6 changes: 6 additions & 0 deletions prboom2/cmake/TargetArch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ function(target_architecture output_var)
set(osx_arch_x86_64 TRUE)
elseif("${osx_arch}" STREQUAL "ppc64" AND ppc_support)
set(osx_arch_ppc64 TRUE)
elseif("${osx_arch}" STREQUAL "arm64")
set(osx_arch_arm64 TRUE)
else()
message(FATAL_ERROR "Invalid OS X arch name: ${osx_arch}")
endif()
Expand All @@ -117,6 +119,10 @@ function(target_architecture output_var)
if(osx_arch_ppc64)
list(APPEND ARCH ppc64)
endif()

if(osx_arch_arm64)
list(APPEND ARCH arm64)
endif()
else()
file(WRITE "${CMAKE_BINARY_DIR}/arch.c" "${archdetect_c_code}")

Expand Down

0 comments on commit 36d2906

Please sign in to comment.