From c34e3e16bc81f5b954b7efb122007f819301520c Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 10 Dec 2024 19:30:00 -0500 Subject: [PATCH 1/2] Build: Support CMAKE_OSX_ARCHITECTURES ... as long as it contains only a singular value, which must equal "x86_64", "arm64", "i386", or "ppc". --- CMakeLists.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 218e4c311..3bfba92be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -127,9 +127,6 @@ foreach(dir ${DIRLIST}) endforeach() # Detect CPU type and word size -if(CMAKE_OSX_ARCHITECTURES MATCHES "ppc") - set(CMAKE_SYSTEM_PROCESSOR ppc) -endif() math(EXPR BITS "${CMAKE_SIZEOF_VOID_P} * 8") string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} CMAKE_SYSTEM_PROCESSOR_LC) if(CMAKE_SYSTEM_PROCESSOR_LC MATCHES "x86_64" OR @@ -158,6 +155,12 @@ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64" AND BITS EQUAL 32) else() set(CPU_TYPE ${CMAKE_SYSTEM_PROCESSOR_LC}) endif() +if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR + CMAKE_OSX_ARCHITECTURES MATCHES "arm64" OR + CMAKE_OSX_ARCHITECTURES MATCHES "i386" OR + CMAKE_OSX_ARCHITECTURES MATCHES "ppc") + set(CPU_TYPE ${CMAKE_OSX_ARCHITECTURES}) +endif() message(STATUS "${BITS}-bit build (${CPU_TYPE})") include(cmakescripts/FindTurboJPEG.cmake) From 362469507fb5773d03c7bfa6ae1bc871649b6b10 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 13 Dec 2024 15:56:28 -0500 Subject: [PATCH 2/2] Build: Disallow multiple simultaneous macOS archs --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3bfba92be..e3112a7b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,6 +129,13 @@ endforeach() # Detect CPU type and word size math(EXPR BITS "${CMAKE_SIZEOF_VOID_P} * 8") string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} CMAKE_SYSTEM_PROCESSOR_LC) +set(COUNT 1) +foreach(ARCH ${CMAKE_OSX_ARCHITECTURES}) + if(COUNT GREATER 1) + message(FATAL_ERROR "TurboVNC contains JNI code, so it cannot be built with multiple values in CMAKE_OSX_ARCHITECTURES.") + endif() + math(EXPR COUNT "${COUNT}+1") +endforeach() if(CMAKE_SYSTEM_PROCESSOR_LC MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR_LC MATCHES "amd64" OR CMAKE_SYSTEM_PROCESSOR_LC MATCHES "i[0-9]86" OR