Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
d46e79c
Fix int to bool compare warning
Rainyan Nov 25, 2025
56a012f
Fix narrowing conversions
Rainyan Dec 3, 2025
c08e809
Fix unused variables
Rainyan Dec 3, 2025
e1ee09b
Fix use of incorrect assert format macro
Rainyan Dec 3, 2025
57d469c
Remove min/max macros
Rainyan Dec 3, 2025
5a0d14b
Fix MSVC false positive warning
Rainyan Dec 3, 2025
89d4b3e
Fix missing includes
Rainyan Dec 3, 2025
86464a5
Fix CMake MSVC EH flags
Rainyan Dec 3, 2025
0fb523b
Fix usage of str literal without args
Rainyan Dec 3, 2025
55fa620
Fix stray token after endif
Rainyan Dec 3, 2025
3fcbe0d
suppress -Wstringop-truncation from SDK base func
Rainyan Dec 3, 2025
58f5802
Fix buffer underflow for 0 len inputs
Rainyan Dec 4, 2025
48d185c
Fix CMake warning for C code
Rainyan Dec 4, 2025
1b9390f
Remove redundant casts
Rainyan Dec 13, 2025
e473244
Remove unused helper macro
Rainyan Dec 13, 2025
c1ede53
appease gcc
Rainyan Dec 13, 2025
9e0775c
fix ub
Rainyan Dec 13, 2025
17fb911
-Wmaybe-uninitialized
Rainyan Dec 13, 2025
9c852f3
fix array index overflow
Rainyan Dec 13, 2025
3a78d0b
Exclude compiler opts unused by MSVC
Rainyan Dec 13, 2025
5162139
Fix MSVC compiler options warning
Rainyan Dec 13, 2025
de429be
Simplify MSVC optimization flags
Rainyan Dec 13, 2025
a40729c
Set initial default branch name
Rainyan Dec 13, 2025
dc75507
Remove redundant ninja install
Rainyan Dec 13, 2025
53e76aa
Error on missing files for upload-artifact action
Rainyan Dec 13, 2025
e6dd0db
Fix comment url
Rainyan Dec 13, 2025
14fbd80
Cleanup unused variable
Rainyan Dec 13, 2025
199978b
Treat warnings as errors
Rainyan Dec 13, 2025
05d54d9
Add "nwae" option
Rainyan Dec 14, 2025
b99c6e4
Update documentation
Rainyan Dec 14, 2025
adca7c7
Unsuppress -Waddress and -Wstrict-aliasing
Rainyan Dec 14, 2025
af0f1bc
Fix incorrect logic in IsKeypad
Rainyan Dec 14, 2025
7e262ea
Fix overflow check
Rainyan Dec 14, 2025
cb133f2
Fix Clang 14 warning
Rainyan Dec 14, 2025
1b90baf
Fix warnings compatibility with Clang
Rainyan Dec 14, 2025
e24dbd9
Fix strict aliasing rule violations
Rainyan Dec 15, 2025
7af3501
[[maybe_unused]] on members only used for Clang
Rainyan Dec 15, 2025
bfa561b
Fix ambiguous whitespace
Rainyan Dec 16, 2025
d327d11
Fix Clang ambiguous GCC/MSVC preprocessor defines
Rainyan Dec 16, 2025
b1f2662
Fix warning: unused-private-field
Rainyan Dec 16, 2025
5f309f5
Fix redundant assignment warning
Rainyan Dec 17, 2025
23ca372
Fix EHANDLE operator== ambiguity
Rainyan Dec 17, 2025
539fdf9
Fix nullptr indirection
Rainyan Dec 17, 2025
4497973
Suppress thisptr null check warning
Rainyan Dec 17, 2025
0235e98
wip: undefined-bool-conversion
Rainyan Dec 17, 2025
7dfaf81
Qualify crash trap as volatile
Rainyan Dec 17, 2025
d3fd965
Fix operator precedence bug
Rainyan Dec 17, 2025
e01a496
Fix tautological ptr compare
Rainyan Dec 17, 2025
6ad5b49
Fix incorrect arguments for BuildWorldRenderLists
Rainyan Dec 17, 2025
0bdf920
Refactor neo_root_serverbrowser
Rainyan Dec 27, 2025
7446dc7
Qualify ->~T for nonvirtual CUtlVector<T> cleanup
Rainyan Dec 17, 2025
23e3439
fixup: qualify nonvirtual dtor calls
Rainyan Dec 17, 2025
53a9003
Fix operator typo
Rainyan Dec 17, 2025
4ade168
Fix incorrect input args
Rainyan Dec 17, 2025
c170fe3
Fix implicit-const-int-float-conversion
Rainyan Dec 17, 2025
c5ea8c9
Fix: tautological-undefined-compare
Rainyan Dec 17, 2025
7e2fb2a
Fix ambiguous operator==
Rainyan Dec 17, 2025
d8e73be
Fix warning about implicit float->bool conversion
Rainyan Dec 17, 2025
df8db0b
Fix bug with incorrect color rgba input args type
Rainyan Dec 17, 2025
2022732
Fix operator bug with bitflag check
Rainyan Dec 17, 2025
0e3e836
Fix bad ptr compare
Rainyan Dec 17, 2025
c2f3b47
fix self-assign warning
Rainyan Dec 17, 2025
965c30b
wip: incorrect color rgba input args
Rainyan Dec 17, 2025
fcbafd4
Fix bad float->int conversion
Rainyan Dec 17, 2025
fa03830
Clean redundant lambda capture
Rainyan Dec 17, 2025
d86d05e
Fix operator precedence
Rainyan Dec 17, 2025
7838e0f
Suppress VMT overwrite warning
Rainyan Dec 17, 2025
5ab6de9
Fix literal to nullptr comparison warning
Rainyan Dec 20, 2025
73f4fee
Fix linker error
Rainyan Dec 18, 2025
02686c3
Use crash intrinsics
Rainyan Dec 20, 2025
d59f84e
Clang 19 warning suppression compat
Rainyan Dec 20, 2025
c918840
Check for nullptr from GetPlayerNetInfo
Rainyan Dec 20, 2025
aaff36e
Fix threadtools regression
Rainyan Dec 20, 2025
a92815b
Don't memset nontrivially copyable types
Rainyan Dec 24, 2025
b94c2e2
Use std::swap for V_swap
Rainyan Dec 24, 2025
d66710d
Avoid dangling pointer from reference
Rainyan Dec 23, 2025
a1953a8
Fix backslash-newline at end of file
Rainyan Dec 24, 2025
c2bd60c
suppress array index warning
Rainyan Dec 24, 2025
0877560
Fix uninitialized struct bug
Rainyan Dec 24, 2025
807e105
wip: array mismatched bound
Rainyan Dec 24, 2025
7ad0f3d
non-const ref can't bind to bit-field
Rainyan Dec 24, 2025
dccc6aa
Fix unused member vars
Rainyan Dec 25, 2025
8d6298e
Check getcwd return value for errors
Rainyan Dec 25, 2025
fc47b4c
Check system call retvals for errors
Rainyan Dec 25, 2025
1493fbd
Fix SHA1 algorithm compile
Rainyan Dec 25, 2025
287aa29
Windows runner image from latest -> 2025
Rainyan Dec 26, 2025
da3e070
wip: gcc steamrt3 stringop-truncation
Rainyan Dec 26, 2025
deb4076
Add tests for bit_cast
Rainyan Dec 26, 2025
df929a6
Fix CMakeLists compiler options for steamrt3 Clang 11
Rainyan Dec 27, 2025
cfd03e8
Cleanup bit_cast
Rainyan Dec 27, 2025
f842138
Cleanup
Rainyan Dec 27, 2025
d063aff
Improve memory pun debug
Rainyan Dec 28, 2025
03605df
Fix type pun size ambiguity
Rainyan Dec 28, 2025
7c768e6
Fix nontrivial SIMD copy
Rainyan Dec 28, 2025
62afad6
wip: fix nontrivial check typo
Rainyan Dec 28, 2025
a6329aa
Fix nontrivial constructor memcpy
Rainyan Dec 28, 2025
6f3b8c9
wip
Rainyan Dec 28, 2025
cc3a4ab
Fix bad indentation
Rainyan Jan 20, 2026
9c6aa71
wip: nontrivial memcpy
Rainyan Jan 20, 2026
37da90c
wip: nontrivial memcpy
Rainyan Jan 20, 2026
46ef2a6
wip: nontrivial memcpy
Rainyan Jan 20, 2026
a9f32d9
wip: nontrivial memcpy
Rainyan Jan 20, 2026
485ce93
wip: nontrivial memcpy
Rainyan Jan 20, 2026
1a50d75
wip: nontrivial memcpy
Rainyan Jan 20, 2026
de19b4d
wip: nontrivial memcpy
Rainyan Jan 20, 2026
e580dc4
wip: nontrivial memcpy
Rainyan Jan 20, 2026
b84ff23
wip: nontrivial memcpy
Rainyan Jan 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions .github/workflows/cibuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ jobs:
image: 'registry.gitlab.steamos.cloud/steamrt/sniper/sdk:latest'

