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
21 changes: 12 additions & 9 deletions .github/workflows/build-test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
env:
BUILD_C_SHARP: ${{ matrix.cxx_compiler == 'msvc-2022' && matrix.build_system == 'CMake' }}
PYTEST_C_SHARP_ARGS: --run-c-sharp-samples --csharp-sample-dir=..\source\x64\${{ matrix.config }}
VCPKG_DEFAULT_TRIPLET: ${{ matrix.vcpkg_triplet || 'x64-windows-meshlib' }}

steps:
- name: Checkout
Expand Down Expand Up @@ -91,7 +92,7 @@ jobs:
uses: actions/cache@v5
id: vcpkg-cache
with:
key: vcpkg-cache-${{ matrix.vcpkg-version }}
key: vcpkg-cache-${{ matrix.vcpkg-version }}-${{ matrix.vcpkg_triplet || 'x64-windows-meshlib' }}
path: |
C:\vcpkg\*

Expand Down Expand Up @@ -203,13 +204,14 @@ jobs:
shell: cmd
env:
VCPKG_ROOT: C:\vcpkg
VCPKG_TARGET_TRIPLET: ${{ matrix.vcpkg_triplet || 'x64-windows-meshlib' }}
run: |
if ${{ fromJSON('["1==0", "1==1"]')[matrix.build_system == 'CMake'] }} (
call "${{matrix.vc-path}}\Common7\Tools\VsDevCmd.bat" -arch=amd64 ${{ fromJSON('["", "-vcvars_ver=14.2"]')[matrix.cxx_compiler == 'msvc-2019'] }}
if errorlevel 1 exit 1
cmake --version
if errorlevel 1 exit 1
cmake -B source\TempOutput -GNinja -DCMAKE_BUILD_TYPE=${{matrix.config}} -DMESHLIB_BUILD_GENERATED_C_BINDINGS=${{ fromJSON('["OFF", "ON"]')[inputs.mrbind_c] }}
cmake -B source\TempOutput -GNinja -DCMAKE_BUILD_TYPE=${{matrix.config}} -DVCPKG_TARGET_TRIPLET=%VCPKG_TARGET_TRIPLET% -DMESHLIB_BUILD_GENERATED_C_BINDINGS=${{ fromJSON('["OFF", "ON"]')[inputs.mrbind_c] }}
if errorlevel 1 exit 1
cmake --build source\TempOutput -j
if errorlevel 1 exit 1
Expand All @@ -218,7 +220,7 @@ jobs:
xcopy source\TempOutput\bin\* source\x64\${{matrix.config}}\* /s /e /i /Y
if errorlevel 1 exit 1
) else (
msbuild -m source\MeshLib.sln -p:Configuration=${{ matrix.config }}${{ fromJSON('["", ";PlatformToolset=v142"]')[matrix.cxx_compiler == 'msvc-2019'] }}
msbuild -m source\MeshLib.sln -p:Configuration=${{ matrix.config }} -p:VcpkgTriplet=%VCPKG_TARGET_TRIPLET%${{ fromJSON('["", ";PlatformToolset=v142"]')[matrix.cxx_compiler == 'msvc-2019'] }}
if errorlevel 1 exit 1
)

