cmake_minimum_required(VERSION 3.13) project(ProjectBrussel LANGUAGES C CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() include(buildtools/cmake/RTTI.cmake) find_package(OpenGL REQUIRED) add_subdirectory(3rdparty/glfw) add_subdirectory(3rdparty/glm) add_subdirectory(3rdparty/imgui) add_subdirectory(3rdparty/imguicolortextedit) add_subdirectory(3rdparty/tracy) # ============================================================================== file(GLOB_RECURSE things_common_SOURCES source-common/*.c source-common/*.cpp) add_library(things_common OBJECT ${things_common_SOURCES}) set_target_properties(things_common PROPERTIES CXX_STANDARD 20 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF # Many files include platform headers, we don't want to leak them - it's just simpler to disable unity build for everything UNITY_BUILD OFF ) target_include_directories(things_common PUBLIC source-common) target_link_libraries(things_common PUBLIC # External dependencies ${CONAN_LIBS} glm::glm ) # ============================================================================== # NOTE: delibrately not recursive, see README.md in the folder for details file(GLOB codegen_SOURCES buildtools/codegen/*.c buildtools/codegen/*.cpp) add_executable(codegen ${codegen_SOURCES}) set_target_properties(codegen PROPERTIES CXX_STANDARD 20 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF UNITY_BUILD OFF ) target_link_libraries(codegen PRIVATE # External dependencies ${CONAN_LIBS} # Project internal components things_common ) target_flag_rtti(codegen OFF) # ============================================================================== file(GLOB_RECURSE things_codegen_base_SOURCES source-common/*.c source-common/*.cpp) add_library(things_codegen_base OBJECT ${things_codegen_base_SOURCES}) set_target_properties(things_common PROPERTIES CXX_STANDARD 20 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF ) target_include_directories(things_codegen_base PUBLIC source-codegen-base) target_link_libraries(things_codegen_base PUBLIC # External dependencies ${CONAN_LIBS} # Project internal components things_common ) # ============================================================================== # add_executable requires at least one source file add_executable(${PROJECT_NAME} dummy.c) add_subdirectory(source) set_target_properties(${PROJECT_NAME} PROPERTIES UNITY_BUILD_MODE BATCH UNITY_BUILD_UNIQUE_ID "${PROJECT_NAME}_UNITY_ID" ) set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 20 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF ) target_compile_definitions(${PROJECT_NAME} PRIVATE RAPIDJSON_HAS_STDSTRING=1 IMGUI_DISABLE_OBSOLETE_FUNCTIONS BRUSSEL_DEV_ENV=1 ) target_include_directories(${PROJECT_NAME} PRIVATE sources ) target_link_libraries(${PROJECT_NAME} PRIVATE # External dependencies ${CONAN_LIBS} OpenGL::GL glfw glm::glm imgui ImGuiColorTextEdit tracy # Project internal components things_common things_metadata ) option(BRUSSEL_ENABLE_PROFILING "Whether profiling support is enabled or not." OFF) if(BRUSSEL_ENABLE_PROFILING) target_compile_definitions(${PROJECT_NAME} PRIVATE TRACY_ENABLE ) endif() option(BRUSSEL_ENABLE_EDITOR "Enable editor support or not." ON) if(BRUSSEL_ENABLE_EDITOR) target_compile_definitions(${PROJECT_NAME} PRIVATE BRUSSEL_ENABLE_EDITOR=1 ) endif() option(BRUSSEL_ENABLE_ASAN "Enable AddressSanitizer or not." OFF) if(BRUSSEL_ENABLE_ASAN) target_compile_options(${PROJECT_NAME} PRIVATE -fsanitize=address -fno-omit-frame-pointer ) target_link_options(${PROJECT_NAME} PRIVATE -fsanitize=address -fno-omit-frame-pointer ) endif()