Another attempt
Some checks failed
Build VulkanEngine / nix (push) Successful in 3m12s
Build VulkanEngine / release (BUNDLE) (push) Failing after 2m13s
Build VulkanEngine / release (PORTABLE) (push) Failing after 2m10s
Build VulkanEngine / notify (push) Successful in 4s

This commit is contained in:
Alexandre 2026-10-09 20:39:35 +02:00
parent e6a2fb9c22
commit 089e7493b6
2 changed files with 334 additions and 120 deletions

View File

@ -7,14 +7,17 @@ on:
pull_request: pull_request:
workflow_dispatch: workflow_dispatch:
schedule: schedule:
- cron: "@weekly" - cron: "0 3 * * 1"
jobs: jobs:
build: # ---------------------------------------------------------------------------
# 1. Nix build: validates the flake build and produces the SPIR-V shaders
# (SPIR-V is OS independent, and slangc is not packaged in Debian).
# ---------------------------------------------------------------------------
nix:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: git.alexdelcamp.fr/alexandre_1a/flake-actions:latest container: git.alexdelcamp.fr/alexandre_1a/flake-actions:latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -22,86 +25,135 @@ jobs:
submodules: recursive submodules: recursive
fetch-depth: 0 fetch-depth: 0
- name: Configure - name: Configure
run: | run: |
nix develop --command cmake -S . -B build \ nix develop --command cmake -S . -B build \
-G Ninja \ -G Ninja \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release
-DVULKANENGINE_PORTABLE=ON
- name: Debug Nix linker environment
run: |
nix develop --command bash -c '
echo "CC=$CC"
echo "CXX=$CXX"
echo "LD=$LD"
echo
echo "NIX_LDFLAGS:"
printf "%s\n" "$NIX_LDFLAGS"
echo
echo "NIX_CFLAGS_LINK:"
printf "%s\n" "$NIX_CFLAGS_LINK"
'
- name: Build - name: Build
run: | run: |
nix develop --command cmake --build build \ nix develop --command cmake --build build --parallel 2
--parallel 2
- name: Install ELF inspection tools - name: Upload shaders
uses: actions/upload-artifact@v4
with:
name: shaders
path: build/engine/shaders
# ---------------------------------------------------------------------------
# 2. Debian 12 builds: portable (static) and bundle (bin/ + lib/)
# Built on glibc 2.36 => runs on Debian 12 and anything newer.
# ---------------------------------------------------------------------------
release:
needs: nix
runs-on: ubuntu-latest
container: debian:12
strategy:
fail-fast: false
matrix:
variant: [PORTABLE, BUNDLE]
steps:
# git + nodejs must exist before checkout (JS actions run in the container)
- name: Dependencies
run: | run: |
nix profile install \ apt-get update
nixpkgs#binutils \ apt-get install -y --no-install-recommends \
nixpkgs#file \ git ca-certificates nodejs \
nixpkgs#gnugrep build-essential cmake ninja-build pkg-config \
libwayland-dev libwayland-bin wayland-protocols libxkbcommon-dev \
libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Git safe directory
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Download shaders
uses: actions/download-artifact@v4
with:
name: shaders
path: prebuilt-shaders
- name: Configure
run: |
cmake -S . -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DVULKANENGINE_FETCH_DEPS=ON \
-DVULKANENGINE_${{ matrix.variant }}=ON \
-DVULKANENGINE_PREBUILT_SHADERS="$PWD/prebuilt-shaders"
- name: Build
run: cmake --build build --parallel 2
- name: Install
run: cmake --install build --prefix dist --strip
- name: Check binaries - name: Check binaries
shell: bash
run: | run: |
for bin in build/server/server build/engine/engine; do set -euo pipefail
echo "========== $bin ==========" for b in dist/bin/engine dist/bin/server; do
echo "========== $b =========="
readelf -l "$b" | grep 'program interpreter'
readelf -d "$b" | grep -E 'RPATH|RUNPATH|NEEDED' || true
file "$bin" if strings "$b" | grep -q '/nix/store'; then
echo "ERROR: $b references /nix/store"; exit 1
fi
echo "--- INTERPRETER ---" # The loader must come from volk (dlopen), never from NEEDED
readelf -l "$bin" | grep 'Requesting program interpreter' || true if readelf -d "$b" | grep -q 'libvulkan'; then
echo "ERROR: $b links libvulkan directly"; exit 1
fi
echo "--- DYNAMIC SECTION ---" if [ "${{ matrix.variant }}" = "PORTABLE" ]; then
readelf -d "$bin" | grep -E 'RPATH|RUNPATH|NEEDED' || true if readelf -d "$b" | grep -Eq 'libstdc\+\+|libgcc_s'; then
echo "ERROR: $b is not static for libstdc++/libgcc"; exit 1
fi
fi
echo "--- NIX STORE REFERENCES ---" max=$(objdump -T "$b" | grep -o 'GLIBC_[0-9.]*' | sed 's/GLIBC_//' | sort -uV | tail -1 || true)
strings "$bin" | grep '/nix/store' || true echo "Highest GLIBC symbol: ${max:-none}"
if [ -n "$max" ] && [ "$(printf '%s\n%s\n' "$max" 2.36 | sort -V | tail -1)" != "2.36" ]; then
echo "ERROR: needs glibc $max (> 2.36)"; exit 1
fi
if ldd "$b" | grep 'not found'; then
echo "ERROR: unresolved libraries in $b"; exit 1
fi
done done
if [ "${{ matrix.variant }}" = "BUNDLE" ]; then
echo "========== lib/ =========="
ls -la dist/lib
fi
# tar keeps permissions and symlinks; artifact zips do not
- name: Package
run: |
tar -C dist -czf VulkanEngine-${{ matrix.variant }}-linux-x86_64.tar.gz .
- name: Upload build - name: Upload build
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: VulkanEngine-linux-x86_64 name: VulkanEngine-${{ matrix.variant }}-linux-x86_64
path: build/ path: VulkanEngine-${{ matrix.variant }}-linux-x86_64.tar.gz
- name: Verify Nix independence # ---------------------------------------------------------------------------
run: | notify:
mkdir -p /tmp/vulkan-test needs: [nix, release]
cp build/server/server /tmp/vulkan-test/
cp build/engine/engine /tmp/vulkan-test/
echo "=== Nix references ==="
if strings /tmp/vulkan-test/server | grep -q '/nix/store'; then
echo "ERROR: server contains /nix/store reference"
exit 1
fi
if strings /tmp/vulkan-test/engine | grep -q '/nix/store'; then
echo "ERROR: engine contains /nix/store reference"
exit 1
fi
echo "OK: no /nix/store references"
- name: Notify routine
if: always() if: always()
runs-on: ubuntu-latest
steps:
- name: Notify routine
run: | run: |
curl \ curl \
-H "Title: [Routine] VulkanEngine build" \ -H "Title: [Routine] VulkanEngine build" \
-d "Build finished (status: ${{ job.status }})" \ -d "Build finished (nix: ${{ needs.nix.result }}, release: ${{ needs.release.result }})" \
https://ntfy.alexdelcamp.fr/FlakeBuild https://ntfy.alexdelcamp.fr/FlakeBuild

