Skip to content
Open
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
24 changes: 17 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ option(FLOAT_TETWILD_ENABLE_TBB "Enable TBB" ON)
option(FLOAT_TETWILD_USE_FLOAT "Use floats instead of double" OFF)
option(FLOAT_TETWILD_WITH_SANITIZERS "Use sanitizers" OFF)
option(FLOAT_TETWILD_WITH_EXACT_ENVELOPE "Use exact envelope" OFF)
option(FLOAT_TETWILD_USE_GMP "Use GMP for exact rational arithmetic (AMIPS energy stabilisation). When OFF a long double fallback is used." OFF)

# Sanitizer options
option(SANITIZE_ADDRESS "Sanitize Address" OFF)
Expand Down Expand Up @@ -81,9 +82,14 @@ igl_include(predicates)
# FloatTetwild library
# ##############################################################################

find_package(GMPfTetWild)
if(NOT ${GMP_FOUND})
message(FATAL_ERROR "Cannot find GMP")
if(FLOAT_TETWILD_USE_GMP)
find_package(GMPfTetWild)
if(NOT ${GMP_FOUND})
message(FATAL_ERROR "Cannot find GMP. Install libgmp-dev or disable with -DFLOAT_TETWILD_USE_GMP=OFF.")
endif()
message(STATUS "GMP enabled: using exact rational arithmetic for AMIPS energy stabilisation")
else()
message(STATUS "GMP disabled: using long double fallback for AMIPS energy stabilisation")
endif()

# add_library() can only be called without any source since CMake 3.11 ...
Expand Down Expand Up @@ -117,7 +123,10 @@ if(FLOAT_TETWILD_USE_FLOAT)
target_compile_definitions(${PROJECT_NAME} PUBLIC -DFLOAT_TETWILD_USE_FLOAT)
endif()

target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC ${GMP_INCLUDE_DIRS})
if(FLOAT_TETWILD_USE_GMP)
target_compile_definitions(${PROJECT_NAME} PUBLIC FLOAT_TETWILD_USE_GMP)
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC ${GMP_INCLUDE_DIRS})
endif()

target_link_libraries(
${PROJECT_NAME}
Expand All @@ -126,11 +135,12 @@ target_link_libraries(
geogram::geogram
spdlog::spdlog
Threads::Threads
# fast_winding_number
json
${GMP_LIBRARIES}
# ${MPFR_LIBRARIES}
)

if(FLOAT_TETWILD_USE_GMP)
target_link_libraries(${PROJECT_NAME} PUBLIC ${GMP_LIBRARIES})
endif()
if(FLOAT_TETWILD_ENABLE_TBB)
target_link_libraries(${PROJECT_NAME} PUBLIC TBB::tbb)
target_compile_definitions(${PROJECT_NAME} PUBLIC FLOAT_TETWILD_USE_TBB)
Expand Down
40 changes: 26 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,20 @@ Here is pre-generated tetmeshes and the extracted surface meshes for research-pu

- Figures in the paper: [Input/output & scripts](https://drive.google.com/file/d/1qTukYF3N05jLxKxYQK5tNOUdFAr_0sf1/view?usp=sharing)

## Documentation

Full documentation is available in the [`doc/`](doc/index.md) folder:

- [Algorithm overview](doc/overview.md)
- [Dependencies](doc/dependencies.md)
- [Library API](doc/library_api.md)
- [Data structures](doc/data_structures.md)
- [Preprocessing](doc/preprocessing.md), [Triangle insertion](doc/triangle_insertion.md), [Mesh improvement](doc/mesh_improvement.md), [Filtering & Booleans](doc/filtering_and_booleans.md)
- [Envelope & AABB](doc/envelope_and_aabb.md)

## Installation via CMake

Our code was originally developed on MacOS and has been tested on Linux and Windows. We provide the commands for installing fTetWild in MacOS:
Our code was originally developed on MacOS and has been tested on Linux and Windows.

- Clone the repository into your local machine:

Expand All @@ -70,24 +81,25 @@ cmake ..
make
```

You may need to install `gmp` before compiling the code. You can install it via
No system packages are required by default. All dependencies are fetched automatically at configure time via CMake's `FetchContent`.

**Optional: GMP for exact rational arithmetic**

GMP is no longer required. By default fTetWild uses a `long double` fallback for the AMIPS energy stabilisation step. To opt in to the original exact GMP-backed implementation:

- [homebrew](https://brew.sh/) on mac:
```bash
brew install gmp
```
- Package manager on Unix:
```
sudo apt-get install gmp
```
- [Conda](https://anaconda.org) on Windows:
```
conda install -c conda-forge mpir
cmake .. -DFLOAT_TETWILD_USE_GMP=ON
```

**Note Windows** The executable needs that the file `mpir.dll` is in the same directiory of `FloatTetwild_bin.exe`. Once you compliled the code, copy `mpir.dll` (e.g., `<conda_dir>\Library\bin`) to the directoy containing `FloatTetwild_bin.exe`.
You will then need GMP installed:

- [homebrew](https://brew.sh/) on mac: `brew install gmp`
- Package manager on Unix: `sudo apt-get install libgmp-dev`
- [Conda](https://anaconda.org) on Windows: `conda install -c conda-forge mpir`

**Note Windows** The executable needs `mpir.dll` in the same directory as `FloatTetwild_bin.exe`.

**Note** if cmake cannot find gmp you need to export the envirnement variable `GMP_INC` and `GMP_LIB` to the folder where you installed (e.g., `<conda_dir>\Library\include` for `GMP_INC` and `<conda_dir>\Library\lib` for `GMP_LIB`).
**Note** if cmake cannot find GMP set the environment variables `GMP_INC` and `GMP_LIB` to the include and library directories respectively.

- Check the installation:

Expand Down
Loading