steps:
# Silence a git warning emitted from actions/checkout.
# For context: https://git-scm.com/docs/git-init#Documentation/git-init.txt---initial-branchbranch-name
- name: Set initial default branch name
run: git config --global init.defaultBranch master

- uses: actions/checkout@v4
with:
fetch-depth: 0
Expand Down Expand Up @@ -111,31 +116,36 @@ jobs:
with:
name: ${{ env.libraries }}
path: ${{ env.install_dir }}/${{ env.libraries }}
if-no-files-found: error

- name: Upload libraries debug information
uses: actions/upload-artifact@v4
with:
name: ${{ env.libraries_debuginfo }}
path: ${{ env.install_dir }}/${{ env.libraries_debuginfo }}
if-no-files-found: error

- name: Upload dedicated library
uses: actions/upload-artifact@v4
with:
name: ${{ env.dedicated }}
path: ${{ env.install_dir }}/${{ env.dedicated }}
if-no-files-found: error

- name: Upload dedicated library debug information
uses: actions/upload-artifact@v4
with:
name: ${{ env.dedicated_debuginfo }}
path: ${{ env.install_dir }}/${{ env.dedicated_debuginfo }}
if-no-files-found: error

- name: Upload SourceMod gamedata
if: ${{ matrix.preset_build_type.name == 'release' }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.gamedata }}
path: ${{ env.install_dir }}/${{ env.gamedata }}
if-no-files-found: error

