504525a148
GitOrigin-RevId: bd645e8668ec6612439a9ee7e71f7eac4099d4f6
192 lines
7.9 KiB
Diff
192 lines
7.9 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 251c456..3d30231 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -27,7 +27,7 @@ option(SDFLIB_USE_SYSTEM_GLM "Use glm library via find_package instead of downlo
|
|
option(SDFLIB_USE_SYSTEM_SPDLOG "Use spdlog library via find_package instead of downloading it" OFF)
|
|
option(SDFLIB_USE_SYSTEM_CEREAL "Use cereal library via find_package instead of downloading it" OFF)
|
|
option(SDFLIB_USE_SYSTEM_ASSIMP "Use assimp library via find_package instead of downloading it" OFF)
|
|
-
|
|
+option(SDFLIB_USE_SYSTEM_TRIANGLEMESHDISTANCE "Use TriangleMeshDistance library via system includes instead of downloading it" OFF)
|
|
|
|
if(SDFLIB_DEBUG_INFO)
|
|
add_compile_definitions(SDFLIB_PRINT_STATISTICS)
|
|
@@ -55,13 +55,52 @@ file(GLOB UTILS_SOURCE_FILES src/utils/*.cpp)
|
|
file(GLOB UTILS_HEADER_FILES src/utils/*.h)
|
|
|
|
# Add libraries
|
|
-add_library(${PROJECT_NAME} STATIC ${SOURCE_FILES} ${HEADER_FILES} ${PUBLIC_HEADER_FILES}
|
|
- ${SDF_SOURCE_FILES} ${SDF_HEADER_FILES}
|
|
- ${UTILS_SOURCE_FILES} ${UTILS_HEADER_FILES})
|
|
-
|
|
-target_include_directories(${PROJECT_NAME} PUBLIC include/)
|
|
+add_library(${PROJECT_NAME} ${SOURCE_FILES} ${HEADER_FILES} ${PUBLIC_HEADER_FILES}
|
|
+ ${SDF_SOURCE_FILES} ${SDF_HEADER_FILES}
|
|
+ ${UTILS_SOURCE_FILES} ${UTILS_HEADER_FILES})
|
|
+add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
|
|
+if(BUILD_SHARED_LIBS AND WIN32)
|
|
+ set_target_properties(${PROJECT_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
|
+endif()
|
|
+include(GNUInstallDirs)
|
|
+target_include_directories(${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
|
target_include_directories(${PROJECT_NAME} PRIVATE src/)
|
|
|
|
+# Install library and CMake config files
|
|
+install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME})
|
|
+install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/SdfLib
|
|
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
+
|
|
+install(EXPORT ${PROJECT_NAME}
|
|
+ FILE ${PROJECT_NAME}Targets.cmake
|
|
+ DESTINATION lib/cmake/${PROJECT_NAME}
|
|
+ NAMESPACE ${PROJECT_NAME}::
|
|
+)
|
|
+
|
|
+include(CMakePackageConfigHelpers)
|
|
+set(PACKAGE_DEPENDENCIES "")
|
|
+if(SDFLIB_USE_SYSTEM_GLM)
|
|
+ string(APPEND PACKAGE_DEPENDENCIES "find_dependency(glm)\n")
|
|
+endif()
|
|
+if(SDFLIB_USE_SYSTEM_SPDLOG)
|
|
+ string(APPEND PACKAGE_DEPENDENCIES "find_dependency(spdlog)\n")
|
|
+endif()
|
|
+if(SDFLIB_USE_SYSTEM_CEREAL)
|
|
+ string(APPEND PACKAGE_DEPENDENCIES "find_dependency(cereal)\n")
|
|
+endif()
|
|
+if(SDFLIB_USE_ASSIMP AND SDFLIB_USE_SYSTEM_ASSIMP)
|
|
+ string(APPEND PACKAGE_DEPENDENCIES "find_dependency(assimp)\n")
|
|
+endif()
|
|
+
|
|
+configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}Config.cmake.in
|
|
+ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
|
|
+ INSTALL_DESTINATION "lib/cmake/${PROJECT_NAME}"
|
|
+ NO_SET_AND_CHECK_MACRO
|
|
+ NO_CHECK_REQUIRED_COMPONENTS_MACRO)
|
|
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
|
|
+ DESTINATION lib/cmake/${PROJECT_NAME})
|
|
+
|
|
# Add shaders
|
|
file(GLOB SHADER_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/src/render_engine/shaders
|
|
src/render_engine/shaders/*.frag
|
|
@@ -69,7 +108,7 @@ file(GLOB SHADER_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/src/render_engine/sh
|
|
src/render_engine/shaders/*.comp)
|
|
|
|
foreach(SHADER IN LISTS SHADER_FILES)
|
|
- add_custom_command(OUTPUT ${SHADER}
|
|
+add_custom_command(OUTPUT ${SHADER}
|
|
COMMAND cmake -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/src/render_engine/shaders/${SHADER} $<TARGET_FILE_DIR:${PROJECT_NAME}>/shaders/${SHADER}
|
|
DEPENDS src/render_engine/shaders/${SHADER}
|
|
)
|
|
@@ -112,7 +151,10 @@ endif()
|
|
target_link_libraries(${PROJECT_NAME} PUBLIC ${SDFLIB_GLM_TARGET})
|
|
target_link_libraries(${PROJECT_NAME} PUBLIC spdlog::spdlog)
|
|
target_link_libraries(${PROJECT_NAME} PUBLIC cereal::cereal)
|
|
-target_link_libraries(${PROJECT_NAME} PUBLIC icg)
|
|
+
|
|
+if(NOT SDFLIB_USE_SYSTEM_TRIANGLEMESHDISTANCE)
|
|
+ target_link_libraries(${PROJECT_NAME} PUBLIC TriangleMeshDistance)
|
|
+endif()
|
|
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
|
target_link_libraries(${PROJECT_NAME} PUBLIC -lstdc++fs)
|
|
diff --git a/SdfLibConfig.cmake.in b/SdfLibConfig.cmake.in
|
|
new file mode 100644
|
|
index 0000000..9b8265c
|
|
--- /dev/null
|
|
+++ b/SdfLibConfig.cmake.in
|
|
@@ -0,0 +1,7 @@
|
|
+@PACKAGE_INIT@
|
|
+
|
|
+include(CMakeFindDependencyMacro)
|
|
+
|
|
+@PACKAGE_DEPENDENCIES@
|
|
+
|
|
+include("${CMAKE_CURRENT_LIST_DIR}/SdfLibTargets.cmake")
|
|
diff --git a/include/SdfLib/TrianglesInfluence.h b/include/SdfLib/TrianglesInfluence.h
|
|
index fc2ca52..b276f23 100644
|
|
--- a/include/SdfLib/TrianglesInfluence.h
|
|
+++ b/include/SdfLib/TrianglesInfluence.h
|
|
@@ -11,7 +11,7 @@
|
|
#include "InterpolationMethods.h"
|
|
#include "utils/Timer.h"
|
|
#include "utils/GJK.h"
|
|
-#include <InteractiveComputerGraphics/TriangleMeshDistance.h>
|
|
+#include <tmd/TriangleMeshDistance.h>
|
|
|
|
#include <vector>
|
|
#include <array>
|
|
diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt
|
|
index 79f70c1..e2a4f10 100644
|
|
--- a/libs/CMakeLists.txt
|
|
+++ b/libs/CMakeLists.txt
|
|
@@ -137,9 +137,10 @@ if(SDFLIB_BUILD_APPS OR SDFLIB_BUILD_DEBUG_APPS)
|
|
target_include_directories(stb_image INTERFACE stb)
|
|
endif()
|
|
|
|
-# icg
|
|
-add_library(icg INTERFACE)
|
|
-target_include_directories(icg INTERFACE InteractiveComputerGraphics)
|
|
+if (NOT SDFLIB_USE_SYSTEM_TRIANGLEMESHDISTANCE)
|
|
+ add_library(TriangleMeshDistance INTERFACE)
|
|
+ target_include_directories(TriangleMeshDistance INTERFACE InteractiveComputerGraphics)
|
|
+endif()
|
|
|
|
if(SDFLIB_BUILD_APPS OR SDFLIB_BUILD_DEBUG_APPS)
|
|
# glfw
|
|
diff --git a/libs/InteractiveComputerGraphics/InteractiveComputerGraphics/TriangleMeshDistance.h b/libs/InteractiveComputerGraphics/tmd/TriangleMeshDistance.h
|
|
similarity index 100%
|
|
rename from libs/InteractiveComputerGraphics/InteractiveComputerGraphics/TriangleMeshDistance.h
|
|
rename to libs/InteractiveComputerGraphics/tmd/TriangleMeshDistance.h
|
|
diff --git a/src/tools/ImageQueryTime/main.cpp b/src/tools/ImageQueryTime/main.cpp
|
|
index 357a78b..f4fd9e7 100644
|
|
--- a/src/tools/ImageQueryTime/main.cpp
|
|
+++ b/src/tools/ImageQueryTime/main.cpp
|
|
@@ -17,7 +17,7 @@
|
|
|
|
#define TEST_METHODS
|
|
#ifdef TEST_METHODS
|
|
-#include <InteractiveComputerGraphics/TriangleMeshDistance.h>
|
|
+#include <tmd/TriangleMeshDistance.h>
|
|
// #include <CGAL/Simple_cartesian.h>
|
|
// #include <CGAL/AABB_tree.h>
|
|
// #include <CGAL/AABB_traits.h>
|
|
diff --git a/src/tools/SdfErrorCompare/main.cpp b/src/tools/SdfErrorCompare/main.cpp
|
|
index deef25f..9e402c4 100644
|
|
--- a/src/tools/SdfErrorCompare/main.cpp
|
|
+++ b/src/tools/SdfErrorCompare/main.cpp
|
|
@@ -23,7 +23,7 @@ using namespace sdflib;
|
|
// #define TEST_OPENVDB
|
|
|
|
#ifdef TEST_ICG
|
|
-#include <InteractiveComputerGraphics/TriangleMeshDistance.h>
|
|
+#include <tmd/TriangleMeshDistance.h>
|
|
#endif
|
|
#ifdef TEST_CGAL
|
|
#include <CGAL/Simple_cartesian.h>
|
|
diff --git a/src/tools/SdfLibUnity/SdfExportFunc.cpp b/src/tools/SdfLibUnity/SdfExportFunc.cpp
|
|
index ff4e017..7e06ada 100644
|
|
--- a/src/tools/SdfLibUnity/SdfExportFunc.cpp
|
|
+++ b/src/tools/SdfLibUnity/SdfExportFunc.cpp
|
|
@@ -1,7 +1,7 @@
|
|
#include "SdfExportFunc.h"
|
|
#include "spdlog/sinks/rotating_file_sink.h"
|
|
|
|
-#include <InteractiveComputerGraphics/TriangleMeshDistance.h>
|
|
+#include <tmd/TriangleMeshDistance.h>
|
|
|
|
using namespace sdflib;
|
|
|
|
diff --git a/src/tools/SdfOffsets/main.cpp b/src/tools/SdfOffsets/main.cpp
|
|
index b6769d7..07f137b 100644
|
|
--- a/src/tools/SdfOffsets/main.cpp
|
|
+++ b/src/tools/SdfOffsets/main.cpp
|
|
@@ -9,7 +9,7 @@
|
|
#include <glm/gtc/type_ptr.hpp>
|
|
#include <glm/gtc/matrix_transform.hpp>
|
|
|
|
-#include <InteractiveComputerGraphics/TriangleMeshDistance.h>
|
|
+#include <tmd/TriangleMeshDistance.h>
|
|
#include <CGAL/Surface_mesh_default_triangulation_3.h>
|
|
#include <CGAL/Complex_2_in_triangulation_3.h>
|
|
#include <CGAL/make_surface_mesh.h>
|