Expand Down Expand Up @@ -304,12 +306,13 @@ jobs:
if: ${{ matrix.config == 'Release' }} # debug builds not supported due to missing file 'tbb12_debug.lib'
env:
VCPKG_ROOT: C:\vcpkg
VCPKG_TARGET_TRIPLET: ${{ matrix.vcpkg_triplet || 'x64-windows-meshlib' }}
run: |
& $env:CMAKE_EXE `
-S examples/cpp-examples `
-B cpp-examples-build `
-D MESHLIB_INCLUDE_DIRS="$pwd/source;$pwd/thirdparty/parallel-hashmap;$env:VCPKG_ROOT/installed/x64-windows-meshlib/include;$env:VCPKG_ROOT/installed/x64-windows-meshlib/include/eigen3" `
-D MESHLIB_LIB_DIRS="$pwd/source/x64/${{ matrix.config }};$env:VCPKG_ROOT/installed/x64-windows-meshlib/lib"
-D MESHLIB_INCLUDE_DIRS="$pwd/source;$pwd/thirdparty/parallel-hashmap;$env:VCPKG_ROOT/installed/$env:VCPKG_TARGET_TRIPLET/include;$env:VCPKG_ROOT/installed/$env:VCPKG_TARGET_TRIPLET/include/eigen3" `
-D MESHLIB_LIB_DIRS="$pwd/source/x64/${{ matrix.config }};$env:VCPKG_ROOT/installed/$env:VCPKG_TARGET_TRIPLET/lib"
& $env:CMAKE_EXE `
--build cpp-examples-build `
--config ${{ matrix.config }} `
Expand All @@ -331,7 +334,7 @@ jobs:
# https://github.com/actions/download-artifact#maintaining-file-permissions-and-case-sensitive-files
- name: Archive files
if: ${{ inputs.upload_artifacts && matrix.cxx_compiler == 'msvc-2019' && matrix.build_system == 'CMake' }}
run: tar -a -c -f MREDist_${{ matrix.config }}.zip ./source/x64/${{matrix.config}}
run: tar -a -c -f MREDist_${{ matrix.upload_name || matrix.config }}.zip ./source/x64/${{ matrix.config }}

- name: Archive generated C headers
if: ${{ inputs.upload_artifacts && matrix.cxx_compiler == 'msvc-2019' && matrix.build_system == 'CMake' && matrix.config == 'Release' && inputs.mrbind_c }}
Expand All @@ -341,8 +344,8 @@ jobs:
if: ${{ inputs.upload_artifacts && matrix.cxx_compiler == 'msvc-2019' && matrix.build_system == 'CMake' }}
uses: actions/upload-artifact@v6
with:
name: WindowsArchive_${{matrix.config}}
path: MREDist_${{matrix.config}}.zip
name: WindowsArchive_${{ matrix.upload_name || matrix.config }}
path: MREDist_${{ matrix.upload_name || matrix.config }}.zip
retention-days: 1

- name: Collect artifact stats
Expand All @@ -351,7 +354,7 @@ jobs:
uses: ./.github/actions/collect-artifact-stats
with:
artifact_path: ${{ github.workspace }}
artifact_glob: MREDist_${{matrix.config}}.zip
artifact_glob: MREDist_${{ matrix.upload_name || matrix.config }}.zip
stats_file_suffix: -${{ steps.collect-runner-stats.outputs.job_id }}

