cmake_minimum_required(VERSION 3.25)
project(3dEngine LANGUAGES CXX)
find_package(SDL2 REQUIRED)
find_path(SCOPE_GUARD_INCLUDE_DIRS "scope_guard.hpp")
add_executable(engine src/main.cpp src/pge.cpp)
target_link_libraries(engine
PRIVATE
$<TARGET_NAME_IF_EXISTS:SDL2::SDL2main>
$<IF:$<TARGET_EXISTS:SDL2::SDL2>,SDL2::SDL2,SDL2::SDL2-static>
)
target_include_directories(engine PRIVATE ${SCOPE_GUARD_INCLUDE_DIRS})
target_include_directories(engine SYSTEM PRIVATE lib/include)
target_compile_features(engine PRIVATE cxx_std_20)
find_package(X11 REQUIRED)
find_package(Threads REQUIRED)
find_package(PkgConfig REQUIRED)
find_package(OpenGL REQUIRED)
pkg_search_module(PNG REQUIRED libpng)
target_include_directories(engine SYSTEM PRIVATE ${PNG_INCLUDE_DIRS})
target_link_libraries(engine
PRIVATE
X11::X11 Threads::Threads ${PNG_LIBRARIES} OpenGL::GL
)
target_compile_definitions(engine PRIVATE OLC_IMAGE_STB)