cmake_minimum_required(VERSION 3.23)

project(RCRAFT)
add_subdirectory(helpers)

set(YAML_BUILD_SHARED_LIBS OFF)
set(YAML_MSVC_SHARED_RT OFF)
set(OPENGL_VERSION 1.1)

add_subdirectory(libraries/raylib)
add_subdirectory(libraries/enet)
add_subdirectory(libraries/yaml-cpp)
add_subdirectory(libraries/Lua)

execute_process(COMMAND date +v.%yw%W OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE) 
add_compile_definitions(GAME_VERSION="${BUILD_DATE}")

add_executable(RCRAFT rcraft.cpp)

if (WIN32)
    add_compile_definitions(WIN32)
    add_compile_options(-DWIN32)
    target_link_libraries(RCRAFT INTERFACE winmm ws2_32)
endif()
add_compile_options(-Wno-narrowing)
target_link_directories(RCRAFT PRIVATE ${CMAKE_SOURCE_DIR}/build/src/libraries/enet/)
target_include_directories(RCRAFT PRIVATE
    libraries/enet/include/.
    libraries/yaml-cpp/include/.
    libraries/raylib/src/.
    libraries/Lua/lua-5.4.7/src/
)
target_link_libraries(RCRAFT PRIVATE    
    raylib 
    helpers
    enet
    yaml-cpp
    lua_static
)