- name: Upload MeshLibC2 headers archive
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/matrix/windows-finalize-release-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"config": "Debug",
"build_system": "CMake",
"vcpkg-version": "__VCPKG_VERSION_VS19__",
"vcpkg_triplet": "x64-windows-meshlib",
"runner": ["windows-2025"],
"vc-path": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise",
"CUDA-VERSION": "11.4.2.47141",
Expand All @@ -17,12 +18,41 @@
"config": "Release",
"build_system": "CMake",
"vcpkg-version": "__VCPKG_VERSION_VS19__",
"vcpkg_triplet": "x64-windows-meshlib",
"runner": ["windows-2025"],
"vc-path": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise",
"CUDA-VERSION": "11.4.2.47141",
"CUDA-MAJOR": "11",
"CUDA-MINOR": "4",
"test_artifacts_path": "windows/windows-2019/Release"
},
{
"cxx_compiler": "msvc-2019",
"config": "Debug",
"build_system": "CMake",
"vcpkg-version": "__VCPKG_VERSION_VS19__",
"vcpkg_triplet": "x64-windows-meshlib-iterator-debug",
"upload_name": "Debug-IteratorDebug",
"runner": ["windows-2025"],
"vc-path": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise",
"CUDA-VERSION": "11.4.2.47141",
"CUDA-MAJOR": "11",
"CUDA-MINOR": "4",
"test_artifacts_path": "windows/windows-2019/Debug-IteratorDebug"
},
{
"cxx_compiler": "msvc-2019",
"config": "Release",
"build_system": "CMake",
"vcpkg-version": "__VCPKG_VERSION_VS19__",
"vcpkg_triplet": "x64-windows-meshlib-iterator-debug",
"upload_name": "Release-IteratorDebug",
"runner": ["windows-2025"],
"vc-path": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise",
"CUDA-VERSION": "11.4.2.47141",
"CUDA-MAJOR": "11",
"CUDA-MINOR": "4",
"test_artifacts_path": "windows/windows-2019/Release-IteratorDebug"
}
]
}
31 changes: 31 additions & 0 deletions .github/workflows/matrix/windows-minimal-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"config": "Release",
"build_system": "CMake",
"vcpkg-version": "__VCPKG_VERSION_VS19__",
"vcpkg_triplet": "x64-windows-meshlib",
"runner": ["windows-2025"],
"vc-path": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise",
"CUDA-VERSION": "11.4.2.47141",
Expand All @@ -17,6 +18,7 @@
"config": "Debug",
"build_system": "MSBuild",
"vcpkg-version": "__VCPKG_VERSION_VS22__",
"vcpkg_triplet": "x64-windows-meshlib",
"runner": ["windows-2025"],
"vc-path": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise",
"CUDA-VERSION": "12.0.1.52833",
Expand All @@ -29,12 +31,41 @@
"config": "Release",
"build_system": "CMake",
"vcpkg-version": "__VCPKG_VERSION_VS22__",
"vcpkg_triplet": "x64-windows-meshlib",
"runner": ["windows-2025"],
"vc-path": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise",
"CUDA-VERSION": "12.0.1.52833",
"CUDA-MAJOR": "12",
"CUDA-MINOR": "0",
"test_artifacts_path": "windows/windows-2022/Debug"
},
{
"cxx_compiler": "msvc-2019",
"config": "Debug",
"build_system": "CMake",
"vcpkg-version": "__VCPKG_VERSION_VS19__",
"vcpkg_triplet": "x64-windows-meshlib-iterator-debug",
"upload_name": "Debug-IteratorDebug",
"runner": ["windows-2025"],
"vc-path": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise",
"CUDA-VERSION": "11.4.2.47141",
"CUDA-MAJOR": "11",
"CUDA-MINOR": "4",
"test_artifacts_path": "windows/windows-2019/Debug-IteratorDebug"
},
{
"cxx_compiler": "msvc-2019",
"config": "Release",
"build_system": "CMake",
"vcpkg-version": "__VCPKG_VERSION_VS19__",
"vcpkg_triplet": "x64-windows-meshlib-iterator-debug",
"upload_name": "Release-IteratorDebug",
"runner": ["windows-2025"],
"vc-path": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise",
"CUDA-VERSION": "11.4.2.47141",
"CUDA-MAJOR": "11",
"CUDA-MINOR": "4",
"test_artifacts_path": "windows/windows-2019/Release-IteratorDebug"
}
]
}
15 changes: 12 additions & 3 deletions .github/workflows/prepare-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,16 @@ jobs:
strategy:
fail-fast: false
matrix:
runner: [ windows-2025 ]
vs: [ vs2019, vs2022 ]
include:
- runner: windows-2025
- vs: vs2022
runner: windows-2025
vcpkg-version: ${{ inputs.vs22_vcpkg_version }}
vcpkg_triplet: x64-windows-meshlib
- vs: vs2019
runner: windows-2025
vcpkg-version: ${{ inputs.vs19_vcpkg_version }}
vcpkg_triplet: x64-windows-meshlib-iterator-debug
steps:
- name: Setup vcpkg
working-directory: C:\vcpkg
Expand All @@ -173,4 +179,7 @@ jobs:
aws-region: us-east-1

- name: Build and cache vcpkg
run: .\thirdparty\install.bat --write-s3
env:
VCPKG_DEFAULT_TRIPLET: ${{ matrix.vcpkg_triplet || 'x64-windows-meshlib' }}
run: |
.\thirdparty\install.bat --write-s3
32 changes: 23 additions & 9 deletions .github/workflows/update-win-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,23 @@ jobs:
update-win-version:
timeout-minutes: 60
runs-on: windows-2025
strategy:
fail-fast: false
matrix:
include:
- vcpkg_triplet: x64-windows-meshlib
extract_release: MREDist_Release.zip
extract_debug: MREDist_Debug.zip
output_zip: MeshLibDist.zip
artifact_name: DistributivesWin
- vcpkg_triplet: x64-windows-meshlib-iterator-debug
extract_release: MREDist_Release-IteratorDebug.zip
extract_debug: MREDist_Debug-IteratorDebug.zip
output_zip: MeshLibDist-IteratorDebug.zip
artifact_name: DistributivesWin-IteratorDebug
env:
vs19_vcpkg_version: ${{ inputs.vs19_vcpkg_version }}
VCPKG_DEFAULT_TRIPLET: ${{ matrix.vcpkg_triplet || 'x64-windows-meshlib' }}
steps:
- name: Checkout
uses: actions/checkout@v6
Expand All @@ -32,12 +47,11 @@ jobs:
uses: actions/cache@v5
id: vcpkg-cache
with:
key: vcpkg-cache-${{env.vs19_vcpkg_version}}
key: vcpkg-cache-${{ env.vs19_vcpkg_version }}-${{ matrix.triplet }}
path: |
C:\vcpkg\*

