Commit Graph

62 Commits

Author SHA1 Message Date
Ryan C. Gordon
001a533399
Initial migration from SDL 1.2 to SDL2. 2024-05-02 08:29:21 -04:00
Jeod
7607593958
Merge branch 'main' into cmake-options 2024-04-30 17:57:58 -04:00
Louis Gombert
0b41a1b963 CMake: expose BUILD_TESTNG option, rename LOGGER to ENABLE_LOGGER 2024-04-30 20:41:45 +02:00
bperris
27eadbf66b
Merge branch 'main' into new-log-system 2024-04-30 14:38:11 -04:00
Louis Gombert
3bdbdc196f
Merge pull request #204 from winterheart/split-debug-module-v2
Move debug functions to own module
2024-04-30 18:35:00 +00:00
Bryan Perris
b0e5754e96 Introduce spdlog logging system
* The game version is now printed via the log system rather than from within the loki_initialize function.
remove this line
2024-04-30 14:27:38 -04:00
Ryan C. Gordon
f8a4cb3cc0
More X11 removal.
This is all unused stuff, just doing a more-complete purge.
2024-04-30 13:04:15 -04:00
Azamat H. Hackimov
2aece028d0 Move debug functions to own module
This commit is part of efforts to isolate subsystems of project into own modules.
2024-04-30 00:58:34 +03:00
Ryan C. Gordon
6c8977caf0
Heavy patching for compiler warnings.
The vast majority of this is fixing up `char *` that should be `const char *`
but a handful of other fixes, like potential buffer overflows that GCC
noticed, etc, were applied as well.

This removes `-Wno-write-strings` from CMakeLists.txt, as it is no longer
necessary, as there is no longer a flood of compiler warning spam when
building.

This does not fix all compiler warnings; there are still a handful, and they
are legitimate, but they can be dealt with in a future commit.
2024-04-29 00:18:56 -04:00
Thomas Otto
19fb21434c Windows/CMake: add /MP for multi process MSBuild
"The /MP option can reduce the total time to compile the source
files on the command line. The /MP option causes the compiler
to create one or more copies of itself, each in a separate process."

<https://learn.microsoft.com/en-us/cpp/build/reference/mp-build-with-multiple-processes?view=msvc-170>
2024-04-29 01:11:57 +02:00
Azamat H. Hackimov
c18be49ae6 Enable WIN32 property only for Descent3
Disable global linker option that forces /SUBSYSTEM:WINDOWS for all executables (tools and unittest included).
2024-04-29 01:43:06 +03:00
Louis Gombert
6d91c381f8
Merge pull request #179 from winterheart/checksum-unittests
Checksum unittests and Osiris types unification
2024-04-28 21:54:34 +00:00
Azamat H. Hackimov
1926a77f19 Introducing git revision in source code
Git revision is generating on build time (not on configure time). In case of uncommited changes this revision will be marked as "dirty". If cmake cannot retrieve revision from git history (i.e. from packaged source code), cmake will attempt to read "git-hash.txt" from `PROJECT_SOURCE_DIR` (it will be generated on build time; after implementing packaging workflow it can be reworked).
Reworked main screen and console output to display proper version.
Version project now is 1.5.0 as previous PATCH value (500) was intended to be D3_RELEASE_BUILD_NO, autogenerated on compile time. As we switched to GIT_HASH, D3_RELEASE_BUILD_NO now useless.
2024-04-28 22:05:26 +03:00
Azamat H. Hackimov
bdcb6cdbf4 Fix typo in CMakeLists.txt
Change CMAKE_SYTEM_NAME with CMAKE_SYSTEM_NAME, replace add_definitions with add_compile_definitions.
2024-04-28 14:28:15 +03:00
scivision
1f9c8cbf54 cmake: use regex to simplify
ref compiler ids:
https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html
2024-04-28 14:07:47 +03:00
scivision
4d109a1382 cmake: use CMAKE_SYSTEM_NAME where prudent 2024-04-28 14:04:51 +03:00
scivision
31855c850b cmake: use find_* name-value for readability 2024-04-28 14:04:51 +03:00
scivision
1188b65c43 cmake: modernize, using safer/clearer options
CMAKE_BUILD_TYPE must be set CACHE before project() to take effect

