From 69215932bb5af3a12c919f1dd581b29bbff6f9cd Mon Sep 17 00:00:00 2001 From: "Zone.N" Date: Tue, 31 Oct 2023 16:07:08 +0800 Subject: [PATCH] build: update cmake, build engine on osx but demo2d cannot find glut Signed-off-by: Zone.N --- cmake/3rd.cmake | 2 +- src/CMakeLists.txt | 38 +++++++++++++++++-- test/CMakeLists.txt | 8 +++- test/system_test/CMakeLists.txt | 15 -------- test/system_test/demo2d/CMakeLists.txt | 29 +++++--------- .../demo2d/{src => }/Constants.cpp | 0 test/system_test/demo2d/{src => }/Grid.cpp | 0 test/system_test/demo2d/{src => }/Main.cpp | 4 +- .../system_test/demo2d/{src => }/Particle.cpp | 0 .../demo2d/{src => }/SPHSolver.cpp | 0 .../demo2d/{src => }/dtkCollisionPair.cpp | 0 .../demo2d/{src => }/dtkFemSimulation.cpp | 0 test/system_test/demo2d/{src => }/dtkMesh.cpp | 0 .../demo2d/{src => }/dtkObject.cpp | 0 .../system_test/demo2d/{src => }/dtkScene.cpp | 6 ++- .../demo2d/include/dtkCollisionPair.h | 4 +- test/system_test/demo2d/include/dtkMesh.h | 3 +- 17 files changed, 64 insertions(+), 45 deletions(-) rename test/system_test/demo2d/{src => }/Constants.cpp (100%) rename test/system_test/demo2d/{src => }/Grid.cpp (100%) rename test/system_test/demo2d/{src => }/Main.cpp (99%) rename test/system_test/demo2d/{src => }/Particle.cpp (100%) rename test/system_test/demo2d/{src => }/SPHSolver.cpp (100%) rename test/system_test/demo2d/{src => }/dtkCollisionPair.cpp (100%) rename test/system_test/demo2d/{src => }/dtkFemSimulation.cpp (100%) rename test/system_test/demo2d/{src => }/dtkMesh.cpp (100%) rename test/system_test/demo2d/{src => }/dtkObject.cpp (100%) rename test/system_test/demo2d/{src => }/dtkScene.cpp (98%) diff --git a/cmake/3rd.cmake b/cmake/3rd.cmake index 5eacaf5..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 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/src/CMakeLists.txt b/src/CMakeLists.txt index 7de03ea..44dcdb3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,7 +4,7 @@ # # CMakeLists.txt for Simple-XX/SimplePhysicsEngine. -add_library(${PROJECT_NAME}-static STATIC +set(lib_src dtk/dtk.cpp dtk/dtkAssert.cpp dtk/dtkCollisionDetectBasic.cpp @@ -51,6 +51,34 @@ add_library(${PROJECT_NAME}-static STATIC physics/dtkRigidBody.cpp ) +add_library(${PROJECT_NAME}-shared SHARED + ${lib_src} +) + +target_include_directories(${PROJECT_NAME}-shared PRIVATE + $ + + $ + +) + +target_link_libraries(${PROJECT_NAME}-shared PRIVATE + ${DEFAULT_LINK_LIB} + Boost::boost + Boost::thread + CGAL + glfw + glm::glm +) + +add_library(${PROJECT_NAME}-static STATIC + ${lib_src} +) + target_include_directories(${PROJECT_NAME}-static PRIVATE $ #include #include +#include "GL/freeglut.h" + #include "dtkScene.h" #include "dtkFemSimulation.h" diff --git a/test/system_test/demo2d/src/Particle.cpp b/test/system_test/demo2d/Particle.cpp similarity index 100% rename from test/system_test/demo2d/src/Particle.cpp rename to test/system_test/demo2d/Particle.cpp diff --git a/test/system_test/demo2d/src/SPHSolver.cpp b/test/system_test/demo2d/SPHSolver.cpp similarity index 100% rename from test/system_test/demo2d/src/SPHSolver.cpp rename to test/system_test/demo2d/SPHSolver.cpp diff --git a/test/system_test/demo2d/src/dtkCollisionPair.cpp b/test/system_test/demo2d/dtkCollisionPair.cpp similarity index 100% rename from test/system_test/demo2d/src/dtkCollisionPair.cpp rename to test/system_test/demo2d/dtkCollisionPair.cpp diff --git a/test/system_test/demo2d/src/dtkFemSimulation.cpp b/test/system_test/demo2d/dtkFemSimulation.cpp similarity index 100% rename from test/system_test/demo2d/src/dtkFemSimulation.cpp rename to test/system_test/demo2d/dtkFemSimulation.cpp diff --git a/test/system_test/demo2d/src/dtkMesh.cpp b/test/system_test/demo2d/dtkMesh.cpp similarity index 100% rename from test/system_test/demo2d/src/dtkMesh.cpp rename to test/system_test/demo2d/dtkMesh.cpp diff --git a/test/system_test/demo2d/src/dtkObject.cpp b/test/system_test/demo2d/dtkObject.cpp similarity index 100% rename from test/system_test/demo2d/src/dtkObject.cpp rename to test/system_test/demo2d/dtkObject.cpp diff --git a/test/system_test/demo2d/src/dtkScene.cpp b/test/system_test/demo2d/dtkScene.cpp similarity index 98% rename from test/system_test/demo2d/src/dtkScene.cpp rename to test/system_test/demo2d/dtkScene.cpp index df5a4ae..9c6405c 100644 --- a/test/system_test/demo2d/src/dtkScene.cpp +++ b/test/system_test/demo2d/dtkScene.cpp @@ -1,5 +1,7 @@ #include "dtkScene.h" +namespace dtk { + dtkScene::dtkScene(unsigned int width, unsigned int height) : State(SCENE_ACTIVE), Keys(), KeysProcessed(), Width(width), Height(height) { @@ -65,4 +67,6 @@ void dtkScene::Render() void dtkScene::DoCollisions() { -} \ No newline at end of file +} + +} diff --git a/test/system_test/demo2d/include/dtkCollisionPair.h b/test/system_test/demo2d/include/dtkCollisionPair.h index ed8589c..021719e 100644 --- a/test/system_test/demo2d/include/dtkCollisionPair.h +++ b/test/system_test/demo2d/include/dtkCollisionPair.h @@ -5,7 +5,9 @@ #include #include -#include + +#include + #include "dtkMesh.h" namespace dtk { diff --git a/test/system_test/demo2d/include/dtkMesh.h b/test/system_test/demo2d/include/dtkMesh.h index a2a0834..dcd89eb 100644 --- a/test/system_test/demo2d/include/dtkMesh.h +++ b/test/system_test/demo2d/include/dtkMesh.h @@ -5,7 +5,8 @@ #include -#include +#include + #include "dtkObject.h" using namespace Eigen;