diff --git a/CMakeLists.txt b/CMakeLists.txt index b313eb9..8622d1d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,13 +2,24 @@ cmake_minimum_required(VERSION 3.10) project(NBEngine VERSION 0.1.0 LANGUAGES C CXX) if(CMAKE_BUILD_TYPE STREQUAL "Release") + message(STATUS "Targeting Release build") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ./release) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ./release) -endif() -if(CMAKE_BUILD_TYPE STREQUAL "Debug") +elseif(CMAKE_BUILD_TYPE STREQUAL "Debug") + message(STATUS "Targeting Debug build") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ./debug) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ./debug) - add_compile_definitions(_NB_GL_DEBUG_ON) + set(NB_LOGGING ON) + set(NB_BUILD_TESTS ON) + add_compile_definitions(_NB_DEBUG) +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + message(STATUS "Building for Windows") + set(NB_TARGET_WINDOWS ON) +elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") + message(STATUS "Building for Linux") + set(NB_TARGET_LINUX ON) endif() find_package(OpenGL) @@ -20,9 +31,8 @@ set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) -set(BUILD_TESTS) - -if (BUILD_TESTS) +if(NB_BUILD_TESTS) + message(STATUS "Building tests") include(FetchContent) FetchContent_Declare( gtest @@ -36,4 +46,15 @@ if (BUILD_TESTS) set(GTEST_COLOR ON) endif() +if (NB_LOGGING) + message(STATUS "Building with automatic logging") + add_compile_definitions(_NB_AUTO_LOG) +endif() + +if (NB_TARGET_WINDOWS) + add_compile_definitions(_TARGET_WINDOWS) +elseif (NB_TARGET_LINUX) + add_compile_definitions(_TARGET_LINUX) +endif() + add_subdirectory(./engine) diff --git a/engine/NBCore/CMakeLists.txt b/engine/NBCore/CMakeLists.txt index efd9e30..b65e891 100644 --- a/engine/NBCore/CMakeLists.txt +++ b/engine/NBCore/CMakeLists.txt @@ -4,4 +4,6 @@ add_library(NBCore ./src/Errors.cpp ) -add_subdirectory(./tests) \ No newline at end of file +if (NB_BUILD_TESTS) + add_subdirectory(./tests) +endif() \ No newline at end of file