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) elseif(CMAKE_BUILD_TYPE STREQUAL "Debug") message(STATUS "Targeting Debug build") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ./debug) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ./debug) 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) add_subdirectory(../glfw ../glfw/build) include_directories(./dep ./include ../glfw/include ../glad/include) set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) if(NB_BUILD_TESTS) message(STATUS "Building tests") include(FetchContent) FetchContent_Declare( gtest URL https://github.com/google/googletest/archive/refs/tags/release-1.12.1.zip ) if (WIN32) set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) FetchContent_MakeAvailable(gtest) endif() include(GoogleTest) 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)