cmake_minimum_required(VERSION 3.14)

add_library(helpers STATIC
    chunks.cpp
    debug.cpp
    entities.cpp
    input.cpp
    menu.cpp
    mesher.cpp
    networking.cpp
    utils.cpp
    locale.cpp
    inventory.cpp
    recipes.cpp
    particles.cpp
    player.cpp
    multisound.cpp
    svlib.cpp
)

if (WIN32)
    add_compile_definitions(WIN32)
    add_compile_options(-DWIN32)
    target_link_libraries(helpers INTERFACE winmm ws2_32)
endif()

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

target_include_directories(helpers
    PUBLIC
        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
        $<INSTALL_INTERFACE:include>
)
target_include_directories(helpers PRIVATE
    ../libraries/enet/include/.
    ../libraries/yaml-cpp/include/.
    ../libraries/Lua/lua-5.4.7/src/
)
target_sources(helpers
    PUBLIC
        FILE_SET headers TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES common.hpp
)

target_link_libraries(helpers PRIVATE raylib yaml-cpp lua_static enet)