Skip to content

Commit

Permalink
build: update cmake
Browse files Browse the repository at this point in the history
Signed-off-by: Zone.N <[email protected]>
  • Loading branch information
MRNIU committed Oct 31, 2023
1 parent 2513e06 commit 2c1e3b9
Show file tree
Hide file tree
Showing 240 changed files with 141 additions and 675 deletions.
2 changes: 2 additions & 0 deletions cmake/3rd.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ CPMAddPackage(
)

# https://github.com/g-truc/glm
set(gRPC_INSTALL ON CACHE BOOL "")
set(gRPC_BUILD_TESTS OFF CACHE BOOL "")
CPMAddPackage(
NAME glm
GITHUB_REPOSITORY g-truc/glm
Expand Down
91 changes: 88 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,91 @@
#
# CMakeLists.txt for Simple-XX/SimplePhysicsEngine.

add_subdirectory(engine)
add_subdirectory(demo2d)
add_subdirectory(demo3d)
add_library(${PROJECT_NAME}-static STATIC
dtk/dtk.cpp
dtk/dtkAssert.cpp
dtk/dtkCollisionDetectBasic.cpp
dtk/dtkCollisionDetectHierarchy.cpp
dtk/dtkCollisionDetectHierarchyKDOPS.cpp
dtk/dtkCollisionDetectNode.cpp
dtk/dtkCollisionDetectNodeKDOPS.cpp
dtk/dtkCollisionDetectPrimitive.cpp
dtk/dtkCollisionDetectStage.cpp
# dtk/dtkCollisionDetectStage.cpp.bak
dtk/dtkErrorManager.cpp
dtk/dtkGraphicsKernel.cpp
# dtk/dtkGraphicsKernel.h.bak
dtk/dtkIntersectTest.cpp
dtk/dtkPhysCore.cpp
# dtk/dtkPhysCore.cpp.bak
dtk/dtkPhysKnotPlanner.cpp
dtk/dtkPhysMassPoint.cpp
dtk/dtkPhysMassSpring.cpp
# dtk/dtkPhysMassSpring.h.bak
dtk/dtkPhysMassSpringCollisionResponse.cpp
dtk/dtkPhysMassSpringThread.cpp
dtk/dtkPhysMassSpringThreadCollisionResponse.cpp
dtk/dtkPhysParticle.cpp
dtk/dtkPhysParticleSystem.cpp
dtk/dtkPhysSpring.cpp
dtk/dtkPhysTetraMassSpring.cpp
dtk/dtkPointsReader.cpp
dtk/dtkPointsWriter.cpp
dtk/dtkScene.cpp
dtk/dtkSign.cpp
dtk/dtkStaticMeshEliminator.cpp
dtk/dtkStaticTetraMesh.cpp
dtk/dtkStaticTetraMeshReader.cpp
dtk/dtkStaticTetraMeshWriter.cpp
dtk/dtkStaticTriangleMesh.cpp
dtk/dtkStaticTriangleMeshReader.cpp
dtk/dtkStaticTriangleMeshWriter.cpp

math/dtkMatrixOp.cpp
math/dtkMatrixOP.h

physics/dtkJoint.cpp
physics/dtkRigidBody.cpp
)

target_include_directories(${PROJECT_NAME}-static PRIVATE
$<BUILD_INTERFACE:
${PROJECT_SOURCE_DIR}/src/dtk
${PROJECT_SOURCE_DIR}/src/math
${PROJECT_SOURCE_DIR}/src/physics
>

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

)

target_link_libraries(${PROJECT_NAME}-static PRIVATE
Boost::headers
CGAL
glfw
glm::glm
)

# 打包
# @todo 导出静态库与动态库
packageProject(
# 要导出的 target
NAME ${PROJECT_NAME}-static
# 版本
VERSION ${PROJECT_VERSION}
# 生成文件目录
BINARY_DIR ${PROJECT_BINARY_DIR}
# 头文件路径
INCLUDE_DIR ${PROJECT_SOURCE_DIR}/src
# 与 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
)
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.
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.
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.
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.
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.
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.
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.
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.
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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
181 changes: 0 additions & 181 deletions src/engine/CMakeLists.txt

This file was deleted.

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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ link_libraries(
SimplePhysicsEngine-static
)

#add_subdirectory(unit_test)
add_subdirectory(unit_test)
#add_subdirectory(integration_test)
#add_subdirectory(system_test)
add_subdirectory(system_test)

add_coverage_target(
DEPENDS unit_test
Expand Down
24 changes: 14 additions & 10 deletions test/system_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@ project(

enable_language(CXX)

add_executable(system_test
main.cpp
display.cpp
)
# add_executable(system_test
# main.cpp
# display.cpp
# )

target_compile_options(system_test PRIVATE
${DEFAULT_TEST_COMPILE_OPTIONS}
)
# target_compile_options(system_test PRIVATE
# ${DEFAULT_TEST_COMPILE_OPTIONS}
# )

target_link_options(system_test PRIVATE
${DEFAULT_TEST_LINK_OPTIONS}
)
# target_link_options(system_test PRIVATE
# ${DEFAULT_TEST_LINK_OPTIONS}
# )

add_subdirectory(demo2d)
# add_subdirectory(demo3d)
# add_subdirectory(demo_old)
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ target_link_libraries(${PROJECT_NAME} PRIVATE
Boost::dynamic_linking
CGAL
Eigen
glut
GLUT::GLUT
glfw
glm
OpenGL::GL
OpenGL::GLU
)

message("GLUT_glut_LIBRARY: ${GLUT_glut_LIBRARY}")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@
*/


#include <engine/physics/dtkJoint.h>
#include <iostream>
#include <vector>
#include <memory>
#include <unordered_map>

#include <Eigen/Dense>

#include <dtkJoint.h>

#include "dtkScene.h"
#include "dtkMesh.h"
Expand All @@ -15,12 +22,6 @@
#include "Constants.h"
#include "SPHSolver.h"

#include <Eigen/Dense>
#include <iostream>
#include <vector>
#include <memory>
#include <unordered_map>

using namespace std;
using namespace Eigen;

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.
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.
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.
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.
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.
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
Loading

0 comments on commit 2c1e3b9

Please sign in to comment.