cmake_minimum_required(VERSION 3.22)

project(MGL
    VERSION 1.1.16
    HOMEPAGE_URL https://acerola-software.jp/mgl-docs/ja/
    LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_EXTENSIONS OFF)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

file(STRINGS "sources.txt" SOURCES)
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES ${SOURCES})
add_library(mgl STATIC ${SOURCES})

target_compile_options(mgl PUBLIC -Wall)
target_compile_options(mgl PUBLIC -Wextra)
target_compile_options(mgl PUBLIC -Wconversion)
target_compile_options(mgl PUBLIC -DMGL_TARGET_CORE_ONLY)

target_compile_options(mgl PUBLIC
    $<$<CONFIG:Release>: -Ofast>
    $<$<CONFIG:Debug>: -g -DMGL_DEBUG>
)

target_include_directories(mgl PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