- name: Update vcpkg packages
# NOTE: This step (thirdparty/install.bat) is the only one keeping us from using github runner for this job
run: |
.\thirdparty\install.bat

Expand All @@ -49,18 +63,18 @@ jobs:

- name: Extract Windows Binaries
run: |
tar -xvzf MREDist_Release.zip
tar -xvzf MREDist_Debug.zip
tar -xvzf ${{ matrix.extract_release }}
tar -xvzf ${{ matrix.extract_debug }}
tar -xvzf MeshLibC2Headers.zip

- name: Make Install Folder
run: py -3.10 scripts\make_install_folder.py ${{ inputs.app_version }}
run: py -3.10 scripts\make_install_folder.py ${{ inputs.app_version }} ${{ matrix.triplet }}

- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2

- name: Archive Distribution
run: py -3.10 scripts\zip_distribution.py install example_plugin MeshLibDist.zip
run: py -3.10 scripts\zip_distribution.py install example_plugin ${{ matrix.output_zip }}

- name: Test Example Plugin # call it after archive not to pack build results
run: |
Expand All @@ -70,6 +84,6 @@ jobs:
- name: Upload Windows Distribution
uses: actions/upload-artifact@v6
with:
name: DistributivesWin
path: MeshLibDist.zip
retention-days: 1
name: ${{ matrix.artifact_name }}
path: ${{ matrix.output_zip }}
retention-days: 1
10 changes: 9 additions & 1 deletion cmake/Modules/CompilerOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,15 @@ ENDIF()

IF(MSVC)
add_definitions(-DUNICODE -D_UNICODE)
add_definitions(-D_ITERATOR_DEBUG_LEVEL=0)
# Set _ITERATOR_DEBUG_LEVEL based on vcpkg triplet
# default val is 0 for backward compatibility
IF(DEFINED VCPKG_TARGET_TRIPLET AND VCPKG_TARGET_TRIPLET MATCHES ".*iterator-debug.*")
add_definitions(-D_ITERATOR_DEBUG_LEVEL=2)
add_definitions(-DMR_ITERATOR_DEBUG_LEVEL=2)
ELSE()
add_definitions(-D_ITERATOR_DEBUG_LEVEL=0)
add_definitions(-DMR_ITERATOR_DEBUG_LEVEL=0)
ENDIF()
ENDIF()

IF(NOT MSVC)
Expand Down
9 changes: 6 additions & 3 deletions scripts/make_install_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,19 @@
not_app_extentions = ['.lib','.obj','.pdb','.obj','.exp','.iobj','.ipdb']

def vcpkg_dir():
vcpkg_exe_dir = ""
vcpkg_triplet = "x64-windows-meshlib"
if len(sys.argv) > 2:
vcpkg_exe_dir = sys.argv[2]
vcpkg_triplet = sys.argv[2]
vcpkg_exe_dir = ""
if len(sys.argv) > 3:
vcpkg_exe_dir = sys.argv[3]
else:
vcpkg_exe_dir = os.popen("where vcpkg").read().strip()
if "vcpkg.exe" not in vcpkg_exe_dir:
vcpkg_exe_dir = "C:\\vcpkg"
else:
vcpkg_exe_dir = os.path.dirname( vcpkg_exe_dir )
return os.path.join(os.path.join(vcpkg_exe_dir, "installed"),"x64-windows-meshlib")
return os.path.join(os.path.join(vcpkg_exe_dir, "installed"), vcpkg_triplet)