general best practice rather than modifying CMake internal variables
is to use add_compile_options with genex
2024-04-28 14:04:48 +03:00
Azamat H. Hackimov
a1e71ddaeb Convert all Osiris bound types to stdint
This unifies (somehow) all structures for scripting system. Checksum for 64-bit systems was decreased by 32 (ulong -> uint32_t in object.).
2024-04-25 23:03:20 +03:00
Azamat H. Hackimov
4b9ecd66de Add unittest for Osiris checksum calculation
Checking that -DCHECKSUM is correct with actual data structures.
2024-04-25 23:03:20 +03:00
Jeod
3daf5b2060
Merge branch 'main' into fix-release-build 2024-04-24 14:37:13 -04:00
Oskar Strengbohm
132a725daa unzip: Link against real zlib. 2024-04-24 08:22:13 +02:00
Edu Garcia
a4f6405cea
Merge pull request #165 from winterheart/64bit-tests
Implementing C++ byteswap functions
2024-04-23 22:49:18 +01:00
Azamat H. Hackimov
4826c37a69 Add BUILD_INTERFACE to cfile module
Other modules that depends on it, can reuse includes on linking.
There some files formally not belonging any packages (lib directory), as workaround there temporary include_directories(cfile) on root of project. After migrating all modules this can be removed.
2024-04-24 00:41:02 +03:00
Azamat H. Hackimov
c275d359c7 Reapply "Cfile module update"
This reverts commit 066b436fd9.
2024-04-24 00:40:39 +03:00
Thomas Roß
acd727710a Merge branch 'main' into fix-release-build
# Conflicts:
#	CMakeLists.txt
2024-04-23 20:41:34 +02:00
Azamat H. Hackimov
c3e0102a4f Implementing C++ byteswap functions
Implementing byteswap functions by using "backported" from C++23 std::byteswap.
Adding unittests based on GoogleTests. To enable it add `-DBUILD_TESTING=ON` to cmake.
2024-04-23 21:18:07 +03:00
Jacob Coby
96ce6d2c73 Logging updates:
* Adds CMake Option
 * Adds LOGGER to the README
 * Removes MONO define in favor of LOGGER
2024-04-23 13:53:00 -04:00
Jacob Coby
9753f8367f Enable console logging if MONO or LOGGER is defined
Re-enable console logging on linux and mac builds with the -DMONO
option.

Rename overloaded Debug_ConsolePrintf function to
Debug_ConsolePrintfAt to fix macro expansion.

Adds -DLOGGER alias for -DMONO.

Implements #157
2024-04-23 09:07:20 -04:00
Kevin Bentley
1fd8876f60
Merge pull request #135 from DanielGibson/use-libacm
Use upstream libacm 1.3 for ACM audio decoding
2024-04-21 13:46:27 -06:00
Daniel Gibson
f61f34971d Add FORCE_COLORED_OUTPUT option (for GCC and Clang) to CMakeLists.txt
To enforce colorful compiler warnings when building with Ninja
(and GCC/Clang) on Linux and similar platforms.

Taken from dhewm3 (where I implemented it).
2024-04-21 18:21:42 +02:00
Azamat H. Hackimov
fb0dabc367 Implementing HogMaker replacement of HogUtils
Currently, this tool can make only create HOG from list of files taken from text file (one line per file).
2024-04-21 19:15:23 +03:00
Thomas Roß
9d2496f28b [Build] Only set preprocessor define _DEBUG in Debug builds.
Linux and Mac had this set on all build configurations.
2024-04-21 15:14:31 +02:00
Thomas Roß
480b6ad0ed [Build] Added missing RELEASE preprocessor define in Release build. 2024-04-21 14:11:45 +02:00
Thomas Otto
00389c50ea Some more CMake white space formatting
- tabs to spaces
 - use Unix line endings everywhere
 - newline at end of file
 - remove trailing white space
 - no space between keywords and opening parenthesis
 - use 2 spaces to indent
2024-04-21 11:46:32 +02:00
Thomas Otto
9b1f6a3178 Remove -fpermissive and -Wno-address-of-temporary flags 2024-04-20 17:22:27 +02:00
Louis Gombert
ac2b95b645 Remove deprecated CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS 2024-04-20 14:45:49 +02:00
Louis Gombert
c2b71b8147 Standardize CMake formatting
lowercase function names, blocks indent
2024-04-20 14:45:49 +02:00
Louis Gombert
4b53454c0f Remove D3_GAMEDIR hard-coded CMake variable 2024-04-20 13:02:40 +02:00
Jeod
1fb980d2b1
Merge pull request #87 from Arcnor/msvc-warnings
enable stricter MSVC warnings, fix some of them
2024-04-19 12:15:03 -04:00
Edu Garcia
066b436fd9
Revert "Cfile module update" 2024-04-19 13:57:55 +01:00
Edu Garcia
6e772ca4da enable stricter MSVC warnings, fix some of them 2024-04-19 12:38:44 +01:00
Edu Garcia
09cb56f269
Merge pull request #76 from winterheart/cfile-update
Cfile module update
2024-04-19 11:02:58 +01:00
Azamat H. Hackimov
9b45091633 Rename/move cfile related files
Rename to lowercase and move headers to own directory.
2024-04-19 00:17:15 +03:00
Jacob Coby
95f1cad545 Remove MONO define
Fixes `mprintf` and `mprintf_at` calls from causing a segfault.

MONO was used to output debugging info to a monochrome monotor.
2024-04-18 17:15:32 -04:00
Louis Gombert
c68d6419c9 Linux-clang: also apply -Wno-address-of-temporary 2024-04-18 19:15:58 +02:00
Jason Yundt
0dfbcb5076 Allow user to specify additional compiler flags
I’m trying to compile Descent 3 on NixOS, but when I run
“cmake --build <path>”, I get this error:

/home/jayman/Documents/Home/VC/Git/Partially mine/Descent3/repo/Descent3/multi_connect.cpp: In function 'int TryToJoinServer(network_address*)':
/home/jayman/Documents/Home/VC/Git/Partially mine/Descent3/repo/Descent3/multi_connect.cpp:358:16: error: format not a string literal and no format arguments [-Werror=format-security]
  358 |         sprintf(str, TXT(Join_response_strings[Ok_to_join]));
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Eventually, we should actually fix that sprintf call (and any other
calls that would trigger format security warnings), but it would be nice
if users could just temporarily ignore stuff like that.

This commit makes it so that users can set custom complier flags by
doing this:

	$ cmake \
		--preset <preset> \
		-B build \
		-DCMAKE_C_FLAGS=<additional-c-flags> \
		-DCMAKE_CXX_FLAGS=<additional-cxx-flags>
	$ cmake --build build
2024-04-18 07:21:43 -04:00
Azamat H. Hackimov
3f7666eaac Fixes and enhancements to CMake build system
Updated compatibility level to 3.19. Set C++17 globally for all platforms. Removed hardcoded compiler and optimisation flags. Adjusted dependencies and libraries linking.

Reworked script building and hog creation.
2024-04-18 03:04:16 +03:00
Thomas Otto
b909a4cf43 Convert min/max macros to std::min/max
Added explicit <float> or <int> template argument where needed.
Add -DNOMINMAX define for Windows.
2024-04-17 21:43:38 +02:00
Louis Gombert
4d181c8ab3
Merge pull request #20 from th1000s/cmake_unix
Set C++ to 17, and a few CMake fixes for Linux
2024-04-17 18:39:51 +00:00