Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change directory structure #918

Merged
merged 6 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions bindings/c/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
project(manifoldc)

# this is a shared library for FFI bindings
add_library(${PROJECT_NAME} SHARED manifoldc.cpp conv.cpp)
add_library(${PROJECT_NAME} SHARED
manifoldc.cpp
conv.cpp
box.cpp
cross.cpp
rect.cpp)

if(MSVC)
set_target_properties(${PROJECT_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
Expand All @@ -12,6 +17,7 @@ if(MSVC)
endif()

if(MANIFOLD_EXPORT)
target_sources(${PROJECT_NAME} PRIVATE meshio.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE meshIO)
target_compile_options(${PROJECT_NAME} PUBLIC -DMANIFOLD_EXPORT)
endif()
Expand All @@ -22,10 +28,13 @@ target_link_libraries(
)

target_include_directories(${PROJECT_NAME} PUBLIC
$<INSTALL_INTERFACE:include/${CMAKE_PROJECT_NAME}>
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>)
target_compile_options(${PROJECT_NAME} PRIVATE ${MANIFOLD_FLAGS})
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)

install(TARGETS ${PROJECT_NAME} EXPORT manifoldTargets)
install(FILES include/manifoldc.h include/types.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME})
install(FILES
include/manifold/manifoldc.h
include/manifold/types.h DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME})
16 changes: 11 additions & 5 deletions bindings/c/box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "conv.h"
#include "manifold.h"
#include "public.h"
#include "types.h"

#include "manifold/common.h"
#include "manifold/conv.h"
#include "manifold/manifold.h"
#include "manifold/types.h"

