From 3b39bf2377dc5c5cfe203bbe7f5737a26c4cbb55 Mon Sep 17 00:00:00 2001 From: Emmett Lalish Date: Mon, 18 Jul 2022 22:01:03 -0700 Subject: [PATCH 01/10] new directory structure --- .gitmodules | 10 ++--- CMakeLists.txt | 16 ++----- bindings/CMakeLists.txt | 8 ++++ bindings/python/CMakeLists.txt | 10 +++++ {test => bindings}/python/bricks.py | 0 {test => bindings}/python/cube_with_dents.py | 0 {tools => bindings/python}/pymanifold.cpp | 0 {test => bindings}/python/run_all.py | 0 bindings/python/third_party/CMakeLists.txt | 1 + .../python/third_party}/pybind11 | 0 {wasm => bindings/wasm}/CMakeLists.txt | 0 {wasm => bindings/wasm}/bindings.cpp | 0 {wasm => bindings/wasm}/index.html | 0 {samples => examples}/CMakeLists.txt | 0 {samples => examples}/include/samples.h | 0 {samples => examples}/models/apollo.png | Bin {samples => examples}/models/apollo.webp | Bin {samples => examples}/models/apolloPan.webp | Bin .../models/apollo_exterior-150k-4096.glb | Bin .../models/mengerSponge3.glb | Bin .../models/mengerSponge3.png | Bin .../models/mengerSponge3.webp | Bin .../models/mengerSponge4.glb | Bin {samples => examples}/models/perf.glb | Bin {samples => examples}/models/perf.png | Bin {samples => examples}/models/perf.webp | Bin {samples => examples}/models/rounding.glb | Bin {samples => examples}/models/rounding.webp | Bin {samples => examples}/models/scallop.glb | Bin {samples => examples}/models/scallop.png | Bin {samples => examples}/models/scallop.webp | Bin .../models/scallopFacets.glb | Bin .../models/scallopFacets.webp | Bin {samples => examples}/src/bracelet.cpp | 0 {samples => examples}/src/knot.cpp | 0 {samples => examples}/src/menger_sponge.cpp | 0 {samples => examples}/src/rounded_frame.cpp | 0 {samples => examples}/src/scallop.cpp | 0 {samples => examples}/src/tet_puzzle.cpp | 0 extras/CMakeLists.txt | 25 +++++++++++ {tools => extras}/perf | 0 {tools => extras}/perf_test.cpp | 0 {tools => extras}/perf_test_cgal.cpp | 0 src/CMakeLists.txt | 5 +++ {collider => src/collider}/CMakeLists.txt | 0 {collider => src/collider}/include/collider.h | 0 {collider => src/collider}/src/collider.cpp | 0 {manifold => src/manifold}/CMakeLists.txt | 0 {manifold => src/manifold}/include/manifold.h | 0 {manifold => src/manifold}/src/boolean3.cpp | 0 {manifold => src/manifold}/src/boolean3.h | 0 .../manifold}/src/boolean_result.cpp | 0 .../manifold}/src/constructors.cpp | 0 {manifold => src/manifold}/src/csg_tree.cpp | 0 {manifold => src/manifold}/src/csg_tree.h | 0 {manifold => src/manifold}/src/edge_op.cpp | 0 {manifold => src/manifold}/src/face_op.cpp | 0 {manifold => src/manifold}/src/impl.cpp | 0 {manifold => src/manifold}/src/impl.h | 0 {manifold => src/manifold}/src/manifold.cpp | 0 {manifold => src/manifold}/src/properties.cpp | 0 {manifold => src/manifold}/src/shared.h | 0 {manifold => src/manifold}/src/smoothing.cpp | 0 {manifold => src/manifold}/src/sort.cpp | 0 {polygon => src/polygon}/CMakeLists.txt | 0 {polygon => src/polygon}/include/polygon.h | 0 {polygon => src/polygon}/src/polygon.cpp | 0 src/third_party/CMakeLists.txt | 1 + {third_party => src/third_party}/glm | 0 .../third_party}/graphlite/CMakeLists.txt | 0 .../third_party}/graphlite/LICENSE.txt | 0 .../third_party}/graphlite/include/graph.h | 0 .../graphlite/include/graph_lite.h | 0 .../graphlite/src/connected_components.cpp | 0 {third_party => src/third_party}/thrust | 0 {utilities => src/utilities}/CMakeLists.txt | 0 {utilities => src/utilities}/include/par.h | 0 {utilities => src/utilities}/include/sparse.h | 0 .../utilities}/include/structs.h | 0 {utilities => src/utilities}/include/utils.h | 0 {utilities => src/utilities}/include/vec_dh.h | 0 .../utilities}/src/detect_cuda.cpp | 0 test/CMakeLists.txt | 19 +++++---- {meshIO => test/meshIO}/CMakeLists.txt | 0 {meshIO => test/meshIO}/include/meshIO.h | 0 {meshIO => test/meshIO}/src/meshIO.cpp | 0 .../third_party}/CMakeLists.txt | 21 ++++----- {third_party => test/third_party}/assimp | 0 {third_party => test/third_party}/google_test | 0 tools/CMakeLists.txt | 40 ------------------ tools/load_mesh.cpp | 39 ----------------- 91 files changed, 78 insertions(+), 117 deletions(-) create mode 100644 bindings/CMakeLists.txt create mode 100644 bindings/python/CMakeLists.txt rename {test => bindings}/python/bricks.py (100%) rename {test => bindings}/python/cube_with_dents.py (100%) rename {tools => bindings/python}/pymanifold.cpp (100%) rename {test => bindings}/python/run_all.py (100%) create mode 100644 bindings/python/third_party/CMakeLists.txt rename {third_party => bindings/python/third_party}/pybind11 (100%) rename {wasm => bindings/wasm}/CMakeLists.txt (100%) rename {wasm => bindings/wasm}/bindings.cpp (100%) rename {wasm => bindings/wasm}/index.html (100%) rename {samples => examples}/CMakeLists.txt (100%) rename {samples => examples}/include/samples.h (100%) rename {samples => examples}/models/apollo.png (100%) rename {samples => examples}/models/apollo.webp (100%) rename {samples => examples}/models/apolloPan.webp (100%) rename {samples => examples}/models/apollo_exterior-150k-4096.glb (100%) rename {samples => examples}/models/mengerSponge3.glb (100%) rename {samples => examples}/models/mengerSponge3.png (100%) rename {samples => examples}/models/mengerSponge3.webp (100%) rename {samples => examples}/models/mengerSponge4.glb (100%) rename {samples => examples}/models/perf.glb (100%) rename {samples => examples}/models/perf.png (100%) rename {samples => examples}/models/perf.webp (100%) rename {samples => examples}/models/rounding.glb (100%) rename {samples => examples}/models/rounding.webp (100%) rename {samples => examples}/models/scallop.glb (100%) rename {samples => examples}/models/scallop.png (100%) rename {samples => examples}/models/scallop.webp (100%) rename {samples => examples}/models/scallopFacets.glb (100%) rename {samples => examples}/models/scallopFacets.webp (100%) rename {samples => examples}/src/bracelet.cpp (100%) rename {samples => examples}/src/knot.cpp (100%) rename {samples => examples}/src/menger_sponge.cpp (100%) rename {samples => examples}/src/rounded_frame.cpp (100%) rename {samples => examples}/src/scallop.cpp (100%) rename {samples => examples}/src/tet_puzzle.cpp (100%) create mode 100644 extras/CMakeLists.txt rename {tools => extras}/perf (100%) rename {tools => extras}/perf_test.cpp (100%) rename {tools => extras}/perf_test_cgal.cpp (100%) create mode 100644 src/CMakeLists.txt rename {collider => src/collider}/CMakeLists.txt (100%) rename {collider => src/collider}/include/collider.h (100%) rename {collider => src/collider}/src/collider.cpp (100%) rename {manifold => src/manifold}/CMakeLists.txt (100%) rename {manifold => src/manifold}/include/manifold.h (100%) rename {manifold => src/manifold}/src/boolean3.cpp (100%) rename {manifold => src/manifold}/src/boolean3.h (100%) rename {manifold => src/manifold}/src/boolean_result.cpp (100%) rename {manifold => src/manifold}/src/constructors.cpp (100%) rename {manifold => src/manifold}/src/csg_tree.cpp (100%) rename {manifold => src/manifold}/src/csg_tree.h (100%) rename {manifold => src/manifold}/src/edge_op.cpp (100%) rename {manifold => src/manifold}/src/face_op.cpp (100%) rename {manifold => src/manifold}/src/impl.cpp (100%) rename {manifold => src/manifold}/src/impl.h (100%) rename {manifold => src/manifold}/src/manifold.cpp (100%) rename {manifold => src/manifold}/src/properties.cpp (100%) rename {manifold => src/manifold}/src/shared.h (100%) rename {manifold => src/manifold}/src/smoothing.cpp (100%) rename {manifold => src/manifold}/src/sort.cpp (100%) rename {polygon => src/polygon}/CMakeLists.txt (100%) rename {polygon => src/polygon}/include/polygon.h (100%) rename {polygon => src/polygon}/src/polygon.cpp (100%) create mode 100644 src/third_party/CMakeLists.txt rename {third_party => src/third_party}/glm (100%) rename {third_party => src/third_party}/graphlite/CMakeLists.txt (100%) rename {third_party => src/third_party}/graphlite/LICENSE.txt (100%) rename {third_party => src/third_party}/graphlite/include/graph.h (100%) rename {third_party => src/third_party}/graphlite/include/graph_lite.h (100%) rename {third_party => src/third_party}/graphlite/src/connected_components.cpp (100%) rename {third_party => src/third_party}/thrust (100%) rename {utilities => src/utilities}/CMakeLists.txt (100%) rename {utilities => src/utilities}/include/par.h (100%) rename {utilities => src/utilities}/include/sparse.h (100%) rename {utilities => src/utilities}/include/structs.h (100%) rename {utilities => src/utilities}/include/utils.h (100%) rename {utilities => src/utilities}/include/vec_dh.h (100%) rename {utilities => src/utilities}/src/detect_cuda.cpp (100%) rename {meshIO => test/meshIO}/CMakeLists.txt (100%) rename {meshIO => test/meshIO}/include/meshIO.h (100%) rename {meshIO => test/meshIO}/src/meshIO.cpp (100%) rename {third_party => test/third_party}/CMakeLists.txt (55%) rename {third_party => test/third_party}/assimp (100%) rename {third_party => test/third_party}/google_test (100%) delete mode 100644 tools/CMakeLists.txt delete mode 100644 tools/load_mesh.cpp diff --git a/.gitmodules b/.gitmodules index 46f2373ff..96a60e1ff 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,16 +1,16 @@ [submodule "third_party/assimp"] - path = third_party/assimp + path = test/third_party/assimp url = https://github.com/assimp/assimp [submodule "third_party/thrust"] - path = third_party/thrust + path = src/third_party/thrust url = https://github.com/NVIDIA/thrust [submodule "third_party/glm"] - path = third_party/glm + path = src/third_party/glm url = https://github.com/g-truc/glm [submodule "third_party/google_test"] - path = third_party/google_test + path = test/third_party/google_test url = https://github.com/google/googletest.git [submodule "third_party/pybind11"] - path = third_party/pybind11 + path = bindings/python/third_party/pybind11 url = https://github.com/pybind/pybind11 branch = stable diff --git a/CMakeLists.txt b/CMakeLists.txt index d7373fefa..c28f05556 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,16 +70,8 @@ if(CODE_COVERAGE AND NOT MSVC) add_link_options("-coverage") endif() -add_subdirectory(utilities) -add_subdirectory(third_party) -add_subdirectory(collider) -add_subdirectory(polygon) -add_subdirectory(manifold) -add_subdirectory(meshIO) -add_subdirectory(samples) +add_subdirectory(src) +add_subdirectory(examples) add_subdirectory(test) -add_subdirectory(tools) - -if(EMSCRIPTEN) -add_subdirectory(wasm) -endif() +add_subdirectory(extras) +add_subdirectory(bindings) \ No newline at end of file diff --git a/bindings/CMakeLists.txt b/bindings/CMakeLists.txt new file mode 100644 index 000000000..b322ce230 --- /dev/null +++ b/bindings/CMakeLists.txt @@ -0,0 +1,8 @@ + +if(NOT EMSCRIPTEN) + add_subdirectory(python) +endif() + +if(EMSCRIPTEN) + add_subdirectory(wasm) +endif() diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt new file mode 100644 index 000000000..7387804e1 --- /dev/null +++ b/bindings/python/CMakeLists.txt @@ -0,0 +1,10 @@ +project(python) + +add_subdirectory(third_party) +pybind11_add_module(pymanifold pymanifold.cpp) +target_link_libraries(pymanifold PRIVATE manifold meshIO) +target_compile_options(pymanifold PRIVATE ${MANIFOLD_FLAGS}) +target_compile_features(pymanifold PUBLIC cxx_std_14) +target_include_directories(pymanifold + PRIVATE ${PYBIND11_DIR}/include +) \ No newline at end of file diff --git a/test/python/bricks.py b/bindings/python/bricks.py similarity index 100% rename from test/python/bricks.py rename to bindings/python/bricks.py diff --git a/test/python/cube_with_dents.py b/bindings/python/cube_with_dents.py similarity index 100% rename from test/python/cube_with_dents.py rename to bindings/python/cube_with_dents.py diff --git a/tools/pymanifold.cpp b/bindings/python/pymanifold.cpp similarity index 100% rename from tools/pymanifold.cpp rename to bindings/python/pymanifold.cpp diff --git a/test/python/run_all.py b/bindings/python/run_all.py similarity index 100% rename from test/python/run_all.py rename to bindings/python/run_all.py diff --git a/bindings/python/third_party/CMakeLists.txt b/bindings/python/third_party/CMakeLists.txt new file mode 100644 index 000000000..40be7452e --- /dev/null +++ b/bindings/python/third_party/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(pybind11) \ No newline at end of file diff --git a/third_party/pybind11 b/bindings/python/third_party/pybind11 similarity index 100% rename from third_party/pybind11 rename to bindings/python/third_party/pybind11 diff --git a/wasm/CMakeLists.txt b/bindings/wasm/CMakeLists.txt similarity index 100% rename from wasm/CMakeLists.txt rename to bindings/wasm/CMakeLists.txt diff --git a/wasm/bindings.cpp b/bindings/wasm/bindings.cpp similarity index 100% rename from wasm/bindings.cpp rename to bindings/wasm/bindings.cpp diff --git a/wasm/index.html b/bindings/wasm/index.html similarity index 100% rename from wasm/index.html rename to bindings/wasm/index.html diff --git a/samples/CMakeLists.txt b/examples/CMakeLists.txt similarity index 100% rename from samples/CMakeLists.txt rename to examples/CMakeLists.txt diff --git a/samples/include/samples.h b/examples/include/samples.h similarity index 100% rename from samples/include/samples.h rename to examples/include/samples.h diff --git a/samples/models/apollo.png b/examples/models/apollo.png similarity index 100% rename from samples/models/apollo.png rename to examples/models/apollo.png diff --git a/samples/models/apollo.webp b/examples/models/apollo.webp similarity index 100% rename from samples/models/apollo.webp rename to examples/models/apollo.webp diff --git a/samples/models/apolloPan.webp b/examples/models/apolloPan.webp similarity index 100% rename from samples/models/apolloPan.webp rename to examples/models/apolloPan.webp diff --git a/samples/models/apollo_exterior-150k-4096.glb b/examples/models/apollo_exterior-150k-4096.glb similarity index 100% rename from samples/models/apollo_exterior-150k-4096.glb rename to examples/models/apollo_exterior-150k-4096.glb diff --git a/samples/models/mengerSponge3.glb b/examples/models/mengerSponge3.glb similarity index 100% rename from samples/models/mengerSponge3.glb rename to examples/models/mengerSponge3.glb diff --git a/samples/models/mengerSponge3.png b/examples/models/mengerSponge3.png similarity index 100% rename from samples/models/mengerSponge3.png rename to examples/models/mengerSponge3.png diff --git a/samples/models/mengerSponge3.webp b/examples/models/mengerSponge3.webp similarity index 100% rename from samples/models/mengerSponge3.webp rename to examples/models/mengerSponge3.webp diff --git a/samples/models/mengerSponge4.glb b/examples/models/mengerSponge4.glb similarity index 100% rename from samples/models/mengerSponge4.glb rename to examples/models/mengerSponge4.glb diff --git a/samples/models/perf.glb b/examples/models/perf.glb similarity index 100% rename from samples/models/perf.glb rename to examples/models/perf.glb diff --git a/samples/models/perf.png b/examples/models/perf.png similarity index 100% rename from samples/models/perf.png rename to examples/models/perf.png diff --git a/samples/models/perf.webp b/examples/models/perf.webp similarity index 100% rename from samples/models/perf.webp rename to examples/models/perf.webp diff --git a/samples/models/rounding.glb b/examples/models/rounding.glb similarity index 100% rename from samples/models/rounding.glb rename to examples/models/rounding.glb diff --git a/samples/models/rounding.webp b/examples/models/rounding.webp similarity index 100% rename from samples/models/rounding.webp rename to examples/models/rounding.webp diff --git a/samples/models/scallop.glb b/examples/models/scallop.glb similarity index 100% rename from samples/models/scallop.glb rename to examples/models/scallop.glb diff --git a/samples/models/scallop.png b/examples/models/scallop.png similarity index 100% rename from samples/models/scallop.png rename to examples/models/scallop.png diff --git a/samples/models/scallop.webp b/examples/models/scallop.webp similarity index 100% rename from samples/models/scallop.webp rename to examples/models/scallop.webp diff --git a/samples/models/scallopFacets.glb b/examples/models/scallopFacets.glb similarity index 100% rename from samples/models/scallopFacets.glb rename to examples/models/scallopFacets.glb diff --git a/samples/models/scallopFacets.webp b/examples/models/scallopFacets.webp similarity index 100% rename from samples/models/scallopFacets.webp rename to examples/models/scallopFacets.webp diff --git a/samples/src/bracelet.cpp b/examples/src/bracelet.cpp similarity index 100% rename from samples/src/bracelet.cpp rename to examples/src/bracelet.cpp diff --git a/samples/src/knot.cpp b/examples/src/knot.cpp similarity index 100% rename from samples/src/knot.cpp rename to examples/src/knot.cpp diff --git a/samples/src/menger_sponge.cpp b/examples/src/menger_sponge.cpp similarity index 100% rename from samples/src/menger_sponge.cpp rename to examples/src/menger_sponge.cpp diff --git a/samples/src/rounded_frame.cpp b/examples/src/rounded_frame.cpp similarity index 100% rename from samples/src/rounded_frame.cpp rename to examples/src/rounded_frame.cpp diff --git a/samples/src/scallop.cpp b/examples/src/scallop.cpp similarity index 100% rename from samples/src/scallop.cpp rename to examples/src/scallop.cpp diff --git a/samples/src/tet_puzzle.cpp b/examples/src/tet_puzzle.cpp similarity index 100% rename from samples/src/tet_puzzle.cpp rename to examples/src/tet_puzzle.cpp diff --git a/extras/CMakeLists.txt b/extras/CMakeLists.txt new file mode 100644 index 000000000..394fb1514 --- /dev/null +++ b/extras/CMakeLists.txt @@ -0,0 +1,25 @@ +project(extras) + +add_executable(perfTest perf_test.cpp) +target_link_libraries(perfTest manifold) + +target_compile_options(perfTest PRIVATE ${MANIFOLD_FLAGS}) +target_compile_features(perfTest PUBLIC cxx_std_14) + +if(BUILD_TEST_CGAL) + add_executable(perfTestCGAL perf_test_cgal.cpp) + find_package(CGAL REQUIRED COMPONENTS Core) + target_compile_definitions(perfTestCGAL PRIVATE CGAL_USE_GMPXX) + + # target_compile_definitions(perfTestCGAL PRIVATE CGAL_DEBUG) + target_link_libraries(perfTestCGAL manifold CGAL::CGAL CGAL::CGAL_Core) + + target_compile_options(perfTestCGAL PRIVATE ${MANIFOLD_FLAGS}) + target_compile_features(perfTestCGAL PUBLIC cxx_std_14) +endif() + +# add_executable(playground playground.cpp) +# target_link_libraries(playground manifold meshIO samples) + +# target_compile_options(playground PRIVATE ${MANIFOLD_FLAGS}) +# target_compile_features(playground PUBLIC cxx_std_14) diff --git a/tools/perf b/extras/perf similarity index 100% rename from tools/perf rename to extras/perf diff --git a/tools/perf_test.cpp b/extras/perf_test.cpp similarity index 100% rename from tools/perf_test.cpp rename to extras/perf_test.cpp diff --git a/tools/perf_test_cgal.cpp b/extras/perf_test_cgal.cpp similarity index 100% rename from tools/perf_test_cgal.cpp rename to extras/perf_test_cgal.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 000000000..88706cd28 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,5 @@ +add_subdirectory(utilities) +add_subdirectory(third_party) +add_subdirectory(collider) +add_subdirectory(polygon) +add_subdirectory(manifold) diff --git a/collider/CMakeLists.txt b/src/collider/CMakeLists.txt similarity index 100% rename from collider/CMakeLists.txt rename to src/collider/CMakeLists.txt diff --git a/collider/include/collider.h b/src/collider/include/collider.h similarity index 100% rename from collider/include/collider.h rename to src/collider/include/collider.h diff --git a/collider/src/collider.cpp b/src/collider/src/collider.cpp similarity index 100% rename from collider/src/collider.cpp rename to src/collider/src/collider.cpp diff --git a/manifold/CMakeLists.txt b/src/manifold/CMakeLists.txt similarity index 100% rename from manifold/CMakeLists.txt rename to src/manifold/CMakeLists.txt diff --git a/manifold/include/manifold.h b/src/manifold/include/manifold.h similarity index 100% rename from manifold/include/manifold.h rename to src/manifold/include/manifold.h diff --git a/manifold/src/boolean3.cpp b/src/manifold/src/boolean3.cpp similarity index 100% rename from manifold/src/boolean3.cpp rename to src/manifold/src/boolean3.cpp diff --git a/manifold/src/boolean3.h b/src/manifold/src/boolean3.h similarity index 100% rename from manifold/src/boolean3.h rename to src/manifold/src/boolean3.h diff --git a/manifold/src/boolean_result.cpp b/src/manifold/src/boolean_result.cpp similarity index 100% rename from manifold/src/boolean_result.cpp rename to src/manifold/src/boolean_result.cpp diff --git a/manifold/src/constructors.cpp b/src/manifold/src/constructors.cpp similarity index 100% rename from manifold/src/constructors.cpp rename to src/manifold/src/constructors.cpp diff --git a/manifold/src/csg_tree.cpp b/src/manifold/src/csg_tree.cpp similarity index 100% rename from manifold/src/csg_tree.cpp rename to src/manifold/src/csg_tree.cpp diff --git a/manifold/src/csg_tree.h b/src/manifold/src/csg_tree.h similarity index 100% rename from manifold/src/csg_tree.h rename to src/manifold/src/csg_tree.h diff --git a/manifold/src/edge_op.cpp b/src/manifold/src/edge_op.cpp similarity index 100% rename from manifold/src/edge_op.cpp rename to src/manifold/src/edge_op.cpp diff --git a/manifold/src/face_op.cpp b/src/manifold/src/face_op.cpp similarity index 100% rename from manifold/src/face_op.cpp rename to src/manifold/src/face_op.cpp diff --git a/manifold/src/impl.cpp b/src/manifold/src/impl.cpp similarity index 100% rename from manifold/src/impl.cpp rename to src/manifold/src/impl.cpp diff --git a/manifold/src/impl.h b/src/manifold/src/impl.h similarity index 100% rename from manifold/src/impl.h rename to src/manifold/src/impl.h diff --git a/manifold/src/manifold.cpp b/src/manifold/src/manifold.cpp similarity index 100% rename from manifold/src/manifold.cpp rename to src/manifold/src/manifold.cpp diff --git a/manifold/src/properties.cpp b/src/manifold/src/properties.cpp similarity index 100% rename from manifold/src/properties.cpp rename to src/manifold/src/properties.cpp diff --git a/manifold/src/shared.h b/src/manifold/src/shared.h similarity index 100% rename from manifold/src/shared.h rename to src/manifold/src/shared.h diff --git a/manifold/src/smoothing.cpp b/src/manifold/src/smoothing.cpp similarity index 100% rename from manifold/src/smoothing.cpp rename to src/manifold/src/smoothing.cpp diff --git a/manifold/src/sort.cpp b/src/manifold/src/sort.cpp similarity index 100% rename from manifold/src/sort.cpp rename to src/manifold/src/sort.cpp diff --git a/polygon/CMakeLists.txt b/src/polygon/CMakeLists.txt similarity index 100% rename from polygon/CMakeLists.txt rename to src/polygon/CMakeLists.txt diff --git a/polygon/include/polygon.h b/src/polygon/include/polygon.h similarity index 100% rename from polygon/include/polygon.h rename to src/polygon/include/polygon.h diff --git a/polygon/src/polygon.cpp b/src/polygon/src/polygon.cpp similarity index 100% rename from polygon/src/polygon.cpp rename to src/polygon/src/polygon.cpp diff --git a/src/third_party/CMakeLists.txt b/src/third_party/CMakeLists.txt new file mode 100644 index 000000000..223fdedd6 --- /dev/null +++ b/src/third_party/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(graphlite) diff --git a/third_party/glm b/src/third_party/glm similarity index 100% rename from third_party/glm rename to src/third_party/glm diff --git a/third_party/graphlite/CMakeLists.txt b/src/third_party/graphlite/CMakeLists.txt similarity index 100% rename from third_party/graphlite/CMakeLists.txt rename to src/third_party/graphlite/CMakeLists.txt diff --git a/third_party/graphlite/LICENSE.txt b/src/third_party/graphlite/LICENSE.txt similarity index 100% rename from third_party/graphlite/LICENSE.txt rename to src/third_party/graphlite/LICENSE.txt diff --git a/third_party/graphlite/include/graph.h b/src/third_party/graphlite/include/graph.h similarity index 100% rename from third_party/graphlite/include/graph.h rename to src/third_party/graphlite/include/graph.h diff --git a/third_party/graphlite/include/graph_lite.h b/src/third_party/graphlite/include/graph_lite.h similarity index 100% rename from third_party/graphlite/include/graph_lite.h rename to src/third_party/graphlite/include/graph_lite.h diff --git a/third_party/graphlite/src/connected_components.cpp b/src/third_party/graphlite/src/connected_components.cpp similarity index 100% rename from third_party/graphlite/src/connected_components.cpp rename to src/third_party/graphlite/src/connected_components.cpp diff --git a/third_party/thrust b/src/third_party/thrust similarity index 100% rename from third_party/thrust rename to src/third_party/thrust diff --git a/utilities/CMakeLists.txt b/src/utilities/CMakeLists.txt similarity index 100% rename from utilities/CMakeLists.txt rename to src/utilities/CMakeLists.txt diff --git a/utilities/include/par.h b/src/utilities/include/par.h similarity index 100% rename from utilities/include/par.h rename to src/utilities/include/par.h diff --git a/utilities/include/sparse.h b/src/utilities/include/sparse.h similarity index 100% rename from utilities/include/sparse.h rename to src/utilities/include/sparse.h diff --git a/utilities/include/structs.h b/src/utilities/include/structs.h similarity index 100% rename from utilities/include/structs.h rename to src/utilities/include/structs.h diff --git a/utilities/include/utils.h b/src/utilities/include/utils.h similarity index 100% rename from utilities/include/utils.h rename to src/utilities/include/utils.h diff --git a/utilities/include/vec_dh.h b/src/utilities/include/vec_dh.h similarity index 100% rename from utilities/include/vec_dh.h rename to src/utilities/include/vec_dh.h diff --git a/utilities/src/detect_cuda.cpp b/src/utilities/src/detect_cuda.cpp similarity index 100% rename from utilities/src/detect_cuda.cpp rename to src/utilities/src/detect_cuda.cpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4e1f9af26..eaec79c9c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,4 +1,6 @@ -project (manifold_test) +project(manifold_test) + +add_subdirectory(meshIO) enable_testing() @@ -12,17 +14,18 @@ target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_14) add_test(test_all ${PROJECT_NAME}) file(COPY data DESTINATION . FILES_MATCHING PATTERN "*.ply") + if(EMSCRIPTEN) - set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS - "-s ASSERTIONS=1 -s DEMANGLE_SUPPORT=1 --preload-file data --bind") + set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS + "-s ASSERTIONS=1 -s DEMANGLE_SUPPORT=1 --preload-file data --bind") else() endif() if(APPLE) -# All executables that link to CUDA need this. If you ever get -# "CUDA driver version is insufficient for CUDA runtime version", -# this is probably what's missing. + # All executables that link to CUDA need this. If you ever get + # "CUDA driver version is insufficient for CUDA runtime version", + # this is probably what's missing. set_property(TARGET ${PROJECT_NAME} - PROPERTY - BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) + PROPERTY + BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) endif() diff --git a/meshIO/CMakeLists.txt b/test/meshIO/CMakeLists.txt similarity index 100% rename from meshIO/CMakeLists.txt rename to test/meshIO/CMakeLists.txt diff --git a/meshIO/include/meshIO.h b/test/meshIO/include/meshIO.h similarity index 100% rename from meshIO/include/meshIO.h rename to test/meshIO/include/meshIO.h diff --git a/meshIO/src/meshIO.cpp b/test/meshIO/src/meshIO.cpp similarity index 100% rename from meshIO/src/meshIO.cpp rename to test/meshIO/src/meshIO.cpp diff --git a/third_party/CMakeLists.txt b/test/third_party/CMakeLists.txt similarity index 55% rename from third_party/CMakeLists.txt rename to test/third_party/CMakeLists.txt index 7dad31db6..d712362bb 100644 --- a/third_party/CMakeLists.txt +++ b/test/third_party/CMakeLists.txt @@ -1,23 +1,23 @@ -add_subdirectory(graphlite) - -############################################################################ -# BUILD ASSIMP LIBRARY # -############################################################################ +# ########################################################################### +# BUILD ASSIMP LIBRARY # +# ########################################################################### option(ASSIMP_BUILD_ASSIMP_TOOLS off) option(ASSIMP_BUILD_TESTS off) add_subdirectory(assimp) -############################################################################ -# Build Google Test # -############################################################################ +# ########################################################################### +# Build Google Test # +# ########################################################################### # Prevent overriding the parent project's compiler/linker # settings on Windows set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) + # Prevent installation of GTest with your project set(INSTALL_GTEST OFF CACHE BOOL "" FORCE) set(INSTALL_GMOCK OFF CACHE BOOL "" FORCE) add_subdirectory(google_test) + # Add aliases for GTest and GMock libraries if(NOT TARGET GTest::GTest) add_library(GTest::GTest ALIAS gtest) @@ -28,8 +28,3 @@ if(NOT TARGET GTest::GMock) add_library(GMock::GMock ALIAS gmock) add_library(GMock::Main ALIAS gmock_main) endif() - -if(NOT EMSCRIPTEN) - add_subdirectory(pybind11) -endif() - diff --git a/third_party/assimp b/test/third_party/assimp similarity index 100% rename from third_party/assimp rename to test/third_party/assimp diff --git a/third_party/google_test b/test/third_party/google_test similarity index 100% rename from third_party/google_test rename to test/third_party/google_test diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt deleted file mode 100644 index a2dc35a4c..000000000 --- a/tools/CMakeLists.txt +++ /dev/null @@ -1,40 +0,0 @@ -project (tools) - -add_executable(loadMesh load_mesh.cpp) -target_link_libraries(loadMesh manifold meshIO) - -target_compile_options(loadMesh PRIVATE ${MANIFOLD_FLAGS}) -target_compile_features(loadMesh PUBLIC cxx_std_14) - -add_executable(perfTest perf_test.cpp) -target_link_libraries(perfTest manifold) - -target_compile_options(perfTest PRIVATE ${MANIFOLD_FLAGS}) -target_compile_features(perfTest PUBLIC cxx_std_14) - -if(BUILD_TEST_CGAL) -add_executable(perfTestCGAL perf_test_cgal.cpp) -find_package(CGAL REQUIRED COMPONENTS Core) -target_compile_definitions(perfTestCGAL PRIVATE CGAL_USE_GMPXX) -# target_compile_definitions(perfTestCGAL PRIVATE CGAL_DEBUG) -target_link_libraries(perfTestCGAL manifold CGAL::CGAL CGAL::CGAL_Core) - -target_compile_options(perfTestCGAL PRIVATE ${MANIFOLD_FLAGS}) -target_compile_features(perfTestCGAL PUBLIC cxx_std_14) -endif() - -if(NOT EMSCRIPTEN) -pybind11_add_module(pymanifold pymanifold.cpp) -target_link_libraries(pymanifold PRIVATE manifold meshIO) -target_compile_options(pymanifold PRIVATE ${MANIFOLD_FLAGS}) -target_compile_features(pymanifold PUBLIC cxx_std_14) -target_include_directories(pymanifold - PRIVATE ${PYBIND11_DIR}/include -) -endif() - -# add_executable(playground playground.cpp) -# target_link_libraries(playground manifold meshIO samples) - -# target_compile_options(playground PRIVATE ${MANIFOLD_FLAGS}) -# target_compile_features(playground PUBLIC cxx_std_14) diff --git a/tools/load_mesh.cpp b/tools/load_mesh.cpp deleted file mode 100644 index 903773b52..000000000 --- a/tools/load_mesh.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2020 Emmett Lalish -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include - -#include "manifold.h" -#include "meshIO.h" - -using namespace manifold; - -int main(int argc, char **argv) { - ALWAYS_ASSERT(argc > 1, userErr, "No filename given!"); - std::string filename = argv[1]; - - Mesh mesh = ImportMesh(filename); - - std::cout << mesh.vertPos.size() << " vertices input" << std::endl; - std::cout << mesh.triVerts.size() << " triangles input" << std::endl; - - Manifold manifold(mesh); - - std::cout << "Manifold is valid" << std::endl; - std::cout << manifold.NumVert() << " vertices now" << std::endl; - std::cout << manifold.NumTri() << " triangles now" << std::endl; - std::cout << "Genus = " << manifold.Genus() << std::endl; - std::cout << manifold.NumDegenerateTris() << " degenerate triangles" - << std::endl; -} From 92bb83c9fd7df1b528a687241317c8c0902f65b5 Mon Sep 17 00:00:00 2001 From: Emmett Lalish Date: Mon, 18 Jul 2022 22:25:59 -0700 Subject: [PATCH 02/10] fixed some CMake stuff --- CMakeLists.txt | 10 +++++----- src/CMakeLists.txt | 2 +- test/CMakeLists.txt | 1 + test/meshIO/CMakeLists.txt | 6 +++--- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c28f05556..6e562dd83 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,10 +21,10 @@ option(BUILD_TEST_CGAL off) option(BUILD_SHARED_LIBS off) set(ASSIMP_INC_DIR - ${PROJECT_SOURCE_DIR}/third_party/assimp/include - ${CMAKE_BINARY_DIR}/third_party/assimp/include) -set(GLM_INC_DIR ${PROJECT_SOURCE_DIR}/third_party/glm) -set(PYBIND11_DIR ${PROJECT_SOURCE_DIR}/third_party/pybind11) + ${PROJECT_SOURCE_DIR}/test/third_party/assimp/include + ${CMAKE_BINARY_DIR}/test/third_party/assimp/include) +set(GLM_INC_DIR ${PROJECT_SOURCE_DIR}/src/third_party/glm) +set(PYBIND11_DIR ${PROJECT_SOURCE_DIR}/bindings/python/third_party/pybind11) option(ASSIMP_FAST_BUILD "build ASSIMP just for tests" ON) @@ -39,7 +39,7 @@ if(ASSIMP_FAST_BUILD) endforeach() endif() -set(THRUST_INC_DIR ${PROJECT_SOURCE_DIR}/third_party/thrust) +set(THRUST_INC_DIR ${PROJECT_SOURCE_DIR}/src/third_party/thrust) if(MANIFOLD_USE_CUDA) enable_language(CUDA) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 88706cd28..b702c5892 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,5 @@ -add_subdirectory(utilities) add_subdirectory(third_party) +add_subdirectory(utilities) add_subdirectory(collider) add_subdirectory(polygon) add_subdirectory(manifold) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index eaec79c9c..00048bc03 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,5 +1,6 @@ project(manifold_test) +add_subdirectory(third_party) add_subdirectory(meshIO) enable_testing() diff --git a/test/meshIO/CMakeLists.txt b/test/meshIO/CMakeLists.txt index 84585095b..05f4ee134 100644 --- a/test/meshIO/CMakeLists.txt +++ b/test/meshIO/CMakeLists.txt @@ -1,12 +1,12 @@ -project (meshIO) +project(meshIO) add_library(${PROJECT_NAME} src/meshIO.cpp) -target_include_directories( ${PROJECT_NAME} +target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/include ${ASSIMP_INC_DIR} ) -target_link_libraries( ${PROJECT_NAME} +target_link_libraries(${PROJECT_NAME} PUBLIC utilities PRIVATE assimp ) From 5b182a243cc6d65ef5cadd01b5db72cd35277006 Mon Sep 17 00:00:00 2001 From: Emmett Lalish Date: Tue, 19 Jul 2022 21:17:09 -0700 Subject: [PATCH 03/10] fix build --- test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 00048bc03..00760818c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -5,7 +5,7 @@ add_subdirectory(meshIO) enable_testing() -file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS *.cpp) +set(SOURCE_FILES polygon_test.cpp mesh_test.cpp samples_test.cpp test_main.cpp) add_executable(${PROJECT_NAME} ${SOURCE_FILES}) target_link_libraries(${PROJECT_NAME} polygon GTest::GTest manifold meshIO samples) From d404b26d7acb45635ebd674e7258baf781f975fb Mon Sep 17 00:00:00 2001 From: Emmett Lalish Date: Tue, 19 Jul 2022 21:28:38 -0700 Subject: [PATCH 04/10] examples adjustments --- CMakeLists.txt | 2 +- bindings/python/{ => examples}/bricks.py | 0 bindings/python/{ => examples}/cube_with_dents.py | 0 bindings/python/{ => examples}/run_all.py | 0 bindings/wasm/{ => examples}/index.html | 0 deploy.sh | 1 + {examples => samples}/CMakeLists.txt | 0 {examples => samples}/include/samples.h | 0 {examples => samples}/models/apollo.png | Bin {examples => samples}/models/apollo.webp | Bin {examples => samples}/models/apolloPan.webp | Bin .../models/apollo_exterior-150k-4096.glb | Bin {examples => samples}/models/mengerSponge3.glb | Bin {examples => samples}/models/mengerSponge3.png | Bin {examples => samples}/models/mengerSponge3.webp | Bin {examples => samples}/models/mengerSponge4.glb | Bin {examples => samples}/models/perf.glb | Bin {examples => samples}/models/perf.png | Bin {examples => samples}/models/perf.webp | Bin {examples => samples}/models/rounding.glb | Bin {examples => samples}/models/rounding.webp | Bin {examples => samples}/models/scallop.glb | Bin {examples => samples}/models/scallop.png | Bin {examples => samples}/models/scallop.webp | Bin {examples => samples}/models/scallopFacets.glb | Bin {examples => samples}/models/scallopFacets.webp | Bin {examples => samples}/src/bracelet.cpp | 0 {examples => samples}/src/knot.cpp | 0 {examples => samples}/src/menger_sponge.cpp | 0 {examples => samples}/src/rounded_frame.cpp | 0 {examples => samples}/src/scallop.cpp | 0 {examples => samples}/src/tet_puzzle.cpp | 0 32 files changed, 2 insertions(+), 1 deletion(-) rename bindings/python/{ => examples}/bricks.py (100%) rename bindings/python/{ => examples}/cube_with_dents.py (100%) rename bindings/python/{ => examples}/run_all.py (100%) rename bindings/wasm/{ => examples}/index.html (100%) rename {examples => samples}/CMakeLists.txt (100%) rename {examples => samples}/include/samples.h (100%) rename {examples => samples}/models/apollo.png (100%) rename {examples => samples}/models/apollo.webp (100%) rename {examples => samples}/models/apolloPan.webp (100%) rename {examples => samples}/models/apollo_exterior-150k-4096.glb (100%) rename {examples => samples}/models/mengerSponge3.glb (100%) rename {examples => samples}/models/mengerSponge3.png (100%) rename {examples => samples}/models/mengerSponge3.webp (100%) rename {examples => samples}/models/mengerSponge4.glb (100%) rename {examples => samples}/models/perf.glb (100%) rename {examples => samples}/models/perf.png (100%) rename {examples => samples}/models/perf.webp (100%) rename {examples => samples}/models/rounding.glb (100%) rename {examples => samples}/models/rounding.webp (100%) rename {examples => samples}/models/scallop.glb (100%) rename {examples => samples}/models/scallop.png (100%) rename {examples => samples}/models/scallop.webp (100%) rename {examples => samples}/models/scallopFacets.glb (100%) rename {examples => samples}/models/scallopFacets.webp (100%) rename {examples => samples}/src/bracelet.cpp (100%) rename {examples => samples}/src/knot.cpp (100%) rename {examples => samples}/src/menger_sponge.cpp (100%) rename {examples => samples}/src/rounded_frame.cpp (100%) rename {examples => samples}/src/scallop.cpp (100%) rename {examples => samples}/src/tet_puzzle.cpp (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e562dd83..748434381 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,7 +71,7 @@ if(CODE_COVERAGE AND NOT MSVC) endif() add_subdirectory(src) -add_subdirectory(examples) +add_subdirectory(samples) add_subdirectory(test) add_subdirectory(extras) add_subdirectory(bindings) \ No newline at end of file diff --git a/bindings/python/bricks.py b/bindings/python/examples/bricks.py similarity index 100% rename from bindings/python/bricks.py rename to bindings/python/examples/bricks.py diff --git a/bindings/python/cube_with_dents.py b/bindings/python/examples/cube_with_dents.py similarity index 100% rename from bindings/python/cube_with_dents.py rename to bindings/python/examples/cube_with_dents.py diff --git a/bindings/python/run_all.py b/bindings/python/examples/run_all.py similarity index 100% rename from bindings/python/run_all.py rename to bindings/python/examples/run_all.py diff --git a/bindings/wasm/index.html b/bindings/wasm/examples/index.html similarity index 100% rename from bindings/wasm/index.html rename to bindings/wasm/examples/index.html diff --git a/deploy.sh b/deploy.sh index 86831a42b..b4eadc15e 100755 --- a/deploy.sh +++ b/deploy.sh @@ -20,6 +20,7 @@ set -x DEPLOYABLE_STATIC_FILES=( \ samples/models \ + bindings/wasm/examples \ ) PACKAGE_ROOT=`pwd` diff --git a/examples/CMakeLists.txt b/samples/CMakeLists.txt similarity index 100% rename from examples/CMakeLists.txt rename to samples/CMakeLists.txt diff --git a/examples/include/samples.h b/samples/include/samples.h similarity index 100% rename from examples/include/samples.h rename to samples/include/samples.h diff --git a/examples/models/apollo.png b/samples/models/apollo.png similarity index 100% rename from examples/models/apollo.png rename to samples/models/apollo.png diff --git a/examples/models/apollo.webp b/samples/models/apollo.webp similarity index 100% rename from examples/models/apollo.webp rename to samples/models/apollo.webp diff --git a/examples/models/apolloPan.webp b/samples/models/apolloPan.webp similarity index 100% rename from examples/models/apolloPan.webp rename to samples/models/apolloPan.webp diff --git a/examples/models/apollo_exterior-150k-4096.glb b/samples/models/apollo_exterior-150k-4096.glb similarity index 100% rename from examples/models/apollo_exterior-150k-4096.glb rename to samples/models/apollo_exterior-150k-4096.glb diff --git a/examples/models/mengerSponge3.glb b/samples/models/mengerSponge3.glb similarity index 100% rename from examples/models/mengerSponge3.glb rename to samples/models/mengerSponge3.glb diff --git a/examples/models/mengerSponge3.png b/samples/models/mengerSponge3.png similarity index 100% rename from examples/models/mengerSponge3.png rename to samples/models/mengerSponge3.png diff --git a/examples/models/mengerSponge3.webp b/samples/models/mengerSponge3.webp similarity index 100% rename from examples/models/mengerSponge3.webp rename to samples/models/mengerSponge3.webp diff --git a/examples/models/mengerSponge4.glb b/samples/models/mengerSponge4.glb similarity index 100% rename from examples/models/mengerSponge4.glb rename to samples/models/mengerSponge4.glb diff --git a/examples/models/perf.glb b/samples/models/perf.glb similarity index 100% rename from examples/models/perf.glb rename to samples/models/perf.glb diff --git a/examples/models/perf.png b/samples/models/perf.png similarity index 100% rename from examples/models/perf.png rename to samples/models/perf.png diff --git a/examples/models/perf.webp b/samples/models/perf.webp similarity index 100% rename from examples/models/perf.webp rename to samples/models/perf.webp diff --git a/examples/models/rounding.glb b/samples/models/rounding.glb similarity index 100% rename from examples/models/rounding.glb rename to samples/models/rounding.glb diff --git a/examples/models/rounding.webp b/samples/models/rounding.webp similarity index 100% rename from examples/models/rounding.webp rename to samples/models/rounding.webp diff --git a/examples/models/scallop.glb b/samples/models/scallop.glb similarity index 100% rename from examples/models/scallop.glb rename to samples/models/scallop.glb diff --git a/examples/models/scallop.png b/samples/models/scallop.png similarity index 100% rename from examples/models/scallop.png rename to samples/models/scallop.png diff --git a/examples/models/scallop.webp b/samples/models/scallop.webp similarity index 100% rename from examples/models/scallop.webp rename to samples/models/scallop.webp diff --git a/examples/models/scallopFacets.glb b/samples/models/scallopFacets.glb similarity index 100% rename from examples/models/scallopFacets.glb rename to samples/models/scallopFacets.glb diff --git a/examples/models/scallopFacets.webp b/samples/models/scallopFacets.webp similarity index 100% rename from examples/models/scallopFacets.webp rename to samples/models/scallopFacets.webp diff --git a/examples/src/bracelet.cpp b/samples/src/bracelet.cpp similarity index 100% rename from examples/src/bracelet.cpp rename to samples/src/bracelet.cpp diff --git a/examples/src/knot.cpp b/samples/src/knot.cpp similarity index 100% rename from examples/src/knot.cpp rename to samples/src/knot.cpp diff --git a/examples/src/menger_sponge.cpp b/samples/src/menger_sponge.cpp similarity index 100% rename from examples/src/menger_sponge.cpp rename to samples/src/menger_sponge.cpp diff --git a/examples/src/rounded_frame.cpp b/samples/src/rounded_frame.cpp similarity index 100% rename from examples/src/rounded_frame.cpp rename to samples/src/rounded_frame.cpp diff --git a/examples/src/scallop.cpp b/samples/src/scallop.cpp similarity index 100% rename from examples/src/scallop.cpp rename to samples/src/scallop.cpp diff --git a/examples/src/tet_puzzle.cpp b/samples/src/tet_puzzle.cpp similarity index 100% rename from examples/src/tet_puzzle.cpp rename to samples/src/tet_puzzle.cpp From 2098bc9d1f8d8598fb2d9f41d1e6b884ad1c61a0 Mon Sep 17 00:00:00 2001 From: Emmett Lalish Date: Tue, 19 Jul 2022 21:40:36 -0700 Subject: [PATCH 05/10] fix workflows --- .github/workflows/manifold.yml | 8 ++++---- clang-format.sh | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/manifold.yml b/.github/workflows/manifold.yml index 92e1556be..00a9a78ab 100644 --- a/.github/workflows/manifold.yml +++ b/.github/workflows/manifold.yml @@ -32,7 +32,7 @@ jobs: - name: Build ${{matrix.backend}} run: | # patch assimp - patch third_party/assimp/code/CMakeLists.txt < assimp.diff + patch test/third_party/assimp/code/CMakeLists.txt < assimp.diff git apply thrust.diff mkdir build cd build @@ -60,7 +60,7 @@ jobs: cd ../ lcov --capture --directory . --output-file ./code_coverage_test.info lcov --add-tracefile ./code_coverage_init.info --add-tracefile ./code_coverage_test.info --output-file ./code_coverage_total.info - lcov --remove ./code_coverage_total.info '/usr/*' '*/third_party/*' '*/test/*' '*/tools/*' --output-file ./code_coverage.info + lcov --remove ./code_coverage_total.info '/usr/*' '*/third_party/*' '*/test/*' '*/extras/*' '*/bindings/*' --output-file ./code_coverage.info - uses: codecov/codecov-action@v2 if: matrix.parallel_backend == 'NONE' && matrix.cuda_support == 'OFF' with: @@ -91,7 +91,7 @@ jobs: run: | source ./emsdk/emsdk_env.sh # patch assimp - patch third_party/assimp/code/CMakeLists.txt < assimp.diff + patch test/third_party/assimp/code/CMakeLists.txt < assimp.diff git apply thrust.diff mkdir build cd build @@ -116,7 +116,7 @@ jobs: - uses: jwlawson/actions-setup-cmake@v1.12 - name: Patch assimp shell: bash - run: patch third_party/assimp/code/CMakeLists.txt < assimp.diff + run: patch test/third_party/assimp/code/CMakeLists.txt < assimp.diff - uses: ilammy/msvc-dev-cmd@v1 - name: Install CUDA if: matrix.backend == 'CUDA' diff --git a/clang-format.sh b/clang-format.sh index b2650d256..b4a1fa904 100755 --- a/clang-format.sh +++ b/clang-format.sh @@ -1,5 +1,5 @@ #!/usr/bin/env -S bash -e -for f in {collider,manifold,meshIO,polygon,samples,utilities}/**/*.{h,cpp} {test,tools}/*.cpp; do +for f in {bindings,samples,extras,src,test}/**/*.{h,cpp}; do clang-format --dry-run --Werror $f & pids[${i}]=$! done From 372f5170eccff3d7b584d3271ddf092713e56f20 Mon Sep 17 00:00:00 2001 From: Emmett Lalish Date: Tue, 19 Jul 2022 21:47:50 -0700 Subject: [PATCH 06/10] formatted bindings --- bindings/wasm/bindings.cpp | 82 ++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 44 deletions(-) diff --git a/bindings/wasm/bindings.cpp b/bindings/wasm/bindings.cpp index cbe3b31cc..ba9d5c729 100644 --- a/bindings/wasm/bindings.cpp +++ b/bindings/wasm/bindings.cpp @@ -16,48 +16,42 @@ Manifold Intersection(Manifold& a, Manifold& b) { return a ^ b; } void Intersect(Manifold& a, Manifold& b) { a ^= b; } EMSCRIPTEN_BINDINGS(whatever) { - - value_object("ivec3") - .field("0", &glm::ivec3::x) - .field("1", &glm::ivec3::y) - .field("2", &glm::ivec3::z) - ; - - register_vector("Vector_ivec3"); - - value_object("vec3") - .field("x", &glm::vec3::x) - .field("y", &glm::vec3::y) - .field("z", &glm::vec3::z) - ; - - register_vector("Vector_vec3"); - - value_object("vec4") - .field("x", &glm::vec4::x) - .field("y", &glm::vec4::y) - .field("z", &glm::vec4::z) - .field("w", &glm::vec4::w) - ; - - register_vector("Vector_vec4"); - - value_object("Mesh") - .field("vertPos", &Mesh::vertPos) - .field("triVerts", &Mesh::triVerts) - .field("vertNormal", &Mesh::vertNormal) - .field("halfedgeTangent", &Mesh::halfedgeTangent) - ; - - class_("Manifold") - .constructor() - .function("Add", &Add) - .function("Subtract", &Subtract) - .function("Intersect", &Intersect) - .function("GetMesh", &Manifold::GetMesh) - ; - - function("Union", &Union); - function("Difference", &Difference); - function("Intersection", &Intersection); + value_object("ivec3") + .field("0", &glm::ivec3::x) + .field("1", &glm::ivec3::y) + .field("2", &glm::ivec3::z); + + register_vector("Vector_ivec3"); + + value_object("vec3") + .field("x", &glm::vec3::x) + .field("y", &glm::vec3::y) + .field("z", &glm::vec3::z); + + register_vector("Vector_vec3"); + + value_object("vec4") + .field("x", &glm::vec4::x) + .field("y", &glm::vec4::y) + .field("z", &glm::vec4::z) + .field("w", &glm::vec4::w); + + register_vector("Vector_vec4"); + + value_object("Mesh") + .field("vertPos", &Mesh::vertPos) + .field("triVerts", &Mesh::triVerts) + .field("vertNormal", &Mesh::vertNormal) + .field("halfedgeTangent", &Mesh::halfedgeTangent); + + class_("Manifold") + .constructor() + .function("Add", &Add) + .function("Subtract", &Subtract) + .function("Intersect", &Intersect) + .function("GetMesh", &Manifold::GetMesh); + + function("Union", &Union); + function("Difference", &Difference); + function("Intersection", &Intersection); } From 6cafc069708b36ef6ace6921ecd707bf21907234 Mon Sep 17 00:00:00 2001 From: Emmett Lalish Date: Tue, 19 Jul 2022 21:49:03 -0700 Subject: [PATCH 07/10] updated diff path --- thrust.diff | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/thrust.diff b/thrust.diff index f45c29a1c..8122cd57e 100644 --- a/thrust.diff +++ b/thrust.diff @@ -1,7 +1,7 @@ -diff --git a/third_party/thrust/thrust/detail/type_traits.h b/third_party/thrust/thrust/detail/type_traits.h +diff --git a/src/third_party/thrust/thrust/detail/type_traits.h b/src/third_party/thrust/thrust/detail/type_traits.h index d147f832..60b57654 100644 ---- a/third_party/thrust/thrust/detail/type_traits.h -+++ b/third_party/thrust/thrust/detail/type_traits.h +--- a/src/third_party/thrust/thrust/detail/type_traits.h ++++ b/src/third_party/thrust/thrust/detail/type_traits.h @@ -144,11 +144,11 @@ template struct has_trivial_constructor is_pod::value #if THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_MSVC || \ @@ -30,10 +30,10 @@ index d147f832..60b57654 100644 #endif // GCC VERSION #endif // THRUST_HOST_COMPILER > -diff --git a/third_party/thrust/thrust/detail/type_traits/has_trivial_assign.h b/third_party/thrust/thrust/detail/type_traits/has_trivial_assign.h +diff --git a/src/third_party/thrust/thrust/detail/type_traits/has_trivial_assign.h b/src/third_party/thrust/thrust/detail/type_traits/has_trivial_assign.h index 8aa55165..73c8f776 100644 ---- a/third_party/thrust/thrust/detail/type_traits/has_trivial_assign.h -+++ b/third_party/thrust/thrust/detail/type_traits/has_trivial_assign.h +--- a/src/third_party/thrust/thrust/detail/type_traits/has_trivial_assign.h ++++ b/src/third_party/thrust/thrust/detail/type_traits/has_trivial_assign.h @@ -39,10 +39,10 @@ template struct has_trivial_assign #elif THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_GCC // only use the intrinsic for >= 4.3 From 63164bed95fa68cbb8ccf663a756f101ca7d9e12 Mon Sep 17 00:00:00 2001 From: Emmett Lalish Date: Tue, 19 Jul 2022 22:03:11 -0700 Subject: [PATCH 08/10] fixing paths --- .github/workflows/manifold.yml | 4 ++-- bindings/wasm/CMakeLists.txt | 4 ++-- flake.nix | 15 +++++++-------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/manifold.yml b/.github/workflows/manifold.yml index 00a9a78ab..98bec907e 100644 --- a/.github/workflows/manifold.yml +++ b/.github/workflows/manifold.yml @@ -41,11 +41,11 @@ jobs: # note that the test for CUDA backend does not really test CUDA, as we # don't have CUDA GPU on GitHub Action run: | - export PYTHONPATH=$PYTHONPATH:$(pwd)/build/tools + export PYTHONPATH=$PYTHONPATH:$(pwd)/build/bindings/python cd build/test ./manifold_test cd ../../ - python3 test/python/run_all.py + python3 bindings/python/examples/run_all.py - name: Coverage Report # only do code coverage for default sequential backend, it seems that TBB # backend will cause failure diff --git a/bindings/wasm/CMakeLists.txt b/bindings/wasm/CMakeLists.txt index bbea27b6f..4d6eda44e 100644 --- a/bindings/wasm/CMakeLists.txt +++ b/bindings/wasm/CMakeLists.txt @@ -1,4 +1,4 @@ -project (wasm) +project(wasm) add_executable(manifoldjs bindings.cpp) target_link_libraries(manifoldjs manifold) @@ -6,4 +6,4 @@ target_compile_options(manifoldjs PRIVATE ${MANIFOLD_FLAGS} -fexceptions) target_link_options(manifoldjs PUBLIC --bind) target_compile_features(manifoldjs PUBLIC cxx_std_14) set_target_properties(manifoldjs PROPERTIES OUTPUT_NAME "manifold") -file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/index.html DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/examples/index.html DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/flake.nix b/flake.nix index 8087b42db..f265f5342 100644 --- a/flake.nix +++ b/flake.nix @@ -36,16 +36,15 @@ cd test ./manifold_test cd ../../ - PYTHONPATH=$PYTHONPATH:$(pwd)/build/tools python3 test/python/run_all.py + PYTHONPATH=$PYTHONPATH:$(pwd)/build/bindings/python python3 bindings/python/examples/run_all.py cd build ''; installPhase = '' mkdir -p $out - cp manifold/libmanifold.a $out/ - cp meshIO/libmeshIO.a $out/ - cp tools/loadMesh $out - cp tools/perfTest $out - cp tools/pymanifold* $out + cp src/manifold/libmanifold.a $out/ + cp test/meshIO/libmeshIO.a $out/ + cp extras/perfTest $out + cp bindings/python/pymanifold* $out ''; }; parallelBackends = [ @@ -115,8 +114,8 @@ ''; installPhase = '' mkdir -p $out - cp {tools,wasm}/*.js $out/ - cp {tools,wasm}/*.wasm $out/ + cp {extras,wasm}/*.js $out/ + cp {extras,wasm}/*.wasm $out/ ''; }; }; From dd889d2b7780d17af2b84f0f78cb0da841265372 Mon Sep 17 00:00:00 2001 From: Emmett Lalish Date: Tue, 19 Jul 2022 22:08:53 -0700 Subject: [PATCH 09/10] more path fixes --- assimp.diff | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assimp.diff b/assimp.diff index c90ef7773..fb21aa2f1 100644 --- a/assimp.diff +++ b/assimp.diff @@ -1,6 +1,6 @@ -diff a/third_party/assimp/code/CMakeLists.txt b/third_party/assimp/code/CMakeLists.txt ---- a/third_party/assimp/code/CMakeLists.txt -+++ b/third_party/assimp/code/CMakeLists.txt +diff a/test/third_party/assimp/code/CMakeLists.txt b/test/third_party/assimp/code/CMakeLists.txt +--- a/test/third_party/assimp/code/CMakeLists.txt ++++ b/test/third_party/assimp/code/CMakeLists.txt @@ -1176,13 +1176,6 @@ ADD_LIBRARY(assimp::assimp ALIAS assimp) TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp) From 311ca75a21de68e103d03a6d67783e8f29a0dbc6 Mon Sep 17 00:00:00 2001 From: Emmett Lalish Date: Tue, 19 Jul 2022 22:31:08 -0700 Subject: [PATCH 10/10] actions format check --- .github/workflows/check_format.yml | 8 ++++++-- clang-format.sh | 9 --------- 2 files changed, 6 insertions(+), 11 deletions(-) delete mode 100755 clang-format.sh diff --git a/.github/workflows/check_format.yml b/.github/workflows/check_format.yml index 032c829d6..726e8f1ef 100644 --- a/.github/workflows/check_format.yml +++ b/.github/workflows/check_format.yml @@ -12,6 +12,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: clang-format - run: ./clang-format.sh + - uses: DoozyX/clang-format-lint-action@v0.14 + with: + source: '.' + exclude: '*/third_party' + extensions: 'h,cpp' + clangFormatVersion: 12 diff --git a/clang-format.sh b/clang-format.sh deleted file mode 100755 index b4a1fa904..000000000 --- a/clang-format.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env -S bash -e -for f in {bindings,samples,extras,src,test}/**/*.{h,cpp}; do - clang-format --dry-run --Werror $f & - pids[${i}]=$! -done - -for pid in ${pids[*]}; do - wait $pid -done