Skip to content
Snippets Groups Projects
Commit e0ffcc87 authored by Behzad Safaei's avatar Behzad Safaei
Browse files

Fix: expose waLBerla dependencies of P4IRS to consumer projects

parent 128e3ca3
No related branches found
No related tags found
No related merge requests found
......@@ -64,7 +64,6 @@ set(PAIRS_TARGET "pairs")
# PAIRS dependencies
set(PAIRS_LINK_LIBRARIES)
set(PAIRS_LINK_DIRS ${CMAKE_CURRENT_BINARY_DIR})
set(PAIRS_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR})
# The target can either be an executable or a static library
......@@ -72,7 +71,9 @@ if(USER_SOURCE_FILES)
add_executable(${PAIRS_TARGET} ${RUNTIME_COMMON_FILES})
else()
add_library(${PAIRS_TARGET} STATIC ${RUNTIME_COMMON_FILES})
list(APPEND PAIRS_LINK_LIBRARIES ${PAIRS_TARGET})
# TODO: Get the location with $<TARGET_FILE> generator expression (at build time)
list(APPEND PAIRS_LINK_LIBRARIES "${CMAKE_CURRENT_BINARY_DIR}/lib${PAIRS_TARGET}.a")
endif()
# Include P4IRS 'runtime' dir
......@@ -119,12 +120,18 @@ if(USE_WALBERLA)
waLBerla_import()
# Recent issue from the waLBerla side: warnings about empty CUDA_ARCHITECTURES for walberla_gpu
set(PAIRS_WALBERLA_DEPENDENCIES walberla::blockforest walberla::core)
target_link_libraries(${PAIRS_TARGET} PUBLIC ${PAIRS_WALBERLA_DEPENDENCIES})
target_link_libraries(${PAIRS_TARGET} PUBLIC
walberla::blockforest
walberla::domain_decomposition
walberla::core
stdc++fs
)
## TODO: PAIRS_LINK_DIRS and PAIRS_LINK_LIBRARIES for walberla modules *AND* their dependencies
## This implemention only works if the consumer of the library is itself a walberla app (made within the build system of walberla)
list(APPEND PAIRS_LINK_LIBRARIES ${PAIRS_WALBERLA_DEPENDENCIES})
# TODO: Get the location with $<TARGET_FILE> generator expression (at build time)
list(APPEND PAIRS_LINK_LIBRARIES ${CMAKE_CURRENT_BINARY_DIR}/external/walberla/src/blockforest/libwalberla_blockforest.a)
list(APPEND PAIRS_LINK_LIBRARIES ${CMAKE_CURRENT_BINARY_DIR}/external/walberla/src/domain_decomposition/libwalberla_domain_decomposition.a)
list(APPEND PAIRS_LINK_LIBRARIES ${CMAKE_CURRENT_BINARY_DIR}/external/walberla/src/core/libwalberla_core.a)
list(APPEND PAIRS_LINK_LIBRARIES stdc++fs)
endif()
#================================================================================
......
......@@ -2,5 +2,4 @@ set ( pairs_SOURCE_DIR @pairs_SOURCE_DIR@ )
set ( pairs_BINARY_DIR @pairs_BINARY_DIR@ )
set ( PAIRS_LINK_LIBRARIES @PAIRS_LINK_LIBRARIES@ )
set ( PAIRS_LINK_DIRS @PAIRS_LINK_DIRS@ )
set ( PAIRS_INCLUDE_DIRS @PAIRS_INCLUDE_DIRS@ )
......@@ -147,6 +147,9 @@ class CGen:
self.print("#define PAIRS_TARGET_OPENMP")
self.print("#include <omp.h>")
if self.sim._use_walberla:
self.print("#define USE_WALBERLA")
self.print("#include <limits.h>")
self.print("#include <math.h>")
self.print("#include <stdbool.h>")
......
......@@ -93,6 +93,7 @@ class Simulation:
# Domain partitioning
self._dom_part = None
self._partitioner = None
self._use_walberla = False
self._comm = None
# Contact history
......@@ -122,6 +123,7 @@ class Simulation:
elif partitioner == DomainPartitioners.BlockForest:
self._dom_part = BlockForest(self)
self._use_walberla = True
else:
raise Exception("Invalid domain partitioner.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment