Use CMake FetchContent to pull tracy sources and build it if frame tracing is enabled. As frame tracing requires annotations in the code, create a wrapper that replaces them with our own defines that are empty when tracing is not enabled.
54 lines
1.1 KiB
CMake
54 lines
1.1 KiB
CMake
cmake_minimum_required(VERSION 3.14)
|
|
project(raycasting)
|
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
|
|
|
# Detect and add SFML
|
|
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules" ${CMAKE_MODULE_PATH})
|
|
find_package(SFML COMPONENTS system window graphics network audio REQUIRED)
|
|
|
|
if(NOT SFML_FOUND)
|
|
message(FATAL_ERROR "SFML could not be found")
|
|
endif()
|
|
|
|
set(LIBS
|
|
sfml-window
|
|
sfml-graphics)
|
|
|
|
find_package(ImGui QUIET)
|
|
find_package(ImGui-SFML QUIET)
|
|
|
|
if(NOT ImGui_FOUND OR NOT ImGui-SFML_FOUND OR NO_IMGUI)
|
|
message("*Not* building with ImGui")
|
|
else ()
|
|
message("Building with ImGui")
|
|
add_compile_definitions(IMGUI)
|
|
set(LIBS ${LIBS}
|
|
ImGui-SFML::ImGui-SFML)
|
|
endif()
|
|
|
|
if(TRACE_FRAMES)
|
|
message("Building with Tracy")
|
|
add_compile_definitions(TRACE_FRAMES)
|
|
|
|
include(FetchContent)
|
|
FetchContent_Declare(
|
|
Tracy
|
|
GIT_REPOSITORY https://github.com/wolfpld/tracy.git
|
|
GIT_TAG d46ffb4e9f132fc95bdd7d04207d8d669a9d4100
|
|
)
|
|
FetchContent_MakeAvailable(Tracy)
|
|
|
|
set(LIBS ${LIBS}
|
|
TracyClient)
|
|
endif()
|
|
|
|
add_compile_options(-Wall -Wextra)
|
|
|
|
add_executable(raycasting
|
|
main.cpp
|
|
Player.cpp
|
|
World.cpp
|
|
)
|
|
|
|
target_link_libraries(raycasting ${LIBS})
|