vcpkg_directory = vcpkg_dir()
Expand Down
7 changes: 6 additions & 1 deletion scripts/mrbind/generate.mk
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ $(error Can't find vcpkg! The path to it should be stored in `$(vcpkg_marker_pat
endif
$(info Using vcpkg at: $(VCPKG_DIR))
endif

# Try to read the triplet from the `VCPKG_DEFAULT_TRIPLET` env variable if it's set.
VCPKG_TRIPLET := $(if $(VCPKG_DEFAULT_TRIPLET),$(VCPKG_DEFAULT_TRIPLET),x64-windows-meshlib)
$(info Using vcpkg triplet: $(VCPKG_TRIPLET))

else
VCPKG_DIR = $(error We're only using vcpkg on Windows)
endif
Expand Down Expand Up @@ -189,7 +194,7 @@ MRBIND_GEN_CSHARP_EXE = $(MRBIND_EXE)_gen_csharp

# Look for MeshLib dependencies relative to this. On Linux should point to the project root, because that's where `./include` and `./lib` are.
ifneq ($(IS_WINDOWS),)
DEPS_BASE_DIR := $(VCPKG_DIR)/installed/x64-windows-meshlib
DEPS_BASE_DIR := $(VCPKG_DIR)/installed/$(VCPKG_TRIPLET)
DEPS_LIB_DIR := $(DEPS_BASE_DIR)/$(if $(filter Debug,$(VS_MODE)),debug/)lib
else
DEPS_BASE_DIR := .
Expand Down
4 changes: 3 additions & 1 deletion source/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(CustomPropertyDir)' == ''">
<ClCompile>
<PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<!-- Set _ITERATOR_DEBUG_LEVEL based on vcpkg triplet -->
<PreprocessorDefinitions Condition="'$(VcpkgTriplet)' == 'x64-windows-meshlib-iterator-debug'">_ITERATOR_DEBUG_LEVEL=2;MR_ITERATOR_DEBUG_LEVEL=2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(VcpkgTriplet)' != 'x64-windows-meshlib-iterator-debug'">_ITERATOR_DEBUG_LEVEL=0;MR_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<Import Project="$(CustomPropertyDir)\CustomMRProps.props" Condition="'$(CustomPropertyDir)' != ''"/>
Expand Down
9 changes: 5 additions & 4 deletions thirdparty/install.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ REM options: use --write-s3 to push vcpkg binary cache to S3
REM The VCPKG_TAG variable represents the S3 folder and may not always exist in S3
REM use "aws s3 ls s3://vcpkg-export/" to list all available tags

set VCPKG_DEFAULT_TRIPLET=x64-windows-meshlib
if not defined VCPKG_DEFAULT_TRIPLET set VCPKG_DEFAULT_TRIPLET=x64-windows-meshlib
echo Using vcpkg triplet: %VCPKG_DEFAULT_TRIPLET%

REM Check if AWS CLI is installed
aws.exe --version >nul 2>&1
Expand Down Expand Up @@ -38,13 +39,13 @@ for %%i in (%*) do (
)
)

REM Configure VCPKG_BINARY_SOURCES
REM Configure VCPKG_BINARY_SOURCES (use %VCPKG_DEFAULT_TRIPLET% for S3 path)
if "!write_s3_option!"=="true" (
echo Mode: pull-push vcpkg binary cache. AWS credentials are required.
set "VCPKG_BINARY_SOURCES=clear;x-aws,s3://vcpkg-export/!VCPKG_TAG!/x64-windows-meshlib/,readwrite;"
set "VCPKG_BINARY_SOURCES=clear;x-aws,s3://vcpkg-export/!VCPKG_TAG!/%VCPKG_DEFAULT_TRIPLET%/,readwrite;"
) else (
echo Mode: pull vcpkg binary cache. No AWS credentials are required.
set "VCPKG_BINARY_SOURCES=clear;x-aws-config,no-sign-request;x-aws,s3://vcpkg-export/!VCPKG_TAG!/x64-windows-meshlib/,readwrite;"
set "VCPKG_BINARY_SOURCES=clear;x-aws-config,no-sign-request;x-aws,s3://vcpkg-export/!VCPKG_TAG!/%VCPKG_DEFAULT_TRIPLET%/,readwrite;"
)

REM Ensure vcpkg downloads folder exists
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Loading