diff --git a/cmake/3rd.cmake b/cmake/3rd.cmake index 83f1216..64c1cd6 100644 --- a/cmake/3rd.cmake +++ b/cmake/3rd.cmake @@ -205,7 +205,7 @@ if (NOT CGAL_FOUND) "Following https://doc.cgal.org/latest/Manual/devman_create_and_use_a_cmakelist.html to install.") endif () -find_package(Boost COMPONENTS thread system REQUIRED) +find_package(Boost COMPONENTS thread REQUIRED) if (NOT Boost_FOUND) message(FATAL_ERROR "Boost not found.\n" "Following https://www.boost.org to install.") diff --git a/cmake/compile_config.cmake b/cmake/compile_config.cmake index 1d99715..b374ca3 100644 --- a/cmake/compile_config.cmake +++ b/cmake/compile_config.cmake @@ -15,4 +15,5 @@ list(APPEND DEFAULT_COMPILE_OPTIONS list(APPEND DEFAULT_LINK_LIB spdlog::spdlog + $ ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d7d672e..be1afc2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -50,11 +50,23 @@ set(lib_src physics/dtkRigidBody.cpp ) -add_library(${PROJECT_NAME}-static STATIC +link_libraries( + ${DEFAULT_LINK_LIB} + Boost::headers + Boost::thread + CGAL + $ +) + +add_library(${PROJECT_NAME}-shared SHARED ${lib_src} ) -target_include_directories(${PROJECT_NAME}-static PRIVATE +target_compile_definitions(${PROJECT_NAME}-shared PRIVATE + BOOST_ALL_DYN_LINK +) + +target_include_directories(${PROJECT_NAME}-shared PRIVATE $ + + $ + ) -# 打包 -# @todo 导出静态库与动态库 +# 打包静态库 packageProject( # 要导出的 target NAME ${PROJECT_NAME}-static diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8ad0fe0..e9a0a00 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -39,7 +39,11 @@ link_libraries( ${DEFAULT_LINK_LIB} gtest_main ${glog_LIBRARIES} - SimplePhysicsEngine-static + Eigen + GLUT::GLUT + OpenGL::GL + OpenGL::GLU + SimplePhysicsEngine-shared ) add_subdirectory(unit_test) diff --git a/test/system_test/demo2d/CMakeLists.txt b/test/system_test/demo2d/CMakeLists.txt index 45e7005..053affa 100644 --- a/test/system_test/demo2d/CMakeLists.txt +++ b/test/system_test/demo2d/CMakeLists.txt @@ -22,11 +22,3 @@ add_executable(${PROJECT_NAME} target_include_directories(${PROJECT_NAME} PRIVATE include ) - -target_link_libraries(${PROJECT_NAME} PRIVATE - Eigen - GLUT::GLUT - glm - OpenGL::GL - OpenGL::GLU -) diff --git a/test/system_test/demo3d/CMakeLists.txt b/test/system_test/demo3d/CMakeLists.txt index ad5fd3a..7c2e641 100644 --- a/test/system_test/demo3d/CMakeLists.txt +++ b/test/system_test/demo3d/CMakeLists.txt @@ -15,11 +15,3 @@ add_executable(demo3d target_include_directories(${PROJECT_NAME} PRIVATE include ) - -target_link_libraries(${PROJECT_NAME} PRIVATE - Eigen - GLUT::GLUT - glm - OpenGL::GL - OpenGL::GLU -)