windows-build:
name: ${{ matrix.platform.display_name }} ${{ matrix.preset_build_type.display_name }}
Expand All @@ -151,7 +161,7 @@ jobs:

matrix:
platform:
- { display_name: 'Windows Native Libraries', os: windows-latest, preset_os: windows }
- { display_name: 'Windows Native Libraries', os: windows-2025, preset_os: windows }

preset_build_type:
- { display_name: 'Debug', name: debug }
Expand All @@ -174,10 +184,6 @@ jobs:
echo "install_dir=$install_dir" >> "$GITHUB_ENV"
echo "preset_name=$preset_name" >> "$GITHUB_ENV"


- name: Install packages
run: choco install -y ninja

- uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
Expand Down Expand Up @@ -244,29 +250,33 @@ jobs:
with:
name: ${{ env.libraries }}
path: ${{ env.install_dir }}/${{ env.libraries }}
if-no-files-found: error

- name: Upload libraries debug information
uses: actions/upload-artifact@v4
with:
name: ${{ env.libraries_debuginfo }}
path: ${{ env.install_dir }}/${{ env.libraries_debuginfo }}
if-no-files-found: error

- name: Upload dedicated library
uses: actions/upload-artifact@v4
with:
name: ${{ env.dedicated }}
path: ${{ env.install_dir }}/${{ env.dedicated }}
if-no-files-found: error

- name: Upload dedicated library debug information
uses: actions/upload-artifact@v4
with:
name: ${{ env.dedicated_debuginfo }}
path: ${{ env.install_dir }}/${{ env.dedicated_debuginfo }}
if-no-files-found: error

pack-resources:
name: Windows Native Resources

runs-on: windows-latest
runs-on: windows-2025

defaults:
run:
Expand All @@ -290,9 +300,6 @@ jobs:
- name: Git fetch tags
run: git fetch origin --tags --force

- name: Install packages
run: choco install -y ninja

- uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
Expand Down Expand Up @@ -322,6 +329,7 @@ jobs:
with:
name: ${{ env.resources }}
path: ${{ env.install_dir }}/${{ env.resources }}
if-no-files-found: error