View File

@ -1,16 +1,24 @@
cmake_minimum_required (VERSION 3.29) cmake_minimum_required(VERSION 3.25) # Debian 12 ships 3.25
project(VulkanEngine) project(VulkanEngine)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake")
include(BuildInfo) include(BuildInfo)
include(FetchContent) include(FetchContent)
#LTO # LTO
include(CheckIPOSupported) include(CheckIPOSupported)
check_ipo_supported(RESULT LTO_SUPPORTED OUTPUT LTO_ERROR) check_ipo_supported(RESULT LTO_SUPPORTED OUTPUT LTO_ERROR)
# ---------------------------------------------------------------------------
# Build modes
# (default) Nix dev build, deps from the Nix shell
# FETCH_DEPS + PORTABLE Single directory, everything static except
# glibc (and the Vulkan loader, loaded via volk)
# FETCH_DEPS + BUNDLE bin/ + lib/, project libs shared in lib/,
# system libstdc++ / libc / loader are used
# ---------------------------------------------------------------------------
option(VULKANENGINE_PORTABLE option(VULKANENGINE_PORTABLE
"Build a Linux binary without Nix-specific runtime paths" "Build a Linux binary without Nix-specific runtime paths (static libs)"
OFF OFF
) )
@ -19,6 +27,24 @@ option(VULKANENGINE_BUNDLE
OFF OFF
) )
option(VULKANENGINE_FETCH_DEPS
"Fetch dependencies with FetchContent instead of using system/Nix packages"
OFF
)
set(VULKANENGINE_PREBUILT_SHADERS "" CACHE PATH
"Directory containing precompiled .spv files (skips glslang/slangc)"
)
if(VULKANENGINE_PORTABLE AND VULKANENGINE_BUNDLE)
message(FATAL_ERROR "VULKANENGINE_PORTABLE and VULKANENGINE_BUNDLE are mutually exclusive")
endif()
if((VULKANENGINE_PORTABLE OR VULKANENGINE_BUNDLE) AND NOT VULKANENGINE_FETCH_DEPS)
message(FATAL_ERROR
"PORTABLE/BUNDLE builds need -DVULKANENGINE_FETCH_DEPS=ON "
"(Nix libraries must not leak into the result)")
endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
@ -26,10 +52,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if(VULKANENGINE_PORTABLE) if(VULKANENGINE_PORTABLE)
message(STATUS "VulkanEngine: PORTABLE build") message(STATUS "VulkanEngine: PORTABLE build")
set(CMAKE_SKIP_BUILD_RPATH TRUE) set(CMAKE_SKIP_RPATH TRUE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
elseif(VULKANENGINE_BUNDLE) elseif(VULKANENGINE_BUNDLE)
message(STATUS "VulkanEngine: BUNDLE build") message(STATUS "VulkanEngine: BUNDLE build")
@ -40,9 +63,11 @@ elseif(VULKANENGINE_BUNDLE)
# Executables are installed in bin/ # Executables are installed in bin/
# Libraries are installed in lib/ # Libraries are installed in lib/
set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib") set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
# Every shared lib we build ends up here, installed as-is into lib/
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
else() else()
message(STATUS "VulkanEngine: normal build") message(STATUS "VulkanEngine: normal build")
endif() endif()
@ -53,9 +78,90 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_AR "${GCC_AR}") set(CMAKE_AR "${GCC_AR}")
set(CMAKE_RANLIB "${GCC_RANLIB}") set(CMAKE_RANLIB "${GCC_RANLIB}")
endif() endif()
# Fetch required things
# fastgltf because it's not in nixpkgs
# ---------------------------------------------------------------------------
# Dependencies
# ---------------------------------------------------------------------------
set(ENGINE_EXTRA_DEFINITIONS "")
if(VULKANENGINE_FETCH_DEPS)
# Portable = static libs, bundle = shared libs (in lib/)
if(VULKANENGINE_BUNDLE)
set(BUILD_SHARED_LIBS ON)
else()
set(BUILD_SHARED_LIBS OFF)
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(VULKAN_HEADERS_ENABLE_MODULE OFF CACHE BOOL "" FORCE)
set(VULKAN_HEADERS_ENABLE_TESTS OFF CACHE BOOL "" FORCE)
set(VULKAN_HEADERS_ENABLE_INSTALL OFF CACHE BOOL "" FORCE)
set(VOLK_PULL_IN_VULKAN OFF CACHE BOOL "" FORCE)
set(VOLK_INSTALL OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_INSTALL OFF CACHE BOOL "" FORCE)
set(FMT_INSTALL OFF CACHE BOOL "" FORCE)
set(FMT_TEST OFF CACHE BOOL "" FORCE)
set(SIMDJSON_DEVELOPER_MODE OFF CACHE BOOL "" FORCE)
set(CLI11_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(CLI11_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(GLM_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLM_BUILD_LIBRARY OFF CACHE BOOL "" FORCE)
# Keep these versions in sync with your nixpkgs (check the tags exist)
FetchContent_Declare(VulkanHeaders
GIT_REPOSITORY https://github.com/KhronosGroup/Vulkan-Headers.git
GIT_TAG v1.4.309)
FetchContent_Declare(volk
GIT_REPOSITORY https://github.com/zeux/volk.git
GIT_TAG 1.4.304)
FetchContent_Declare(VMA
GIT_REPOSITORY https://github.com/GPUOpen-LibrariesAndPatches/VulkanMemoryAllocator.git
GIT_TAG v3.2.1)
FetchContent_Declare(glfw
GIT_REPOSITORY https://github.com/glfw/glfw.git
GIT_TAG 3.4)
FetchContent_Declare(vk-bootstrap
GIT_REPOSITORY https://github.com/charles-lunarg/vk-bootstrap.git
GIT_TAG v1.4.309)
FetchContent_Declare(fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
GIT_TAG 11.0.2)
FetchContent_Declare(CLI11
GIT_REPOSITORY https://github.com/CLIUtils/CLI11.git
GIT_TAG v2.4.2)
FetchContent_Declare(glm
GIT_REPOSITORY https://github.com/g-truc/glm.git
GIT_TAG 1.0.1)
FetchContent_Declare(simdjson
GIT_REPOSITORY https://github.com/simdjson/simdjson.git
GIT_TAG v3.10.1)
# Vulkan headers first: vk-bootstrap and volk pick up Vulkan::Headers
FetchContent_MakeAvailable(VulkanHeaders)
FetchContent_MakeAvailable(volk VMA glfw vk-bootstrap fmt CLI11 glm simdjson)
target_link_libraries(volk PUBLIC Vulkan::Headers)
# No link-time dependency on libvulkan: functions come from volk
list(APPEND ENGINE_EXTRA_DEFINITIONS
VK_NO_PROTOTYPES
VMA_STATIC_VULKAN_FUNCTIONS=0
VMA_DYNAMIC_VULKAN_FUNCTIONS=1
)
else()
# Nix path (unchanged)
find_package( glfw3 REQUIRED )
find_package( glm REQUIRED )
find_package( VulkanMemoryAllocator CONFIG REQUIRED )
find_package( CLI11 REQUIRED )
find_package( simdjson REQUIRED )
endif()
# fastgltf because it's not in nixpkgs (declared after the switch above so it
# inherits BUILD_SHARED_LIBS)
FetchContent_Declare( FetchContent_Declare(
fastgltf fastgltf
GIT_REPOSITORY https://github.com/spnda/fastgltf.git GIT_REPOSITORY https://github.com/spnda/fastgltf.git
@ -63,28 +169,25 @@ FetchContent_Declare(
) )
FetchContent_MakeAvailable(fastgltf) FetchContent_MakeAvailable(fastgltf)
# Find all package dependencies # ---------------------------------------------------------------------------
find_package( glfw3 REQUIRED ) # Shader compilers (not needed when precompiled shaders are provided)
find_package( glm REQUIRED ) # ---------------------------------------------------------------------------
find_package( VulkanMemoryAllocator CONFIG REQUIRED ) if(NOT VULKANENGINE_PREBUILT_SHADERS)
find_package( CLI11 REQUIRED ) add_executable (glslang::validator IMPORTED)
find_package( simdjson REQUIRED ) find_program (
# Shader compilers
add_executable (glslang::validator IMPORTED)
find_program (
GLSLANG_VALIDATOR GLSLANG_VALIDATOR
"glslangValidator" "glslangValidator"
HINTS $ENV{VULKAN_SDK}/bin HINTS $ENV{VULKAN_SDK}/bin
REQUIRED REQUIRED
) )
set_property ( set_property (
TARGET glslang::validator TARGET glslang::validator
PROPERTY IMPORTED_LOCATION "${GLSLANG_VALIDATOR}" PROPERTY IMPORTED_LOCATION "${GLSLANG_VALIDATOR}"
) )
find_program(SLANGC_EXECUTABLE slangc HINTS $ENV{VULKAN_SDK}/bin REQUIRED) find_program(SLANGC_EXECUTABLE slangc HINTS $ENV{VULKAN_SDK}/bin REQUIRED)
endif()
# Helper functions to build shaders # Helper functions to build shaders
@ -130,7 +233,7 @@ endfunction()
# A function to automate executables aditions # A function to automate executables aditions
function ( addBinary BINARY_NAME ) function ( addBinary BINARY_NAME )
cmake_parse_arguments ( BINARY "IMGUI;LICENSE" "SOURCE" "SHADERS;SLANG_SHADERS;LIBS;TEXTURES;MODELS" ${ARGN} ) cmake_parse_arguments ( BINARY "IMGUI;LICENSE" "SOURCE" "SHADERS;SLANG_SHADERS;SLANG_ENTRIES;LIBS;TEXTURES;MODELS" ${ARGN} )
if (DEFINED BINARY_SOURCE) if (DEFINED BINARY_SOURCE)
add_executable ( ${BINARY_NAME} src/${BINARY_SOURCE}.cpp ) add_executable ( ${BINARY_NAME} src/${BINARY_SOURCE}.cpp )
endif() endif()
@ -156,7 +259,13 @@ function ( addBinary BINARY_NAME )
set_target_properties(${BINARY_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE) set_target_properties(${BINARY_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE)
message("Enabled LTO") message("Enabled LTO")
endif() endif()
set_target_properties(${BINARY_NAME} PROPERTIES CXX_SCAN_FOR_MODULES OFF)
# Portable: libstdc++/libgcc statically linked so the binary does not depend
# on the host's version. NOT done for bundle: the shared libs in lib/ use the
# system libstdc++, and mixing two copies in one process is asking for trouble.
if(VULKANENGINE_PORTABLE)
target_link_options(${BINARY_NAME} PRIVATE -static-libstdc++ -static-libgcc)
endif()
# Define VULKAN_HPP_HANDLE_ERROR_OUT_OF_DATE_AS_SUCCESS to treat VK_ERROR_OUT_OF_DATE_KHR as a success code # Define VULKAN_HPP_HANDLE_ERROR_OUT_OF_DATE_AS_SUCCESS to treat VK_ERROR_OUT_OF_DATE_KHR as a success code
target_compile_definitions ( target_compile_definitions (
@ -166,6 +275,7 @@ function ( addBinary BINARY_NAME )
$<$<CONFIG:Debug>:DEBUG> # So CMAKE expose a #define DEBUG for debug builds $<$<CONFIG:Debug>:DEBUG> # So CMAKE expose a #define DEBUG for debug builds
# Exposes versions # Exposes versions
BUILD_ID="${ENGINE_VERSION}" BUILD_ID="${ENGINE_VERSION}"
${ENGINE_EXTRA_DEFINITIONS}
) )
if(BINARY_IMGUI) if(BINARY_IMGUI)
@ -186,6 +296,11 @@ function ( addBinary BINARY_NAME )
${CMAKE_SOURCE_DIR}/include/imgui/backends/imgui_impl_glfw.cpp ${CMAKE_SOURCE_DIR}/include/imgui/backends/imgui_impl_glfw.cpp
${CMAKE_SOURCE_DIR}/include/imgui/backends/imgui_impl_vulkan.cpp ${CMAKE_SOURCE_DIR}/include/imgui/backends/imgui_impl_vulkan.cpp
) )
# imgui's Vulkan backend must use volk when there is no linked loader
if(VULKANENGINE_FETCH_DEPS)
target_compile_definitions(${BINARY_NAME} PRIVATE IMGUI_IMPL_VULKAN_USE_VOLK)
endif()
endif() endif()
@ -196,6 +311,15 @@ function ( addBinary BINARY_NAME )
if(DEFINED BINARY_SHADERS) if(DEFINED BINARY_SHADERS)
set(SHADER_OUTPUT_DIR ${CMAKE_BINARY_DIR}/${BINARY_NAME}/shaders) set(SHADER_OUTPUT_DIR ${CMAKE_BINARY_DIR}/${BINARY_NAME}/shaders)
if(VULKANENGINE_PREBUILT_SHADERS)
# Copy the .spv produced by the Nix job instead of compiling them
file(GLOB PREBUILT_SPV CONFIGURE_DEPENDS "${VULKANENGINE_PREBUILT_SHADERS}/*.spv")
if(NOT PREBUILT_SPV)
message(FATAL_ERROR "No .spv found in ${VULKANENGINE_PREBUILT_SHADERS}")
endif()
file(COPY ${PREBUILT_SPV} DESTINATION ${SHADER_OUTPUT_DIR})
else()
set(ALL_SPV_FILES "") set(ALL_SPV_FILES "")
set(EXPANDED_SHADERS "") set(EXPANDED_SHADERS "")
@ -225,9 +349,10 @@ function ( addBinary BINARY_NAME )
add_custom_target(shaders_${BINARY_NAME} DEPENDS ${ALL_SPV_FILES}) add_custom_target(shaders_${BINARY_NAME} DEPENDS ${ALL_SPV_FILES})
add_dependencies(${BINARY_NAME} shaders_${BINARY_NAME}) add_dependencies(${BINARY_NAME} shaders_${BINARY_NAME})
endif() endif()
endif()
if (DEFINED BINARY_LIBS) if (DEFINED BINARY_LIBS)
target_link_libraries ( ${BINARY_NAME} ${BINARY_LIBS} ) target_link_libraries ( ${BINARY_NAME} PRIVATE ${BINARY_LIBS} )
endif() endif()
if (DEFINED BINARY_MODELS) # Adds the 3D models in the binary folder if (DEFINED BINARY_MODELS) # Adds the 3D models in the binary folder
@ -260,8 +385,9 @@ function ( addBinary BINARY_NAME )
endfunction() endfunction()
# Adds the main binary # ---------------------------------------------------------------------------
# Binaries
# ---------------------------------------------------------------------------
list( list(
APPEND APPEND
lib_list lib_list
@ -269,11 +395,24 @@ list(
glfw glfw
fmt fmt
vk-bootstrap vk-bootstrap
#Vulkan::UtilityHeaders
vulkan
CLI11::CLI11 CLI11::CLI11
fastgltf fastgltf
) )
if(VULKANENGINE_FETCH_DEPS)
# No libvulkan at link time: volk loads libvulkan.so.1 at runtime.
# Remove what your code does not use (simdjson, glm...).
list(APPEND lib_list
volk
Vulkan::Headers
GPUOpen::VulkanMemoryAllocator
glm::glm-header-only
simdjson::simdjson
)
else()
list(APPEND lib_list vulkan)
endif()
addBinary ( addBinary (
engine engine
SOURCE Engine/main SOURCE Engine/main
@ -291,3 +430,26 @@ addBinary (
server server
SOURCE Server/main SOURCE Server/main
) )
# ---------------------------------------------------------------------------
# Install (used for portable / bundle packaging)
# dist/bin/{engine,server,shaders,models,textures}
# dist/lib/*.so* (bundle only)
# dist/LICENSE
# Never bundled: libc, libstdc++, libvulkan, GL, X11, Wayland.
# ---------------------------------------------------------------------------
install(TARGETS engine server RUNTIME DESTINATION bin)
install(DIRECTORY ${CMAKE_BINARY_DIR}/engine/shaders DESTINATION bin OPTIONAL)
install(DIRECTORY ${CMAKE_BINARY_DIR}/engine/models DESTINATION bin OPTIONAL)
install(DIRECTORY ${CMAKE_BINARY_DIR}/engine/textures DESTINATION bin OPTIONAL)
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION .)
if(VULKANENGINE_BUNDLE)
# Every shared lib built from fetched deps (glfw, fmt, fastgltf and its own
# simdjson, ...) with its symlinks. libstdc++ etc. are not built here.
install(DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/
DESTINATION lib
USE_SOURCE_PERMISSIONS
FILES_MATCHING PATTERN "*.so*"
)
endif()