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
87 changes: 67 additions & 20 deletions .github/workflows/continuous.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,14 @@ jobs:
####################

Windows:
name: windows-2025 (${{ matrix.config }})
runs-on: windows-2025
name: ${{ matrix.os }} (${{ matrix.config }})
runs-on: ${{ matrix.os }}
env:
SCCACHE_GHA_ENABLED: "true"
strategy:
fail-fast: false
matrix:
os: [windows-2025]
config: [Release, Debug]
steps:
- name: Show disk space
Expand All @@ -214,9 +215,26 @@ jobs:
fetch-depth: 0

- uses: actions/setup-python@v5
if: matrix.os != 'windows-11-arm'
with:
python-version: 3.13

# On windows-11-arm the hostedtoolcache Python ships only the interpreter binary;
# it lacks include/ headers and libs/python3XX.lib, so CMake cannot satisfy the
# Development.Module component. Use uv instead: it pulls python-build-standalone
# distributions which include full dev files. uv defaults to x64-emulated Python
# on ARM64 Windows (uv PR #13724), so we must pin the aarch64 specifier.
- uses: astral-sh/setup-uv@v6
if: matrix.os == 'windows-11-arm'

- name: Install native ARM64 Python via uv
if: matrix.os == 'windows-11-arm'
shell: pwsh
run: |
uv python install cpython-3.13-windows-aarch64
$pyExe = (uv python find cpython-3.13-windows-aarch64).Trim()
echo "PYTHON_ARM64_EXE=$($pyExe -replace '\\', '/')" >> $env:GITHUB_ENV

- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@master

Expand All @@ -227,33 +245,62 @@ jobs:
# 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: Sccache
uses: mozilla-actions/sccache-action@v0.0.10

# 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 `)
- name: Configure and build
shell: cmd
- name: Set x64 vars
if: matrix.os == 'windows-2025'
run: |
echo "BUILD_DIR=D:/build" >> ${env:GITHUB_ENV}
echo "ARCH=x64" >> ${env:GITHUB_ENV}

- name: Set arm64 vars
if: matrix.os == 'windows-11-arm'
run: |
echo "BUILD_DIR=C:/build" >> ${env:GITHUB_ENV}
echo "ARCH=arm64" >> ${env:GITHUB_ENV}

- name: Setup MSVC Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ env.ARCH }}

