ADDRESS_SIZE auto detection was broken with python3, fix this.
- Simplify detection by using regex - OSX is always 64 bitmaster
parent
d6c170a66d
commit
07a7c4e190
|
|
@ -79,27 +79,28 @@ elseif (ADDRESS_SIZE EQUAL 64)
|
|||
#message(STATUS "ADDRESS_SIZE is 64")
|
||||
set(ARCH x86_64)
|
||||
else (ADDRESS_SIZE EQUAL 32)
|
||||
#message(STATUS "ADDRESS_SIZE is UNRECOGNIZED: '${ADDRESS_SIZE}'")
|
||||
# Use Python's platform.machine() since uname -m isn't available everywhere.
|
||||
# Even if you can assume cygwin uname -m, the answer depends on whether
|
||||
# you're running 32-bit cygwin or 64-bit cygwin! But even 32-bit Python will
|
||||
# report a 64-bit processor.
|
||||
execute_process(COMMAND
|
||||
"${PYTHON_EXECUTABLE}" "-c"
|
||||
"import platform; print platform.machine()"
|
||||
OUTPUT_VARIABLE ARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
# We expect values of the form i386, i686, x86_64, AMD64.
|
||||
# In CMake, expressing ARCH.endswith('64') is awkward:
|
||||
string(LENGTH "${ARCH}" ARCH_LENGTH)
|
||||
math(EXPR ARCH_LEN_2 "${ARCH_LENGTH} - 2")
|
||||
string(SUBSTRING "${ARCH}" ${ARCH_LEN_2} 2 ARCH_LAST_2)
|
||||
if (ARCH_LAST_2 STREQUAL 64)
|
||||
#message(STATUS "ARCH is detected as 64; ARCH is ${ARCH}")
|
||||
# Note we cannnot use if(DARWIN) here, this variable is set way lower
|
||||
if( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
|
||||
set(ADDRESS_SIZE 64)
|
||||
else ()
|
||||
#message(STATUS "ARCH is detected as 32; ARCH is ${ARCH}")
|
||||
set(ADDRESS_SIZE 32)
|
||||
endif ()
|
||||
set(ARCH x86_64)
|
||||
else()
|
||||
# Use Python's platform.machine() since uname -m isn't available everywhere.
|
||||
# Even if you can assume cygwin uname -m, the answer depends on whether
|
||||
# you're running 32-bit cygwin or 64-bit cygwin! But even 32-bit Python will
|
||||
# report a 64-bit processor.
|
||||
execute_process(COMMAND
|
||||
"${PYTHON_EXECUTABLE}" "-c"
|
||||
"import platform; print( platform.machine() )"
|
||||
OUTPUT_VARIABLE ARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string( REGEX MATCH ".*(64)$" RE_MATCH "${ARCH}" )
|
||||
if( RE_MATCH AND ${CMAKE_MATCH_1} STREQUAL "64" )
|
||||
set(ADDRESS_SIZE 64)
|
||||
set(ARCH x86_64)
|
||||
else()
|
||||
set(ADDRESS_SIZE 32)
|
||||
set(ARCH i686)
|
||||
endif()
|
||||
endif()
|
||||
endif (ADDRESS_SIZE EQUAL 32)
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||
|
|
|
|||
Loading…
Reference in New Issue