Skip to content
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
3 changes: 3 additions & 0 deletions .github/tsan.suppressions.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@ race:openvdb::*::tools::mesh_to_volume_internal::ComputeIntersectingVoxelSign
race:openvdb::*::tools::v2s_internal::UpdatePoints
# See https://github.com/embree/embree/issues/469
race_top:embree::parallel_any_of
# Instant Meshes uses __sync_bool_compare_and_swap mixed with plain reads, and has other data races in its
# Optimizer class. These are all in the third-party instant-meshes-core library.
race:instant_meshes::
# Well... this one isn't gonna fix itself.
race:^triangleinit
72 changes: 38 additions & 34 deletions .github/workflows/continuous.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ concurrency:
env:
CTEST_OUTPUT_ON_FAILURE: ON
CTEST_PARALLEL_LEVEL: 1
SCCACHE_GHA_ENABLED: "true"

jobs:
####################
Expand All @@ -25,7 +26,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-15-intel, macos-15]
config: [RelwithDebInfo, Debug]
config: [RelWithDebInfo, Debug]
compiler: [gcc, apple, llvm]
sanitizer: ["Address", "Thread"] # TODO: Add Memory+Undefined Sanitizer
exclude:
Expand Down Expand Up @@ -82,8 +83,7 @@ jobs:

- name: Select build dir (macOS)
if: runner.os == 'macOS'
run:
echo "build_dir=build" >> "$GITHUB_ENV"
run: echo "build_dir=build" >> "$GITHUB_ENV"

- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -109,18 +109,22 @@ jobs:
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
fi
sudo apt-get install xorg-dev ccache
sudo apt-get install xorg-dev

- name: Dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install ccache
if [ "${{ matrix.compiler }}" = "llvm" ]; then
brew install llvm@17
echo "CC='$(brew --prefix llvm@17)/bin/clang'" >> $GITHUB_ENV
echo "CXX='$(brew --prefix llvm@17)/bin/clang++'" >> $GITHUB_ENV
fi

- name: Ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.sanitizer }}-${{ matrix.config }}

- name: Setup Xcode version
if: matrix.os == 'macos-15-intel'
uses: maxim-lobanov/setup-xcode@v1
Expand All @@ -133,22 +137,22 @@ jobs:
with:
xcode-version: '26.0.1'

- name: Select embree isa (Linux)
if: runner.os == 'Linux'
run: echo "embree_max_isa=SSE2" >> $GITHUB_ENV

- name: Select embree isa (macOS x64)
if: runner.os == 'macOS' && runner.arch == 'X64'
run: echo "embree_max_isa=DEFAULT" >> $GITHUB_ENV

- name: Select embree isa (macOS arm64)
if: runner.os == 'macOS' && runner.arch == 'ARM64'
run: echo "embree_max_isa=NONE" >> $GITHUB_ENV

- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores

- name: Cache Build
id: cache-build
uses: actions/cache@v3
with:
path: ~/.ccache
key: ${{ matrix.name }}-${{ matrix.config }}-cache

- name: Prepare ccache
run: |
ccache --max-size=1.0G
ccache -V && ccache --show-stats && ccache --zero-stats

- name: Configure
run: |
cmake --version
Expand All @@ -161,12 +165,11 @@ jobs:
-DOPENVDB_CORE_STATIC=OFF \
-DUSE_EXPLICIT_INSTANTIATION=OFF \
-DLAGRANGE_POLYSCOPE_MOCK_BACKEND=ON \
-DEMBREE_MAX_ISA=${{ env.embree_max_isa }} \
-DUSE_SANITIZER="${{ matrix.sanitizer }}"

- name: Build
run: |
cmake --build ${{ env.build_dir }} -j ${{ steps.cpu-cores.outputs.count }}
ccache --show-stats
run: cmake --build ${{ env.build_dir }} -j ${{ steps.cpu-cores.outputs.count }}

- name: Show disk space
if: always()
Expand Down Expand Up @@ -208,25 +211,20 @@ jobs:
- name: Set env variable for sccache
run: |
echo "appdata=$env:LOCALAPPDATA" >> ${env:GITHUB_ENV}
# Disable idle timeout: embree AVX2 files take 12+ min each and can occupy all job slots,
# starving sccache of requests until the default 600s timeout kills the server.
echo "SCCACHE_IDLE_TIMEOUT=0" >> ${env:GITHUB_ENV}

