set(CMAKE_CXX_STANDARD 20) # c++ 20
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
cmake_minimum_required(VERSION 3.16)  # Specifies the required CMake version.
project(rla_iipp)  # Defines the project name.

#[[include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)  # Includes the contents of the conanbuildinfo.cmake file.
conan_basic_setup()  # Prepares the CMakeList.txt for Conan.]]

# $source_files is a space-delimited list of filenames.
add_executable(rla_iipp src/main.cpp src/engine/engine.hpp src/engine/game/game.hpp src/engine/rendering/renderer.hpp src/game/visualizer.hpp src/game/visualizer.cpp src/engine/rendering/sdl/sdlrenderer.cpp src/engine/rendering/sdl/sdlrenderer.hpp src/engine/rendering/sdl/sdlrenderer.cpp src/engine/rendering/sdl/sdlrenderer.hpp src/engine/engine.cpp src/engine/engine.hpp src/engine/rendering/sdl/sdltexturemanager.cpp src/engine/rendering/sdl/sdltexturemanager.hpp src/engine/resources/resourcemanager.hpp src/engine/rendering/sdl/sdlfontmanager.cpp src/engine/rendering/sdl/sdlfontmanager.hpp src/engine/input/inputprocessor.hpp src/engine/input/sdlinputprocessor.cpp src/engine/input/sdlinputprocessor.hpp src/engine/utility/camera.cpp src/engine/utility/camera.hpp src/engine/utility/point.hpp src/engine/utility/rectangle.hpp src/engine/utility/grid2d.hpp src/engine/scripting/luacontextmanager.cpp src/engine/scripting/luacontextmanager.hpp src/game/algorithmmanager.cpp src/game/algorithmmanager.hpp src/game/tilemap.cpp src/game/tilemap.hpp src/engine/rlengineexception.hpp)  # Specifies the executable to build.

# vcpkg packages
find_package(SDL2 CONFIG REQUIRED)
target_link_libraries(rla_iipp
        PRIVATE
        $<TARGET_NAME_IF_EXISTS:SDL2::SDL2main>
        $<IF:$<TARGET_EXISTS:SDL2::SDL2>,SDL2::SDL2,SDL2::SDL2-static>
        )
find_package(SDL2_ttf CONFIG REQUIRED)
target_link_libraries(rla_iipp PRIVATE $<IF:$<TARGET_EXISTS:SDL2_ttf::SDL2_ttf>,SDL2_ttf::SDL2_ttf,SDL2_ttf::SDL2_ttf-static>)
find_package(SDL2_image CONFIG REQUIRED)
target_link_libraries(rla_iipp PRIVATE $<IF:$<TARGET_EXISTS:SDL2_image::SDL2_image>,SDL2_image::SDL2_image,SDL2_image::SDL2_image-static>)
find_package(fmt CONFIG REQUIRED)
target_link_libraries(rla_iipp PRIVATE fmt::fmt)
find_package(tomlplusplus CONFIG REQUIRED)
target_link_libraries(rla_iipp PRIVATE tomlplusplus::tomlplusplus)
find_package(sol2 CONFIG REQUIRED)
target_link_libraries(rla_iipp PRIVATE lua)
target_link_libraries(rla_iipp PRIVATE sol2)
find_package(range-v3 CONFIG REQUIRED)
target_link_libraries(rla_iipp PRIVATE range-v3::meta range-v3::concepts range-v3::range-v3)

#[[target_link_libraries(rla_iipp ${CONAN_LIBS})  # Specifies what libraries to link, using Conan.]]
file(COPY assets DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY config DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY scripts DESTINATION ${CMAKE_BINARY_DIR}/bin)