cmake_minimum_required(VERSION 3.15)

project(mirage_core LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 26)
if (MSVC)
    # MSVC编译器设置C++标准
    add_compile_options(/std:c++latest)
    # 设置utf-8编码
    add_compile_options(/utf-8)
endif ()

find_package(Freetype REQUIRED)
find_package(Eigen3 REQUIRED)

set(SRC_FILES)
retrieve_files(${CMAKE_CURRENT_SOURCE_DIR} SRC_FILES)

add_library(${PROJECT_NAME} STATIC ${SRC_FILES})
target_link_libraries(${PROJECT_NAME} PUBLIC Freetype::Freetype Eigen3::Eigen)
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
add_os_definitions(${PROJECT_NAME})

# 添加编译shader的自定义命令
add_mirage_shader_directory(${CMAKE_CURRENT_SOURCE_DIR}/shaders)
add_shader_dependencies(${PROJECT_NAME})

if (WIN32)
    target_compile_definitions(${PROJECT_NAME} PUBLIC -DSOKOL_D3D11)
elseif (UNIX)
    target_compile_definitions(${PROJECT_NAME} PUBLIC -DSOKOL_GLCORE33)
endif ()
