Skip to content
Merged
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
3 changes: 0 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
*.cs linguist-detectable=true linguist-language=C#
*.axaml linguist-detectable=true linguist-language=C#

# Rust
*.rs linguist-detectable=true linguist-language=Rust

# Lua
*.lua linguist-detectable=true linguist-language=Lua
*.d.lua linguist-detectable=true linguist-language=Lua
Expand Down
9 changes: 0 additions & 9 deletions .github/workflows/ci-build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ jobs:
with:
dotnet-version: "10.0.x"

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable

- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1

Expand Down Expand Up @@ -81,9 +78,6 @@ jobs:
with:
dotnet-version: "10.0.x"

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable

- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1

Expand Down Expand Up @@ -125,9 +119,6 @@ jobs:
with:
dotnet-version: "10.0.x"

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable

- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1

Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/ci-linux-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ jobs:
env:
TRACY_NO_INVARIANT_CHECK: "1"
run: nix develop --command bash -c "
rustup toolchain install stable --no-self-update &&
rustup default stable &&
cmake -B build -G Ninja
-DCMAKE_C_COMPILER=gcc
-DCMAKE_CXX_COMPILER=g++
Expand Down Expand Up @@ -68,8 +66,6 @@ jobs:

- name: Configure and run clang-tidy
run: nix develop --command bash -c "
rustup toolchain install stable --no-self-update &&
rustup default stable &&
cmake -B build -G Ninja
-DCMAKE_C_COMPILER=gcc
-DCMAKE_CXX_COMPILER=g++
Expand Down
16 changes: 5 additions & 11 deletions .github/workflows/ci-linux-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ jobs:
env:
TRACY_NO_INVARIANT_CHECK: "1"
run: nix develop --command bash -c "
rustup toolchain install stable --no-self-update &&
rustup default stable &&
cmake -B build -G Ninja
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }}
Expand Down Expand Up @@ -89,8 +87,6 @@ jobs:

- name: Configure and run clang-tidy
run: nix develop --command bash -c "
rustup toolchain install stable --no-self-update &&
rustup default stable &&
cmake -B build -G Ninja
-DCMAKE_C_COMPILER=gcc
-DCMAKE_CXX_COMPILER=g++
Expand All @@ -102,12 +98,12 @@ jobs:
bash ./tools/ci/clang_tidy.sh build
"

cargo-reflection-generator:
name: Cargo reflection_generator (${{ matrix.build_type }})
dotnet-reflection-generator:
name: Dotnet reflection_generator (${{ matrix.build_type }})
runs-on: [self-hosted, Linux, X64]
strategy:
matrix:
build_type: [debug, release]
build_type: [Debug, Release]
fail-fast: false
steps:
- name: Checkout PR branch
Expand All @@ -121,10 +117,8 @@ jobs:
- name: Install Nix
uses: cachix/install-nix-action@v31.10.6

- name: Cargo build
env:
RELEASE_FLAG: ${{ matrix.build_type == 'release' && '--release' || '' }}
run: nix develop --command bash -c "rustup toolchain install stable --no-self-update && rustup default stable && cargo build --manifest-path tools/reflection_generator/Cargo.toml $RELEASE_FLAG"
- name: Dotnet build and test
run: nix develop --command bash -c 'dotnet build tools/reflection_generator/reflection_generator.csproj --configuration ${{ matrix.build_type }} && dotnet test tools/reflection_generator/tests/ReflectionGenerator.Tests --configuration ${{ matrix.build_type }}'

dotnet-editor:
name: Dotnet editor (${{ matrix.build_type }})
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ CMakeUserPresets.json
**.sln
vsxmake**/
vs**/
Cargo.lock
*.user

# exclusions
!/tests/**
!/toast/src/**

!/tools/reflection_generator/build.rs
**/imgui.ini
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
cmake_minimum_required(VERSION 3.28)
set(VCPKG_APPLOCAL_DEPS OFF)
project(engine)

include(cmake/runtime_dlls.cmake)

include(CTest)

