Skip to content

Commit

Permalink
maintainer: use target_sources for scriptinterface target.
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiSzuttor committed Mar 2, 2020
1 parent a6e28f7 commit d67ab4a
Show file tree
Hide file tree
Showing 19 changed files with 53 additions and 71 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
#

cmake_minimum_required(VERSION 3.10)
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.13)
cmake_policy(SET CMP0076 NEW)
endif()
include(FeatureSummary)
include(GNUInstallDirs)
project(ESPResSo)
Expand Down
4 changes: 3 additions & 1 deletion libs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
add_library(Random123 INTERFACE)
target_include_directories(Random123 SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/Random123-1.09/include)

target_compile_definitions(Random123 INTERFACE R123_USE_MULHILO64_C99)

add_library(h5xx INTERFACE)
target_include_directories(h5xx SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/h5xx)
12 changes: 7 additions & 5 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,7 @@ if(WITH_COVERAGE)
endif()
endif()

target_link_libraries(EspressoCore PUBLIC EspressoConfig utils)
target_link_libraries(EspressoCore PUBLIC Boost::serialization Boost::mpi
MPI::MPI_CXX Random123)
target_link_libraries(EspressoCore PRIVATE Profiler)
target_link_libraries(EspressoCore PUBLIC shapes)
target_link_libraries(EspressoCore PUBLIC EspressoConfig utils Boost::serialization Boost::mpi MPI::MPI_CXX Random123 shapes PRIVATE Profiler)

if(FFTW3_FOUND)
target_include_directories(EspressoCore PRIVATE SYSTEM ${FFTW3_INCLUDE_DIR})
Expand All @@ -186,6 +182,12 @@ endif(SCAFACOS)

# Subdirectories
add_subdirectory(io)
if(H5MD)
target_link_libraries(EspressoCore PUBLIC ${HDF5_LIBRARIES} Boost::filesystem h5xx)
target_sources(EspressoCore PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/io/writer/h5md_core.cpp)
target_include_directories(EspressoCore SYSTEM PUBLIC ${HDF5_INCLUDE_DIRS} ${CMAKE_CURRRENT_SOURCE_DIR}/io/writer)
target_compile_definitions(EspressoCore PUBLIC H5XX_USE_MPI)
endif(H5MD)

if(WITH_UNIT_TESTS)
add_subdirectory(unit_tests)
Expand Down
1 change: 0 additions & 1 deletion src/core/io/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
add_subdirectory(writer)
add_subdirectory(mpiio)
12 changes: 0 additions & 12 deletions src/core/io/writer/CMakeLists.txt

This file was deleted.

14 changes: 7 additions & 7 deletions src/core/unit_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,23 @@ include(unit_test)
unit_test(NAME RuntimeError_test SRC RuntimeError_test.cpp DEPENDS Boost::serialization)
unit_test(NAME RuntimeErrorCollector_test SRC RuntimeErrorCollector_test.cpp DEPENDS EspressoCore Boost::mpi MPI::MPI_CXX)

unit_test(NAME ScriptInterface_test SRC ScriptInterface_test.cpp DEPENDS EspressoScriptInterface)
unit_test(NAME ScriptInterface_test SRC ScriptInterface_test.cpp DEPENDS ScriptInterface)
unit_test(NAME MpiCallbacks_test SRC MpiCallbacks_test.cpp DEPENDS utils Boost::mpi MPI::MPI_CXX NUM_PROC 2)
unit_test(NAME ParallelScriptInterface_test SRC ParallelScriptInterface_test.cpp DEPENDS EspressoScriptInterface Boost::mpi MPI::MPI_CXX NUM_PROC 2)
unit_test(NAME AutoParameters_test SRC AutoParameters_test.cpp DEPENDS EspressoScriptInterface)
unit_test(NAME AutoParameter_test SRC AutoParameter_test.cpp DEPENDS EspressoScriptInterface)
unit_test(NAME Variant_test SRC Variant_test.cpp DEPENDS EspressoScriptInterface)
unit_test(NAME ParallelScriptInterface_test SRC ParallelScriptInterface_test.cpp DEPENDS ScriptInterface Boost::mpi MPI::MPI_CXX NUM_PROC 2)
unit_test(NAME AutoParameters_test SRC AutoParameters_test.cpp DEPENDS ScriptInterface)
unit_test(NAME AutoParameter_test SRC AutoParameter_test.cpp DEPENDS ScriptInterface)
unit_test(NAME Variant_test SRC Variant_test.cpp DEPENDS ScriptInterface)
unit_test(NAME ParticleIterator_test SRC ParticleIterator_test.cpp)
unit_test(NAME link_cell_test SRC link_cell_test.cpp DEPENDS utils)
unit_test(NAME verlet_ia_test SRC verlet_ia_test.cpp DEPENDS utils)
unit_test(NAME ParticleCache_test SRC ParticleCache_test.cpp DEPENDS utils Boost::mpi MPI::MPI_CXX Boost::serialization Random123 NUM_PROC 2)
unit_test(NAME Particle_test SRC Particle_test.cpp DEPENDS utils Boost::serialization)
unit_test(NAME get_value SRC get_value_test.cpp DEPENDS EspressoScriptInterface)
unit_test(NAME get_value SRC get_value_test.cpp DEPENDS ScriptInterface)
unit_test(NAME field_coupling_couplings SRC field_coupling_couplings_test.cpp DEPENDS utils)
unit_test(NAME field_coupling_fields SRC field_coupling_fields_test.cpp DEPENDS utils)
unit_test(NAME field_coupling_force_field SRC field_coupling_force_field_test.cpp DEPENDS utils)
unit_test(NAME periodic_fold_test SRC periodic_fold_test.cpp)
unit_test(NAME None_test SRC None_test.cpp DEPENDS EspressoScriptInterface)
unit_test(NAME None_test SRC None_test.cpp DEPENDS ScriptInterface)
unit_test(NAME grid_test SRC grid_test.cpp DEPENDS EspressoCore)
unit_test(NAME BoxGeometry_test SRC BoxGeometry_test.cpp DEPENDS EspressoCore)
unit_test(NAME LocalBox_test SRC LocalBox_test.cpp DEPENDS EspressoCore)
Expand Down
2 changes: 1 addition & 1 deletion src/python/espressomd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ foreach(cython_file ${cython_SRC})
set_source_files_properties(${outputpath} PROPERTIES COMPILE_FLAGS "-Wno-pedantic -Wno-unused-variable")
endif()
set_target_properties(${target} PROPERTIES CXX_CLANG_TIDY "")
target_link_libraries(${target} PRIVATE EspressoConfig EspressoCore EspressoScriptInterface)
target_link_libraries(${target} PRIVATE EspressoConfig EspressoCore ScriptInterface)
target_include_directories(${target} SYSTEM PRIVATE ${PYTHON_INCLUDE_DIRS} ${NUMPY_INCLUDE_DIR})
add_dependencies(espressomd ${target})
install(TARGETS ${target} LIBRARY DESTINATION ${PYTHON_INSTDIR}/espressomd)
Expand Down
65 changes: 21 additions & 44 deletions src/script_interface/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,49 +1,26 @@
set(EspressoScriptInterface_SRC
"${CMAKE_CURRENT_SOURCE_DIR}/accumulators/initialize.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/initialize.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/collision_detection/initialize.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/constraints/initialize.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/cluster_analysis/initialize.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/lbboundaries/initialize.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/virtual_sites/initialize.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/observables/initialize.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/pair_criteria/initialize.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/mpiio/initialize.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ScriptInterfaceBase.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/shapes/initialize.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ParallelScriptInterface.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ScriptInterfaceBase.cpp")
add_library(
ScriptInterface SHARED
initialize.cpp
ScriptInterfaceBase.cpp
ParallelScriptInterface.cpp)

if(H5MD)
list(APPEND EspressoScriptInterface_SRC
"${CMAKE_CURRENT_SOURCE_DIR}/h5md/initialize.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/h5md/h5md.cpp")
endif(H5MD)
add_subdirectory(accumulators)
add_subdirectory(collision_detection)
add_subdirectory(constraints)
add_subdirectory(cluster_analysis)
add_subdirectory(lbboundaries)
add_subdirectory(virtual_sites)
add_subdirectory(observables)
add_subdirectory(pair_criteria)
add_subdirectory(mpiio)
add_subdirectory(shapes)
add_subdirectory(h5md)

if(WITH_COVERAGE)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -fprofile-instr-generate -fcoverage-mapping")
else()
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} --coverage -fprofile-arcs -ftest-coverage")
link_libraries(gcov)
endif()
endif()

add_library(EspressoScriptInterface SHARED ${EspressoScriptInterface_SRC})
install(TARGETS EspressoScriptInterface
install(TARGETS ScriptInterface
LIBRARY DESTINATION ${PYTHON_INSTDIR}/espressomd)
target_link_libraries(
EspressoScriptInterface
PRIVATE EspressoConfig
PUBLIC EspressoCore core_cluster_analysis mpiio)

target_link_libraries(EspressoScriptInterface PRIVATE shapes)

if(HDF5_FOUND)
target_link_libraries(EspressoScriptInterface PRIVATE H5mdCore)
endif()
target_link_libraries(
ScriptInterface PRIVATE EspressoConfig EspressoCore
PUBLIC mpiio utils MPI::MPI_CXX shapes core_cluster_analysis)

target_include_directories(EspressoScriptInterface
PUBLIC ${CMAKE_SOURCE_DIR}/src)
target_include_directories(ScriptInterface PUBLIC ${CMAKE_SOURCE_DIR}/src)
1 change: 1 addition & 0 deletions src/script_interface/accumulators/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target_sources(ScriptInterface PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/initialize.cpp)
1 change: 1 addition & 0 deletions src/script_interface/cluster_analysis/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target_sources(ScriptInterface PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/initialize.cpp)
1 change: 1 addition & 0 deletions src/script_interface/collision_detection/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target_sources(ScriptInterface PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/initialize.cpp)
1 change: 1 addition & 0 deletions src/script_interface/constraints/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target_sources(ScriptInterface PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/initialize.cpp)
1 change: 1 addition & 0 deletions src/script_interface/h5md/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target_sources(ScriptInterface PRIVATE $<$<BOOL:H5MD>:${CMAKE_CURRENT_SOURCE_DIR}/initialize.cpp> $<$<BOOL:H5MD>:${CMAKE_CURRENT_SOURCE_DIR}/h5md.cpp>)
1 change: 1 addition & 0 deletions src/script_interface/lbboundaries/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target_sources(ScriptInterface PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/initialize.cpp)
1 change: 1 addition & 0 deletions src/script_interface/mpiio/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target_sources(ScriptInterface PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/initialize.cpp)
1 change: 1 addition & 0 deletions src/script_interface/observables/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target_sources(ScriptInterface PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/initialize.cpp)
1 change: 1 addition & 0 deletions src/script_interface/pair_criteria/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target_sources(ScriptInterface PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/initialize.cpp)
1 change: 1 addition & 0 deletions src/script_interface/shapes/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target_sources(ScriptInterface PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/initialize.cpp)
1 change: 1 addition & 0 deletions src/script_interface/virtual_sites/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target_sources(ScriptInterface PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/initialize.cpp)

0 comments on commit d67ab4a

Please sign in to comment.