Skip to content
Snippets Groups Projects
Commit 2b487f56 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

use check_type_size instead of built-in CMAKE_SIZEOF_VOID_P to fix 64 bit

detection on some Suse machines (patch from Bastien)
parent 859b22c6
No related branches found
No related tags found
No related merge requests found
...@@ -137,6 +137,16 @@ macro(find_all_libraries VARNAME LISTNAME SUFFIX) ...@@ -137,6 +137,16 @@ macro(find_all_libraries VARNAME LISTNAME SUFFIX)
endif(NUM_FOUND_LIBRARIES LESS NUM_LIST) endif(NUM_FOUND_LIBRARIES LESS NUM_LIST)
endmacro(find_all_libraries) endmacro(find_all_libraries)
# check if the machine is 64 bits (this is more reliable than using
# CMAKE_SIZEOF_VOID_P, which does not seem to work e.g. on some Suse
# machines)
include(CheckTypeSize)
check_type_size("void*" SIZEOF_VOID_P)
if(SIZEOF_VOID_P EQUAL 8)
set(HAVE_64BIT_SIZE_T TRUE)
list(APPEND CONFIG_OPTIONS "Have64BitSizeT")
endif(SIZEOF_VOID_P EQUAL 8)
if(ENABLE_BLAS_LAPACK) if(ENABLE_BLAS_LAPACK)
if(MSVC) if(MSVC)
# on Windows with Visual C++ try really hard to find blas/lapack # on Windows with Visual C++ try really hard to find blas/lapack
...@@ -145,11 +155,11 @@ if(ENABLE_BLAS_LAPACK) ...@@ -145,11 +155,11 @@ if(ENABLE_BLAS_LAPACK)
# get the reference blas/lapack libs (useful for users with no # get the reference blas/lapack libs (useful for users with no
# Fortran compiler and no MKL license, who can just download our # Fortran compiler and no MKL license, who can just download our
# precompiled "gmsh-dep" package) # precompiled "gmsh-dep" package)
if(CMAKE_SIZEOF_VOID_P EQUAL 8) if(HAVE_64BIT_SIZE_T)
set(MKL_PATH em64t/lib) set(MKL_PATH em64t/lib)
else(CMAKE_SIZEOF_VOID_P EQUAL 8) else(HAVE_64BIT_SIZE_T)
set(MKL_PATH ia32/lib) set(MKL_PATH ia32/lib)
endif(CMAKE_SIZEOF_VOID_P EQUAL 8) endif(HAVE_64BIT_SIZE_T)
set(MKL_LIBS_REQUIRED libguide40 mkl_intel_c mkl_intel_thread mkl_core) set(MKL_LIBS_REQUIRED libguide40 mkl_intel_c mkl_intel_thread mkl_core)
find_all_libraries(LAPACK_LIBRARIES MKL_LIBS_REQUIRED ${MKL_PATH}) find_all_libraries(LAPACK_LIBRARIES MKL_LIBS_REQUIRED ${MKL_PATH})
if(LAPACK_LIBRARIES) if(LAPACK_LIBRARIES)
...@@ -168,11 +178,11 @@ if(ENABLE_BLAS_LAPACK) ...@@ -168,11 +178,11 @@ if(ENABLE_BLAS_LAPACK)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# on Linux also try to find the Intel MKL without a Fortran # on Linux also try to find the Intel MKL without a Fortran
# compiler # compiler
if(CMAKE_SIZEOF_VOID_P EQUAL 8) if(HAVE_64BIT_SIZE_T)
set(MKL_PATH lib/em64t) set(MKL_PATH lib/em64t)
else(CMAKE_SIZEOF_VOID_P EQUAL 8) else(HAVE_64BIT_SIZE_T)
set(MKL_PATH lib/32) set(MKL_PATH lib/32)
endif(CMAKE_SIZEOF_VOID_P EQUAL 8) endif(HAVE_64BIT_SIZE_T)
set(MKL_LIBS_REQUIRED mkl_gf_lp64 iomp5 mkl_gnu_thread mkl_core) set(MKL_LIBS_REQUIRED mkl_gf_lp64 iomp5 mkl_gnu_thread mkl_core)
find_all_libraries(LAPACK_LIBRARIES MKL_LIBS_REQUIRED ${MKL_PATH}) find_all_libraries(LAPACK_LIBRARIES MKL_LIBS_REQUIRED ${MKL_PATH})
if(LAPACK_LIBRARIES) if(LAPACK_LIBRARIES)
...@@ -524,6 +534,9 @@ if(ENABLE_OCC) ...@@ -524,6 +534,9 @@ if(ENABLE_OCC)
list(APPEND CONFIG_OPTIONS "OpenCascade") list(APPEND CONFIG_OPTIONS "OpenCascade")
list(APPEND EXTERNAL_LIBRARIES ${OCC_LIBS}) list(APPEND EXTERNAL_LIBRARIES ${OCC_LIBS})
list(APPEND EXTERNAL_INCLUDES ${OCC_INC}) list(APPEND EXTERNAL_INCLUDES ${OCC_INC})
if(HAVE_64BIT_SIZE_T)
add_definitions(-D_OCC64)
endif(HAVE_64BIT_SIZE_T)
if(CYGWIN) if(CYGWIN)
list(APPEND EXTERNAL_LIBRARIES "winspool") list(APPEND EXTERNAL_LIBRARIES "winspool")
elseif(MSVC) elseif(MSVC)
...@@ -542,14 +555,6 @@ if(ENABLE_OSMESA) ...@@ -542,14 +555,6 @@ if(ENABLE_OSMESA)
endif(OSMESA_LIB) endif(OSMESA_LIB)
endif(ENABLE_OSMESA) endif(ENABLE_OSMESA)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(HAVE_64BIT_SIZE_T TRUE)
list(APPEND CONFIG_OPTIONS "Have64BitSizeT")
if(HAVE_OCC)
add_definitions(-D_OCC64)
endif(HAVE_OCC)
endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
include(CheckFunctionExists) include(CheckFunctionExists)
check_function_exists(vsnprintf HAVE_VSNPRINTF) check_function_exists(vsnprintf HAVE_VSNPRINTF)
if(NOT HAVE_VSNPRINTF) if(NOT HAVE_VSNPRINTF)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment