Commit graph

31 commits

Author SHA1 Message Date
cbnolok
6cdf242da1 CMake: external libs are now compiled as obj files, without an intermediate link-in-a-library stage.
This speeds up overall compilation, since only one link pass is done,
instead of one per target.
2025-05-09 20:08:22 +02:00
cbnolok
205549abc2 CMake toolchains: moved some flags from CompilerFlagsChecker to CompilerFlagsBase.
The one moved are supported since a long time/older compiler versions
and from both Clang and GCC, so they can be safely moved.
Also, not having to check them, CMake configuration is a bit faster.
2025-04-26 17:34:59 +02:00
cbnolok
43ca74b5a2 Renamed CMake flags CXX_FLAGS_EXTRA and CMAKE_EXE_LINFER_FLAGS_EXTRA
to CUSTOM_CXX_FLAGS and CUSTOM_EXE_LINKER_FLAGS.
Added -Wdouble-promotion.
2025-02-15 13:27:05 +01:00
cbnolok
0b19f79b99 Moved fixed GCC/Clang compilation flags to separate cmake files. Fixed a
CMake parsing error causing optimizations not being applied correctly to
Nightly and Release build.
2025-02-14 07:27:23 +01:00
cbnolok
69302c6f19 Fixed MacOS compilation error
Caused by changes in mariadb-c-connector homebrew packaging.
2024-11-27 20:03:30 +01:00
cbnolok
e194ba7daf Fixed path concat regression and fixed come cmake options being loaded before being set. 2024-10-13 18:30:13 +02:00
cbnolok
b75a9c949e Refactoring and small additions to CompilerFlagsChecker.cmake. 2024-10-13 18:30:12 +02:00
cbnolok
250cae76f0 Moved all the compiler/linker flags selection for GCC/Clang in CompilerFlagsChecker.cmake. 2024-10-13 18:30:11 +02:00
cbnolok
55f9688159 Changed compiler flags for debug builds, to enable better line-to-line debugging. 2024-09-21 12:01:28 +02:00
cbnolok
b0584d08fd Renamed a couple of cmake utility files. 2024-09-21 12:01:27 +02:00
cbnolok
5b03df7671 Fixed exception on Linux when stdin was not a terminal (i.e. debugging
from some IDEs or other apps). Set debug build optimization flags again to minimal (Og)
Using O1 sometimes combined statements and inlined variables, making
line-by-line debugging harder.
Updated Windows-GNU toolchain warning flags.
2024-09-21 12:01:27 +02:00
cbnolok
01be47ec07 Added stricter warning flags for GCC and Clang.
Fixed some function calls getting as argument a null pointer instead of
a string, and similar issues found with a new warning flag.
Also minimal refactoring to CSQLite, encapsulated zlib includes in a
zlib namespace.
2024-09-21 12:01:27 +02:00
cbnolok
8dece16d96 CMake files (cmake_format_gersemi.sh): added tab conversion to 4 spaces also for commented lines. 2024-09-08 14:48:12 +02:00
cbnolok
eae1a45276 Formatted cmake files with gersemi. 2024-09-08 14:33:56 +02:00
cbnolok
0d95e68c3a Treat compiler/linker warnings as errors. 2024-09-05 13:57:41 +02:00
cbnolok
dffa6fb84f Added Linux-AArch64 and OSX-AArch64 toolchains, cleanup of other toolchains. 2024-08-26 16:30:59 +02:00
cbnolok
4ea4325320 Fixed script parsing regression with empty strings, fixed undefined behaviors 2024-08-06 09:56:32 +02:00
cbnolok
75a07b4498 Several stability fixes
- Fixed: ini CommandPrefix being overwritten by data from other ini settings.
- Fixed: function call stack sometimes being subject to a race condition between two writing threads, corrupting it.
- Fixed: lots of memory corruption errors leaving the server unstable when loading a broken save file and recovering by loading a backup save.
- Fixed: CCacheableScriptFile sometimes not reading the last character.
- Fixed: .clang_format.
- Changed: RES_GET_INDEX macro to ResGetIndex function, allowing more integer type safety. Same for RES_GET_TYPE.
- Changed: Renamed THREAD_* macros to MT_*. Split them in always active macros (MT_*) and macros active only when MT_ENGINE is set to 1 (MT_ENGINE_*). There are some situations where we still need a mutex
even if not working with multithreaded script/networking engines (which are NOT complete).
- Changed: Disable signal handlers under Linux if running with ASAN or a debugger.
- Added: NOEXCEPT_DEBUG, it's simply the noexcept specifier, but it's ignored if running in a debug build (useful if we're using DEBUG_ASSERT inside a function which wouldn't otherwise throw an exception).
- Fixed: some undefined behaviors, like signed to unsigned conversion and vice versa.
- Added: additional checks for GCC and Clang ASAN builds.
2024-08-06 09:56:32 +02:00
cbnolok
e3db3e4753 Fix CMakeDetectArch for x86 2024-08-06 09:56:32 +02:00
cbnolok
9829fcbcc2 Improved how triggers are interrogated, reducing CPU load.
Fixed some Linux compilation warnings and errors.
MSVC will compile by default with SSE2 CPU extensions enabled on x86_64. Updated CMakeDetectArch.cmake with 3rd party code.
2024-08-06 09:56:32 +02:00
cbnolok
743dda9900 Started rework of timed object ticking system (trying to change the default container from map of vectors to a multimap, also trying to delete elements as little as possible, to avoid cpu usage, reallocations and tree rebalancing).
Added #define MT_ENGINES: it doesn't make sense to keep unneeded mutex locks, at least until (if ever) we'll have a fully multithreaded engine.
Some advancement in making ASAN work on Windows with Clang.
Added .cmake-format
2024-08-06 09:56:32 +02:00
cbnolok
945ce47fc0 Fixed a case of wrong << parsing inside other angular brackets.
Changes to functions to retrieve the monotonic clock value: on non-Windows OSes they now use faster backends according to the time precision needed.
2024-06-13 15:22:49 +02:00
cbnolok
c7f4eb52f1 - Added: client commands ADDITEM and ADDCHAR, to be used in place of .ADD when there's the need to force the argument to be an item or a char.
This can be useful when using raw IDs (like 01, 0bd1, etc) instead of defnames.
- Improvement: changed the logic behind script files reading and caching, now it will be faster and require less memory.
- Fixed: correct thread name not being shown in the stack trace.
- Renamed ResourceGetID_Advance to ResourceGetID_EatStr, added fCanFail argument.
- Added some string functions, starting from POSIX C getline and getdelim (got the source from NetBSD and renamed to fReadUntilDelimiter), then added some more custom functions to help read from file or string buffers.
2024-06-04 13:56:45 +02:00
cbnolok
cc8d5d2593 Added ini settings for network security: MaxConnectRequestsPerIP, TimeoutIncompleteConn.
Added serv_trigger functions: f_onserver_connectreq_ex, f_onserver_connection_acquired.
Fixed version string with git versioning disabled.
Updated .editorconfig.
Added more AddressSanitizer compiler/linker flags.
2024-06-03 17:42:05 +02:00
cbnolok
08bf180f05 Fixed sign/str format warnings, MinGW compilation, ASan Nightly MSVC builds 2024-05-29 19:14:11 +02:00
cbnolok
9f39def7dd Disabled some unuseful warnings for AppleClang toolchain and GCC on 32bits, fixed Windows phmap compilation error 2024-05-28 21:29:38 +02:00
cbnolok
da942a685b CMake additions, fixed used memory estimation on Linux, more optimizations.
Added: CMake switch to statically link C/C++ runtime libraries (on
Linux, glibc still isn't included); fixed linker flags when using
sanitizers.
Added: asan symbolizer setting in configure_asan.sh, to be able to see
the function names.
Further optimized CWorldSearch::Get* methods and CItem/CChar::GetHeight.
Added checks to avoid buffer overflows using sprintf (and removed the
compiler warnings).
Fixed some invalid memory reads when the server is closing (reading from
deleted thread data).
2024-05-27 11:26:31 +02:00
cbnolok
80929e0e24 Added static linking of (a)san library. Fixed C library target arch. 2024-05-23 23:02:59 +02:00
cbnolok
66ef50b3c6 Some more optimizations, changed rand algorithm to the fast one for trivial tasks, fixed MSVC, typo for OSX toolchains and rigid cast making the Linux build fail. 2024-05-23 19:10:16 +02:00
cbnolok
d66675e40a Added separated linker options for each C 3rd party lib.
Fixed twofish compilation error on Windows. That library wasn't really meant to be used as-is...
Made _GITVERSION define macro available only when enabling git versioning from CMake.
Modernized and fixed MSVC CMake toolchain.
Removed mariadb_version.h from git index.
2024-05-20 11:16:23 +02:00
cbnolok
84888279c9 Updated toolchains to set options per target, instead of globally.
Windows and OS X not yet tested.
Moved toolchains .inc files to include/ folder.
Renamed folder lib/bin into _bin.
Moved bcrypt and twofish library into lib folder and into new cmake projects. Restored twofish library to the original version.


Fixed some format warnings.
2024-05-19 14:04:53 +02:00