cmake_minimum_required(VERSION 3.20)
set(CMAKE_CXX_FLAGS "-std=c++26 -Wno-error -w -Oz -g -mavx2")

if (DEFINED PLATFORMNAME)
    SET(CURRPLATFORM ${PLATFORMNAME})
else ()
    SET(CURRPLATFORM "linux-64")
endif (DEFINED PLATFORMNAME)

file(GLOB_RECURSE ENGINE_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")

add_library(enginend STATIC ${ENGINE_SOURCES} )
target_link_directories(
        enginend PUBLIC
        "${CMAKE_SOURCE_DIR}/link/${CURRPLATFORM}")
set(ENGINE_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
set(ENGINE_EXPORT_DIR "${CMAKE_SOURCE_DIR}/include/enginend")
set_target_properties(enginend PROPERTIES
        CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/link/${CURRPLATFORM}"
        ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/link/${CURRPLATFORM}"
        LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/link/${CURRPLATFORM}"
        RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/link/${CURRPLATFORM}"
)



add_executable(test test.cpp)

set_target_properties(test PROPERTIES
        RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/engine/test"
)
target_link_directories(
        test PUBLIC
        "${CMAKE_SOURCE_DIR}/link/${CURRPLATFORM}")
target_link_libraries(test PRIVATE
        enginend
        raylib
)
target_include_directories(test PUBLIC
        ${CMAKE_SOURCE_DIR}/include
)
target_include_directories(enginend PUBLIC
        ${CMAKE_SOURCE_DIR}/include

)
