cmake_minimum_required(VERSION 3.22.0)

set(PROJECT_NAME cool_project)

project(${PROJECT_NAME})
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

string(APPEND resources_dir "${CMAKE_CURRENT_SOURCE_DIR}/data@data")

if (EMSCRIPTEN)
    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Oz -s ALLOW_MEMORY_GROWTH=1 -s NO_EXIT_RUNTIME=0 -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s ASYNCIFY --preload-file ${resources_dir} --shell-file=\"${CMAKE_CURRENT_SOURCE_DIR}/shell.html\"")
    set(CMAKE_EXECUTABLE_SUFFIX ".html")
endif ()

file(GLOB_RECURSE PROJECT_SRC src/*.cpp src/*.hpp src/*.h)

find_package(raylib)
find_package(glm)
find_package(nlohmann_json)

add_executable(${PROJECT_NAME} ${PROJECT_SRC})
target_link_libraries(${PROJECT_NAME} raylib nlohmann_json::nlohmann_json glm::glm)