#ifdef __cplusplus
extern "C" {
#endif
ManifoldBox *manifold_box(void *mem, double x1, double y1, double z1, double x2,
double y2, double z2) {
auto p1 = vec3(x1, y1, z1);
Expand Down Expand Up @@ -96,3 +99,6 @@ int manifold_box_does_overlap_box(ManifoldBox *a, ManifoldBox *b) {
}

int manifold_box_is_finite(ManifoldBox *b) { return from_c(b)->IsFinite(); }
#ifdef __cplusplus
}
#endif
10 changes: 5 additions & 5 deletions bindings/c/conv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "conv.h"
#include "manifold/conv.h"

#include <vector>

#include "cross_section.h"
#include "manifold.h"
#include "public.h"
#include "types.h"
#include "manifold/common.h"
#include "manifold/cross_section.h"
#include "manifold/manifold.h"
#include "manifold/types.h"

ManifoldManifold *to_c(manifold::Manifold *m) {
return reinterpret_cast<ManifoldManifold *>(m);
Expand Down
18 changes: 12 additions & 6 deletions bindings/c/cross.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@

#include <vector>

#include "conv.h"
#include "cross_section.h"
#include "manifold.h"
#include "public.h"
#include "types.h"

#include "manifold/common.h"
#include "manifold/conv.h"
#include "manifold/cross_section.h"
#include "manifold/manifold.h"
#include "manifold/types.h"

#ifdef __cplusplus
extern "C" {
#endif
ManifoldCrossSection *manifold_cross_section_empty(void *mem) {
return to_c(new (mem) CrossSection());
}
Expand Down Expand Up @@ -248,3 +251,6 @@ ManifoldCrossSectionVec *manifold_cross_section_decompose(
auto comps = from_c(cs)->Decompose();
return to_c(new (mem) CrossSectionVec(comps));
}
#ifdef __cplusplus
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
#include <cstring>
#include <vector>

#include "cross_section.h"
#include "manifold.h"
#include "public.h"
#include "types.h"
#include "manifold/common.h"
#include "manifold/cross_section.h"
#include "manifold/manifold.h"
#include "manifold/types.h"

using namespace manifold;
using ManifoldVec = std::vector<Manifold>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <stddef.h>
#include <stdint.h>

#include "types.h"
#include "manifold/types.h"

#ifdef __cplusplus
#include <cstdint>
Expand Down
File renamed without changes.
21 changes: 6 additions & 15 deletions bindings/c/manifoldc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <conv.h>
#include <cross_section.h>
#include <manifold.h>
#include <manifoldc.h>
#include <public.h>
#include "manifold/manifoldc.h"

#include <vector>

#include "box.cpp"
#include "cross.cpp"
#include "include/conv.h"
#include "include/types.h"
#include "rect.cpp"
#include "types.h"

#ifdef MANIFOLD_EXPORT
#include "meshio.cpp"
#endif
#include "manifold/common.h"
#include "manifold/conv.h"
#include "manifold/cross_section.h"
#include "manifold/manifold.h"
#include "manifold/types.h"

using namespace manifold;

Expand Down
6 changes: 3 additions & 3 deletions bindings/c/meshio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "meshIO.h"
#include "manifold/meshIO.h"

#include "conv.h"
#include "types.h"
#include "manifold/conv.h"
#include "manifold/types.h"

// C <-> C++ conversions

Expand Down
18 changes: 12 additions & 6 deletions bindings/c/rect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "conv.h"
#include "cross_section.h"
#include "manifold.h"
#include "public.h"
#include "types.h"

#include "manifold/common.h"
#include "manifold/conv.h"
#include "manifold/cross_section.h"
#include "manifold/manifold.h"
#include "manifold/types.h"

#ifdef __cplusplus
extern "C" {
#endif
ManifoldRect *manifold_rect(void *mem, double x1, double y1, double x2,
double y2) {
auto p1 = vec2(x1, y1);
Expand Down Expand Up @@ -100,3 +103,6 @@ int manifold_rect_does_overlap_rect(ManifoldRect *a, ManifoldRect *r) {
int manifold_rect_is_empty(ManifoldRect *r) { return from_c(r)->IsEmpty(); }

int manifold_rect_is_finite(ManifoldRect *r) { return from_c(r)->IsFinite(); }
#ifdef __cplusplus
}
#endif
2 changes: 1 addition & 1 deletion bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ set(DOCSTRING_DEPS
${CMAKE_CURRENT_SOURCE_DIR}/../../src/manifold/src/sort.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/cross_section/src/cross_section.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/polygon/src/polygon.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utilities/include/public.h
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utilities/include/manifold/common.h
)
add_custom_command(
OUTPUT autogen_docstrings.inl
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/gen_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def select_functions(s):
f"{base}/src/cross_section/src/cross_section.cpp", lambda s: method_re.search(s)
)
collect(f"{base}/src/polygon/src/polygon.cpp", select_functions)
collect(f"{base}/src/utilities/include/public.h", select_functions)
collect(f"{base}/src/utilities/include/manifold/common.h", select_functions)

comments = dict(sorted(comments.items()))

Expand Down
6 changes: 3 additions & 3 deletions bindings/python/manifold3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
#include <string>

#include "autogen_docstrings.inl" // generated in build folder
#include "cross_section.h"
#include "manifold.h"
#include "manifold/cross_section.h"
#include "manifold/manifold.h"
#include "manifold/polygon.h"
#include "nanobind/nanobind.h"
#include "nanobind/ndarray.h"
#include "nanobind/operators.h"
Expand All @@ -26,7 +27,6 @@
#include "nanobind/stl/pair.h"
#include "nanobind/stl/tuple.h"
#include "nanobind/stl/vector.h"
#include "polygon.h"

namespace nb = nanobind;
using namespace manifold;
Expand Down
6 changes: 3 additions & 3 deletions bindings/wasm/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

#include <vector>

#include "cross_section.h"
#include "helpers.cpp"
#include "manifold.h"
#include "polygon.h"
#include "manifold/cross_section.h"
#include "manifold/manifold.h"
#include "manifold/polygon.h"

using namespace emscripten;
using namespace manifold;
Expand Down
6 changes: 3 additions & 3 deletions bindings/wasm/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

#include <vector>

#include "cross_section.h"
#include "manifold.h"
#include "polygon.h"
#include "manifold/cross_section.h"
#include "manifold/manifold.h"
#include "manifold/polygon.h"

using namespace emscripten;
using namespace manifold;
Expand Down
6 changes: 3 additions & 3 deletions extras/convert_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

#include <iostream>

#include "manifold.h"
#include "meshIO.h"
#include "manifold/manifold.h"
#include "manifold/meshIO.h"

using namespace manifold;

Expand Down Expand Up @@ -64,4 +64,4 @@ int main(int argc, char** argv) {
}

return 0;
}
}
2 changes: 1 addition & 1 deletion extras/large_scene_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <chrono>
#include <iostream>

#include "manifold.h"
#include "manifold/manifold.h"

using namespace manifold;

Expand Down
4 changes: 2 additions & 2 deletions extras/minimize_testcase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include <execution>
#endif

#include "polygon.h"
#include "utils.h"
#include "manifold/polygon.h"
#include "manifold/utils.h"

using namespace manifold;

Expand Down
2 changes: 1 addition & 1 deletion extras/perf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <chrono>
#include <iostream>

#include "manifold.h"
#include "manifold/manifold.h"

using namespace manifold;

Expand Down
2 changes: 1 addition & 1 deletion extras/perf_test_cgal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <fstream>
#include <iostream>

#include "manifold.h"
#include "manifold/manifold.h"

using namespace manifold;

Expand Down
2 changes: 1 addition & 1 deletion extras/stl_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <random>
#include <vector>

#include "par.h"
#include "manifold/parallel.h"

static constexpr size_t g_Iterations = 5;
static constexpr size_t g_IterationsDiscard = 1;
Expand Down
4 changes: 2 additions & 2 deletions extras/test_hull_performance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
#include <random>
#include <sstream> // For string manipulation

#include "manifold.h"
#include "meshIO.h"
#include "manifold/manifold.h"
#include "manifold/meshIO.h"
#include "samples.h"
using namespace std;
using namespace glm;
Expand Down
5 changes: 3 additions & 2 deletions format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ $CLANG_FORMAT -i meshIO/**/*.{h,cpp}
$CLANG_FORMAT -i samples/**/*.{h,cpp}
$CLANG_FORMAT -i test/*.{h,cpp}
$CLANG_FORMAT -i bindings/*/*.cpp
$CLANG_FORMAT -i bindings/c/include/*.h
$CLANG_FORMAT -i bindings/c/include/manifold/*.h
$CLANG_FORMAT -i bindings/wasm/**/*.{js,ts,html}
$CLANG_FORMAT -i src/!(third_party)/*/*.{h,cpp}
$CLANG_FORMAT -i src/*/src/*.{h,cpp}
$CLANG_FORMAT -i src/*/include/manifold/*.h
black bindings/python/examples/*.py
4 changes: 2 additions & 2 deletions meshIO/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ project(meshIO)
add_library(${PROJECT_NAME} src/meshIO.cpp)

target_include_directories(${PROJECT_NAME} PUBLIC
$<INSTALL_INTERFACE:include/${CMAKE_PROJECT_NAME}>
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>)

target_link_libraries(${PROJECT_NAME}
Expand All @@ -29,4 +29,4 @@ target_compile_options(${PROJECT_NAME} PRIVATE ${MANIFOLD_FLAGS})
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17)

install(TARGETS ${PROJECT_NAME} EXPORT manifoldTargets)
install(FILES include/meshIO.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME})
install(FILES include/manifold/meshIO.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME})
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#pragma once
#include <string>

#include "manifold.h"
#include "manifold/manifold.h"

namespace manifold {

Expand Down
Loading
Loading