Skip to content

Commit 206871a

Browse files
authored
dependency update (#559)
* dependency update * revert BUILD_SHARED_LIBS changes * test * . * don't try weird stuff with windows * update * update CI
1 parent 2055b9c commit 206871a

13 files changed

+136
-97
lines changed

.github/workflows/build_wheels.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
name: Build
1+
name: build_wheels
22

3-
on: [release]
3+
on: [release, workflow_dispatch]
44

55
jobs:
66
build_wheels:
@@ -10,7 +10,9 @@ jobs:
1010
matrix:
1111
os: [ubuntu-22.04, windows-latest, macos-latest]
1212
steps:
13-
- run: git config --global submodule.fetchJobs 8
13+
- run: |
14+
git config --global submodule.fetchJobs 8
15+
git config --global core.longpaths true
1416
- uses: actions/checkout@v3
1517
with:
1618
submodules: recursive

.github/workflows/manifold.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Install dependencies
2323
run: |
2424
sudo apt-get -y update
25-
DEBIAN_FRONTEND=noninteractive sudo apt install -y libgtest-dev libassimp-dev git libtbb-dev pkg-config libpython3-dev python3 python3-distutils python3-pip lcov
25+
DEBIAN_FRONTEND=noninteractive sudo apt install -y libglm-dev libgtest-dev libassimp-dev git libtbb-dev pkg-config libpython3-dev python3 python3-distutils python3-pip lcov
2626
pip install trimesh
2727
- uses: actions/checkout@v3
2828
with:
@@ -73,7 +73,7 @@ jobs:
7373
- name: Install dependencies
7474
run: |
7575
sudo apt-get -y update
76-
DEBIAN_FRONTEND=noninteractive sudo apt install -y libgtest-dev libassimp-dev git libtbb-dev pkg-config libpython3-dev python3 python3-distutils python3-pip
76+
DEBIAN_FRONTEND=noninteractive sudo apt install -y libgtest-dev libglm-dev libassimp-dev git libtbb-dev pkg-config libpython3-dev python3 python3-distutils python3-pip
7777
- uses: actions/checkout@v3
7878
with:
7979
submodules: recursive
@@ -96,7 +96,7 @@ jobs:
9696
- name: Install dependencies
9797
run: |
9898
sudo apt-get -y update
99-
DEBIAN_FRONTEND=noninteractive sudo apt install -y nodejs
99+
DEBIAN_FRONTEND=noninteractive sudo apt install -y nodejs libglm-dev
100100
- uses: actions/checkout@v3
101101
with:
102102
submodules: recursive
@@ -219,7 +219,7 @@ jobs:
219219
- uses: actions/checkout@v3
220220
with:
221221
submodules: recursive
222-
- uses: cachix/install-nix-action@v15
222+
- uses: cachix/install-nix-action@v22
223223
- run: nix build -L '.?submodules=1#manifold-${{matrix.variant}}'
224224

225225
build_nix_python:
@@ -230,5 +230,5 @@ jobs:
230230
- uses: actions/checkout@v3
231231
with:
232232
submodules: recursive
233-
- uses: cachix/install-nix-action@v15
233+
- uses: cachix/install-nix-action@v22
234234
- run: nix build -L '.?submodules=1#manifold3d'

.gitmodules

-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
[submodule "third_party/thrust"]
2-
path = src/third_party/thrust
3-
url = https://github.com/NVIDIA/thrust
4-
[submodule "third_party/glm"]
5-
path = src/third_party/glm
6-
url = https://github.com/g-truc/glm
7-
[submodule "third_party/google_test"]
8-
path = test/third_party/google_test
9-
url = https://github.com/google/googletest.git
101
[submodule "src/third_party/clipper2"]
112
path = src/third_party/clipper2
123
url = https://github.com/AngusJohnson/clipper2

CMakeLists.txt

+5-6
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,20 @@ cmake_minimum_required(VERSION 3.18)
1616
project(manifold LANGUAGES CXX)
1717

1818
set(CMAKE_VERBOSE_MAKEFILE ON)
19-
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
2019

20+
set(MANIFOLD_PAR "NONE" CACHE STRING "Parallel backend, either \"TBB\" or \"NONE\"")
21+
set(MANIFOLD_FLAGS "" CACHE STRING "Manifold compiler flags")
2122
option(MANIFOLD_EXPORT "Build mesh export (via assimp) utility library" OFF)
2223
option(MANIFOLD_TEST "Enable testing suite" ON)
2324
option(MANIFOLD_DEBUG "Enable debug tracing/timing" OFF)
25+
2426
option(MANIFOLD_PYBIND "Build python bindings" ON)
2527
option(MANIFOLD_CBIND "Build C (FFI) bindings" OFF)
28+
option(MANIFOLD_JSBIND "Build js binding" ${EMSCRIPTEN})
29+
2630
option(TRACY_ENABLE "Use tracy profiling" OFF)
2731
option(TRACY_MEMORY_USAGE "Track memory allocation with tracy (expensive)" OFF)
2832
option(BUILD_TEST_CGAL "Build CGAL performance comparisons" OFF)
29-
set(MANIFOLD_PAR "NONE" CACHE STRING "Parallel backend, either \"TBB\" or \"NONE\"")
30-
set(MANIFOLD_FLAGS "" CACHE STRING "Manifold compiler flags")
31-
3233
if(TRACY_ENABLE)
3334
option(CMAKE_BUILD_TYPE "Build type" RelWithDebInfo)
3435
if(TRACY_MEMORY_USAGE)
@@ -57,8 +58,6 @@ if(MANIFOLD_PYBIND)
5758
endif()
5859
endif()
5960

60-
set(THRUST_INC_DIR ${PROJECT_SOURCE_DIR}/src/third_party/thrust)
61-
6261
if(CMAKE_EXPORT_COMPILE_COMMANDS AND NOT EMSCRIPTEN)
6362
# for nixos
6463
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES

README.md

+22-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ For example, here is a log-log plot of Manifold's performance vs. earlier OpenSC
1111

1212
## [ManifoldCAD.org](https://manifoldcad.org)
1313

14-
If you like OpenSCAD / JSCAD, you might also like ManifoldCAD - our own solid modelling web app. Our WASM is not GPU-accelerated, but it's still quite fast and a good way to test out our Manifold library.
14+
If you like OpenSCAD / JSCAD, you might also like ManifoldCAD - our own solid modelling web app. Our WASM is not multithreaded yet, but it's still quite fast and a good way to test out our Manifold library.
1515

1616
![A metallic Menger sponge](https://elalish.github.io/manifold/samples/models/mengerSponge3.webp "A metallic Menger sponge")
1717

@@ -31,11 +31,16 @@ of this repository may solve the problem.
3131

3232
This is a modern C++ library that Github's CI verifies builds and runs on a variety of platforms. Additionally, we build bindings for JavaScript ([manifold-3d](https://www.npmjs.com/package/manifold-3d) on npm), Python, and C to make this library more portable and easy to use.
3333

34-
We have four core dependencies, making use of submodules to ensure compatibility:
35-
- `graphlite`: connected components algorithm
36-
- `Clipper2`: provides our 2D subsystem
37-
- `GLM`: a compact vector library
38-
- `Thrust`: Nvidia's parallel algorithms library (basically a superset of C++17 std::parallel_algorithms)
34+
System Dependencies (note that we will automatically download the dependency if there is no such package on the system):
35+
- [`GLM`](https://github.com/g-truc/glm/): A compact header-only vector library.
36+
- [`Thrust`](https://github.com/NVIDIA/thrust): NVIDIA's parallel algorithms library (basically a superset of C++17 std::parallel_algorithms)
37+
- [`tbb`](https://github.com/oneapi-src/oneTBB/): Intel's thread building blocks library. (only when `MANIFOLD_PAR=TBB` is enabled)
38+
- [`gtest`](https://github.com/google/googletest/): Google test library (only when test is enabled, i.e. `MANIFOLD_TEST=ON`)
39+
40+
Other dependencies:
41+
- [`graphlite`](https://github.com/haasdo95/graphlite): connected components algorithm.
42+
- [`Clipper2`](https://github.com/AngusJohnson/Clipper2j): provides our 2D subsystem
43+
- [`quickhull`](https://github.com/akuukka/quickhull): 3D convex hull algorithm.
3944

4045
## What's here
4146

@@ -64,11 +69,22 @@ test/manifold_test
6469
```
6570

6671
CMake flags (usage e.g. `-DMANIFOLD_DEBUG=ON`):
72+
- `MANIFOLD_JSBIND=[OFF, <ON>]`: Build js binding when using emscripten.
73+
- `MANIFOLD_CBIND=[<OFF>, ON]`: Build C FFI binding.
74+
- `MANIFOLD_PYBIND=[OFF, <ON>]`: Build python binding.
6775
- `MANIFOLD_PAR=[<NONE>, TBB]`: Provides multi-thread parallelization, requires `libtbb-dev` if `TBB` backend is selected.
6876
- `MANIFOLD_EXPORT=[<OFF>, ON]`: Enables GLB export of 3D models from the tests, requires `libassimp-dev`.
6977
- `MANIFOLD_DEBUG=[<OFF>, ON]`: Enables internal assertions and exceptions.
78+
- `MANIFOLD_TEST=[OFF, <ON>]`: Build unittests.
79+
- `TRACY_ENABLE=[<OFF>, ON]`: Enable integration with tracy profiler.
80+
See profiling section below.
7081
- `BUILD_TEST_CGAL=[<OFF>, ON]`: Builds a CGAL-based performance [comparison](https://github.com/elalish/manifold/tree/master/extras), requires `libcgal-dev`.
7182

83+
Offline building:
84+
- `FETCHCONTENT_SOURCE_DIR_GLM`: path to glm source.
85+
- `FETCHCONTENT_SOURCE_DIR_GOOGLETEST`: path to googletest source.
86+
- `FETCHCONTENT_SOURCE_DIR_THRUST`: path to NVIDIA thrust source.
87+
7288
The build instructions used by our CI are in [manifold.yml](https://github.com/elalish/manifold/blob/master/.github/workflows/manifold.yml), which is a good source to check if something goes wrong and for instructions specific to other platforms, like Windows.
7389

7490
### WASM

bindings/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ if(NOT EMSCRIPTEN AND MANIFOLD_PYBIND)
2020
add_subdirectory(python)
2121
endif()
2222

23-
if(EMSCRIPTEN)
23+
if(EMSCRIPTEN AND MANIFOLD_JSBIND)
2424
add_subdirectory(wasm)
2525
endif()

flake.nix

+43-11
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
url = "github:google/googletest/v1.14.0";
66
flake = false;
77
};
8-
98
outputs = { self, nixpkgs, flake-utils, gtest-src }:
109
flake-utils.lib.eachDefaultSystem
1110
(system:
@@ -14,6 +13,37 @@
1413
inherit system;
1514
config.allowUnfree = true;
1615
};
16+
thrust-210 = pkgs.nvidia-thrust.overrideAttrs (_: _: {
17+
version = "24486a1";
18+
src = builtins.fetchGit {
19+
url = "https://github.com/NVIDIA/thrust.git";
20+
ref = "main";
21+
rev = "24486a169a62a58ef8f824d3dc9613c006b6f5a7";
22+
submodules = true;
23+
};
24+
cmakeFlags = [ "-DTHRUST_ENABLE_HEADER_TESTING=OFF" "-DTHRUST_ENABLE_TESTING=OFF" "-DTHRUST_ENABLE_EXAMPLES=OFF" "-DTHRUST_DEVICE_SYSTEM=CPP" ];
25+
fixupPhase = ''
26+
cat <<EOT > $out/lib/cmake/thrust/thrust-header-search.cmake
27+
# Parse version information from version.h in source tree
28+
set(_THRUST_VERSION_INCLUDE_DIR "$out/include")
29+
if(EXISTS "\''${_THRUST_VERSION_INCLUDE_DIR}/thrust/version.h")
30+
set(_THRUST_VERSION_INCLUDE_DIR "\''${_THRUST_VERSION_INCLUDE_DIR}" CACHE FILEPATH "" FORCE) # Clear old result
31+
set_property(CACHE _THRUST_VERSION_INCLUDE_DIR PROPERTY TYPE INTERNAL)
32+
endif()
33+
EOT
34+
cat <<EOT > $out/lib/cmake/libcudacxx/libcudacxx-header-search.cmake
35+
# Parse version information from version header:
36+
unset(_libcudacxx_VERSION_INCLUDE_DIR CACHE) # Clear old result to force search
37+
find_path(_libcudacxx_VERSION_INCLUDE_DIR cuda/std/detail/__config
38+
NO_DEFAULT_PATH # Only search explicit paths below:
39+
PATHS
40+
"\''${CMAKE_CURRENT_LIST_DIR}/../../../include" # Source tree
41+
)
42+
set_property(CACHE _libcudacxx_VERSION_INCLUDE_DIR PROPERTY TYPE INTERNAL)
43+
EOT
44+
'';
45+
enableParallelBuilding = false;
46+
});
1747
manifold =
1848
{ parallel-backend ? "none"
1949
, doCheck ? true
@@ -26,6 +56,8 @@
2656
src = self;
2757
nativeBuildInputs = (with pkgs; [
2858
cmake
59+
thrust-210
60+
glm
2961
ninja
3062
(python39.withPackages
3163
(ps: with ps; [ trimesh ]))
@@ -49,20 +81,15 @@
4981
{ parallel-backend = "none"; }
5082
{
5183
parallel-backend = "tbb";
52-
build-tools = with pkgs; [ tbb pkg-config ];
84+
build-tools = with pkgs; [ tbb_2021_8 pkg-config ];
5385
}
5486
];
5587
devShell = { additional ? [ ] }: pkgs.mkShell {
5688
buildInputs = with pkgs; [
5789
cmake
58-
llvmPackages_13.openmp
59-
clang-tools
60-
clang_13
61-
emscripten
62-
tbb
63-
lcov
90+
tbb_2021_8
91+
thrust-210
6492
gtest
65-
tracy
6693
] ++ additional;
6794
};
6895
in
@@ -85,7 +112,10 @@
85112
export EM_CACHE=$(pwd)/.emscriptencache
86113
mkdir build
87114
cd build
88-
emcmake cmake -DCMAKE_BUILD_TYPE=Release -DFETCHCONTENT_SOURCE_DIR_GOOGLETEST=${gtest-src} ..
115+
emcmake cmake -DCMAKE_BUILD_TYPE=Release \
116+
-DFETCHCONTENT_SOURCE_DIR_GLM=${pkgs.glm.src} \
117+
-DFETCHCONTENT_SOURCE_DIR_GOOGLETEST=${gtest-src} \
118+
-DFETCHCONTENT_SOURCE_DIR_THRUST=${thrust-210.src} ..
89119
'';
90120
buildPhase = ''
91121
emmake make -j''${NIX_BUILD_CORES}
@@ -110,7 +140,9 @@
110140
numpy
111141
];
112142
buildInputs = with pkgs; [
113-
tbb
143+
tbb_2021_8
144+
thrust-210
145+
glm
114146
];
115147
nativeBuildInputs = with pkgs; [
116148
cmake

pyproject.toml

-16
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,6 @@ sdist.exclude = [
4848
"src/third_party/clipper2/Delphi/",
4949
"src/third_party/clipper2/DLL/",
5050
"src/third_party/clipper2/Tests/",
51-
"src/third_party/glm/doc/",
52-
"src/third_party/glm/test/",
53-
"src/third_party/thrust/dependencies/cub/",
54-
"src/third_party/thrust/dependencies/libcudacxx/.upstream-tests/",
55-
"src/third_party/thrust/dependencies/libcudacxx/docker/",
56-
"src/third_party/thrust/dependencies/libcudacxx/test/",
57-
"src/third_party/thrust/dependencies/libcudacxx/docs/",
58-
"src/third_party/thrust/dependencies/libcudacxx/libcxx/",
59-
"src/third_party/thrust/dependencies/libcudacxx/libcxxabi/",
60-
"src/third_party/thrust/dependencies/libcudacxx/libunwind/",
61-
"src/third_party/thrust/dependencies/libcudacxx/utils/google-benchmark/",
62-
"src/third_party/thrust/docs/",
63-
"src/third_party/thrust/testing/",
64-
"src/third_party/thrust/internal/test/",
65-
"src/third_party/thrust/examples/",
66-
"src/third_party/thrust/thrust/system/cuda",
6751
]
6852
wheel.packages = ["manifold3d"]
6953
cmake.args = ["-DMANIFOLD_PAR=TBB", "-DMANIFOLD_TEST=OFF"]

src/third_party/CMakeLists.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
add_subdirectory(glm)
21
add_subdirectory(graphlite)
32

43
set(CLIPPER2_UTILS OFF)
54
set(CLIPPER2_EXAMPLES OFF)
65
set(CLIPPER2_TESTS OFF)
76
set(CLIPPER2_USINGZ "OFF" CACHE STRING "Preempt cache default of USINGZ (we only use 2d)")
8-
add_definitions(-D_HAS_EXCEPTIONS=0) # disable exceptions for STL
97
add_subdirectory(clipper2/CPP)
108

119
add_library(quickhull quickhull/QuickHull.cpp)

src/third_party/glm

-1
This file was deleted.

src/third_party/thrust

-1
This file was deleted.

src/utilities/CMakeLists.txt

+43-19
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,36 @@
1515
project(utilities)
1616

1717
add_library(${PROJECT_NAME} INTERFACE)
18-
1918
message("Parallel Backend: ${MANIFOLD_PAR}")
2019

21-
target_include_directories(${PROJECT_NAME} INTERFACE ${PROJECT_SOURCE_DIR}/include)
22-
target_include_directories(${PROJECT_NAME} INTERFACE ${THRUST_INC_DIR}/dependencies/libcudacxx/include)
23-
24-
if (TRACY_ENABLE)
25-
include(FetchContent)
26-
FetchContent_Declare(tracy
27-
GIT_REPOSITORY https://github.com/wolfpld/tracy.git
28-
GIT_TAG v0.9.1
20+
include(FetchContent)
21+
FetchContent_Declare(glm
22+
GIT_REPOSITORY https://github.com/g-truc/glm.git
23+
GIT_TAG 0.9.9.8
2924
GIT_SHALLOW TRUE
3025
GIT_PROGRESS TRUE
31-
)
32-
FetchContent_MakeAvailable(tracy)
33-
target_link_libraries(${PROJECT_NAME} INTERFACE TracyClient)
34-
target_compile_options(${PROJECT_NAME} INTERFACE -DTRACY_NO_CODE_TRANSFER=1)
26+
FIND_PACKAGE_ARGS NAMES glm
27+
)
28+
FetchContent_MakeAvailable(glm)
29+
30+
FetchContent_Declare(Thrust
31+
GIT_REPOSITORY https://github.com/NVIDIA/thrust.git
32+
GIT_TAG 2.1.0
33+
FIND_PACKAGE_ARGS NAMES Thrust
34+
)
35+
FetchContent_MakeAvailable(Thrust)
36+
37+
if (TRACY_ENABLE)
38+
include(FetchContent)
39+
FetchContent_Declare(tracy
40+
GIT_REPOSITORY https://github.com/wolfpld/tracy.git
41+
GIT_TAG v0.9.1
42+
GIT_SHALLOW TRUE
43+
GIT_PROGRESS TRUE
44+
)
45+
FetchContent_MakeAvailable(tracy)
46+
target_link_libraries(${PROJECT_NAME} INTERFACE TracyClient)
47+
target_compile_options(${PROJECT_NAME} INTERFACE -DTRACY_NO_CODE_TRANSFER=1)
3548
endif()
3649

3750
if(MANIFOLD_PAR STREQUAL "TBB")
@@ -45,10 +58,10 @@ if(MANIFOLD_PAR STREQUAL "TBB")
4558
set(TBB_TEST OFF CACHE INTERNAL "" FORCE)
4659
set(TBB_STRICT OFF CACHE INTERNAL "" FORCE)
4760
FetchContent_Declare(TBB
48-
GIT_REPOSITORY https://github.com/oneapi-src/oneTBB.git
49-
GIT_TAG v2021.10.0
50-
GIT_SHALLOW TRUE
51-
GIT_PROGRESS TRUE
61+
GIT_REPOSITORY https://github.com/oneapi-src/oneTBB.git
62+
GIT_TAG v2021.10.0
63+
GIT_SHALLOW TRUE
64+
GIT_PROGRESS TRUE
5265
)
5366
FetchContent_MakeAvailable(TBB)
5467
set_property(DIRECTORY ${TBB_SOURCE_DIR} PROPERTY EXCLUDE_FROM_ALL YES)
@@ -67,8 +80,19 @@ else()
6780
"Should be \"TBB\" or \"NONE\"")
6881
endif()
6982

70-
target_include_directories(${PROJECT_NAME} INTERFACE ${THRUST_INC_DIR})
71-
target_link_libraries(${PROJECT_NAME} INTERFACE glm)
83+
target_include_directories(${PROJECT_NAME} INTERFACE ${PROJECT_SOURCE_DIR}/include)
84+
target_link_libraries(${PROJECT_NAME} INTERFACE glm::glm)
85+
if(DEFINED Thrust_SOURCE_DIR)
86+
target_include_directories(${PROJECT_NAME} INTERFACE
87+
${Thrust_SOURCE_DIR}
88+
${Thrust_SOURCE_DIR}/dependencies/libcudacxx/include
89+
)
90+
else()
91+
target_include_directories(${PROJECT_NAME} INTERFACE
92+
${THRUST_ROOT}
93+
${THRUST_ROOT}/dependencies/libcudacxx/include
94+
)
95+
endif()
7296

7397
target_compile_options(${PROJECT_NAME} INTERFACE
7498
-DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_${MANIFOLD_PAR}

0 commit comments

Comments
 (0)