# Cmd uses ^ to break commands into multiple lines, powershell uses `
- name: Configure
if: matrix.os != 'windows-11-arm'
run: |
cmake --version
cmake -G Ninja `
-DCMAKE_BUILD_TYPE=${{ matrix.config }} `
-DLAGRANGE_JENKINS=ON `
-DLAGRANGE_ALL=ON `
-DLAGRANGE_POLYSCOPE_MOCK_BACKEND=ON `
-DEMBREE_MAX_ISA=AVX2 `
-B ${{ env.BUILD_DIR }} `
-S .

# Force CMake to use the ARM64 Python (now complete with dev files)
# and skip the Windows registry so it doesn't fall back to x64 Python.
- name: Configure (ARM64)
if: matrix.os == 'windows-11-arm'
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=x64
cmake --version
cmake -G Ninja ^
-DCMAKE_BUILD_TYPE=${{ matrix.config }} ^
-DLAGRANGE_JENKINS=ON ^
-DLAGRANGE_ALL=ON ^
-DLAGRANGE_POLYSCOPE_MOCK_BACKEND=ON ^
-DEMBREE_MAX_ISA=${{ env.embree_max_isa }} ^
-B "D:/build" ^
cmake -G Ninja `
-DCMAKE_BUILD_TYPE=${{ matrix.config }} `
-DLAGRANGE_JENKINS=ON `
-DLAGRANGE_ALL=ON `
-DLAGRANGE_POLYSCOPE_MOCK_BACKEND=ON `
-DPython_EXECUTABLE="$env:PYTHON_ARM64_EXE" `
-DPython_FIND_REGISTRY=NEVER `
-B ${{ env.BUILD_DIR }} `
-S .
cmake --build "D:/build" -j ${{ steps.cpu-cores.outputs.count }}

- name: Build
run: cmake --build ${{ env.BUILD_DIR }} -j ${{ steps.cpu-cores.outputs.count }}

- name: Sccache stats
if: always()
Expand All @@ -265,4 +312,4 @@ jobs:
run: Get-PSDrive

- name: Tests
run: cd "D:/build"; ctest --verbose -j ${{ steps.cpu-cores.outputs.count }}
run: cd ${{ env.BUILD_DIR }}; ctest --verbose -j ${{ steps.cpu-cores.outputs.count }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ tensor_*.vdb
func_*.json

# Extra directories
/.cursor
/.vscode
/.vs
/.idea
Expand All @@ -86,6 +87,10 @@ func_*.json
/data
/docs/cpp/build

# pixi environments (doc tooling, see docs/cpp/pixi.toml)
.pixi
pixi.lock

# Lagrange specifics
LagrangeOptions.cmake
# The MetaBuild equivalent
Expand Down
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,20 @@ if(LAGRANGE_TOPLEVEL_PROJECT)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "Enable/Disable output of compile commands during generation.")
endif()

if(WIN32 AND SKBUILD)
include(cmake/lagrange/lagrange_cpm_cache.cmake)
include(cmake/recipes/external/CPM.cmake)
CPMAddPackage(
NAME windowstoolchain
GIT_REPOSITORY https://github.com/MarkSchofield/WindowsToolchain.git
GIT_TAG v0.14.0
QUIET
DOWNLOAD_ONLY ON
)
FetchContent_GetProperties(windowstoolchain)
set(CMAKE_TOOLCHAIN_FILE "${windowstoolchain_SOURCE_DIR}/Windows.MSVC.toolchain.cmake")
endif()

################################################################################

if(SKBUILD)
Expand Down
1 change: 1 addition & 0 deletions LagrangeOptions.cmake.sample
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
# option(LAGRANGE_MODULE_UI "Build module lagrange::ui" ON)
# option(LAGRANGE_MODULE_VOLUME "Build module lagrange::volume" ON)
# option(LAGRANGE_MODULE_WINDING "Build module lagrange::winding" ON)
# option(LAGRANGE_MODULE_XATLAS "Build module lagrange::xatlas" ON)

# General options
# option(LAGRANGE_BINDINGS_JS "Build JavaScript/WebAssembly bindings" OFF)
Expand Down
2 changes: 1 addition & 1 deletion cmake/lagrange/lagrange_vcpkg_toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ if(WIN32)
CPMAddPackage(
NAME windowstoolchain
GIT_REPOSITORY https://github.com/MarkSchofield/WindowsToolchain.git
GIT_TAG v0.13.0
GIT_TAG v0.14.0
QUIET
DOWNLOAD_ONLY ON
)
Expand Down
19 changes: 14 additions & 5 deletions cmake/recipes/external/gklib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ include(CPM)
CPMAddPackage(
NAME gklib
GITHUB_REPOSITORY KarypisLab/GKlib
GIT_TAG 67c6e4322bb326a04727995775c3eafc47d7a252
GIT_TAG e2856c2f595b153ca1ce9258c5301dbabc4f39f5
DOWNLOAD_ONLY ON
)

file(GLOB INC_FILES "${gklib_SOURCE_DIR}/*.h" )
file(GLOB SRC_FILES "${gklib_SOURCE_DIR}/*.c" )
file(GLOB INC_FILES "${gklib_SOURCE_DIR}/include/*.h" )
file(GLOB SRC_FILES "${gklib_SOURCE_DIR}/src/*.c" )
if(NOT MSVC)
list(REMOVE_ITEM SRC_FILES "${gklib_SOURCE_DIR}/gkregex.c")
list(REMOVE_ITEM SRC_FILES "${gklib_SOURCE_DIR}/src/gkregex.c")
endif()

add_library(GKlib STATIC ${INC_FILES} ${SRC_FILES})
Expand All @@ -35,11 +35,20 @@ add_library(GKlib::GKlib ALIAS GKlib)
if(MSVC)
target_compile_definitions(GKlib PUBLIC USE_GKREGEX)
target_compile_definitions(GKlib PUBLIC "__thread=__declspec(thread)")
# gk_ms_stdint.h / gk_ms_inttypes.h are 2006-era polyfills for pre-VS2010 MSVC.
# Modern MSVC (VS2010+) ships <stdint.h> natively, but on ARM64 it defines
# int_fast16_t as 'int' (32-bit) while the polyfill defines it as 'int16_t',
# causing a redefinition error. Suppress the polyfills via their include guards
# and force-include the real system header so the types are still available.
# Upstream fix: https://github.com/KarypisLab/GKlib/pull/59
# (remove this workaround once it lands in our pinned GIT_TAG above).
target_compile_definitions(GKlib PUBLIC _MSC_STDINT_H_ _MSC_INTTYPES_H_)
target_compile_options(GKlib PUBLIC "/FIstdint.h" "/FIinttypes.h")
endif()

include(GNUInstallDirs)
target_include_directories(GKlib SYSTEM PUBLIC
"$<BUILD_INTERFACE:${gklib_SOURCE_DIR}>"
"$<BUILD_INTERFACE:${gklib_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)

Expand Down
4 changes: 3 additions & 1 deletion cmake/recipes/external/imgui.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ message(STATUS "Third-party (external): creating target 'imgui::imgui' ('docking
block()
set(BUILD_SHARED_LIBS OFF)
include(CPM)
set(IMGUI_BACKEND_RENDERER "opengl3;null")
set(IMGUI_BACKEND_PLATFORM "glfw;null")
CPMAddPackage(
NAME imgui
GITHUB_REPOSITORY adobe/imgui
GIT_TAG dff188effaa59c5c4d502868b96bd717207adb9c # docking_v1.91.5
GIT_TAG 8c63f38b165efed6b1ba7bc638b698ab4ca3f36b # docking_v1.92.8
)
endblock()

Expand Down
22 changes: 18 additions & 4 deletions cmake/recipes/external/imgui_fonts.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,32 @@
# governing permissions and limitations under the License.
#

# Ensure IconFontCppHeaders target exists
if(NOT TARGET juliettef::IconFontCppHeaders)
message(STATUS "Third-party (external): creating target 'juliettef::IconFontCppHeaders'")
include(CPM)
CPMAddPackage(
NAME IconFontCppHeaders
GITHUB_REPOSITORY juliettef/IconFontCppHeaders
GIT_TAG 8a381189ecfe58e732466cc52e79ca887dd6a297
)

add_library(IconFontCppHeadersPrime INTERFACE)
target_sources(IconFontCppHeadersPrime PUBLIC "${IconFontCppHeaders_SOURCE_DIR}/IconsFontAwesome6.h")
target_include_directories(IconFontCppHeadersPrime INTERFACE "${IconFontCppHeaders_SOURCE_DIR}")

add_library(juliettef::IconFontCppHeaders ALIAS IconFontCppHeadersPrime)
endif()

# The fonts repo does not add any target by default, but it does add this function
if(NOT COMMAND fonts_add_font)

message(STATUS "Third-party (external): creating target 'imgui::fonts'")

include(CPM)
CPMAddPackage(
NAME imgui_fonts
GITHUB_REPOSITORY HasKha/imgui-fonts
GIT_TAG aa4a4c83be6a6b275a74809e853fd272b4eaaaa1
)

endif()

block()
Expand All @@ -32,4 +46,4 @@ endblock()

set_target_properties(fonts_fontawesome6 PROPERTIES FOLDER third_party)
set_target_properties(fonts_source_sans_pro_regular PROPERTIES FOLDER third_party)
set_target_properties(IconFontCppHeaders PROPERTIES FOLDER third_party)
set_target_properties(IconFontCppHeadersPrime PROPERTIES FOLDER third_party)
15 changes: 5 additions & 10 deletions cmake/recipes/external/imguizmo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,13 @@ message(STATUS "Third-party (external): creating target 'imguizmo::imguizmo'")
include(CPM)
CPMAddPackage(
NAME imguizmo
GITHUB_REPOSITORY CedricGuillemet/ImGuizmo
GIT_TAG e3174578bdc99c715e51c5ad88e7d50b4eeb19b0
GITHUB_REPOSITORY jdumas/ImGuizmo
GIT_TAG 097e4da69386a6351ec441b7839a3b385eec6a0e
OPTIONS "IMGUIZMO_BUILD_EXAMPLE OFF"
)

add_library(imguizmo STATIC
"${imguizmo_SOURCE_DIR}/ImGuizmo.h"
"${imguizmo_SOURCE_DIR}/ImGuizmo.cpp"
)
add_library(imguizmo::imguizmo ALIAS imguizmo)

target_include_directories(imguizmo PUBLIC "${imguizmo_SOURCE_DIR}")

# The upstream CMakeLists.txt defines imguizmo::imguizmo but does not link imgui.
# We add the dependency here so our build picks up the correct imgui target.
include(imgui)
target_link_libraries(imguizmo PUBLIC imgui::imgui)

Expand Down
42 changes: 42 additions & 0 deletions cmake/recipes/external/implot.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#
# Copyright 2026 Adobe. All rights reserved.
# This file is licensed to you 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 REPRESENTATIONS
# OF ANY KIND, either express or implied. See the License for the specific language
# governing permissions and limitations under the License.
#
if(TARGET implot::implot)
return()
endif()

message(STATUS "Third-party (external): creating target 'implot::implot'")

include(CPM)
CPMAddPackage(
NAME implot
GITHUB_REPOSITORY epezent/implot
GIT_TAG d65a2bef53d32502407de3a4be80f191e2f412d7 # post-v1.0, includes imgui 1.92.8 AddRect signature fix (#703)
)

add_library(implot STATIC)
target_sources(implot
PUBLIC
"${implot_SOURCE_DIR}/implot.h"
PRIVATE
"${implot_SOURCE_DIR}/implot_internal.h"
"${implot_SOURCE_DIR}/implot.cpp"
"${implot_SOURCE_DIR}/implot_items.cpp"
)
add_library(implot::implot ALIAS implot)

target_include_directories(implot PUBLIC "${implot_SOURCE_DIR}")

include(imgui)
target_link_libraries(implot PUBLIC imgui::imgui)

set_target_properties(implot PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_target_properties(implot PROPERTIES FOLDER third_party)
14 changes: 12 additions & 2 deletions cmake/recipes/external/polyscope.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,27 @@ include(glfw)
include(imgui)
include(nlohmann_json)
include(glad)
include(implot)
include(imguizmo)

block()
include(CPM)
set(BUILD_SHARED_LIBS OFF)
CPMAddPackage(
NAME polyscope
GITHUB_REPOSITORY nmwsharp/polyscope
GIT_TAG f0245f375f4585c0fdd5d57179c28f25aa03cf22
GITHUB_REPOSITORY jdumas/polyscope
GIT_TAG 3e57795adc4eefae5ec8c4a5afb03ef62e99c110 # jdumas/imgui: imgui 1.92.8 + AddRect fix + ImGuizmo -> nmwsharp@097e4da
)
endblock()

# polyscope expects imgui::imgui to contains implot and imguizmo.
# explicitly link them here to ensure proper build.
target_link_libraries(polyscope
PUBLIC
implot::implot
imguizmo::imguizmo
)

add_library(polyscope::polyscope ALIAS polyscope)
set_target_properties(polyscope PROPERTIES FOLDER third_party)
set_target_properties(glm PROPERTIES FOLDER third_party)
Expand Down
10 changes: 2 additions & 8 deletions cmake/recipes/external/simde.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,8 @@ include(CPM)
CPMAddPackage(
NAME simde
GITHUB_REPOSITORY simd-everywhere/simde
GIT_TAG 48edfa906d835525e2061fbf6062b7c326d66840
GIT_TAG 1747b2482589fe894d49989159421da08c2a8bcd
)

add_library(simde::simde INTERFACE IMPORTED GLOBAL)
target_include_directories(simde::simde INTERFACE "${simde_SOURCE_DIR}")

# Enables native aliases. Not ideal but makes it easier to convert old code.
target_compile_definitions(simde::simde INTERFACE SIMDE_ENABLE_NATIVE_ALIASES)

# Uncomment this line to ensure code can be compiled without native SIMD (i.e. emulates everything)
# target_compile_definitions(simde::simde INTERFACE SIMDE_NO_NATIVE)
target_compile_definitions(simde INTERFACE SIMDE_ENABLE_NATIVE_ALIASES)
Loading
Loading