release build setup

This commit is contained in:
Till Wübbers
2025-03-16 02:00:33 +01:00
parent 442fd23a0b
commit ebf29b058a
9 changed files with 28 additions and 10 deletions

3
src/.gitignore vendored
View File

@@ -33,5 +33,6 @@
# build dirs # build dirs
cmake-build/ cmake-build/
cmake-build-release/
out/ out/
.vs/ .vs/

View File

@@ -2,17 +2,17 @@ cmake_minimum_required(VERSION 3.10)
project(PuzGameProj) project(PuzGameProj)
if (MSVC) if (MSVC)
else() else()
add_compile_options(-g -gcodeview) add_compile_options(-g -gcodeview)
add_link_options(-fuse-ld=lld -g -Wl,--pdb=) add_link_options(-fuse-ld=lld -g -Wl,--pdb=)
endif() endif()
add_compile_definitions("$<$<CONFIG:DEBUG>:DEBUG>")
# set the output directory for built objects. # set the output directory for built objects.
# This makes sure that the dynamic library goes into the build directory automatically. # This makes sure that the dynamic library goes into the build directory automatically.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$<CONFIGURATION>") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$<CONFIGURATION>")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$<CONFIGURATION>") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$<CONFIGURATION>")
set(PROFILE ON)
# Imgui # Imgui
file(GLOB imgui_sources dependency/imgui/*.h dependency/imgui/*.cpp) file(GLOB imgui_sources dependency/imgui/*.h dependency/imgui/*.cpp)
@@ -27,7 +27,6 @@ file(GLOB_RECURSE sources_engine engine/*.cpp engine/*.h)
add_executable(PuzGameEngine ${sources_engine}) add_executable(PuzGameEngine ${sources_engine})
target_compile_definitions(PuzGameEngine PUBLIC "_AMD64_") target_compile_definitions(PuzGameEngine PUBLIC "_AMD64_")
set_property(TARGET PuzGameEngine PROPERTY CXX_STANDARD 17) set_property(TARGET PuzGameEngine PROPERTY CXX_STANDARD 17)
target_include_directories(PuzGameEngine PUBLIC dependency/tracy/public/)
# Game # Game
add_custom_command( add_custom_command(
@@ -42,10 +41,11 @@ file(GLOB source_singleheader dependency/tinygltf/stb_image.h dependency/tinyglt
add_library(PuzGame SHARED ${sources_game} ${source_singleheader} ${imgui_sources} ${imgui_backend_sdl}) add_library(PuzGame SHARED ${sources_game} ${source_singleheader} ${imgui_sources} ${imgui_backend_sdl})
set_property(TARGET PuzGame PROPERTY CXX_STANDARD 17) set_property(TARGET PuzGame PROPERTY CXX_STANDARD 17)
target_include_directories(PuzGame PUBLIC dependency/imgui) target_include_directories(PuzGame PUBLIC dependency/imgui)
target_include_directories(PuzGame PUBLIC dependency/tracy/public/)
# Profiling # Profiling
if (PROFILE) option(TRACY_ENABLE "" OFF)
option(TRACY_ENABLE "" ON) if (TRACY_ENABLE)
option(TRACY_ON_DEMAND "" ON) option(TRACY_ON_DEMAND "" ON)
set(TRACY_DELAYED_INIT ON) set(TRACY_DELAYED_INIT ON)
set(TRACY_MANUAL_LIFETIME ON) set(TRACY_MANUAL_LIFETIME ON)
@@ -61,6 +61,11 @@ SET(BGFX_BUILD_EXAMPLES OFF)
add_subdirectory("${CMAKE_SOURCE_DIR}/dependency/bgfx.cmake") add_subdirectory("${CMAKE_SOURCE_DIR}/dependency/bgfx.cmake")
# Link # Link
if (TRACY_ENABLE)
target_link_libraries(PuzGame bx bimg bgfx SDL3::SDL3 Tracy::TracyClient) target_link_libraries(PuzGame bx bimg bgfx SDL3::SDL3 Tracy::TracyClient)
target_link_libraries(PuzGameEngine bx SDL3::SDL3 Tracy::TracyClient) target_link_libraries(PuzGameEngine bx SDL3::SDL3 Tracy::TracyClient)
else()
target_link_libraries(PuzGame bx bimg bgfx SDL3::SDL3)
target_link_libraries(PuzGameEngine bx SDL3::SDL3)
endif()
set_target_properties(PuzGame PROPERTIES OUTPUT_NAME "PuzGame2") set_target_properties(PuzGame PROPERTIES OUTPUT_NAME "PuzGame2")

1
src/build-release.bat Normal file
View File

@@ -0,0 +1 @@
cmake --build cmake-build-release

View File

@@ -1,4 +1,6 @@
cd dependency/bgfx.cmake cd dependency/bgfx.cmake
cmake -G "Ninja" -S . -B cmake-build -DCMAKE_C_COMPILER="clang.exe" -DCMAKE_CXX_COMPILER="clang++.exe" -DBGFX_BUILD_TOOLS=OFF -DBGFX_BUILD_EXAMPLES=OFF cmake -G "Ninja" -S . -B cmake-build -DCMAKE_C_COMPILER="clang.exe" -DCMAKE_CXX_COMPILER="clang++.exe" -DBGFX_BUILD_TOOLS=OFF -DBGFX_BUILD_EXAMPLES=OFF
cmake -G "Ninja" -S . -B cmake-build-release -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="clang.exe" -DCMAKE_CXX_COMPILER="clang++.exe" -DBGFX_BUILD_TOOLS=OFF -DBGFX_BUILD_EXAMPLES=OFF
cd ..\.. cd ..\..
cmake -G "Ninja" -S . -B cmake-build -DCMAKE_C_COMPILER="clang.exe" -DCMAKE_CXX_COMPILER="clang++.exe" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON cmake -G "Ninja" -S . -B cmake-build -DCMAKE_C_COMPILER="clang.exe" -DCMAKE_CXX_COMPILER="clang++.exe" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cmake -G "Ninja" -S . -B cmake-build-release -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="clang.exe" -DCMAKE_CXX_COMPILER="clang++.exe" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON

View File

@@ -15,7 +15,7 @@
#include <SDL3/SDL.h> #include <SDL3/SDL.h>
#include <bx/math.h> #include <bx/math.h>
#include <cstdint> #include <cstdint>
#include <tracy/tracy.hpp> #include <tracy/Tracy.hpp>
namespace Game namespace Game
{ {

View File

@@ -7,8 +7,10 @@
#include "bx/bx.h" #include "bx/bx.h"
#include "bx/timer.h" #include "bx/timer.h"
#ifdef TRACY_ENABLE
#include <client/TracyProfiler.hpp> #include <client/TracyProfiler.hpp>
#include <tracy/tracy.hpp> #endif
#include <tracy/Tracy.hpp>
namespace Game namespace Game
{ {
@@ -26,7 +28,10 @@ namespace Game
void Setup(SharedData& shared) void Setup(SharedData& shared)
{ {
LOG("Game Setup Start!"); LOG("Game Setup Start!");
#ifdef TRACY_ENABLE
LOG("Tracy is enabled");
tracy::StartupProfiler(); tracy::StartupProfiler();
#endif
if (shared.Game.PermanentStorage == nullptr) if (shared.Game.PermanentStorage == nullptr)
{ {
@@ -89,6 +94,8 @@ namespace Game
{ {
LOG("Shutdown"); LOG("Shutdown");
SetupInstance.Rendering.Shutdown(); SetupInstance.Rendering.Shutdown();
#ifdef TRACY_ENABLE
tracy::ShutdownProfiler(); tracy::ShutdownProfiler();
#endif
} }
} // namespace Game } // namespace Game

View File

@@ -342,7 +342,9 @@ namespace Game
bgfx::Init init; bgfx::Init init;
init.type = bgfx::RendererType::Direct3D12; init.type = bgfx::RendererType::Direct3D12;
#ifdef _DEBUG
init.debug = true; init.debug = true;
#endif
init.platformData.nwh = shared.Window.Handle; init.platformData.nwh = shared.Window.Handle;
init.platformData.ndt = nullptr; init.platformData.ndt = nullptr;
init.platformData.type = bgfx::NativeWindowHandleType::Default; init.platformData.type = bgfx::NativeWindowHandleType::Default;

View File

@@ -105,7 +105,7 @@ namespace Game
Model Models[MaxModels]; Model Models[MaxModels];
int32_t LastWidth = 0; int32_t LastWidth = 0;
int32_t LastHeight = 0; int32_t LastHeight = 0;
uint32_t ResetFlags = 0; // BGFX_RESET_VSYNC; uint32_t ResetFlags = BGFX_RESET_NONE;
uint16_t MainViewID = 10; uint16_t MainViewID = 10;
float LastShaderLoadTime = 0.0f; float LastShaderLoadTime = 0.0f;
int32_t DitherRecursion = 1; int32_t DitherRecursion = 1;