cmake_minimum_required(VERSION 3.26)

project(Bigfoot VERSION 0.1.0
                DESCRIPTION "The Bigfoot engine"
                LANGUAGES CXX)

set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)

get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
set(CMAKE_CONFIGURATION_TYPES "Release;RelWithDebInfo;Debug" CACHE STRING "" FORCE)

option(BUILD_TESTS OFF)
option(BUILD_BENCHMARKS OFF)
option(ASAN OFF)
option(COVERAGE OFF)
option(TRACY ON)
option(VULKAN ON)

set(AUTO_GENERATED_COMMENT "// AUTO-GENERATED DO NOT TOUCH")

include(${CMAKE_SOURCE_DIR}/CMake/CustomTargets.cmake)
include(${CMAKE_SOURCE_DIR}/CMake/FindDependencies.cmake)
include(${CMAKE_SOURCE_DIR}/CMake/Utils.cmake)
include(${CMAKE_SOURCE_DIR}/CMake/Package.cmake)

find_program(FLATBUFFERS_FLATC_EXECUTABLE NAMES flatc)
find_program(SQLITE3_EXECUTABLE NAMES sqlite3)
find_program(MINJECT_EXECUTABLE NAMES minject)
find_program(BIN2CPP_EXECUTABLE NAMES Bin2CPP)

bigfoot_remove_default_exception_flags()

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_OPTIMIZE_DEPENDENCIES 1)

if(BUILD_TESTS)
    enable_testing()
endif()

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

SET(CMAKE_SKIP_BUILD_RPATH  FALSE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
SET(CMAKE_INSTALL_RPATH "\${ORIGIN}")

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/Bigfoot/Sources)
if(${BUILD_TESTS})
    add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/Bigfoot/Tests)
endif()

add_custom_target(NatVis SOURCES 
    ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/NatVis/EASTL/EASTL.natvis
    ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/NatVis/VulkanHpp/VulkanHpp.natvis
    ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/NatVis/GLM/GLM.natvis)