Skip to content
Merged
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
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ include(cmake/modes.cmake)
include(cmake/sanitizers.cmake)
include(cmake/json.cmake)
include(cmake/libenvpp.cmake)
include(cmake/stb.cmake)

################# Parallel programming technologies #################

Expand Down
12 changes: 12 additions & 0 deletions cmake/gtest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,15 @@ ExternalProject_Add(
"${CMAKE_COMMAND}" --install
"${CMAKE_CURRENT_BINARY_DIR}/ppc_googletest/build" --prefix
"${CMAKE_CURRENT_BINARY_DIR}/ppc_googletest/install")

function(ppc_link_gtest exec_func_lib)
# Add external project include directories
target_include_directories(
${exec_func_lib}
PUBLIC ${CMAKE_SOURCE_DIR}/3rdparty/googletest/googletest/include)

add_dependencies(${exec_func_lib} ppc_googletest)
target_link_directories(${exec_func_lib} PUBLIC
"${CMAKE_BINARY_DIR}/ppc_googletest/install/lib")
target_link_libraries(${exec_func_lib} PUBLIC gtest gtest_main)
endfunction()
10 changes: 10 additions & 0 deletions cmake/json.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,13 @@ ExternalProject_Add(
INSTALL_COMMAND
"${CMAKE_COMMAND}" --install "${CMAKE_CURRENT_BINARY_DIR}/ppc_json/build"
--prefix "${CMAKE_CURRENT_BINARY_DIR}/ppc_json/install")

function(ppc_link_json exec_func_lib)
# Add external project include directories
target_include_directories(${exec_func_lib}
PUBLIC ${CMAKE_SOURCE_DIR}/3rdparty/json/include)

add_dependencies(${exec_func_lib} ppc_json)
target_link_directories(${exec_func_lib} INTERFACE
"${CMAKE_BINARY_DIR}/ppc_json/install/include")
endfunction()
17 changes: 17 additions & 0 deletions cmake/libenvpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,20 @@ if(WIN32)
else()
set(PPC_ENVPP_LIB_NAME envpp)
endif()

function(ppc_link_envpp exec_func_lib)
# Add external project include directories
target_include_directories(
${exec_func_lib} PUBLIC ${CMAKE_SOURCE_DIR}/3rdparty/libenvpp/include)
target_include_directories(
${exec_func_lib} SYSTEM
PUBLIC ${CMAKE_SOURCE_DIR}/3rdparty/libenvpp/external/fmt/include)

add_dependencies(${exec_func_lib} ppc_libenvpp)
target_link_directories(${exec_func_lib} PUBLIC
"${CMAKE_BINARY_DIR}/ppc_libenvpp/install/lib")
target_link_directories(${exec_func_lib} PUBLIC
"${CMAKE_BINARY_DIR}/ppc_libenvpp/build")
target_link_libraries(${exec_func_lib} PUBLIC ${PPC_ENVPP_LIB_NAME})
target_link_libraries(${exec_func_lib} PUBLIC ${PPC_FMT_LIB_NAME})
endfunction()
17 changes: 16 additions & 1 deletion cmake/mpi.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
find_package(MPI REQUIRED)
if(NOT MPI_FOUND)
message(FATAL_ERROR "MPI NOT FOUND")
endif(MPI_FOUND)
endif()

function(ppc_link_mpi exec_func_lib)
find_package(MPI REQUIRED)
if(MPI_COMPILE_FLAGS)
set_target_properties(${exec_func_lib} PROPERTIES COMPILE_FLAGS
"${MPI_COMPILE_FLAGS}")
endif(MPI_COMPILE_FLAGS)

if(MPI_LINK_FLAGS)
set_target_properties(${exec_func_lib} PROPERTIES LINK_FLAGS
"${MPI_LINK_FLAGS}")
endif(MPI_LINK_FLAGS)
target_include_directories(${exec_func_lib} PUBLIC ${MPI_INCLUDE_PATH})
target_link_libraries(${exec_func_lib} PUBLIC ${MPI_LIBRARIES})
endfunction()
13 changes: 13 additions & 0 deletions cmake/onetbb.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,16 @@ if(cmake_build_type_lower STREQUAL "debug")
else()
set(PPC_TBB_LIB_NAME tbb)
endif()

function(ppc_link_tbb exec_func_lib)
# Add external project include directories
target_include_directories(${exec_func_lib}
PUBLIC ${CMAKE_SOURCE_DIR}/3rdparty/onetbb/include)

add_dependencies(${exec_func_lib} ppc_onetbb)
target_link_directories(${exec_func_lib} PUBLIC
${CMAKE_BINARY_DIR}/ppc_onetbb/install/lib)
if(NOT MSVC)
target_link_libraries(${exec_func_lib} PUBLIC ${PPC_TBB_LIB_NAME})
endif()
endfunction()
10 changes: 10 additions & 0 deletions cmake/openmp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,13 @@ if(OpenMP_FOUND)
else(OpenMP_FOUND)
message(FATAL_ERROR "OpenMP NOT FOUND")
endif(OpenMP_FOUND)