set(CMAKE_CXX_STANDARD 23)
Expand Down
74 changes: 13 additions & 61 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
"name": "windows",
"hidden": true,
"inherits": "vcpkg",
"cacheVariables": {
"CMAKE_C_COMPILER": "cl",
"CMAKE_CXX_COMPILER": "cl"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
Expand All @@ -36,74 +40,34 @@
{
"name": "win-debug",
"displayName": "Debug",
"description": "Visual Studio, MSVC, Debug",
"description": "Ninja, MSVC, Debug",
"inherits": "windows",
"generator": "Visual Studio 18 2026",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/Debug",
"cacheVariables": {
"CMAKE_CONFIGURATION_TYPES": "Debug"
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "win-release",
"displayName": "Release",
"description": "Visual Studio, MSVC, Release",
"description": "Ninja, MSVC, Release",
"inherits": "windows",
"generator": "Visual Studio 18 2026",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/Release",
"cacheVariables": {
"CMAKE_CONFIGURATION_TYPES": "Release"
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "win-relwithdebinfo",
"displayName": "RelWithDebInfo",
"description": "Visual Studio, MSVC, Release with debug information",
"inherits": "windows",
"generator": "Visual Studio 18 2026",
"binaryDir": "${sourceDir}/build/RelWithDebInfo",
"cacheVariables": {
"CMAKE_CONFIGURATION_TYPES": "RelWithDebInfo"
}
},
{
"name": "win-ninja",
"displayName": "Ninja",
"description": "Ninja, MSVC, Debug",
"description": "Ninja, MSVC, Release with debug information",
"inherits": "windows",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/Debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_C_COMPILER": "cl",
"CMAKE_CXX_COMPILER": "cl"
}
},
{
"name": "winja-rwd",
"displayName": "Ninja",
"description": "Ninja, MSVC, Debug",
"inherits": "windows",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/ReleaseWithDebInfo",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"CMAKE_C_COMPILER": "cl",
"CMAKE_CXX_COMPILER": "cl"
}
},
{
"name": "win-ninja-gcc",
"displayName": "Ninja (gcc)",
"description": "Ninja, GCC, Debug",
"inherits": "windows",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/Mingw",
"binaryDir": "${sourceDir}/build/RelWithDebInfo",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_C_COMPILER": "gcc",
"CMAKE_CXX_COMPILER": "g++",
"VCPKG_TARGET_TRIPLET": "x64-mingw-dynamic"
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
},
{
Expand Down Expand Up @@ -199,18 +163,6 @@
"configurePreset": "win-relwithdebinfo",
"configuration": "RelWithDebInfo"
},
{
"name": "win-ninja",
"displayName": "Ninja",
"inherits": "windows-build",
"configurePreset": "win-ninja"
},
{
"name": "win-ninja-gcc",
"displayName": "Ninja (gcc)",
"inherits": "windows-build",
"configurePreset": "win-ninja-gcc"
},
{
"name": "linux-debug",
"displayName": "Debug",
Expand Down
24 changes: 4 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,19 @@ Credits:
### Prerequisites
- CMake >=3.24
- A C++23 compiler (VS18 and GCC15 tested)
- Rustc and Cargo
- C# .NET10 toolchain
- C# .NET8 toolchain
- VCPKG with `VCPKG_ROOT` set up in PATH

### Generation

Powershell
```pwsh
cmake -B build/Debug -G "Visual Studio 18 2026" -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"
cmake --template win-relwithdebinfo
```

Linux
```bash
cmake -B build/Debug -G "Visual Studio 18 2026" -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"
cmake --template linux-relwithdebinfo
```

Or using the Nix flake
Expand All @@ -40,11 +39,7 @@ cmake-gen
### Build

```bash
cmake --build ./build/Debug
```

```bash
dotnet run --project editor
cmake --build --template win-relwithdebinfo --target editor
```

Or using the Nix flake
Expand All @@ -57,14 +52,3 @@ cmake-build
```bash
ctest --test-dir build/Debug -C Debug
```

## Other tooling

To properly install `kenzo` on release and be properly accessible through your entire
computer run the following command:

```bash
cargo install --git https://github.com/nullptr-studios/toast-engine.git --branch main kenzo
```

It's even faster than running the Release version you make through Cargo!
41 changes: 15 additions & 26 deletions cmake/codegen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,39 +48,28 @@ macro(run_codegen)
set(_cfg "Debug")
endif()
if(_cfg STREQUAL "Release" OR _cfg STREQUAL "RelWithDebInfo" OR _cfg STREQUAL "MinSizeRel")
set(_profile_dir "release")
set(_profile_flag "release")
set(_dotnet_config "Release")
else()
set(_profile_dir "debug")
set(_profile_flag "dev")
set(_dotnet_config "Debug")
endif()
set(_refgen_cargo_dir "${OUTPUT_ROOT}/${_cfg}/cargo")
set(_refgen_dir "${OUTPUT_ROOT}/${_cfg}/reflection_generator")

find_program(CARGO cargo REQUIRED)
find_program(DOTNET dotnet REQUIRED)
execute_process(
COMMAND ${CARGO} build --profile "${_profile_flag}" --target-dir "${_refgen_cargo_dir}"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/tools/reflection_generator"
RESULT_VARIABLE _cargo_result
ERROR_VARIABLE _cargo_error
COMMAND ${DOTNET} msbuild -restore "${CMAKE_SOURCE_DIR}/tools/reflection_generator/reflection_generator.csproj"
-property:Configuration=${_dotnet_config} "-property:OutputPath=${_refgen_dir}/" -property:_CommandLineDefinedOutputPath=true -nologo -verbosity:quiet -consoleloggerparameters:NoSummary
RESULT_VARIABLE _dotnet_result
OUTPUT_VARIABLE _dotnet_output
ERROR_VARIABLE _dotnet_error
)
if(NOT _cargo_result EQUAL 0)
message(FATAL_ERROR "Failed to build reflection_generator:\n${_cargo_error}")
if(NOT _dotnet_result EQUAL 0)
# msbuild reports compile errors on stdout
message(FATAL_ERROR "Failed to build reflection_generator:\n${_dotnet_output}\n${_dotnet_error}")
endif()

set(_bin "reflection_generator${CMAKE_EXECUTABLE_SUFFIX}")
set(_direct "${_refgen_cargo_dir}/${_profile_dir}/${_bin}")
if(EXISTS "${_direct}")
set(REFLECTION_GENERATOR "${_direct}")
else()
file(GLOB _cands "${_refgen_cargo_dir}/*/${_profile_dir}/${_bin}")
if(NOT _cands)
message(FATAL_ERROR
"reflection_generator binary not found.\n"
"Searched:\n"
" ${_refgen_cargo_dir}/${_profile_dir}/${_bin}\n"
" ${_refgen_cargo_dir}/*/${_profile_dir}/${_bin}")
endif()
list(GET _cands 0 REFLECTION_GENERATOR)
set(REFLECTION_GENERATOR "${_refgen_dir}/reflection_generator${CMAKE_EXECUTABLE_SUFFIX}")
if(NOT EXISTS "${REFLECTION_GENERATOR}")
message(FATAL_ERROR "reflection_generator binary not found at ${REFLECTION_GENERATOR}")
endif()

message(STATUS "Using reflection_generator: ${REFLECTION_GENERATOR}")
Expand Down
33 changes: 0 additions & 33 deletions cmake/install_cargo_output.cmake

This file was deleted.

16 changes: 16 additions & 0 deletions cmake/runtime_dlls.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
function(toast_copy_runtime_dlls target)
if (WIN32)
set(_vcpkg_prefix "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}")
file(GLOB _vcpkg_dlls_debug CONFIGURE_DEPENDS "${_vcpkg_prefix}/debug/bin/*.dll")
file(GLOB _vcpkg_dlls_release CONFIGURE_DEPENDS "${_vcpkg_prefix}/bin/*.dll")
add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_RUNTIME_DLLS:${target}>
"$<$<CONFIG:Debug>:${_vcpkg_dlls_debug}>"
"$<$<NOT:$<CONFIG:Debug>>:${_vcpkg_dlls_release}>"
$<TARGET_FILE_DIR:${target}>
COMMAND_EXPAND_LISTS
VERBATIM
)
endif ()
endfunction()
Loading
Loading