Skip to content

Commit 62a2cae

Browse files
committed
fix: improve build system, packaging, and cross-platform support
1 parent 3ce17d3 commit 62a2cae

6 files changed

Lines changed: 85 additions & 11 deletions

File tree

.github/workflows/release.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ['v*']
6+
7+
jobs:
8+
build-release:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Install dependencies
15+
run: |
16+
sudo apt-get update
17+
sudo apt-get install -y cmake ninja-build
18+
19+
- name: Configure
20+
run: >
21+
cmake -B build -G Ninja
22+
-DCMAKE_BUILD_TYPE=Release
23+
-DSIMFORGE_BUILD_TESTS=ON
24+
25+
- name: Build
26+
run: cmake --build build -j$(nproc)
27+
28+
- name: Test
29+
run: cd build && ctest --output-on-failure
30+
31+
- name: Package
32+
run: |
33+
cmake --install build --prefix staging
34+
tar czf simforge-linux-x86_64.tar.gz -C staging .
35+
36+
- name: Create Release
37+
uses: softprops/action-gh-release@v2
38+
with:
39+
files: simforge-linux-x86_64.tar.gz
40+
generate_release_notes: true

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,10 @@ endif()
106106
if(SIMFORGE_USE_COACD)
107107
find_package(coacd QUIET)
108108
if(NOT coacd_FOUND)
109+
if(CMAKE_VERSION VERSION_LESS "3.24")
110+
message(FATAL_ERROR "SIMFORGE_USE_COACD with FetchContent requires CMake >= 3.24")
111+
endif()
109112
message(STATUS "CoACD not found, fetching from source...")
110-
cmake_minimum_required(VERSION 3.24)
111113
FetchContent_Declare(
112114
coacd
113115
GIT_REPOSITORY https://github.com/SarahWeiii/CoACD.git
@@ -141,3 +143,4 @@ if(SIMFORGE_BUILD_TESTS)
141143
enable_testing()
142144
add_subdirectory(tests)
143145
endif()
146+

pyproject.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[build-system]
2+
requires = ["scikit-build-core>=0.9"]
3+
build-backend = "scikit_build_core.build"
4+
5+
[project]
6+
name = "simforge"
7+
version = "0.1.0"
8+
requires-python = ">=3.9"
9+
description = "Asset pipeline for robotics simulation"
10+
license = {file = "LICENSE"}
11+
12+
[tool.scikit-build]
13+
cmake.build-type = "Release"
14+
cmake.args = ["-DSIMFORGE_BUILD_PYTHON=ON", "-DSIMFORGE_BUILD_TESTS=OFF"]
15+
wheel.packages = []

python/CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,15 @@ target_link_libraries(simforge_python PRIVATE simforge_core)
1414

1515
# Ensure all symbols from the static library are included so that
1616
# adapter and stage registration works correctly.
17-
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
17+
if(APPLE)
18+
target_link_options(simforge_python PRIVATE
19+
"-Wl,-force_load,$<TARGET_FILE:simforge_core>"
20+
)
21+
elseif(MSVC)
22+
target_link_options(simforge_python PRIVATE
23+
"/WHOLEARCHIVE:$<TARGET_FILE:simforge_core>"
24+
)
25+
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
1826
target_link_options(simforge_python PRIVATE
1927
"LINKER:--whole-archive"
2028
$<TARGET_FILE:simforge_core>

src/CMakeLists.txt

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ target_include_directories(simforge_core PUBLIC
3030
${CMAKE_BINARY_DIR}/include
3131
)
3232

33-
target_link_libraries(simforge_core PUBLIC
34-
yaml-cpp::yaml-cpp
35-
spdlog::spdlog
36-
nlohmann_json::nlohmann_json
37-
tinyxml2::tinyxml2
38-
meshoptimizer
33+
target_link_libraries(simforge_core
34+
PUBLIC
35+
yaml-cpp::yaml-cpp
36+
nlohmann_json::nlohmann_json
37+
PRIVATE
38+
spdlog::spdlog
39+
tinyxml2::tinyxml2
40+
meshoptimizer
3941
)
4042

4143
target_include_directories(simforge_core PRIVATE
@@ -57,8 +59,13 @@ add_executable(simforge cli/main.cpp)
5759
target_link_libraries(simforge PRIVATE
5860
simforge_core
5961
CLI11::CLI11
62+
spdlog::spdlog
6063
)
6164

62-
install(TARGETS simforge RUNTIME DESTINATION bin)
63-
install(TARGETS simforge_core ARCHIVE DESTINATION lib)
64-
install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION include)
65+
include(GNUInstallDirs)
66+
67+
install(TARGETS simforge RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
68+
install(TARGETS simforge_core ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
69+
install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
70+
install(FILES ${CMAKE_SOURCE_DIR}/data/materials.yaml
71+
DESTINATION ${CMAKE_INSTALL_DATADIR}/simforge)

tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ add_executable(simforge_tests
2525
target_link_libraries(simforge_tests PRIVATE
2626
simforge_core
2727
Catch2::Catch2WithMain
28+
spdlog::spdlog
2829
tinyxml2::tinyxml2
2930
)
3031

0 commit comments

Comments
 (0)