- name: Select embree isa (Windows)
if: runner.os == 'Windows'
run: echo "embree_max_isa=AVX2" >> ${env:GITHUB_ENV}

- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores

- name: Cache build
id: cache-build
uses: actions/cache@v3
with:
path: ${{ env.appdata }}\Mozilla\sccache
key: ${{ runner.os }}-${{ matrix.config }}-cache

- name: Prepare sccache
run: |
iwr -useb 'https://raw.githubusercontent.com/scoopinstaller/install/master/install.ps1' -outfile 'install.ps1'
.\install.ps1 -RunAsAdmin
scoop install sccache --global
# Scoop modifies the PATH so we make it available for the next steps of the job
echo "${env:PATH}" >> ${env:GITHUB_PATH}
- name: Sccache
uses: mozilla-actions/sccache-action@v0.0.9

# We run configure + build in the same step, since they both need to call VsDevCmd
# Also, cmd uses ^ to break commands into multiple lines (in powershell this is `)
Expand All @@ -240,10 +238,16 @@ jobs:
-DLAGRANGE_JENKINS=ON ^
-DLAGRANGE_ALL=ON ^
-DLAGRANGE_POLYSCOPE_MOCK_BACKEND=ON ^
-DEMBREE_MAX_ISA=${{ env.embree_max_isa }} ^
-B "D:/build" ^
-S .
cmake --build "D:/build" -j ${{ steps.cpu-cores.outputs.count }}

- name: Sccache stats
if: always()
shell: bash
run: ${SCCACHE_PATH} --show-stats

- name: Show disk space
if: always()
run: Get-PSDrive
Expand Down
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ endif()

# Detects whether internal libs are available
if(IS_DIRECTORY "${PROJECT_SOURCE_DIR}/cmake/recipes/internal")
set(LAGRANGE_NO_INTERNAL OFF)
option(LAGRANGE_NO_INTERNAL "Disable internal dependencies" OFF)
else()
set(LAGRANGE_NO_INTERNAL ON)
option(LAGRANGE_NO_INTERNAL "Disable internal dependencies" ON)
endif()

# Define this first since other options defaults depend on this
Expand Down Expand Up @@ -189,8 +189,10 @@ endif()
# When using vcpkg, use find_package() to find external libraries
if(DEFINED VCPKG_INSTALLED_DIR)
set(LAGRANGE_USE_FIND_PACKAGE_DEFAULT ON)
option(LAGRANGE_WITH_EMBREE_3 "Use Embree3 with Lagrange" ON)
else()
set(LAGRANGE_USE_FIND_PACKAGE_DEFAULT OFF)
option(LAGRANGE_WITH_EMBREE_3 "Use Embree3 with Lagrange" OFF)
endif()

