@@ -9,17 +9,24 @@ set(DIR_EXT "${CMAKE_CURRENT_SOURCE_DIR}/ext")
99
1010# Set options if top level
1111if (PROJECT_IS_TOP_LEVEL)
12- # Options for the project
12+ # Options to generate python bindings
13+ option (USE_PYBIND "Generate pybindings" ON )
14+
15+ # Alternative library options
1316 option (USE_MULTIPRECISION "Use high precision floating point" OFF )
14- option (CHECK_VALIDITY "Check validity pre and post conditions" ON )
17+ option (USE_EMBREE "Use Embree for rendering" OFF )
18+ option (USE_SUITESPARSE "Use suite sparse methods for matrix inversion" ON )
19+ option (USE_COMISO "Use Comiso for field generation" ON )
20+
21+ # Visualization options
1522 option (ENABLE_VISUALIZATION "Generate viewers for visualization" ON )
1623 option (RENDER_TEXTURE "Render results" ON )
17- option (USE_SUITESPARSE "Use suite sparse methods for matrix inversion" ON )
18- option (USE_PYBIND "Generate pybindings" ON )
24+
25+ # Validity check options
1926 option (BUILD_CURVATURE_METRIC_TESTS "Build tests" ON )
20- option (USE_EMBREE "Use Embree for rendering" OFF )
27+ option (CHECK_VALIDITY "Check validity pre and post conditions" ON )
2128
22- # Set libigl and suitesparse options
29+ # Set default libigl and suitesparse options
2330 option (LIBIGL_PREDICATES "Use Predicates" ON )
2431 set ( SUITESPARSE_ENABLE_PROJECTS "suitesparse_config;cholmod;spqr" )
2532 option ( SUITESPARSE_USE_CUDA OFF )
@@ -40,6 +47,25 @@ if(USE_MULTIPRECISION)
4047 link_directories (${MPFR_LIBRARIES_DIR} )
4148endif ()
4249
50+ # Optionally get frame field libraries
51+ if (USE_COMISO)
52+ add_compile_definitions (USE_COMISO)
53+ option (LIBIGL_COPYLEFT_COMISO "Use COSIMO" ON )
54+ set (COMISO_LIBS
55+ igl_copyleft::comiso
56+ )
57+ endif ()
58+
59+ # Set libigl options for rendering if enabled
60+ if (RENDER_TEXTURE)
61+ option (LIBIGL_OPENGL "Use OpenGL" ON )
62+ option (LIBIGL_GLFW "Use GLFW" ON )
63+ option (LIBIGL_PNG "Use PNG" ON )
64+ endif ()
65+ if (USE_EMBREE)
66+ option (LIBIGL_EMBREE "Use EMBREE" ON )
67+ endif ()
68+
4369# Set compile definitions
4470add_compile_definitions (_USE_MATH_DEFINES)
4571if (USE_MULTIPRECISION)
@@ -49,49 +75,56 @@ if(CHECK_VALIDITY)
4975 add_compile_definitions (CHECK_VALIDITY)
5076endif ()
5177if (RENDER_TEXTURE)
52- option (LIBIGL_OPENGL "Use OpenGL" ON )
53- option (LIBIGL_GLFW "Use GLFW" ON )
54- option (LIBIGL_PNG "Use PNG" ON )
5578 add_compile_definitions (RENDER_TEXTURE)
5679endif ()
5780if (USE_EMBREE)
5881 add_compile_definitions (USE_EMBREE)
59- option (LIBIGL_EMBREE "Use EMBREE" ON )
6082endif ()
6183if (USE_PYBIND)
6284 add_compile_definitions (PYBIND)
6385endif ()
64-
65- # Set suitesparse compile definitions
6686# WARNING: This compile definition publicly links suitesparse into the
6787# conformal ideal delaunay library
6888if (USE_SUITESPARSE)
6989 add_compile_definitions (USE_SUITESPARSE)
90+ set (SUITESPARSE_LIBS
91+ SuiteSparse::SuiteSparseConfig
92+ SuiteSparse::SPQR
93+ SuiteSparse::CHOLMOD
94+ )
7095endif ()
7196
7297# Get external libraries
73- include_directories ("${CMAKE_CURRENT_SOURCE_DIR} /src/util" )
7498include (conformal_ideal_delaunay)
7599include (libigl)
76100include (spectra)
77101include (cli11)
102+ include (json)
103+ include (geometry-central)
78104
79- # Optionally create visualization library
105+ # Optionally create rendering library
80106if (RENDER_TEXTURE)
107+ # Build core rendering library
108+ # TODO: Move somewhere reasonable
81109 add_library (rendering
82- src/util/visualization.cc
110+ src/optimization/ util/visualization.cc
83111 )
112+ target_include_directories (rendering PUBLIC include /optimization/optimization/util)
84113 target_link_libraries (rendering PUBLIC
85114 igl::core
86115 igl::glfw
87116 igl::png
88117 plot
89118 )
90- if (USE_EMBREE)
91- target_link_libraries (rendering PUBLIC
92- igl::embree
93- )
94- endif ()
119+
120+ # Link in embree if enabled
121+ if (USE_EMBREE)
122+ target_link_libraries (rendering PUBLIC
123+ igl::embree
124+ )
125+ endif ()
126+
127+ # Change rendering libraries from null to singleton
95128 set (RENDER_LIBRARIES
96129 rendering
97130 )
@@ -106,50 +139,13 @@ if(ENABLE_VISUALIZATION)
106139 )
107140endif ()
108141
109- # Install executables to bin directory
110- set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /bin)
111-
112- # Make main cpp library
113- add_subdirectory (src)
114-
115- # Build executables
116- add_subdirectory (src/app)
117-
118- # Build pybind optimization functions
142+ # Optionally build pybind
119143if (USE_PYBIND)
120144 include (pybind11)
121- add_library (optimization_py MODULE
122- src/penner_optimization_pybind.cpp
123- )
124-
125- # Link libraries
126- target_link_libraries (optimization_py PUBLIC
127- PennerOptimizationLib
128- pybind11::module
129- ${RENDER_LIBRARIES}
130- )
131-
132- # Set pybinding settings
133- set_target_properties (optimization_py PROPERTIES LIBRARY_OUTPUT_DIRECTORY
134- ${PROJECT_SOURCE_DIR} /py
135- )
136- set_target_properties (optimization_py PROPERTIES PREFIX
137- "${PYTHON_MODULE_PREFIX} "
138- )
139145endif ()
140146
141- # Optionally build tests (only valid for double precision)
142- if ((BUILD_CURVATURE_METRIC_TESTS) AND (NOT USE_MULTIPRECISION))
143- include (Catch2)
147+ # Install executables to bin directory
148+ set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /bin)
144149
145- # Build testing executable
146- add_executable (CurvatureMetricTests
147- src/tests/tests.cpp
148- )
149- target_link_libraries (CurvatureMetricTests PRIVATE
150- PennerOptimizationLib
151- Catch2::Catch2WithMain
152- )
153- set (TEST_DATA_ROOT "${PROJECT_SOURCE_DIR} /src/tests/regression/" )
154- target_compile_definitions (CurvatureMetricTests PUBLIC TEST_DATA_DIR=\"${TEST_DATA_ROOT} \")
155- endif ()
150+ # Make main cpp library
151+ add_subdirectory (src)
0 commit comments