Skip to content

Commit

Permalink
Merge pull request #743 from jdemel/fix-64bit-cpu
Browse files Browse the repository at this point in the history
cmake: Fix 64bit host CPU detection
  • Loading branch information
jdemel authored Jul 9, 2024
2 parents 39f0494 + 881a839 commit 6cfa5b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
########################################################################
# Project setup
########################################################################
cmake_minimum_required(VERSION 3.8)
# We use `IS_64BIT now: https://cmake.org/cmake/help/latest/command/cmake_host_system_information.html
cmake_minimum_required(VERSION 3.10)

set(CMAKE_BUILD_TYPE
${CMAKE_BUILD_TYPE}
CACHE STRING "Choose build type: None Debug Release RelWithDebInfo MinSizeRel")
Expand Down
9 changes: 4 additions & 5 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -255,17 +255,16 @@ endif()
########################################################################
if(NOT CROSSCOMPILE_MULTILIB AND CPU_IS_x86)
include(CheckTypeSize)
check_type_size("void*[8]" SIZEOF_CPU BUILTIN_TYPES_ONLY)
if(${SIZEOF_CPU} EQUAL 64)
cmake_host_system_information(RESULT ASSUME_64BIT_HOST QUERY IS_64BIT)
if(ASSUME_64BIT_HOST)
overrule_arch(32 "CPU width is 64 bits")
endif()
if(${SIZEOF_CPU} EQUAL 32)
else()
overrule_arch(64 "CPU width is 32 bits")
endif()

#MSVC 64 bit does not have MMX, overrule it
if(MSVC)
if(${SIZEOF_CPU} EQUAL 64)
if(ASSUME_64BIT_HOST)
overrule_arch(mmx "No MMX for Win64")
endif()
force_arch(sse "Built-in for MSVC > 2013")
Expand Down

0 comments on commit 6cfa5b2

Please sign in to comment.