cmake_minimum_required(VERSION 3.10)

project(cc2 C)

set_target_properties(PROPERTIES LINKER_LANGUAGE C)

include_directories(include)
include_directories(${PROJECT_SOURCE_DIR}/src)

file(GLOB src
        "${PROJECT_SOURCE_DIR}/src/*.c"
        "${PROJECT_SOURCE_DIR}/src/engine/*.c"
        "${PROJECT_SOURCE_DIR}/src/game/*.c"
        "${PROJECT_SOURCE_DIR}/src/game/ecs/*.c"
        "${PROJECT_SOURCE_DIR}/src/game/ecs/component/*.c"
        "${PROJECT_SOURCE_DIR}/src/game/ecs/component/action/*.c"
        "${PROJECT_SOURCE_DIR}/src/game/ecs/component/control/*.c"
        "${PROJECT_SOURCE_DIR}/src/game/ecs/component/stat/*.c"
        "${PROJECT_SOURCE_DIR}/src/game/ecs/entity/*.c"
        "${PROJECT_SOURCE_DIR}/src/game/ecs/entity/play/*.c"
        "${PROJECT_SOURCE_DIR}/src/game/ecs/entity/play/enemy*.c"
        "${PROJECT_SOURCE_DIR}/src/game/input/*.c"
        "${PROJECT_SOURCE_DIR}/src/game/render/*.c"
        "${PROJECT_SOURCE_DIR}/src/game/resource/*.c"
        "${PROJECT_SOURCE_DIR}/src/game/state/*.c"
        "${PROJECT_SOURCE_DIR}/src/game/state/play/*.c"
)

add_executable(cc2 ${src})

find_package(SDL2 REQUIRED)
find_package(SDL2_image REQUIRED)
find_package(SDL2_mixer REQUIRED)
find_package(SDL2_ttf REQUIRED)
find_package(GLEW REQUIRED)
find_package(OpenGL REQUIRED)
find_package(json-c REQUIRED)

# TODO: different build types
set (CMAKE_BUILD_TYPE "Debug")
set (CMAKE_C_FLAGS "-DDEBUG -g -O2 -Wno-unused-variable -Wno-unused-parameter -Wall -Wextra -pedantic")
target_link_libraries(${PROJECT_NAME} m SDL2 SDL2_image SDL2_mixer SDL2_ttf GL GLEW json-c)

message("System: ${CMAKE_SYSTEM_NAME}")
message("Project: ${PROJECT_NAME}")
message("Build: ${CMAKE_BUILD_TYPE}")
message("Flags: ${CMAKE_C_FLAGS}")
