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

Link dependencies dynamically #596

Merged
merged 3 commits into from
Jun 4, 2020
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
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ endif()

find_package(MS_GSL REQUIRED)
find_package(Boost REQUIRED COMPONENTS ${Boost_components})
if(BUILD_SHARED_LIBS AND NOT DEFINED FMILibrary_USE_SHARED_LIB)
set(FMILibrary_USE_SHARED_LIB TRUE)
endif()
find_package(FMILibrary REQUIRED)
find_package(LIBZIP REQUIRED)
find_package(YAML_CPP REQUIRED)
Expand Down
1 change: 1 addition & 0 deletions cmake/project-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ list(APPEND CMAKE_MODULE_PATH "${PACKAGE_PREFIX_DIR}/@LIBCOSIM_CMAKE_INSTALL_DIR

find_dependency(MS_GSL REQUIRED)
find_dependency(Boost REQUIRED COMPONENTS date_time fiber filesystem log)
set(FMILibrary_USE_SHARED_LIB @FMILibrary_USE_SHARED_LIB@)
find_dependency(FMILibrary REQUIRED)
find_dependency(LIBZIP REQUIRED)
find_dependency(YAML_CPP REQUIRED)
Expand Down
13 changes: 9 additions & 4 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,22 @@ class LibcosimConan(ConanFile):
"fmilibrary/2.0.3",
"ms-gsl/2.1.0",
"libzip/1.5.2@bincrafters/stable",
"openssl/1.0.2u",
"zlib/1.2.11",
"yaml-cpp/0.6.3",
"xerces-c/3.2.2",
# Only for conflict resolution
"bzip2/1.0.8",
"xerces-c/3.2.2"
"openssl/1.0.2u",
"zlib/1.2.11",
)

options = {"fmuproxy": [True, False]}
default_options = (
"fmuproxy=False",
"boost:shared=True"
"boost:shared=True",
"fmilibrary:shared=True",
"libzip:shared=True",
"yaml-cpp:shared=True",
"xerces-c:shared=True"
)

def set_version(self):
Expand Down
8 changes: 6 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,12 @@ endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_link_libraries(cosim INTERFACE "atomic")
endif()
if(WIN32 AND NOT BUILD_SHARED_LIBS)
set_target_properties(cosim PROPERTIES OUTPUT_NAME "libcosim")
if(WIN32)
if(BUILD_SHARED_LIBS)
target_link_libraries(cosim PUBLIC "Bcrypt" "Shlwapi") # Windows API DLLs
else()
set_target_properties(cosim PROPERTIES OUTPUT_NAME "libcosim")
endif()
endif()
if(LIBCOSIM_STANDALONE_INSTALLATION)
set_target_properties(cosim PROPERTIES INSTALL_RPATH "\$ORIGIN")
Expand Down