Skip to content

Commit

Permalink
Update CMakeLists.txt to use in CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ofmla authored Feb 26, 2024
1 parent 26cd2a2 commit 278523d
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,18 @@ set(CMAKE_Fortran_FLAGS_RELEASE "-O3")
# Set compiler flags based on build type
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}}")

find_package(PkgConfig REQUIRED)
pkg_search_module(LIBRARY_NAME REQUIRED SPERR)

include_directories(${LIBRARY_NAME_INCLUDE_DIRS})
link_directories(${LIBRARY_NAME_LIBRARY_DIRS})

# External dependencies (provide default values, users can override)
set(EXTERN_INCLUDE_DIR /path/to/lossy_compression/include CACHE PATH "Path to lossy_compression include directory")
set(EXTERN_LIB_DIR /path/to/lossy_compression/lib CACHE PATH "Path to lossy_compression lib directory")
#set(EXTERN_INCLUDE_DIR /path/to/lossy_compression/include CACHE PATH "Path to lossy_compression include directory")
#set(EXTERN_LIB_DIR /path/to/lossy_compression/lib CACHE PATH "Path to lossy_compression lib directory")

include_directories(${EXTERN_INCLUDE_DIR})
link_directories(${EXTERN_LIB_DIR})
#include_directories(${EXTERN_INCLUDE_DIR})
#link_directories(${EXTERN_LIB_DIR})

# List of source files
set(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
Expand All @@ -40,11 +46,11 @@ set(TEST_3D_FILES
)

# Create an object library for common source files in the src folder
add_library(sperr_object OBJECT ${SRC_FILES})
#add_library(sperr_object OBJECT ${SRC_FILES})

# Create executables in the root directory and link with the object library
add_executable(2d ${TEST_2D_FILES} $<TARGET_OBJECTS:sperr_object>)
add_executable(3d ${TEST_3D_FILES} $<TARGET_OBJECTS:sperr_object>)
add_executable(2d ${TEST_2D_FILES} ${SRC_FILES})
add_executable(3d ${TEST_3D_FILES} ${SRC_FILES})

foreach(TARGET_NAME 2d 3d)
target_link_libraries(${TARGET_NAME} SPERR)
Expand Down

0 comments on commit 278523d

Please sign in to comment.