if(EMSCRIPTEN)
Expand Down
1 change: 1 addition & 0 deletions LagrangeOptions.cmake.sample
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
# option(LAGRANGE_MODULE_PRIMITIVE "Build module lagrange::primitive" ON)
# option(LAGRANGE_MODULE_PYTHON "Build module lagrange::python" ON)
# option(LAGRANGE_MODULE_RAYCASTING "Build module lagrange::raycasting" ON)
# option(LAGRANGE_MODULE_REMESHING_IM "Build module lagrange::remeshing_im" ON)
# option(LAGRANGE_MODULE_SCENE "Build module lagrange::scene" ON)
# option(LAGRANGE_MODULE_SOLVER "Build module lagrange::solver" ON)
# option(LAGRANGE_MODULE_SUBDIVISION "Build module lagrange::subdivision" ON)
Expand Down
2 changes: 1 addition & 1 deletion cmake/lagrange/lagrange_download_data.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function(lagrange_download_data)
PREFIX "${FETCHCONTENT_BASE_DIR}/lagrange-test-data"
SOURCE_DIR ${LAGRANGE_DATA_FOLDER}
GIT_REPOSITORY https://github.com/adobe/lagrange-test-data.git
GIT_TAG 2a36e21810e5e4e16c34f0c3969b4fcffe8d02f2
GIT_TAG a8331c8a1fd9c114abdcc3d5ed8ea5f7f8058c99
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
Expand Down
12 changes: 12 additions & 0 deletions cmake/lagrange/lagrange_vcpkg_toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ CPMAddPackage(
set(ENV{VCPKG_ROOT} "${vcpkg_SOURCE_DIR}")
set(ENV{VCPKG_KEEP_ENV_VARS} "VCPKG_ROOT;$ENV{VCPKG_KEEP_ENV_VARS}")

if(WIN32)
CPMAddPackage(
NAME windowstoolchain
GIT_REPOSITORY https://github.com/MarkSchofield/WindowsToolchain.git
GIT_TAG v0.13.0
QUIET
DOWNLOAD_ONLY ON
)
FetchContent_GetProperties(windowstoolchain)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${windowstoolchain_SOURCE_DIR}/Windows.MSVC.toolchain.cmake")
endif()

# Since this file is included as a toolchain file via our CMake preset, we setup vcpkg.cmake
# via CMAKE_PROJECT_TOP_LEVEL_INCLUDES instead. See the following threads for more information:
# https://discourse.cmake.org/t/built-in-package-manager-for-cmake-modules/7513
Expand Down
2 changes: 1 addition & 1 deletion cmake/recipes/external/CPM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# accordance with the terms of the Adobe license agreement accompanying
# it.
#
set(CPM_DOWNLOAD_VERSION 0.40.8)
set(CPM_DOWNLOAD_VERSION 0.42.1)

if(CPM_SOURCE_CACHE)
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
Expand Down
15 changes: 9 additions & 6 deletions cmake/recipes/external/OpenSubdiv.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,14 @@ block()
endif()
endforeach()

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" OR
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
target_compile_options(bfr_obj PRIVATE
"-Wno-unused-private-field"
)
endif()
foreach(name IN ITEMS bfr_obj far_obj osd_cpu_obj osd_static_cpu sdc_obj vtr_obj)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" OR
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
target_compile_options(${name} PRIVATE
"-Wno-unused-private-field"
"-Wno-unused-parameter"
)
endif()
endforeach()

endblock()
49 changes: 34 additions & 15 deletions cmake/recipes/external/embree.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,30 @@ set(EMBREE_TESTING_INTENSITY 0 CACHE STRING "Intensity of testing (0 = n
set(EMBREE_TASKING_SYSTEM "TBB" CACHE STRING "Selects tasking system")
option(EMBREE_IGNORE_CMAKE_CXX_FLAGS "When enabled Embree ignores default CMAKE_CXX_FLAGS." OFF)

# Set C++ namespace to ensure support for user-defined namespaces
# TODO: Not supported yet by other internal dependencies.
# set(EMBREE_API_NAMESPACE "embree" CACHE STRING "C++ namespace to put API symbols into.")

# The following options are necessary to ensure packed-ray support
option(EMBREE_RAY_MASK "Enable the usage of mask for packed ray." ON)
option(EMBREE_RAY_PACKETS "Enable the usage packed ray." ON)

if(APPLE)
set(EMBREE_MAX_ISA "NEON" CACHE STRING "Selects highest ISA to support.")
elseif(EMSCRIPTEN)
# Match embree's platform detection logic for arm
if(APPLE AND CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" AND CMAKE_OSX_ARCHITECTURES STREQUAL "") OR ("arm64" IN_LIST CMAKE_OSX_ARCHITECTURES))
set(EMBREE_ARM ON)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
set(EMBREE_ARM ON)
endif()

if(EMSCRIPTEN)
set(EMBREE_MAX_ISA "SSE2" CACHE STRING "Selects highest ISA to support.")
set(FLAGS_SSE2 "-msse -msse2 -msimd128") # set to non-empty to prevent embree from using incorrect flags
else()
set(EMBREE_MAX_ISA "DEFAULT" CACHE STRING "Selects highest ISA to support.")
if(APPLE AND NOT EMBREE_ARM)
set(EMBREE_MAX_ISA "DEFAULT" CACHE STRING "Selects highest ISA to support.")
else()
set(EMBREE_MAX_ISA "NONE" CACHE STRING "Selects highest ISA to support.")
endif()
endif()

# We want to compile Embree with TBB support, so we need to overwrite Embree's
Expand Down Expand Up @@ -89,23 +102,29 @@ function(embree_import_target)
lagrange_find_package(TBB CONFIG REQUIRED)
ignore_package(TBB)
get_target_property(TBB_INCLUDE_DIRS TBB::tbb INTERFACE_INCLUDE_DIRECTORIES)
add_library(TBB INTERFACE)
target_link_libraries(TBB INTERFACE TBB::tbb)
if(NOT TARGET TBB)
add_library(TBB INTERFACE)
target_link_libraries(TBB INTERFACE TBB::tbb)
endif()
set(TBB_LIBRARIES TBB)

# Ready to include embree's atrocious CMake
include(CPM)
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
set(EMBREE_VERSION v4.4.0)
set(EMBREE_PATCHES "")
if(LAGRANGE_WITH_EMBREE_3)
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
set(EMBREE_VERSION v3.13.5)
# Patch for emscripten compatibility. Fix available upstream in Embree 4+.
# https://github.com/RenderKit/embree/pull/365
# https://github.com/RenderKit/embree/issues/486
set(EMBREE_PATCHES PATCHES embree.patch)
endif()
CPMAddPackage(
NAME embree
GITHUB_REPOSITORY embree/embree
GIT_TAG v3.13.5

PATCHES
# Patch for emscripten compatibility. Fix available upstream in Embree 4+.
# https://github.com/RenderKit/embree/pull/365
# https://github.com/RenderKit/embree/issues/486
embree.patch
GITHUB_REPOSITORY RenderKit/embree
GIT_TAG ${EMBREE_VERSION}
${EMBREE_PATCHES}
)

unignore_package(TBB)
Expand Down
7 changes: 7 additions & 0 deletions cmake/recipes/external/geometry-central.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,10 @@ install(DIRECTORY ${geometry-central_SOURCE_DIR} DESTINATION ${CMAKE_INSTALL_INC
install(TARGETS geometry-central EXPORT GeometryCentral_Targets)
install(EXPORT GeometryCentral_Targets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/geometry-central
NAMESPACE geometry-central::)

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" OR
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
target_compile_options(geometry-central PRIVATE
"-Wno-deprecated-declarations"
)
endif()
2 changes: 1 addition & 1 deletion cmake/recipes/external/gl3w.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ block()
CPMAddPackage(
NAME gl3w
GITHUB_REPOSITORY adobe/lagrange-gl3w
GIT_TAG a9e41479e30266cecb72df413f4f6d71b0228a71
GIT_TAG b31870049f562cfe9af52ccbedebfff0694864f2
)
endblock()

Expand Down
3 changes: 3 additions & 0 deletions cmake/recipes/external/instant-meshes-core.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ CPMAddPackage(
NAME instant-meshes-core
GITHUB_REPOSITORY qnzhou/instant-meshes-core
GIT_TAG 7e2b804d533e10578a730bb9d06dee2a5418730d
PATCHES
# Fix memory leak: adj_sets buffer not freed in generate_adjacency_matrix_pointcloud.
instant-meshes-core.patch
)

add_library(instant-meshes-core::instant-meshes-core ALIAS instant-meshes-core)
Expand Down
11 changes: 11 additions & 0 deletions cmake/recipes/external/instant-meshes-core.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/src/adjacency.cpp
+++ b/src/adjacency.cpp
@@ -320,6 +320,8 @@ AdjacencyMatrix generate_adjacency_matrix_pointcloud(
}
});

+ delete[] adj_sets;
+
/* Use a heuristic to estimate some useful quantities for point clouds (this
is a biased estimate due to the kNN queries, but it's convenient and
reasonably accurate) */
3 changes: 2 additions & 1 deletion cmake/recipes/external/spdlog.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ endif()
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "spdlog")

# Versions of fmt bundled with spdlog:
# - spdlog 1.17.0 -> fmt 12.1.0
# - spdlog 1.16.0 -> fmt 12.0.0
# - spdlog 1.15.3 -> fmt 11.2.0
# - spdlog 1.15.2 -> fmt 11.1.4
Expand All @@ -39,7 +40,7 @@ include(CPM)
CPMAddPackage(
NAME spdlog
GITHUB_REPOSITORY gabime/spdlog
GIT_TAG v1.16.0
GIT_TAG v1.17.0
)

set_target_properties(spdlog PROPERTIES POSITION_INDEPENDENT_CODE ON)
Expand Down
2 changes: 1 addition & 1 deletion cmake/recipes/external/ufbx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ include(CPM)
CPMAddPackage(
NAME ufbx
GITHUB_REPOSITORY ufbx/ufbx
GIT_TAG v0.21.2
GIT_TAG v0.21.3
)

include(GNUInstallDirs)
Expand Down
Loading
Loading