-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 078878c
Showing
33 changed files
with
5,357 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Заставляем VS и другие IDE сохранять файлы в кодировке UTF-8 | ||
# https://editorconfig.org | ||
|
||
# В родительских папках .editorconfig искаться не будет | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
# Не меняет формат концов строк. Может возникнуть конфликт с настройками git | ||
#end_of_line = lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Автоматически нормализуем концы строк, если у пользователя не настроен параметр autocrlf | ||
# https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings | ||
# https://www.aleksandrhovhannisyan.com/blog/crlf-vs-lf-normalizing-line-endings-in-git/ | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
# Copyright (c) the Dviglo project | ||
# License: MIT | ||
|
||
name: Tester | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
windows: | ||
runs-on: windows-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
compiler: [vs, mingw] | ||
build_type: [debug, release] | ||
|
||
name: windows-${{ matrix.compiler }}-${{ matrix.build_type }} | ||
|
||
steps: | ||
- name: Устанавливаем MinGW | ||
if: matrix.compiler == 'mingw' | ||
uses: msys2/setup-msys2@v2 | ||
with: | ||
update: true | ||
install: mingw-w64-x86_64-toolchain | ||
|
||
- name: Добавляем в PATH путь к MinGW | ||
if: matrix.compiler == 'mingw' | ||
shell: bash | ||
run: echo "${RUNNER_TEMP}/msys64/mingw64/bin" >> $GITHUB_PATH | ||
|
||
- name: Скачиваем репозиторий | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
path: repo | ||
|
||
- name: Генерируем проекты | ||
shell: bash | ||
run: | | ||
args=(repo -B build) | ||
if [ "${{ matrix.compiler }}" == "vs" ] | ||
then | ||
args+=(-G "Visual Studio 17 2022") | ||
else | ||
args+=(-G "MinGW Makefiles") | ||
args+=(-D CMAKE_BUILD_TYPE=${{ matrix.build_type }}) | ||
fi | ||
cmake "${args[@]}" | ||
- name: Компилируем | ||
shell: bash | ||
run: | | ||
args=(--build build) | ||
if [ "${{ matrix.compiler }}" == "vs" ] | ||
then | ||
args+=(--config ${{ matrix.build_type }}) | ||
fi | ||
cmake "${args[@]}" | ||
- name: CTest | ||
shell: bash | ||
run: | | ||
args=(--verbose --test-dir build --timeout 60) | ||
if [ "${{ matrix.compiler }}" == "vs" ] | ||
then | ||
args+=(-C ${{ matrix.build_type }}) | ||
fi | ||
ctest "${args[@]}" | ||
linux: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
compiler: | ||
- { | ||
id: gcc, | ||
c: gcc-13, | ||
cxx: g++-13, | ||
} | ||
- { | ||
id: clang, | ||
c: clang-13, | ||
cxx: clang++-13, | ||
} | ||
build_type: [debug, release] | ||
|
||
name: linux-${{ matrix.compiler.id }}-${{ matrix.build_type }} | ||
|
||
steps: | ||
- name: Скачиваем репозиторий | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
path: repo | ||
|
||
- name: Генерируем проекты | ||
run: | | ||
cmake repo -B build -G "Unix Makefiles" \ | ||
-D CMAKE_C_COMPILER=${{ matrix.compiler.c }} -D CMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }} \ | ||
-D CMAKE_BUILD_TYPE=${{ matrix.build_type }} | ||
- name: Компилируем | ||
run: | | ||
cmake --build build | ||
- name: CTest | ||
run: | | ||
ctest --verbose --test-dir build --timeout 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# https://git-scm.com/docs/gitignore | ||
# https://www.atlassian.com/ru/git/tutorials/saving-changes/gitignore | ||
|
||
# Игнорируем папки, которые создаёт VS Code | ||
/.vscode/ | ||
/build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Copyright (c) the Dviglo project | ||
# License: MIT | ||
|
||
# Указываем минимальную версию CMake | ||
cmake_minimum_required(VERSION 3.16) | ||
|
||
# Название проекта | ||
project(big_int) | ||
|
||
# Название таргета | ||
set(target_name tester) | ||
|
||
# Версия стандарта C++ | ||
set(CMAKE_CXX_STANDARD 20) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
|
||
# Если используется одноконфигурационный генератор и конфигурация не указана | ||
if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) | ||
# то конфигурацией по умолчанию будет Release | ||
set(CMAKE_BUILD_TYPE Release) | ||
# Нельзя оставлять переменную CMAKE_BUILD_TYPE пустой (подробности в Dviglo2D) | ||
endif() | ||
|
||
# Указываем Студии на то, что исходники в кодировке UTF-8. | ||
# Это позволяет писать U'🍌'. У других компиляторов, похоже, нет с этим проблем | ||
# https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2295r6.pdf | ||
if(MSVC) | ||
add_compile_options(/utf-8) | ||
endif() | ||
|
||
# Выводим больше предупреждений | ||
if(MSVC) | ||
add_compile_options(/W4) | ||
else() | ||
add_compile_options(-Wall -Wextra -Wpedantic) | ||
|
||
if(NOT MINGW) | ||
add_compile_options(-fsanitize=undefined) | ||
add_link_options(-fsanitize=undefined) | ||
endif() | ||
endif() | ||
|
||
# Создаём список файлов | ||
file(GLOB source_files *.cpp *.hpp) | ||
|
||
# Создаём приложение | ||
add_executable(${target_name} ${source_files}) | ||
|
||
# Отладочная версия приложения будет иметь суффикс _d | ||
set_property(TARGET ${target_name} PROPERTY DEBUG_POSTFIX _d) | ||
|
||
# Заставляем VS отображать дерево каталогов | ||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${source_files}) | ||
|
||
# Включаем поддержку папок в IDE | ||
set_property(GLOBAL PROPERTY USE_FOLDERS ON) | ||
|
||
# Включаем тестирование | ||
enable_testing() | ||
|
||
# Добавляем приложение в список тестируемых | ||
add_test(NAME ${target_name} COMMAND ${target_name}) | ||
|
||
# В Visual Studio таргет будет назначен стартовым вместо ALL_BUILD, | ||
# чтобы потом не делать это вручную при отладке приложения | ||
set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${target_name}) |
Oops, something went wrong.