upload-latest-build:
name: Upload Latest Build
Expand Down
57 changes: 51 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,58 @@ This project uses the [CMake](https://cmake.org/) build system to generate ninja
### Preprocessor definitions
In shared code, clientside code can be differentiated with CLIENT_DLL, vs. serverside's GAME_DLL. In more general engine files, Neotokyo specific code can be marked with a NEO ifdef.

### Code style
## Supported compilers

Only the x64 (64-bit) architecture is supported.

### Windows
* MSVC v143 - VS 2022 C++ x64/x86 build tools (Latest)
* MSVC version used by the latest `windows-2025` [runner image](https://github.com/actions/runner-images/blob/main/images/windows/Windows2025-Readme.md) (Microsoft.VisualStudio.Component.VC.Tools.x86.x64)

No big restrictions on general code format, just try to more or less match the other SDK code style.
### Linux
* GCC 10 [steamrt3 'sniper'](https://gitlab.steamos.cloud/steamrt/sniper/sdk)
* GCC 14 [steamrt3 'sniper'](https://gitlab.steamos.cloud/steamrt/sniper/sdk)
* GCC 14 [steamrt4](https://gitlab.steamos.cloud/steamrt/steamrt4/sdk)
* Clang 19 [steamrt4](https://gitlab.steamos.cloud/steamrt/steamrt4/sdk)

### Code style

* C++20 within GCC 10+ and MSVC v143+ support.
* STL generally shouldn't be included in as it may conflicts with existing similar functions.
* Valve likes to ( space ) their arguments, especially with macros, but it's not necessary to strictly follow everywhere.
* C++20, within the [supported compilers'](#supported-compilers) capabilities.
* Formatting:
* No big restrictions on general format, but try to more or less match the surrounding SDK code style for consistency.
* Warnings are treated as errors.
* You may choose to suppress a warning with compiler-specific preprocessing directives if it is a false positive, but **please do not suppress valid warnings**; instead resolve it by fixing the underlying issue.
* For local development, you may disable warnings-as-errors by modifying your `CMAKE_COMPILE_WARNING_AS_ERROR` option, eg. by modifying the entry in your `CMakeCache.txt` file.
* For the CI runners, the following cases are exempt from the *warnings-as-errors* rule:
* Tagged release builds (`v<major>.<minor>`...)
* Branch name or its latest commit message containing the phrase `nwae` (acronym for: *"no warnings as errors"*)
* The `nwae` phrase also works locally, but you may need to refresh the CMake cache for it to take effect.
* Please note that the above methods of disabling warnings-as-errors are intended as temporary workarounds to allow devs to resolve exceptional situations (eg. the un-pinned MSVC compiler version changes unexpectedly changing warnings behaviour), and it should *not* be regularly relied upon to dodge warnings. The preferred long-term solution is almost always to properly fix the warning!
* STL and platform-specific headers may be used when needed, but generally the SDK libraries should be preferred. If you do use such includes, be careful with not bringing in conflicting macro definitions or performance-costly code.
* The `min` and `max` from the SDK macros have been disabled, because they were polluting namespaces and making things like like `::max` awkward to use. You may use the templated `Min` and `Max` functions from `basetypes.h` instead.
* Some nonstandard casting helpers are available:
* `assert_cast`:
* The preferred cast for pointer conversion where an incompatible cast may occur by accident
* If you know for a fact it is always a safe cast, you can use `static_cast` instead
* For debug builds, will runtime-validate the cast with `ptr == dynamic_cast<T>(ptr)`
* For release builds, it is identical to `static_cast`
* `narrow_cast`:
* The preferred cast for narrowing conversions where loss of information may occur
* Use to mark narrowing conversions where the input could overflow
* If you know for a fact it is always a safe cast, you can use `static_cast` instead
* For debug builds, will runtime-validate narrowing conversions for:
* Roundtrip equality: `value v of type A equals itself after A->B->A type conversion`
* Signed/unsigned conversion overflow
* For release builds, it is identical to `static_cast`
* `neo::bit_cast`:
* Well-formed type punning helper. Mostly used to avoid UB in the SDK code.
* Wrapper for `std::bit_cast` when it's available, else will fall back to `memcpy` based conversions (for example on the steamrt3 default GCC compiler).
* For debug builds, a runtime assertion test is available as an additional parameter:
* `auto output = neo::bit_cast<T>(BC_TEST(input, expectedOutput));`
* When replacing ill-formed type puns, this test syntax can be used to ensure the output of `neo::bit_cast<T>(input)` remains identical to `expectedOutput`
* For release builds, the above test optimizes away, into:
* `auto output = neo::bit_cast<T>(input);`
* Valve likes to `( space )` indent their parentheses, especially with macros, but it's not necessary to strictly follow everywhere.
* Tabs are preferred for indentation, to be consistent with the SDK code.
* When using a TODO/FIXME/HACK... style comment, use the format "// NEO TODO (Your-username): Example comment." to make it easier to search NEO specific todos/fixmes (opposed to Valve ones), and at a glance figure out who has written them.
* When using a TODO/FIXME/HACK... style comment, use the format `// NEO TODO (Your-username): Example comment.` to make it easier to search for `NEO` specific todos/fixmes (opposed to Valve ones of the original SDK), and at a glance figure out who has written them.
* For classes running on both client and server, you should generally follow Valve's <i>C_Thing</i> (client) -- <i>CThing</i> (server) convention. On shared files, this might mean #defining serverclass for client, or vice versa. There's plenty of examples of this pattern in Valve's classes for reference, [for example here](https://github.com/NeotokyoRebuild/neo/blob/f749c07a4701d285bbb463686d5a5a50c20b9528/mp/src/game/shared/hl2mp/weapon_357.cpp#L20).
73 changes: 46 additions & 27 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ if(NOT OS_WINDOWS AND NOT OS_LINUX AND NOT OS_MACOS)
message(FATAL_ERROR "Unknown OS")
endif()

option(CMAKE_COMPILE_WARNING_AS_ERROR "Treat compile warnings as errors" ${DEFAULT_WARN_AS_ERR})
option(NEO_CI_BUILD "CI build mode" OFF)
option(NEO_USE_CCACHE "Use ccache" ${OS_LINUX})
option(NEO_STAGING_ONLY "Staging mode (STAGING_ONLY)" OFF)
Expand Down Expand Up @@ -49,6 +50,7 @@ option(NEO_ENABLE_CPACK "Enable CPack" OFF)
option(NEO_USE_MEM_DEBUG "Enable USE_MEM_DEBUG defines" OFF)
option(NEO_GENERATE_GAMEDATA "Generate SourceMod gamedata" ${NEO_DEDICATED})

message(STATUS "Treat compile warnings as errors: ${CMAKE_COMPILE_WARNING_AS_ERROR}")
message(STATUS "CI build mode: ${NEO_CI_BUILD}")
message(STATUS "Use ccache: ${NEO_USE_CCACHE}")
message(STATUS "Staging (STAGING_ONLY): ${NEO_STAGING_ONLY}")
Expand Down Expand Up @@ -107,14 +109,22 @@ elseif(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWith
NDEBUG
)

add_compile_options(
#-fno-strict-aliasing
-ffast-math
-fno-omit-frame-pointer
-ftree-vectorize
)
if (NOT COMPILER_MSVC)
add_compile_options(
#-fno-strict-aliasing
-ffast-math
-fno-omit-frame-pointer
-ftree-vectorize
)
endif()
endif()

add_compile_definitions(
# Whether to validate narrowing conversions done with narrow_cast<T>(...)
# If not, will simply alias narrow_cast to static_cast
$<$<CONFIG:Debug>:PARANOID_NARROWING>
)

if(NEO_RAD_TELEMETRY_DISABLED)
add_compile_definitions(RAD_TELEMETRY_DISABLED)
endif()
Expand Down Expand Up @@ -142,6 +152,10 @@ add_compile_definitions(
# NEO NOTE (nullsystem): New defines since 2025-02-18 TF2 SDK Update
PLATFORM_64BITS
INCLUDED_STEAM2_USERID_STRUCTS

# NEO NOTE (Rain): Needed to remove platform specific min/max C macro pollution;
# instead you can use the Min/Max templated functions from basetypes.h.
NOMINMAX
)

if(OS_WINDOWS)
Expand Down Expand Up @@ -215,7 +229,6 @@ if(OS_WINDOWS)
/Zc:forScope
/Zc:inline
/Zc:forScope
/Oy-
/MTd
)

Expand All @@ -235,17 +248,16 @@ if(OS_WINDOWS)
add_compile_options(
#/Z7 # DebugInformationFormat - C7 Compatible
#/Wp64 # Detect64bitPortabilityIssues
#/O2 # Optimization - Maximize Speed
/Ob2 # InlineFunctionExpansion - Any Suitable
/Oi # EnableIntrinsicFunctions
/Ot # FavorSizeOrSpeed - Favor Fast Code
/GF # EnableStringPooling
/Gy # EnableFunctionLevelLinking
/O2 # Optimization - Maximize Speed
#/Zo
/Oy-
/MT
)

if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
# In x64 compilers, /Oy and /Oy- are not available.
add_compile_options(/Oy-)
endif()

add_link_options(
/NODEFAULTLIB:libcmtd
/NODEFAULTLIB:libcpmtd
Expand Down Expand Up @@ -300,14 +312,15 @@ if(OS_LINUX OR OS_MACOS)
#-Wextra # if STEAM_BRANCH
#-Wshadow # if STEAM_BRANCH

$<$<CXX_COMPILER_ID:GNU>:-mfpmath=sse>
# Required for SourceMod gamedata generation
$<$<COMPILE_LANGUAGE:CXX>:-Wno-invalid-offsetof>

$<$<CXX_COMPILER_ID:GNU>:-mfpmath=sse>
$<$<COMPILE_LANGUAGE:CXX>:-Wno-overloaded-virtual>
$<$<COMPILE_LANGUAGE:CXX>:-Wno-reorder>
-Wno-multichar
-Wno-write-strings
-Wno-unused-variable
-Wno-unused-but-set-variable
-Wno-unused-function
-Wno-unknown-pragmas
-Wno-unused-parameter
Expand All @@ -317,8 +330,12 @@ if(OS_LINUX OR OS_MACOS)
-Wno-float-equal
-Wno-unused-local-typedefs
-Wno-switch
-Wno-strict-aliasing
-Wno-address
#-Wno-strict-aliasing
#-Wno-address
$<$<CXX_COMPILER_ID:Clang>:-Wno-inconsistent-missing-override>

# Unsupported by the steamrt3 Clang compiler
$<$<NOT:$<AND:$<COMPILE_LANG_AND_ID:CXX,Clang>,$<CXX_COMPILER_VERSION:11.0.1>>>:-Wno-unused-but-set-variable>

-Werror=return-type
-fdiagnostics-show-option
Expand All @@ -329,30 +346,27 @@ if(OS_LINUX OR OS_MACOS)
-Ustrncpy

# Fix for non-clickable vgui buttons when using -O2
-fno-devirtualize-speculatively
$<$<CXX_COMPILER_ID:GNU>:-fno-devirtualize-speculatively>

# Fix for non-clickable vgui buttons when using -O3
-fno-ipa-cp-clone
$<$<CXX_COMPILER_ID:GNU>:-fno-ipa-cp-clone>

# Fix for "error: cast from pointer to smaller type 'unsigned int' loses information"
#-fms-extensions

# Required for SourceMod gamedata generation
-Wno-invalid-offsetof
)

# Disable option for older compiler in docker
if(NOT CMAKE_CXX_COMPILER_VERSION STREQUAL "4.8.4")
add_compile_options(
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-fabi-compat-version=2>
$<$<COMPILE_LANGUAGE:CXX>:-Wno-class-memaccess>
$<$<COMPILE_LANGUAGE:CXX>:-Wno-template-id-cdtor>
-Wno-nonnull-compare
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wno-class-memaccess>
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wno-template-id-cdtor>
$<$<CXX_COMPILER_ID:GNU>:-Wno-nonnull-compare>
)
endif()

# We should always specify -Wl,--build-id, as documented at:
# http://linux.die.net/man/1/ld and http://fedoraproject.org/wiki/Releases/FeatureBuildId.http://fedoraproject.org/wiki/Releases/FeatureBuildId
# http://linux.die.net/man/1/ld and http://fedoraproject.org/wiki/Releases/FeatureBuildId
add_link_options(
-Wl,--build-id
-static-libgcc
Expand All @@ -374,10 +388,15 @@ if(OS_LINUX)
)
endif()

# Clang may define GCC or MSVC values as some kind of a compatibility thing,
# but this can break code that relies on accurately identifying the used compiler.
# The "ACTUALLY_..." defs here can be used for succintly determining the compiler for real.
if(COMPILER_MSVC)
add_compile_definitions(COMPILER_MSVC)
add_compile_definitions(ACTUALLY_COMPILER_MSVC)
elseif(COMPILER_GCC)
add_compile_definitions(COMPILER_GCC)
add_compile_definitions(ACTUALLY_COMPILER_GCC)
elseif(COMPILER_CLANG)
add_compile_definitions(COMPILER_CLANG)
endif()
Expand Down
Loading