Changes to detect 64-bit builds correctly

This commit is contained in:
Leland Lucius 2020-02-12 13:08:41 -06:00
parent 85219e371c
commit db70394964
3 changed files with 28 additions and 11 deletions

View File

@ -35,13 +35,6 @@ if( WIN32 )
set( GETTEXT_VERSION "0.20.1.1" )
set( PYTHON_NAME "python2" )
set( PYTHON_VERSION "2.7.17" )
# Force the build to 32-bit, unless the user specifically specified
# something else.
if( NOT CMAKE_GENERATOR_PLATFORM )
message( STATUS "Defaulting to 32-bit build..." )
set( CMAKE_GENERATOR_PLATFORM Win32 )
endif()
elseif( APPLE )
# Define the OSX compatibility parameters
set( CMAKE_OSX_ARCHITECTURES x86_64 CACHE INTERNAL "" )
@ -258,6 +251,19 @@ check_type_size( "size_t" SIZEOF_SIZE LANGUAGE C )
check_type_size( "wchar_t" SIZEOF_WCHAR LANGUAGE C )
check_type_size( "void*" SIZEOF_POINTER LANGUAGE C )
# Determine 32-bit or 64-bit target
if( CMAKE_C_COMPILER_ID MATCHES "MSVC" AND CMAKE_VS_PLATFORM_NAME MATCHES "Win64|x64" )
set( IS_64BIT ON )
elseif( NOT CMAKE_SIZEOF_VOID_P STREQUAL "4" )
set( IS_64BIT ON )
endif()
if( IS_64BIT )
message( STATUS "Building for 64-bit target" )
else()
message( STATUS "Building for 32-bit target" )
endif()
# We'll be using it if it's available
find_package( PkgConfig QUIET )

View File

@ -3,6 +3,14 @@ add_library( ${TARGET} STATIC )
def_vars()
if( IS_64BIT )
set( FPM FPM_64BIT )
elseif( ${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "X86|AMD64|i386|i686|x86_64" )
set( FPM FPM_INTEL )
else()
set( FPM FPM_DEFAULT )
endif()
list( APPEND SOURCES
PRIVATE
${TARGET_ROOT}/bit.c
@ -30,8 +38,7 @@ list( APPEND DEFINES
PRIVATE
HAVE_CONFIG_H
OPT_ACCURACY
$<$<IN_LIST:${CMAKE_HOST_SYSTEM_PROCESSOR},X86;AMD64;i386;i686;x86_64>:FPM_INTEL>
$<$<NOT:$<IN_LIST:${CMAKE_HOST_SYSTEM_PROCESSOR},X86;AMD64;i386;i686;x86_64>>:FPM_DEFAULT>
${FPM}
)
list( APPEND OPTIONS
@ -39,8 +46,6 @@ list( APPEND OPTIONS
$<$<C_COMPILER_ID:AppleClang,Clang,GNU>:-Wall>
)
set( FPM FPM_DEFAULT )
configure_file( config.h.in private/config.h )
configure_file( mad.h.in public/mad.h )

View File

@ -989,6 +989,12 @@ list( APPEND DEFINES
wxDEBUG_LEVEL=0
WXINTL_NO_GETTEXT_MACRO
WXUSINGDLL
$<$<BOOL:${HAVE_LRINT}>:
HAVE_LRINT
>
$<$<BOOL:${HAVE_LRINTF}>:
HAVE_LRINTF
>
$<$<BOOL:${HAVE_MLOCK}>:
HAVE_MLOCK
>