mirror of https://github.com/libAthena/athena.git
Use LLVM_ROOT_DIR again, add .clang-{format,tidy}
This commit is contained in:
parent
5358d195bb
commit
85a16c7f45
|
@ -0,0 +1,29 @@
|
||||||
|
---
|
||||||
|
BasedOnStyle: LLVM
|
||||||
|
ColumnLimit: 120
|
||||||
|
UseTab: Never
|
||||||
|
TabWidth: 2
|
||||||
|
---
|
||||||
|
Language: Cpp
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
PointerAlignment: Left
|
||||||
|
AlignAfterOpenBracket: Align
|
||||||
|
AlignConsecutiveAssignments: false
|
||||||
|
IndentCaseLabels: false
|
||||||
|
AllowShortBlocksOnASingleLine: Always
|
||||||
|
AlignOperands: true
|
||||||
|
AlignTrailingComments: true
|
||||||
|
AlwaysBreakBeforeMultilineStrings: true
|
||||||
|
AlwaysBreakTemplateDeclarations: Yes
|
||||||
|
BreakConstructorInitializersBeforeComma: true
|
||||||
|
AlwaysBreakAfterReturnType: None
|
||||||
|
AlwaysBreakAfterDefinitionReturnType: None
|
||||||
|
AllowShortFunctionsOnASingleLine: All
|
||||||
|
Cpp11BracedListStyle: true
|
||||||
|
NamespaceIndentation: None
|
||||||
|
BinPackArguments: true
|
||||||
|
BinPackParameters: true
|
||||||
|
SortIncludes: false
|
||||||
|
AccessModifierOffset: -2
|
||||||
|
ConstructorInitializerIndentWidth: 0
|
||||||
|
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
|
@ -0,0 +1 @@
|
||||||
|
Checks: '*,-misc-unused-parameters,-modernize-use-trailing-return-type,-readability-named-parameter,-readability-convert-member-functions-to-static,-readability-uppercase-literal-suffix,-readability-magic-numbers,-hicpp-uppercase-literal-suffix,-hicpp-signed-bitwise,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-pro-type-static-cast-downcast,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-owning-memory,-cppcoreguidelines-pro-type-union-access,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-non-private-member-variables-in-classes,-fuchsia-*,-google-runtime-references,-llvmlibc-*'
|
|
@ -104,7 +104,7 @@ jobs:
|
||||||
- name: Configure CMake
|
- name: Configure CMake
|
||||||
run: |
|
run: |
|
||||||
cmake -B build -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" \
|
cmake -B build -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" \
|
||||||
-DClang_DIR=/opt/local/libexec/llvm-11/lib/cmake/clang \
|
-DLLVM_ROOT_DIR=/opt/local/libexec/llvm-11 \
|
||||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache .
|
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache .
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
|
@ -149,9 +149,6 @@ jobs:
|
||||||
- name: Enable Visual Studio environment
|
- name: Enable Visual Studio environment
|
||||||
uses: ilammy/msvc-dev-cmd@v1
|
uses: ilammy/msvc-dev-cmd@v1
|
||||||
|
|
||||||
- name: Create build directory
|
|
||||||
run: cmake -E make_directory ${{github.workspace}}/build
|
|
||||||
|
|
||||||
- name: Configure CMake
|
- name: Configure CMake
|
||||||
run: |
|
run: |
|
||||||
$workspace = $env:RUNNER_WORKSPACE -replace '\\', '/'
|
$workspace = $env:RUNNER_WORKSPACE -replace '\\', '/'
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
cmake_minimum_required(VERSION 3.10 FATAL_ERROR) # because of c++17
|
cmake_minimum_required(VERSION 3.10 FATAL_ERROR) # because of c++17
|
||||||
# Set MSVC runtime library flags from CMAKE_MSVC_RUNTIME_LIBRARY
|
# Set MSVC runtime library flags from CMAKE_MSVC_RUNTIME_LIBRARY
|
||||||
cmake_policy(SET CMP0091 NEW)
|
cmake_policy(SET CMP0091 NEW)
|
||||||
project(athena)
|
|
||||||
if (NOT MSVC)
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Athena Version #
|
# Athena Version #
|
||||||
|
@ -17,6 +12,75 @@ set(ATHENA_PATCH_VERSION 0)
|
||||||
set(ATHENA_VERSION
|
set(ATHENA_VERSION
|
||||||
${ATHENA_MAJOR_VERSION}.${ATHENA_MINOR_VERSION}.${ATHENA_PATCH_VERSION})
|
${ATHENA_MAJOR_VERSION}.${ATHENA_MINOR_VERSION}.${ATHENA_PATCH_VERSION})
|
||||||
|
|
||||||
|
project(athena VERSION ${ATHENA_VERSION} LANGUAGES C CXX)
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
# Shaddup MSVC
|
||||||
|
add_compile_definitions(UNICODE=1 _UNICODE=1 __SSE__=1
|
||||||
|
_CRT_SECURE_NO_WARNINGS=1 D_SCL_SECURE_NO_WARNINGS=1
|
||||||
|
_SCL_SECURE_NO_DEPRECATE=1 _CRT_NONSTDC_NO_WARNINGS=1
|
||||||
|
_ENABLE_EXTENDED_ALIGNED_STORAGE=1 NOMINMAX=1)
|
||||||
|
add_compile_options(/IGNORE:4221
|
||||||
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4018>
|
||||||
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4800>
|
||||||
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4005>
|
||||||
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4311>
|
||||||
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4068>
|
||||||
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4267>
|
||||||
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4244>
|
||||||
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4200>
|
||||||
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4305>
|
||||||
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4067>
|
||||||
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4146>
|
||||||
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4309>
|
||||||
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4805>
|
||||||
|
${VS_OPTIONS})
|
||||||
|
|
||||||
|
string(REPLACE "/GR " "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
|
string(REPLACE " /EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
|
add_compile_options(
|
||||||
|
# Disable exceptions
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:/EHsc->
|
||||||
|
|
||||||
|
# Disable RTTI
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:/GR->
|
||||||
|
|
||||||
|
# Enforce various standards compliant behavior.
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:/permissive->
|
||||||
|
|
||||||
|
# Enable standard volatile semantics.
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:/volatile:iso>
|
||||||
|
|
||||||
|
# Reports the proper value for the __cplusplus preprocessor macro.
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:/Zc:__cplusplus>
|
||||||
|
|
||||||
|
# Use latest C++ standard.
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:/std:c++latest>
|
||||||
|
)
|
||||||
|
|
||||||
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||||
|
# Flags for MSVC (not clang-cl)
|
||||||
|
add_compile_options(
|
||||||
|
# Allow constexpr variables to have explicit external linkage.
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:/Zc:externConstexpr>
|
||||||
|
|
||||||
|
# Assume that new throws exceptions, allowing better code generation.
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:/Zc:throwingNew>
|
||||||
|
|
||||||
|
# Link-time Code Generation for Release builds
|
||||||
|
$<$<CONFIG:Release>:/GL>
|
||||||
|
)
|
||||||
|
|
||||||
|
# Link-time Code Generation for Release builds
|
||||||
|
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "/LTCG")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/DEBUG /RELEASE /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:cv,fixup")
|
||||||
|
endif ()
|
||||||
|
else ()
|
||||||
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
endif ()
|
||||||
|
|
||||||
################
|
################
|
||||||
# Athena Build #
|
# Athena Build #
|
||||||
################
|
################
|
||||||
|
|
Loading…
Reference in New Issue