Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Libs.private #343

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,7 @@
All notable changes to this project will be documented in this file. For future plans, see our [Roadmap](https://github.com/precice/precice/wiki/Roadmap).

## develop
- Add Libs.private field to the pkg-config file

## 1.4.0
- The python modules are now proper packages tracking dependencies etc.
Expand Down
10 changes: 10 additions & 0 deletions CMakeLists.txt
Expand Up @@ -140,13 +140,17 @@ set_target_properties(precice PROPERTIES
CXX_STANDARD 11
SOVERSION ${preCICE_VERSION}
)
# Initialize list of private libraries for the pkg-config Libs.private field
set(PRECICE_PKG_PRIVATE_LIBS "")

# Setup Boost
target_compile_definitions(precice PRIVATE BOOST_ALL_DYN_LINK BOOST_ASIO_ENABLE_OLD_SERVICES)
target_link_libraries(precice PRIVATE ${Boost_LIBRARIES})
target_include_directories(precice PRIVATE ${Boost_INCLUDE_DIRS})
list(APPEND PRECICE_PKG_PRIVATE_LIBS -lboost_filesystem -lboost_log -lboost_log_setup -lboost_program_options -lboost_system -lboost_thread -lboost_unit_test_framework -lboost_date_time -lboost_regex -lboost_chrono -lboost_atomic)
if(UNIX OR APPLE OR MINGW)
target_link_libraries(precice PRIVATE ${CMAKE_DL_LIBS})
list(APPEND PRECICE_PKG_PRIVATE_LIBS -ldl)
endif()

# Setup Eigen3
Expand All @@ -156,6 +160,7 @@ target_compile_definitions(precice PRIVATE "$<$<CONFIG:DEBUG>:EIGEN_INITIALIZE_M
# Setup LIBXML2
target_include_directories(precice PRIVATE ${LIBXML2_INCLUDE_DIR})
target_link_libraries(precice PRIVATE ${LIBXML2_LIBRARIES})
list(APPEND PRECICE_PKG_PRIVATE_LIBS -lxml2)

if (Platform STREQUAL "SuperMUC")
target_compile_definitions(precice PRIVATE SuperMUC_WORK)
Expand All @@ -164,6 +169,7 @@ endif()
# Setup MPI
if (MPI)
target_link_libraries(precice PRIVATE MPI::MPI_CXX)
list(APPEND PRECICE_PKG_PRIVATE_LIBS ${MPI_CXX_LIB_NAMES})
else()
target_compile_definitions(precice PRIVATE PRECICE_NO_MPI)
endif()
Expand All @@ -172,6 +178,7 @@ endif()
if (PETSC AND MPI)
target_include_directories(precice PRIVATE ${PETSC_INCLUDES})
target_link_libraries(precice PRIVATE ${PETSC_LIBRARIES})
list(APPEND PRECICE_PKG_PRIVATE_LIBS -lpetsc)
else()
target_compile_definitions(precice PRIVATE PRECICE_NO_PETSC)
endif()
Expand All @@ -182,6 +189,7 @@ if (PYTHON)
target_include_directories(precice PRIVATE ${PYTHON_INCLUDE_DIRS})
target_compile_definitions(precice PRIVATE NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION)
target_link_libraries(precice PRIVATE ${PYTHON_LIBRARIES})
list(APPEND PRECICE_PKG_PRIVATE_LIBS -lpython2.7)
else()
target_compile_definitions(precice PRIVATE PRECICE_NO_PYTHON)
endif()
Expand Down Expand Up @@ -367,6 +375,8 @@ else()
endif()

# Configure a pkg-config file
# Turn the Libs.private list from a semicolon-separated to a space-separated list
string(REPLACE ";" " " PRECICE_PKG_PRIVATE_LIBS "${PRECICE_PKG_PRIVATE_LIBS}")
configure_file(
"${PROJECT_SOURCE_DIR}/tools/packaging/debian/precice.pc.in"
"lib/pkgconfig/libprecice.pc"
Expand Down
1 change: 1 addition & 0 deletions tools/packaging/debian/precice.pc.in
Expand Up @@ -8,4 +8,5 @@ Description: preCICE coupling library
Version: @preCICE_VERSION@
URL: https://www.precice.org
Libs: -L${libdir} -lprecice
Libs.private: @PRECICE_PKG_PRIVATE_LIBS@
Cflags: -I${includedir}