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
27 changes: 23 additions & 4 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ jobs:
URI: ${{ matrix.uri }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- name: Make runner image version accessible
run: echo "ImageVersion=${ImageVersion}" >> $GITHUB_ENV
Expand Down Expand Up @@ -195,14 +198,30 @@ jobs:
fi
mkdir build
cd build
cmake .. -DLIB3MF_TESTS=OFF
cmake .. -DCMAKE_BUILD_TYPE=Release
# Limit workers to 2 for macos, as GHA's macos runner gets overloaded and very slow otherwise
WORKERS=
if [[ "$(uname -s)" = Darwin ]]; then WORKERS=2; fi
cmake --build . --parallel ${WORKERS}
cmake --build . --config Release --parallel ${WORKERS}
# Meanwhile let's also verify the "install" step works; installed files aren't actually used further on here
cmake --install . || sudo cmake --install .
working-directory: 3mfmerge
cmake --install . --config Release || sudo cmake --install .

- name: Fix Windows bin layout
if: runner.os == 'Windows'
run: |
cd 3mfmerge/bin

# 1) Move the EXE up if it only lives in Release/
if [[ ! -f 3mfmerge.exe && -f Release/3mfmerge.exe ]]; then
mv Release/3mfmerge.exe .
echo "Moved EXE: Release/3mfmerge.exe → 3mfmerge/bin/"
fi

# 2) Copy all DLLs from Release/ into bin/
if compgen -G "Release/*.dll" > /dev/null; then
cp Release/*.dll .
echo "Copied DLLs: Release/*.dll → 3mfmerge/bin/"
fi

- name: Run tests
run: |
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea
cmake-build-debug
cmake-build-release
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "vcpkg"]
path = vcpkg
url = https://github.com/microsoft/vcpkg.git
38 changes: 22 additions & 16 deletions 3mfmerge/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
cmake_minimum_required(VERSION 3.14...3.28)
project(3mfmerge LANGUAGES CXX)

project(3mfmerge)
# Output binaries into ./bin (all configurations)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)

# The generator expression $<0:> at the end, is only there to prevent multi-config generators such
# as MSVC's nmake from adding 'Debug' and the like
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin$<0:>)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin$<0:>)

set(CMAKE_CXX_STANDARD 11)
# Enforce C++11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_EXTENSIONS OFF)

include(FetchContent)
set(FETCHCONTENT_QUIET FALSE)
# Find lib3mf (installed via vcpkg manifest in the superproject)
find_package(lib3mf CONFIG REQUIRED)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# Build
add_executable(${PROJECT_NAME}
3mfmerge.cpp
)
target_link_libraries(${PROJECT_NAME}
PRIVATE lib3mf::lib3mf
)

find_package(LIB3MF 2)
# Install
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin
)

add_executable(${PROJECT_NAME} 3mfmerge.cpp)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
target_link_libraries(${PROJECT_NAME} PRIVATE lib3mf)
install(TARGETS ${PROJECT_NAME})
# Copy lib3mf’s runtime libraries alongside the executable
copy_lib3mf_libraries(${PROJECT_NAME})
65 changes: 0 additions & 65 deletions 3mfmerge/cmake/FindLIB3MF.cmake

This file was deleted.

13 changes: 0 additions & 13 deletions 3mfmerge/patches/lib3mf_static.patch

This file was deleted.

43 changes: 41 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,45 @@
cmake_minimum_required(VERSION 3.14...3.28)

project(colorscad)
# ─────────────────────────────────────────────────────────────────────────────
# AUTO-BOOTSTRAP VCPKG & SET TOOLCHAIN
# ─────────────────────────────────────────────────────────────────────────────

# Set the path to vcpkg submodule
set(VCPKG_DIR "${CMAKE_SOURCE_DIR}/vcpkg")

# Bootstrap vcpkg if needed
if (NOT EXISTS "${VCPKG_DIR}/vcpkg")
message(STATUS "Bootstrapping vcpkg...")
if (UNIX)
execute_process(
COMMAND ${CMAKE_COMMAND} -E env bash "${VCPKG_DIR}/bootstrap-vcpkg.sh"
WORKING_DIRECTORY ${VCPKG_DIR}
)
elseif (WIN32)
execute_process(
COMMAND "${VCPKG_DIR}/bootstrap-vcpkg.bat"
WORKING_DIRECTORY ${VCPKG_DIR}
)
endif()
endif()

# Set vcpkg toolchain file for CMake to use
if (EXISTS "${VCPKG_DIR}/scripts/buildsystems/vcpkg.cmake")
set(CMAKE_TOOLCHAIN_FILE "${VCPKG_DIR}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "")
else()
message(FATAL_ERROR "vcpkg failed to bootstrap or install packages.")
endif()

# ─────────────────────────────────────────────────────────────────────────────
# PROJECT DEFINITION
# ─────────────────────────────────────────────────────────────────────────────

project(colorscad LANGUAGES CXX)

add_subdirectory(3mfmerge)

install(PROGRAMS colorscad.sh RENAME colorscad DESTINATION bin)
install(
PROGRAMS colorscad.sh
RENAME colorscad
DESTINATION bin
)
1 change: 1 addition & 0 deletions vcpkg
Submodule vcpkg added at 8f54ef
11 changes: 11 additions & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "colorscad",
"version": "1.0.0",
"builtin-baseline": "8f54ef5453e7e76ff01e15988bf243e7247c5eb5",
"dependencies": [
"lib3mf"
],
"overrides": [
{ "name": "lib3mf", "version": "2.3.2" }
]
}