Xenith/CMakeLists.txt
2026-09-29 20:02:10 +07:00

46 lines
1.6 KiB
CMake
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

cmake_minimum_required(VERSION 3.20)
project(Xenith)
set(CMAKE_CXX_STANDARD 17) # В Makefile указан c++17
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Опции компиляции из твоего Makefile
# Для Debug сборки CLion обычно сам добавляет -O0 -g, но можно форсировать
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_CXX_FLAGS_DEBUG "-O1 -g -fsanitize=address,undefined")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-fsanitize=address,undefined")
else()
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -ffast-math -funroll-loops")
endif()
# Добавляем предупреждения
add_compile_options(-Wall -Wextra -Wno-unused-parameter)
# Список исходных файлов из твоего Makefile
set(SOURCES
main.cpp
xenith/core/model.cpp
xenith/core/backward.cpp
xenith/core/trainer.cpp
xenith/core/checkpoint.cpp
xenith/core/generate.cpp
xenith/core/gradcheck.cpp
# Файлы, которые уже были в твоем старом CMakeLists.txt
xenith/preprocessing/tokenizer.cpp
ollama_api/test.cpp
xenith/converter.cpp
)
# Заголовочные файлы (для удобства в IDE)
file(GLOB_RECURSE HEADER_FILES "*.h" "*.hpp")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
add_executable(Xenith ${SOURCES} ${HEADER_FILES})
# Настройка include директорий
target_include_directories(Xenith PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
# Потоки (pthread)
find_package(Threads REQUIRED)
target_link_libraries(Xenith PRIVATE Threads::Threads)