Skip to content

Commit ed3e0f1

Browse files
authored
Merge pull request #10 from 3dJan/3dJan/ExtendedVolumetricSpec
3d jan/extended volumetric spec
2 parents 410f289 + 5977c59 commit ed3e0f1

File tree

101 files changed

+11080
-1185
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+11080
-1185
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
description: 'Reviews code, documents, or other materials, providing feedback and suggestions for improvement.'
3+
tools: ['edit', 'runNotebooks', 'search', 'new', 'runCommands', 'runTasks', 'usages', 'vscodeAPI', 'think', 'problems', 'changes', 'testFailure', 'openSimpleBrowser', 'fetch', 'githubRepo', 'extensions', 'todos', 'runTests', 'serena']
4+
---
5+
6+
Start with using git log and git diff to understand the last 10 commits. Then create yourself a plan how to proceed.
7+
8+
Your task is to ensure that the code is high-quality, efficient, and maintainable.
9+
Check for adherence to coding standards, best practices, and overall functionality. If a spec is provided, ensure the code meets the requirements outlined in it.
10+
Check for
11+
- Is the code reusable and modular?
12+
- Can the code be optimized for better performance?
13+
- Are there any security vulnerabilities?
14+
- Can the code be simplified for better readability?
15+
- Does the code follow the project's coding standards and conventions?
16+
- Does the code follow KISS (Keep It Simple, Stupid) and DRY (Don't Repeat Yourself) principles?
17+
- Are there any potential bugs or edge cases that have not been handled?
18+
- Is the code well-documented and easy to understand?
19+
- Is the code covered by tests? If not, suggest appropriate tests to add.
20+

.github/codeql/codeql-config.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "CodeQL Configuration"
2+
3+
# Exclude vcpkg directories and third-party libraries from CodeQL scanning
4+
paths-ignore:
5+
# vcpkg installation directories
6+
- "vcpkg_installed/**"
7+
- "**/vcpkg_installed/**"
8+
9+
- "vcpkg/**"
10+
- "**/vcpkg/**"
11+
12+
# Ignore vcpkg buildtrees directory
13+
- "vcpkg/buildtrees/**"
14+
- "**/vcpkg/buildtrees/**"
15+
16+
# Common build artifact directories that may contain vcpkg dependencies
17+
- "build/**"
18+
- "**/build/**"
19+
- "out/**"
20+
- "**/out/**"
21+
22+
# vcpkg tool directory (if cloned locally)
23+
- "vcpkg/**"
24+
- "**/vcpkg/**"
25+
26+
# CMake build directories that might contain FetchContent or vcpkg deps
27+
- "_deps/**"
28+
- "**/_deps/**"
29+
30+
# Other common build artifact directories
31+
- ".vs/**"
32+
- "**/CMakeFiles/**"
33+
- "**/.cmake/**"
34+
35+
# Include only our project source directories
36+
paths:
37+
- "gladius/src/**"
38+
- "gladius/library/**"
39+
- "gladius/components/**"
40+
- "gladius/examples/**"
41+
- "gladius/tests/**"
42+
- "gladius/cmake/**"
43+
- "scripts/**"

.github/workflows/build.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ jobs:
112112
- name: Build
113113
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
114114
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
115-
116115
- name: Test
117116
# Run only unit tests, excluding integration tests
118117
working-directory: ${{ steps.strings.outputs.build-output-dir }}

.github/workflows/codeql.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ "main", "develop" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
schedule:
9+
- cron: '42 5 * * 1' # Weekly on Mondays
10+
11+
jobs:
12+
analyze:
13+
name: Analyze (${{ matrix.language }})
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 120
16+
permissions:
17+
# required for all workflows
18+
security-events: write
19+
# required to fetch internal or private CodeQL packs
20+
packages: read
21+
# only required for workflows in private repositories
22+
actions: read
23+
contents: read
24+
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
include:
29+
- language: c-cpp
30+
build-mode: manual
31+
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v4
35+
with:
36+
submodules: true
37+
38+
- name: Install dependencies
39+
run: sudo apt-get update && sudo apt-get install -y libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev build-essential libglfw3-dev ninja-build
40+
41+
- name: Setup vcpkg environment
42+
shell: bash
43+
run: |
44+
echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV
45+
46+
- name: Setup vcpkg
47+
uses: lukka/run-vcpkg@v11
48+
with:
49+
vcpkgGitCommitId: 'f2bf7d935af722c0cd8219c1f6e30d5ae3d666f2'
50+
vcpkgJsonGlob: '${{ github.workspace }}/gladius/vcpkg.json'
51+
env:
52+
VCPKG_OVERLAY_PORTS: '${{ github.workspace }}/gladius/vcpkg-overlay-ports'
53+
54+
# Initializes the CodeQL tools for scanning.
55+
- name: Initialize CodeQL
56+
uses: github/codeql-action/init@v3
57+
with:
58+
languages: ${{ matrix.language }}
59+
build-mode: ${{ matrix.build-mode }}
60+
config-file: .github/codeql/codeql-config.yml
61+
62+
- name: Set reusable strings
63+
id: strings
64+
shell: bash
65+
run: |
66+
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
67+
68+
- name: Configure CMake
69+
run: >
70+
cmake -B ${{ steps.strings.outputs.build-output-dir }}
71+
-DCMAKE_CXX_COMPILER=clang++
72+
-DCMAKE_C_COMPILER=clang
73+
-DCMAKE_BUILD_TYPE=Release
74+
-DENABLE_OPENCL_TESTS=OFF
75+
-G Ninja
76+
-S ${{ github.workspace }}/gladius
77+
env:
78+
VCPKG_OVERLAY_PORTS: '${{ github.workspace }}/gladius/vcpkg-overlay-ports'
79+
80+
- name: Build
81+
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config Release
82+
83+
- name: Perform CodeQL Analysis
84+
uses: github/codeql-action/analyze@v3
85+
with:
86+
category: "/language:${{matrix.language}}"

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,8 @@ build/
3838
gladius/vcpkg_installed/*
3939
gladius/.serena/cache/
4040
gladius/compile_commands.json
41+
build/build_test/
42+
vcpkg/buildtrees/
43+
**/vcpkg_installed/
44+
_CPack_Packages/*
45+
*.deb

gladius/CMakeLists.txt

Lines changed: 55 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ option(ENABLE_OPENCL_TESTS "Enable tests that require OpenCL" ON)
1616

1717
set(CPACK_PACKAGE_VERSION_MAJOR "1")
1818
set(CPACK_PACKAGE_VERSION_MINOR "2")
19-
set(CPACK_PACKAGE_VERSION_PATCH "14")
19+
set(CPACK_PACKAGE_VERSION_PATCH "15")
2020

2121
# Set the version of the package in src/version.h
2222
configure_file(
@@ -37,6 +37,8 @@ if(buildcache_program)
3737
else()
3838
message("buildcache not found")
3939
endif()
40+
else()
41+
message("Not using build cache. You can enable it by setting USE_CACHE=ON")
4042
endif() # USE_CACHE
4143
message("CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
4244
message("VCPKG_ROOT=${VCPKG_ROOT}")
@@ -84,6 +86,10 @@ project(gladius)
8486
# Include coverage support after project declaration so compiler info is available
8587
include(cmake/Coverage.cmake)
8688

89+
# Ensure the 'install' target depends on building all targets first
90+
# (so CPack does not try to install artifacts that were not built yet).
91+
set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY OFF)
92+
8793
if (MSVC)
8894
add_compile_options(/bigobj /utf-8 /Zc:__cplusplus)
8995

@@ -124,11 +130,15 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
124130

125131
# Ensure installed binaries look for co-located shared libraries first
126132
if(UNIX)
127-
# Use $ORIGIN so binaries in /opt/gladius/<version> can find bundled .so
133+
# Install tree: Use $ORIGIN so installed binaries in /opt/gladius/<version> resolve
134+
# bundled shared objects (e.g. our patched lib3mf) placed alongside them.
128135
set(CMAKE_INSTALL_RPATH "$ORIGIN")
129-
# Build artifacts will already carry the final install RPATH, avoiding RPATH rewrite during install
130-
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
131-
set(CMAKE_SKIP_BUILD_RPATH OFF)
136+
# Build tree: DO NOT force build RPATH to install RPATH. Tests run from the
137+
# build tree (e.g. build/tests/unittests) and previously failed to locate
138+
# lib3mf.so.2 when we set CMAKE_BUILD_WITH_INSTALL_RPATH ON (RPATH became
139+
# just $ORIGIN which points to the test directory that does not contain lib3mf).
140+
set(CMAKE_BUILD_WITH_INSTALL_RPATH OFF)
141+
set(CMAKE_SKIP_BUILD_RPATH OFF)
132142
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
133143
endif()
134144

@@ -212,10 +222,17 @@ if(UNIX)
212222
if(_lib3mf_resolved)
213223
get_filename_component(_lib3mf_dir "${_lib3mf_resolved}" DIRECTORY)
214224
if(EXISTS "${_lib3mf_dir}")
225+
# Bundle all versioned variants (lib3mf.so, lib3mf.so.2, etc.) into install prefix.
215226
file(GLOB _lib3mf_so_files "${_lib3mf_dir}/lib3mf.so*")
216227
if(_lib3mf_so_files)
217228
install(FILES ${_lib3mf_so_files} DESTINATION ${INSTALL_PREFIX})
218229
endif()
230+
# Ensure build-tree executables (tests, tools) can locate lib3mf at runtime
231+
# by appending its directory to the build RPATH. This fixes CI failures like:
232+
# error while loading shared libraries: lib3mf.so.2: cannot open shared object file
233+
list(APPEND CMAKE_BUILD_RPATH "${_lib3mf_dir}")
234+
list(REMOVE_DUPLICATES CMAKE_BUILD_RPATH)
235+
set(CMAKE_BUILD_RPATH "${CMAKE_BUILD_RPATH}" CACHE STRING "RPATH for build tree executables" FORCE)
219236
endif()
220237
endif()
221238
endif()
@@ -274,8 +291,24 @@ install(DIRECTORY components/licenses DESTINATION ${INSTALL_PREFIX}/doc/licenses
274291
# Install imgui.ini
275292
install(FILES src/imgui.ini DESTINATION ${INSTALL_PREFIX})
276293

277-
# Install icon
278-
install(FILES ${CMAKE_SOURCE_DIR}/documentation/img/gladius.ico DESTINATION ${INSTALL_PREFIX}/share/pixmaps/)
294+
# Icon installation and desktop integration assets (no build-time conversion)
295+
if(UNIX)
296+
set(GLADIUS_ICON_NAME gladius)
297+
# Install pre-generated PNG icon to hicolor so Icon=gladius works via theme
298+
install(FILES ${CMAKE_SOURCE_DIR}/documentation/img/gladius.png DESTINATION /usr/share/icons/hicolor/256x256/apps/ RENAME ${GLADIUS_ICON_NAME}.png)
299+
set(GLADIUS_ICON ${GLADIUS_ICON_NAME})
300+
endif()
301+
302+
# Linux desktop integration (GNOME/KDE): install .desktop file and icon into system directories
303+
if(UNIX)
304+
# Generate desktop launcher file
305+
set(GLADIUS_DESKTOP_FILE "${PROJECT_BINARY_DIR}/gladius.desktop")
306+
# Paths used inside the desktop file
307+
set(GLADIUS_EXEC "/usr/bin/gladius")
308+
configure_file(${CMAKE_SOURCE_DIR}/cmake/desktop/gladius.desktop.in ${GLADIUS_DESKTOP_FILE} @ONLY)
309+
# Install desktop entry for all users
310+
install(FILES ${GLADIUS_DESKTOP_FILE} DESTINATION /usr/share/applications)
311+
endif()
279312

280313
# Install documentation - not yet available
281314
# install(DIRECTORY ${CMAKE_SOURCE_DIR}/documentation/ DESTINATION ${INSTALL_PREFIX}/share/doc/)
@@ -316,15 +349,15 @@ if(UNIX)
316349
file(WRITE "${GLADIUS_LAUNCHER}" "#!/bin/sh\n"
317350
"# Added by CMake: ensure Gladius' private libs (e.g., custom lib3mf) are found first.\n"
318351
"GLADIUS_DIR=\"${INSTALL_PREFIX}\"\n"
319-
"if [ -z \"\\$LD_LIBRARY_PATH\" ]; then\n"
320-
" export LD_LIBRARY_PATH=\\"\\$GLADIUS_DIR\\"\n"
352+
"if [ -z \"\$LD_LIBRARY_PATH\" ]; then\n"
353+
" export LD_LIBRARY_PATH=\"\$GLADIUS_DIR\"\n"
321354
"else\n"
322-
" case :\\$LD_LIBRARY_PATH: in\n"
323-
" *:\\$GLADIUS_DIR:*) ;;\n"
324-
" *) export LD_LIBRARY_PATH=\\"\\$GLADIUS_DIR:\\$LD_LIBRARY_PATH\\" ;;\n"
355+
" case :\$LD_LIBRARY_PATH: in\n"
356+
" *:\$GLADIUS_DIR:*) ;;\n"
357+
" *) export LD_LIBRARY_PATH=\"\$GLADIUS_DIR:\$LD_LIBRARY_PATH\" ;;\n"
325358
" esac\n"
326359
"fi\n"
327-
"exec \"\\$GLADIUS_DIR/gladius\" \"$@\"\n")
360+
"exec \"\$GLADIUS_DIR/gladius\" \"$@\"\n")
328361
install(PROGRAMS "${GLADIUS_LAUNCHER}" DESTINATION ${SYMLINK_BIN_DIR} RENAME gladius)
329362
endif()
330363

@@ -358,8 +391,12 @@ if (UNIX)
358391
endif()
359392

360393
include(CPack)
361-
add_custom_target( Generate_Installer
362-
COMMAND "${CMAKE_CPACK_COMMAND}"
363-
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
364-
DEPENDS gladius gladiuslib
365-
COMMENT "Running CPack. Please wait...")
394+
395+
# Convenience target to generate installer and ensure required binaries are built first
396+
add_custom_target(Generate_Installer
397+
COMMAND "${CMAKE_CPACK_COMMAND}"
398+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
399+
# Make sure both desktop app variants are built before packaging
400+
DEPENDS gladius gladiusmcp gladius_lib
401+
COMMENT "Running CPack. Please wait...")
402+

gladius/CMakePresets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"hidden": true,
77
"generator": "Ninja",
88
"binaryDir": "${sourceDir}/out/build/${presetName}",
9-
"installDir": "$env{CML}/gladius/gladius-1.2.14",
9+
"installDir": "$env{CML}/gladius/gladius-1.2.15",
1010
"condition": {
1111
"type": "equals",
1212
"lhs": "${hostSystemName}",
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[Desktop Entry]
2+
Version=@CPACK_PACKAGE_VERSION_MAJOR@.@CPACK_PACKAGE_VERSION_MINOR@.@CPACK_PACKAGE_VERSION_PATCH@
3+
Type=Application
4+
Name=Gladius
5+
GenericName=3MF Volumetric/Implicit Tool
6+
Comment=Work with 3MF Volumetric and Implicit extensions
7+
TryExec=@GLADIUS_EXEC@
8+
Exec=@GLADIUS_EXEC@ %F
9+
Icon=@GLADIUS_ICON@
10+
Terminal=false
11+
Categories=Graphics;3DGraphics;Engineering;
12+
Keywords=3MF;3D;Printing;Volumetric;Implicit;Gladius;
13+
StartupNotify=true
14+
# Uncomment when MIME is registered; left here for future integration
15+
# MimeType=application/3mf;
46.7 KB
Loading

gladius/src/BeamLatticeResource.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ namespace gladius
1212
std::vector<BeamData> && beams,
1313
std::vector<BallData> && balls,
1414
BeamLatticeBallConfig ballConfig,
15-
bool useVoxelAcceleration)
15+
BeamLatticeAcceleration acceleration)
1616
: ResourceBase(std::move(key))
1717
, m_beams(std::move(beams))
1818
, m_balls(std::move(balls))
1919
, m_ballConfig(ballConfig)
20-
, m_useVoxelAcceleration(useVoxelAcceleration)
20+
, m_acceleration(acceleration)
2121
{
2222
// Validate ball configuration per 3MF specification
2323
if (!m_ballConfig.isValid())
@@ -55,7 +55,7 @@ namespace gladius
5555

5656
void BeamLatticeResource::buildAccelerationStructure()
5757
{
58-
if (m_useVoxelAcceleration)
58+
if (m_acceleration == BeamLatticeAcceleration::Voxel)
5959
{
6060
buildVoxelAcceleration();
6161
}

0 commit comments

Comments
 (0)