# 设置cmake的最低版本
cmake_minimum_required(VERSION 3.5)

# 设置项目名
project(GPT2)

# 设置编译器
set(CMAKE_CXX_COMPILER g++)
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -std=c++17) # 2.2版本以上需要c++17
set(CMAKE_BUILD_TYPE release)

# 添加头文件路径
set(INCLUDE_PATH    ${CMAKE_CURRENT_SOURCE_DIR}/Src/
                    ${CMAKE_CURRENT_SOURCE_DIR}/Src/Utility/ 
                    $ENV{DTKROOT}/include/
                    $ENV{DTKROOT}/onnxruntime/include/)
                    ${CMAKE_CURRENT_SOURCE_DIR}/depend/include/)
include_directories(${INCLUDE_PATH})

# 添加依赖库路径
set(LIBRARY_PATH ${CMAKE_CURRENT_SOURCE_DIR}/depend/lib64/
                $ENV{DTKROOT}/lib/)
link_directories(${LIBRARY_PATH})

# 添加依赖库
set(LIBRARY onnxruntime
            )
link_libraries(${LIBRARY})

# 添加源文件
set(SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/Src/main.cpp
                ${CMAKE_CURRENT_SOURCE_DIR}/Src/GPT2.cpp
                ${CMAKE_CURRENT_SOURCE_DIR}/Src/Utility/tokenization.cpp
                ${CMAKE_CURRENT_SOURCE_DIR}/Src/Utility/utf8proc.c
                ${CMAKE_CURRENT_SOURCE_DIR}/Src/Utility/Filesystem.cpp)

# 添加可执行目标
add_executable(GPT2 ${SOURCE_FILES})