function(ppc_link_threads exec_func_lib)
target_link_libraries(${exec_func_lib} PUBLIC Threads::Threads)
endfunction()

function(ppc_link_openmp exec_func_lib)
find_package(OpenMP REQUIRED)
target_link_libraries(${exec_func_lib} PUBLIC ${OpenMP_libomp_LIBRARY}
OpenMP::OpenMP_CXX)
endfunction()
6 changes: 6 additions & 0 deletions cmake/stb.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function(ppc_link_stb exec_func_lib)
add_library(stb_image STATIC
${CMAKE_SOURCE_DIR}/3rdparty/stb_image_wrapper.cpp)
target_include_directories(stb_image PUBLIC ${CMAKE_SOURCE_DIR}/3rdparty/stb)
target_link_libraries(${exec_func_lib} PUBLIC stb_image)
endfunction()
65 changes: 8 additions & 57 deletions modules/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,63 +29,14 @@ target_include_directories(
${exec_func_lib} PUBLIC ${CMAKE_SOURCE_DIR}/3rdparty
${CMAKE_SOURCE_DIR}/modules ${CMAKE_SOURCE_DIR}/tasks)

# Add external project include directories
target_include_directories(
${exec_func_lib}
PUBLIC ${CMAKE_SOURCE_DIR}/3rdparty/onetbb/include
${CMAKE_SOURCE_DIR}/3rdparty/json/include
${CMAKE_SOURCE_DIR}/3rdparty/googletest/googletest/include
${CMAKE_SOURCE_DIR}/3rdparty/libenvpp/include)
target_include_directories(
${exec_func_lib} SYSTEM
PUBLIC ${CMAKE_SOURCE_DIR}/3rdparty/libenvpp/external/fmt/include)

add_dependencies(${exec_func_lib} ppc_libenvpp)
target_link_directories(${exec_func_lib} PUBLIC
"${CMAKE_BINARY_DIR}/ppc_libenvpp/install/lib")
target_link_directories(${exec_func_lib} PUBLIC
"${CMAKE_BINARY_DIR}/ppc_libenvpp/build")
target_link_libraries(${exec_func_lib} PUBLIC ${PPC_ENVPP_LIB_NAME})
target_link_libraries(${exec_func_lib} PUBLIC ${PPC_FMT_LIB_NAME})

add_dependencies(${exec_func_lib} ppc_json)
target_link_directories(${exec_func_lib} INTERFACE
"${CMAKE_BINARY_DIR}/ppc_json/install/include")

add_dependencies(${exec_func_lib} ppc_googletest)
target_link_directories(${exec_func_lib} PUBLIC
"${CMAKE_BINARY_DIR}/ppc_googletest/install/lib")
target_link_libraries(${exec_func_lib} PUBLIC gtest gtest_main)

target_link_libraries(${exec_func_lib} PUBLIC Threads::Threads)

find_package(OpenMP REQUIRED)
target_link_libraries(${exec_func_lib} PUBLIC ${OpenMP_libomp_LIBRARY}
OpenMP::OpenMP_CXX)

add_dependencies(${exec_func_lib} ppc_onetbb)
target_link_directories(${exec_func_lib} PUBLIC
${CMAKE_BINARY_DIR}/ppc_onetbb/install/lib)
if(NOT MSVC)
target_link_libraries(${exec_func_lib} PUBLIC ${PPC_TBB_LIB_NAME})
endif()

find_package(MPI REQUIRED)
if(MPI_COMPILE_FLAGS)
set_target_properties(${exec_func_lib} PROPERTIES COMPILE_FLAGS
"${MPI_COMPILE_FLAGS}")
endif(MPI_COMPILE_FLAGS)

if(MPI_LINK_FLAGS)
set_target_properties(${exec_func_lib} PROPERTIES LINK_FLAGS
"${MPI_LINK_FLAGS}")
endif(MPI_LINK_FLAGS)
target_include_directories(${exec_func_lib} PUBLIC ${MPI_INCLUDE_PATH})
target_link_libraries(${exec_func_lib} PUBLIC ${MPI_LIBRARIES})

add_library(stb_image STATIC ${CMAKE_SOURCE_DIR}/3rdparty/stb_image_wrapper.cpp)
target_include_directories(stb_image PUBLIC ${CMAKE_SOURCE_DIR}/3rdparty/stb)
target_link_libraries(${exec_func_lib} PUBLIC stb_image)
ppc_link_envpp(${exec_func_lib})
ppc_link_json(${exec_func_lib})
ppc_link_gtest(${exec_func_lib})
ppc_link_threads(${exec_func_lib})
ppc_link_openmp(${exec_func_lib})
ppc_link_tbb(${exec_func_lib})
ppc_link_mpi(${exec_func_lib})
ppc_link_stb(${exec_func_lib})

add_executable(${exec_func_tests} ${FUNC_TESTS_SOURCE_FILES})

Expand Down
Loading