cmake_minimum_required(VERSION 3.28)

set(CMAKE_CXX_STANDARD 20)

set(PROJECT_EXECUTABLE_NAME open_engine)

project(OpenEngine
    VERSION 0.0.1
)

add_definitions( -DOE_ENABLE_ASSERTS )

find_package(imgui REQUIRED)

file(GLOB_RECURSE SRC_FILES "src/*.cpp")
add_library(${PROJECT_EXECUTABLE_NAME} STATIC
    ${SRC_FILES}
    "vendor/stb_image/stb_image.cpp"
)

target_precompile_headers(${PROJECT_EXECUTABLE_NAME} PRIVATE
    include/open_engine/pch.hpp
)

target_include_directories(${PROJECT_EXECUTABLE_NAME} PRIVATE
    "${CMAKE_CURRENT_SOURCE_DIR}/include/open_engine"
    "${CMAKE_CURRENT_SOURCE_DIR}/vendor/stb_image"
)

target_include_directories(${PROJECT_EXECUTABLE_NAME} PUBLIC
    "${CMAKE_CURRENT_SOURCE_DIR}/include"
    "/home/erris/.conan2/p/b/imguic69fe98538919/p/include"
)

#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
#set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -fsanitize=address")

target_link_libraries(${PROJECT_EXECUTABLE_NAME} PUBLIC
    imgui::imgui
    spdlog
    glad
    glfw
    glm
    dl
    X11
)

#target_link_directories(${PROJECT_EXECUTABLE_NAME} PRIVATE
#    ${PROJECT_SOURCE_DIR}/lib
#)

add_subdirectory(vendor/glad
    ./lib
)
