Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,20 @@ endif()

list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

# Fetch libneo once at the top level so every KAMEL subproject uses the same
# build tree and module directory.
set(LIBNEO_BUILD_TESTING OFF CACHE BOOL "Disable libneo tests" FORCE)
set(LIBNEO_ENABLE_TESTS OFF CACHE BOOL "Disable libneo tests" FORCE)
set(LIBNEO_ENABLE_GOLDEN_TESTS OFF CACHE BOOL "Disable libneo golden tests" FORCE)
set(_KAMEL_BUILD_TESTING_SAVED ${BUILD_TESTING})
set(BUILD_TESTING OFF)
if(NOT TARGET LIBNEO::magfie)
find_or_fetch(libneo)
endif()
set(BUILD_TESTING ${_KAMEL_BUILD_TESTING_SAVED})
set(KAMEL_LIBNEO_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/libneo" CACHE INTERNAL
"Binary dir for the shared libneo subproject")

# Unified build: add subprojects for KiLCA, KIM, and QL-Balance
add_subdirectory(common/math)
add_subdirectory(common/logger)
Expand Down
8 changes: 4 additions & 4 deletions PreProc/fourier/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ include(Util)
# Only fetch libneo if not already available (prevents duplicate targets)
if(NOT TARGET LIBNEO::magfie)
find_or_fetch(libneo)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/libneo/include)
set(_FOURIER_LIBNEO_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/libneo")
else()
# Use libneo from common/equil when building as part of KAMEL
include_directories(${CMAKE_BINARY_DIR}/common/equil/libneo/include)
set(_FOURIER_LIBNEO_BINARY_DIR "${KAMEL_LIBNEO_BINARY_DIR}")
endif()
include_directories(${_FOURIER_LIBNEO_BINARY_DIR}/include)

# Add netcdf library paths (needed because libneo's link_directories doesn't propagate)
find_program(NF_CONFIG "nf-config")
Expand Down Expand Up @@ -62,7 +62,7 @@ if(TARGET kamel_equil)
LIBNEO::magfie
)
target_include_directories(fouriermodes PUBLIC
${CMAKE_BINARY_DIR}/common/equil/libneo/include
${_FOURIER_LIBNEO_BINARY_DIR}/include
${KAMEL_EQUIL_INCLUDE_DIRS}
)
else()
Expand Down
2 changes: 1 addition & 1 deletion QL-Balance/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ set(LIBNEO_BUILD_TESTING OFF CACHE BOOL "Disable libneo tests" FORCE)
if(NOT TARGET LIBNEO::neo)
find_or_fetch(libneo)
endif()
include_directories(${CMAKE_CURRENT_BINARY_DIR}/../libneo/include)
include_directories(${KAMEL_LIBNEO_BINARY_DIR}/include)

add_dependencies(ql-balance_lib sparse)

Expand Down
2 changes: 1 addition & 1 deletion common/equil/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ set_target_properties(kamel_equil PROPERTIES
target_include_directories(kamel_equil
PUBLIC
${EQUIL_MODULE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/libneo/include
${KAMEL_LIBNEO_BINARY_DIR}/include
)

# Link libneo magfie for equilibrium field functionality
Expand Down
16 changes: 3 additions & 13 deletions common/hdf5_tools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,40 +1,30 @@
# HDF5 tools library for KAMEL project
# Provides common HDF5 wrapper functions for all KAMEL codes

# Find HDF5 with Fortran support
cmake_policy(SET CMP0074 NEW)
find_package(HDF5 REQUIRED COMPONENTS Fortran Fortran_HL)

if (NOT ${HDF5_FOUND})
message(FATAL_ERROR "HDF5 with Fortran support not found. Please set environment variable HDF5_ROOT to the correct path")
endif()

# Create the HDF5 tools library
add_library(kamel_hdf5_tools STATIC
hdf5_tools.f90
hdf5_tools_f2003.f90
)

# Set properties for the library
set_target_properties(kamel_hdf5_tools PROPERTIES
POSITION_INDEPENDENT_CODE ON
Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/modules
)

# Include directories
add_dependencies(kamel_hdf5_tools LIBNEO::hdf5_tools)
target_include_directories(kamel_hdf5_tools
PUBLIC
${HDF5_INCLUDE_DIRS}
${KAMEL_LIBNEO_BINARY_DIR}/include
${CMAKE_BINARY_DIR}/modules
)

# Link HDF5 libraries
target_link_libraries(kamel_hdf5_tools
PUBLIC
LIBNEO::hdf5_tools
${HDF5_Fortran_LIBRARIES}
${HDF5_Fortran_HL_LIBRARIES}
)

# Export for use by other KAMEL components
set(KAMEL_HDF5_TOOLS_LIBRARIES kamel_hdf5_tools CACHE INTERNAL "KAMEL HDF5 tools library")
set(KAMEL_HDF5_TOOLS_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/modules CACHE INTERNAL "KAMEL HDF5 tools include directory")
Loading
Loading