Skip to content

Commit

Permalink
fix: dtk boost link
Browse files Browse the repository at this point in the history
Signed-off-by: NZH <[email protected]>
  • Loading branch information
MRNIU committed Nov 7, 2023
1 parent 1adb151 commit 5f3f64b
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 38 deletions.
77 changes: 40 additions & 37 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,47 +54,50 @@ link_libraries(
$<BUILD_INTERFACE:glfw>
)

add_library(${PROJECT_NAME}-shared SHARED
${lib_src}
)
# @bug linux 下链接 boost 有问题
if (NOT LINUX)
add_library(${PROJECT_NAME}-shared SHARED
${lib_src}
)

target_compile_definitions(${PROJECT_NAME}-shared PRIVATE
BOOST_ALL_DYN_LINK
)
target_compile_definitions(${PROJECT_NAME}-shared PRIVATE
BOOST_ALL_DYN_LINK
)

target_include_directories(${PROJECT_NAME}-shared PRIVATE
$<BUILD_INTERFACE:
${PROJECT_SOURCE_DIR}/src/include
${PROJECT_SOURCE_DIR}/src/collision_detect/include
${PROJECT_SOURCE_DIR}/src/math/include
${PROJECT_SOURCE_DIR}/src/physics/include
>
target_include_directories(${PROJECT_NAME}-shared PRIVATE
$<BUILD_INTERFACE:
${PROJECT_SOURCE_DIR}/src/include
${PROJECT_SOURCE_DIR}/src/collision_detect/include
${PROJECT_SOURCE_DIR}/src/math/include
${PROJECT_SOURCE_DIR}/src/physics/include
>

$<INSTALL_INTERFACE:include/${PROJECT_NAME}-${PROJECT_VERSION}>
)
$<INSTALL_INTERFACE:include/${PROJECT_NAME}-${PROJECT_VERSION}>
)

# 打包动态库
packageProject(
# 要导出的 target
NAME ${PROJECT_NAME}-shared
# 版本
VERSION ${PROJECT_VERSION}
# 生成文件目录
BINARY_DIR ${PROJECT_BINARY_DIR}
# 头文件路径
INCLUDE_DIR ${PROJECT_SOURCE_DIR}/src/include ${PROJECT_SOURCE_DIR}/src/math/include ${PROJECT_SOURCE_DIR}/src/physics/include
# 与 target 的 INSTALL_INTERFACE 一致
INCLUDE_DESTINATION include/${PROJECT_NAME}-${PROJECT_VERSION}
# 头文件过滤
INCLUDE_HEADER_PATTERN "*.h"
# namespace 名称,不能包含 '::'
NAMESPACE ${PROJECT_NAMESPACE}
# (optional) option to disable the versioning of install destinations
DISABLE_VERSION_SUFFIX YES
ARCH_INDEPENDENT YES
# 生成 CPack 变量
CPACK YES
)
# 打包动态库
packageProject(
# 要导出的 target
NAME ${PROJECT_NAME}-shared
# 版本
VERSION ${PROJECT_VERSION}
# 生成文件目录
BINARY_DIR ${PROJECT_BINARY_DIR}
# 头文件路径
INCLUDE_DIR ${PROJECT_SOURCE_DIR}/src/include ${PROJECT_SOURCE_DIR}/src/math/include ${PROJECT_SOURCE_DIR}/src/physics/include
# 与 target 的 INSTALL_INTERFACE 一致
INCLUDE_DESTINATION include/${PROJECT_NAME}-${PROJECT_VERSION}
# 头文件过滤
INCLUDE_HEADER_PATTERN "*.h"
# namespace 名称,不能包含 '::'
NAMESPACE ${PROJECT_NAMESPACE}
# (optional) option to disable the versioning of install destinations
DISABLE_VERSION_SUFFIX YES
ARCH_INDEPENDENT YES
# 生成 CPack 变量
CPACK YES
)
endif ()

add_library(${PROJECT_NAME}-static STATIC
${lib_src}
Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ link_libraries(
GLUT::GLUT
OpenGL::GL
OpenGL::GLU
SimplePhysicsEngine-shared
SimplePhysicsEngine-static
)

add_subdirectory(unit_test)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 5f3f64b

Please sign in to comment.