From 8cd3dc0435465aee7f550669cd78eaf2abcdbd52 Mon Sep 17 00:00:00 2001 From: Luis Manuel Diaz Angulo Date: Mon, 29 Apr 2024 17:04:49 +0200 Subject: [PATCH] Changes for comptability as subdir --- set_precompiled_libraries.cmake | 38 +++++++++++++++++---------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/set_precompiled_libraries.cmake b/set_precompiled_libraries.cmake index 0336429d..8273995e 100644 --- a/set_precompiled_libraries.cmake +++ b/set_precompiled_libraries.cmake @@ -1,20 +1,22 @@ +set(PRECOMPILED_DIR "${PROJECT_SOURCE_DIR}/precompiled_libraries") + if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU" AND ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - set(JSONFORTRAN_DIR "${CMAKE_SOURCE_DIR}/precompiled_libraries/linux-gcc-rls/jsonfortran/") + set(JSONFORTRAN_DIR "${PRECOMPILED_DIR}/linux-gcc-rls/jsonfortran/") set(JSONFORTRAN_LIB ${JSONFORTRAN_DIR}libjsonfortran.a) elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "NVHPC" AND ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - set(JSONFORTRAN_DIR "${CMAKE_SOURCE_DIR}/precompiled_libraries/linux-nvhpc-rls/jsonfortran/") + set(JSONFORTRAN_DIR "${PRECOMPILED_DIR}/linux-nvhpc-rls/jsonfortran/") set(JSONFORTRAN_LIB ${JSONFORTRAN_DIR}libjsonfortran.a) elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel" AND ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - set(JSONFORTRAN_DIR "${CMAKE_SOURCE_DIR}/precompiled_libraries/linux-intel-rls/jsonfortran/") + set(JSONFORTRAN_DIR "${PRECOMPILED_DIR}/linux-intel-rls/jsonfortran/") set(JSONFORTRAN_LIB ${JSONFORTRAN_DIR}libjsonfortran.a) elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "IntelLLVM" AND ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - set(JSONFORTRAN_DIR "${CMAKE_SOURCE_DIR}/precompiled_libraries/linux-intelLLVM-rls/jsonfortran/") + set(JSONFORTRAN_DIR "${PRECOMPILED_DIR}/linux-intelLLVM-rls/jsonfortran/") set(JSONFORTRAN_LIB ${JSONFORTRAN_DIR}libjsonfortran-static.a) elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel" AND ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - set(JSONFORTRAN_DIR "${CMAKE_SOURCE_DIR}/precompiled_libraries/windows-intel-rls/jsonfortran/") + set(JSONFORTRAN_DIR "${PRECOMPILED_DIR}/windows-intel-rls/jsonfortran/") set(JSONFORTRAN_LIB ${JSONFORTRAN_DIR}jsonfortran.lib) elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "IntelLLVM" AND ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - set(JSONFORTRAN_DIR "${CMAKE_SOURCE_DIR}/precompiled_libraries/windows-intelLLVM-rls/jsonfortran/") + set(JSONFORTRAN_DIR "${PRECOMPILED_DIR}/windows-intelLLVM-rls/jsonfortran/") set(JSONFORTRAN_LIB ${JSONFORTRAN_DIR}jsonfortran-static.lib) else() message(FATAL_ERROR "json-fortran precompiled libraries for this platform and/or compiler have not been found.") @@ -23,7 +25,7 @@ include_directories(${JSONFORTRAN_DIR}/include/) MESSAGE(STATUS "Using json-fortran precompiled libraries at: " ${JSONFORTRAN_DIR}) if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU" AND ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - set(LAPACK_DIR "${CMAKE_SOURCE_DIR}/precompiled_libraries/linux-gcc-rls/lapack/") + set(LAPACK_DIR "${PRECOMPILED_DIR}/linux-gcc-rls/lapack/") set(LAPACK_LIB ${LAPACK_DIR}liblapack.a) set(BLAS_LIB ${LAPACK_DIR}libblas.a) elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "NVHPC" AND ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") @@ -31,19 +33,19 @@ elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "NVHPC" AND ${CMAKE_SYSTEM_NAME} S set(LAPACK_LIB ${LAPACK_DIR}liblapack.a) set(BLAS_LIB ${LAPACK_DIR}libblas.a) elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel" AND ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - set(LAPACK_DIR "${CMAKE_SOURCE_DIR}/precompiled_libraries/linux-intel-rls/lapack/") + set(LAPACK_DIR "${PRECOMPILED_DIR}/linux-intel-rls/lapack/") set(LAPACK_LIB ${LAPACK_DIR}liblapack.a) set(BLAS_LIB ${LAPACK_DIR}libblas.a) elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "IntelLLVM" AND ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - set(LAPACK_DIR "${CMAKE_SOURCE_DIR}/precompiled_libraries/linux-intelLLVM-rls/lapack/") + set(LAPACK_DIR "${PRECOMPILED_DIR}/linux-intelLLVM-rls/lapack/") set(LAPACK_LIB ${LAPACK_DIR}liblapack.a) set(BLAS_LIB ${LAPACK_DIR}libblas.a) elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel" AND ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - set(LAPACK_DIR "${CMAKE_SOURCE_DIR}/precompiled_libraries/windows-intel-rls/lapack/") + set(LAPACK_DIR "${PRECOMPILED_DIR}/windows-intel-rls/lapack/") set(LAPACK_LIB ${LAPACK_DIR}liblapack.lib) set(BLAS_LIB ${LAPACK_DIR}libblas.lib) elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "IntelLLVM" AND ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - set(LAPACK_DIR "${CMAKE_SOURCE_DIR}/precompiled_libraries/windows-intelLLVM-rls/lapack/") + set(LAPACK_DIR "${PRECOMPILED_DIR}/windows-intelLLVM-rls/lapack/") set(LAPACK_LIB ${LAPACK_DIR}liblapack.lib) set(BLAS_LIB ${LAPACK_DIR}libblas.lib) else() @@ -52,23 +54,23 @@ endif() MESSAGE(STATUS "Using lapack precompiled libraries at: " ${LAPACK_DIR}) if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU" AND ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - set(NGSPICE_DIR "${CMAKE_SOURCE_DIR}/precompiled_libraries/linux-gcc-rls/ngspice/") + set(NGSPICE_DIR "${PRECOMPILED_DIR}/linux-gcc-rls/ngspice/") set(NGSPICE_LIB ${NGSPICE_DIR}libngspice.a) elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "NVHPC" AND ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - set(NGSPICE_DIR "${CMAKE_SOURCE_DIR}/precompiled_libraries/linux-gcc-rls/ngspice/") + set(NGSPICE_DIR "${PRECOMPILED_DIR}/linux-gcc-rls/ngspice/") set(NGSPICE_LIB ${NGSPICE_DIR}libngspice.a) elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel" AND ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - set(NGSPICE_DIR "${CMAKE_SOURCE_DIR}/precompiled_libraries/linux-intel-dbg/ngspice/") + set(NGSPICE_DIR "${PRECOMPILED_DIR}/linux-intel-dbg/ngspice/") set(NGSPICE_LIB ${NGSPICE_DIR}libngspice.a) elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "IntelLLVM" AND ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND ${CMAKE_BUILD_TYPE} STREQUAL "Debug") - set(NGSPICE_DIR "${CMAKE_SOURCE_DIR}/precompiled_libraries/linux-intelLLVM-dbg/ngspice/") + set(NGSPICE_DIR "${PRECOMPILED_DIR}/linux-intelLLVM-dbg/ngspice/") set(NGSPICE_LIB ${NGSPICE_DIR}libngspice.a) elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "IntelLLVM" AND ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - set(NGSPICE_DIR "${CMAKE_SOURCE_DIR}/precompiled_libraries/linux-intelLLVM-rls/ngspice/") + set(NGSPICE_DIR "${PRECOMPILED_DIR}/linux-intelLLVM-rls/ngspice/") set(NGSPICE_LIB ${NGSPICE_DIR}libngspice.a) elseif ((${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel" OR ${CMAKE_Fortran_COMPILER_ID} STREQUAL "IntelLLVM") AND ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - set(NGSPICE_DIR "${CMAKE_SOURCE_DIR}/precompiled_libraries/windows-intel-rls/ngspice/") + set(NGSPICE_DIR "${PRECOMPILED_DIR}/windows-intel-rls/ngspice/") set(NGSPICE_LIB ${NGSPICE_DIR}ngspice.lib) add_library(ngspice SHARED IMPORTED) set_target_properties(ngspice PROPERTIES @@ -86,7 +88,7 @@ if (CompileWithHDF) if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU" OR ${CMAKE_Fortran_COMPILER_ID} STREQUAL "NVHPC") # System libraries. Install with sudo apt install libhdf5 elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel" OR CMAKE_Fortran_COMPILER_ID MATCHES "IntelLLVM") - set(HDF5_DIR ${CMAKE_SOURCE_DIR}/precompiled_libraries/linux-intel-rls/hdf5/cmake/) + set(HDF5_DIR ${PRECOMPILED_DIR}/linux-intel-rls/hdf5/cmake/) endif() find_package(HDF5 REQUIRED COMPONENTS Fortran HL)