aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrent Cook <busterb@gmail.com>2023-11-01 20:48:51 -0500
committerBrent Cook <busterb@gmail.com>2023-11-01 20:48:51 -0500
commit60f4156d768ee3e60e92f59ea9d03e6957da3bc9 (patch)
treeda74e6831deb42679f7b41d86eef53a153e3169b
parent5319ff3b1761852b54cdfffc832f8797dd7babea (diff)
parent321fa56d9af8f4cb0ce7cd69d4f91b8c1a37b7a8 (diff)
downloadportable-60f4156d768ee3e60e92f59ea9d03e6957da3bc9.tar.gz
portable-60f4156d768ee3e60e92f59ea9d03e6957da3bc9.tar.bz2
portable-60f4156d768ee3e60e92f59ea9d03e6957da3bc9.zip
Land #909, Fix processor detection with Cmake
-rw-r--r--CMakeLists.txt39
-rwxr-xr-xupdate.sh1
2 files changed, 20 insertions, 20 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ca593f2..a1a0077 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -63,11 +63,7 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
63endif() 63endif()
64 64
65# Enable asserts regardless of build type 65# Enable asserts regardless of build type
66if(MSVC) 66add_definitions(-UNDEBUG)
67 add_definitions(/UNDEBUG)
68else()
69 add_definitions(-UNDEBUG)
70endif()
71 67
72set(BUILD_NC true) 68set(BUILD_NC true)
73 69
@@ -152,17 +148,17 @@ if(MSVC)
152 "C4100" # 'identifier' : unreferenced formal parameter 148 "C4100" # 'identifier' : unreferenced formal parameter
153 "C4127" # conditional expression is constant 149 "C4127" # conditional expression is constant
154 "C4146" # unary minus operator applied to unsigned type, 150 "C4146" # unary minus operator applied to unsigned type,
155 # result still unsigned 151 # result still unsigned
156 "C4244" # 'argument' : conversion from 'type1' to 'type2', 152 "C4244" # 'argument' : conversion from 'type1' to 'type2',
157 # possible loss of data 153 # possible loss of data
158 "C4245" # 'conversion' : conversion from 'type1' to 'type2', 154 "C4245" # 'conversion' : conversion from 'type1' to 'type2',
159 # signed/unsigned mismatch 155 # signed/unsigned mismatch
160 "C4267" # 'var' : conversion from 'size_t' to 'type', 156 "C4267" # 'var' : conversion from 'size_t' to 'type',
161 # possible loss of data 157 # possible loss of data
162 "C4389" # 'operator' : signed/unsigned mismatch 158 "C4389" # 'operator' : signed/unsigned mismatch
163 "C4706" # assignment within conditional expression 159 "C4706" # assignment within conditional expression
164 "C4996" # The POSIX name for this item is deprecated. 160 "C4996" # The POSIX name for this item is deprecated.
165 # Instead, use the ISO C and C++ conformant name 161 # Instead, use the ISO C and C++ conformant name
166 ) 162 )
167 elseif(CMAKE_C_COMPILER_ID MATCHES "Intel") 163 elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
168 add_definitions(-D_CRT_SUPPRESS_RESTRICT) 164 add_definitions(-D_CRT_SUPPRESS_RESTRICT)
@@ -333,32 +329,35 @@ endif()
333# single architecture work on macOS at least. 329# single architecture work on macOS at least.
334# 330#
335# Don't set CMAKE_OSX_ARCHITECTURES to more than a single value for now. 331# Don't set CMAKE_OSX_ARCHITECTURES to more than a single value for now.
336if(APPLE) 332if(APPLE AND (NOT CMAKE_OSX_ARCHITECTURES STREQUAL ""))
337 set(CMAKE_SYSTEM_PROCESSOR "${CMAKE_OSX_ARCHITECTURES}") 333 set(CMAKE_SYSTEM_PROCESSOR "${CMAKE_OSX_ARCHITECTURES}")
338endif() 334endif()
339 335
340if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(aarch64|arm64)") 336if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(aarch64|arm64|ARM64)")
341 set(HOST_AARCH64 true) 337 set(HOST_AARCH64 true)
342elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm") 338elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm")
343 set(HOST_ARM true) 339 set(HOST_ARM true)
344elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS" AND "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i386") 340elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS" AND "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i386")
345 set(HOST_X86_64 true) 341 set(HOST_X86_64 true)
346elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(x86_64|amd64)") 342elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(x86_64|amd64|AMD64)")
347 set(HOST_X86_64 true) 343 set(HOST_X86_64 true)
348elseif("${CMAKE_SYSTEM_NAME}" MATCHES "[i?86|x86]") 344 if (MSVC)
345 set(ENABLE_ASM false)
346 endif()
347elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(i[3-6]86|[xX]86)")
349 set(ENABLE_ASM false) 348 set(ENABLE_ASM false)
350 set(HOST_I386 true) 349 set(HOST_I386 true)
351elseif("${CMAKE_SYSTEM_NAME}" MATCHES "mips64") 350elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "mips64")
352 set(HOST_MIPS64 true) 351 set(HOST_MIPS64 true)
353elseif("${CMAKE_SYSTEM_NAME}" MATCHES "mips") 352elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "mips")
354 set(HOST_MIPS true) 353 set(HOST_MIPS true)
355elseif("${CMAKE_SYSTEM_NAME}" MATCHES "powerpc") 354elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "powerpc")
356 set(HOST_POWERPC true) 355 set(HOST_POWERPC true)
357elseif("${CMAKE_SYSTEM_NAME}" MATCHES "ppc64") 356elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "ppc64")
358 set(HOST_PPC64 true) 357 set(HOST_PPC64 true)
359elseif("${CMAKE_SYSTEM_NAME}" MATCHES "riscv64") 358elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "riscv64")
360 set(HOST_RISCV64 true) 359 set(HOST_RISCV64 true)
361elseif("${CMAKE_SYSTEM_NAME}" MATCHES "sparc64") 360elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "sparc64")
362 set(HOST_SPARC64 true) 361 set(HOST_SPARC64 true)
363else() 362else()
364 set(ENABLE_ASM false) 363 set(ENABLE_ASM false)
diff --git a/update.sh b/update.sh
index ef40eed..4c97ae3 100755
--- a/update.sh
+++ b/update.sh
@@ -191,6 +191,7 @@ fixup_masm() {
191 | sed -e 's/|/OR/g' \ 191 | sed -e 's/|/OR/g' \
192 | sed -e 's/~/NOT/g' \ 192 | sed -e 's/~/NOT/g' \
193 | sed -e 's/1 << \([0-9]*\)/1 SHL \1/g' \ 193 | sed -e 's/1 << \([0-9]*\)/1 SHL \1/g' \
194 | sed -e 's/^ALIGN.*//g' \
194 > $2 195 > $2
195} 196}
196 197