Attempt to fix linkage errors

This commit is contained in:
Guilhem Lavaux 2023-12-07 08:56:24 +01:00
parent b878efb8b1
commit 6adf02b287
2 changed files with 19 additions and 9 deletions

View File

@ -42,6 +42,17 @@ ENDIF(BUILD_PYTHON)
MESSAGE(STATUS "Using the target ${CosmoTool_local} to build python module") MESSAGE(STATUS "Using the target ${CosmoTool_local} to build python module")
find_library(ZLIB_LIBRARY z)
find_library(DL_LIBRARY dl)
find_library(RT_LIBRARY rt)
if (RT_LIBRARY)
SET(RT_DEP rt)
message(STATUS "RT found, linking against it")
else()
SET(RT_DEP)
endif()
find_library(MATH_LIBRARY m)
include(${CMAKE_SOURCE_DIR}/external/external_build.cmake) include(${CMAKE_SOURCE_DIR}/external/external_build.cmake)
IF(YORICK_SUPPORT) IF(YORICK_SUPPORT)
@ -55,9 +66,6 @@ IF(YORICK_SUPPORT)
ENDIF(YORICK_SUPPORT) ENDIF(YORICK_SUPPORT)
find_program(CYTHON NAMES cython3 cython) find_program(CYTHON NAMES cython3 cython)
find_library(ZLIB_LIBRARY z)
find_library(DL_LIBRARY dl)
find_library(MATH_LIBRARY m)
set(NETCDF_FIND_REQUIRED ${YORICK_SUPPORT}) set(NETCDF_FIND_REQUIRED ${YORICK_SUPPORT})
set(GSL_FIND_REQUIRED TRUE) set(GSL_FIND_REQUIRED TRUE)

View File

@ -105,7 +105,7 @@ if (INTERNAL_HDF5)
SET(ENV{HDF5_ROOT} ${HDF5_BIN_DIR}) SET(ENV{HDF5_ROOT} ${HDF5_BIN_DIR})
SET(HDF5_ROOTDIR ${HDF5_BIN_DIR}) SET(HDF5_ROOTDIR ${HDF5_BIN_DIR})
SET(CONFIGURE_LDFLAGS "${CONFIGURE_LDFLAGS} -L${HDF5_BIN_DIR}/lib") SET(CONFIGURE_LDFLAGS "${CONFIGURE_LDFLAGS} -L${HDF5_BIN_DIR}/lib")
SET(CONFIGURE_LIBS "${CONFIGURE_LIBS} -ldl") SET(CONFIGURE_LIBS "${CONFIGURE_LIBS} -ldl ${RT_LIBRARY}")
set(HDF5_C_STATIC_LIBRARY ${HDF5_BIN_DIR}/lib/libhdf5.a) set(HDF5_C_STATIC_LIBRARY ${HDF5_BIN_DIR}/lib/libhdf5.a)
set(HDF5_HL_STATIC_LIBRARY ${HDF5_BIN_DIR}/lib/libhdf5_hl.a) set(HDF5_HL_STATIC_LIBRARY ${HDF5_BIN_DIR}/lib/libhdf5_hl.a)
set(HDF5_LIBRARIES ${HDF5_BIN_DIR}/lib/libhdf5.a CACHE STRING "HDF5 lib" FORCE) set(HDF5_LIBRARIES ${HDF5_BIN_DIR}/lib/libhdf5.a CACHE STRING "HDF5 lib" FORCE)
@ -175,26 +175,28 @@ if (INTERNAL_NETCDF)
string(REPLACE ";" "|" CMAKE_PREFIX_PATH_ALT_SEP "${CMAKE_PREFIX_PATH}") string(REPLACE ";" "|" CMAKE_PREFIX_PATH_ALT_SEP "${CMAKE_PREFIX_PATH}")
ExternalProject_Add(netcdf ExternalProject_Add(netcdf
DEPENDS ${hdf5_built} DEPENDS ${hdf5_built}
URL_HASH MD5=f48ee01534365006934f0c63d4055ea0
PREFIX ${BUILD_PREFIX}/netcdf-prefix PREFIX ${BUILD_PREFIX}/netcdf-prefix
DOWNLOAD_DIR ${SOURCE_PREFIX}/downloads DOWNLOAD_DIR ${SOURCE_PREFIX}/downloads
URL ${NETCDF_URL} URL ${NETCDF_URL}
LIST_SEPARATOR | LIST_SEPARATOR |
CMAKE_ARGS CMAKE_ARGS
-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH_ALT_SEP} -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH_ALT_SEP}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DNC_EXTRA_DEPS=${RT_DEP}
-DBUILD_SHARED_LIBS=OFF -DBUILD_SHARED_LIBS=OFF
-DBUILD_TESTING=OFF -DBUILD_TESTING=OFF
-DCMAKE_BUILD_TYPE=Release -DCMAKE_BUILD_TYPE=Release
-DENABLE_NETCDF4=ON -DENABLE_NETCDF4=ON
-DENABLE_BYTERANGE=FALSE -DENABLE_BYTERANGE=FALSE
-DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DENABLE_DAP=OFF -DENABLE_DAP=OFF
-DCMAKE_INSTALL_PREFIX=${NETCDF_BIN_DIR} -DCMAKE_INSTALL_PREFIX=${NETCDF_BIN_DIR}
-DHDF5_C_LIBRARY=${HDF5_C_STATIC_LIBRARY} -DHDF5_C_LIBRARY=${HDF5_C_STATIC_LIBRARY}
-DHDF5_HL_LIBRARY=${HDF5_HL_STATIC_LIBRARY} -DHDF5_HL_LIBRARY=${HDF5_HL_STATIC_LIBRARY}
-DHDF5_INCLUDE_DIR=${HDF5_INCLUDE_DIRS} -DHDF5_INCLUDE_DIR=${HDF5_INCLUDE_DIRS}
-DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_LIBDIR=lib
) )
SET(NETCDFCXX_SOURCE_DIR ${BUILD_PREFIX}/netcdf-c++-prefix/src/netcdf-c++) SET(NETCDFCXX_SOURCE_DIR ${BUILD_PREFIX}/netcdf-c++-prefix/src/netcdf-c++)