### Required packages
The minimum SDL version is 2.0.18 for Linux and 2.24.0 for Windows.
+The supported compilers are GCC and Clang.
The following package names are for Debian, see below for Windows and Mac.
##### Client
Not recommended due to poor support for C standards, and lack of maintenance.
-DarkPlaces requires C11, so Windows SDK 10.0.22000.0 (VS 2019) or 10.0.20348.0 (VS 2022) or later is needed.
-To install it, run the Visual Studio Installer, click "Modify", click "Individual components", select the latest Windows SDK version and de-select older versions.
-You will also need the NuGet Package Manager selected (to download SDL2 headers the first time you build).
+DarkPlaces requires C11, so Windows SDK 10.0.20348.0 or later is needed.
+To install it, run the Visual Studio Installer, click "Modify", click "Individual components", type "Windows SDK" in the search box, select the latest Windows SDK and de-select older versions.
+You will also need "NuGet package manager" selected (to download SDL2 headers the first time you build).
Click "Modify" to apply the changes.
-VS 2019
-![MSVC2019](msvc2019_C11.png)
+Open `darkplaces-vs2019.sln`, select build type (`Debug` or `Release`) and platform (`Win32` or `x64`), and choose "Build Solution" from the "Build" menu to create files `darkplaces-sdl2-vs2019.exe` and `SDL2.dll`.
-Open `darkplaces-vs2019.sln`, select build type "Debug" or "Release, and choose "Build Solution" from the "Build" menu to create the file `darkplaces-sdl2-vs2019.exe`.
+The Release build crashes. The Debug x64 build doesn't crash (but is rather slow) so this will be Fun for someone to debug.
-The Release build crashes. The Debug build doesn't crash (but is rather slow) so this will be Fun for someone to debug.
-
-To get a build suitable for playing Quake you'll need to use MinGW gcc, or download the autobuild from Xonotic (see above).
+To get a build suitable for playing you'll need to use MinGW GCC, or download the autobuild from Xonotic (see above).
## Contributing
<RootNamespace>darkplacessdl2</RootNamespace>\r
<Keyword>Win32Proj</Keyword>\r
<ProjectName>darkplaces-sdl2-vs2019</ProjectName>\r
- <WindowsTargetPlatformVersion>10.0.22000.0</WindowsTargetPlatformVersion>\r
+ <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\r
</PropertyGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
- <PlatformToolset>v142</PlatformToolset>\r
<CharacterSet>MultiByte</CharacterSet>\r
<WholeProgramOptimization>true</WholeProgramOptimization>\r
+ <PlatformToolset>v142</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
- <PlatformToolset>v142</PlatformToolset>\r
<CharacterSet>MultiByte</CharacterSet>\r
+ <PlatformToolset>v142</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
- <PlatformToolset>v142</PlatformToolset>\r
<CharacterSet>MultiByte</CharacterSet>\r
<WholeProgramOptimization>true</WholeProgramOptimization>\r
+ <PlatformToolset>v142</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
- <PlatformToolset>v142</PlatformToolset>\r
<CharacterSet>MultiByte</CharacterSet>\r
+ <PlatformToolset>v142</PlatformToolset>\r
</PropertyGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
<ImportGroup Label="ExtensionSettings">\r
<DisableSpecificWarnings>4706;4127;4100;4055;4054;4244;4305;4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>\r
<MultiProcessorCompilation>true</MultiProcessorCompilation>\r
<AdditionalOptions>/wd"4201" %(AdditionalOptions)</AdditionalOptions>\r
+ <LanguageStandard>stdcpp17</LanguageStandard>\r
+ <LanguageStandard_C>stdc17</LanguageStandard_C>\r
</ClCompile>\r
<Link>\r
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>\r
<DisableSpecificWarnings>4706;4127;4100;4055;4054;4244;4305;4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>\r
<MultiProcessorCompilation>true</MultiProcessorCompilation>\r
<AdditionalOptions>/wd"4201" %(AdditionalOptions)</AdditionalOptions>\r
+ <LanguageStandard>stdcpp17</LanguageStandard>\r
+ <LanguageStandard_C>stdc17</LanguageStandard_C>\r
</ClCompile>\r
<Link>\r
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>\r
# Compilation
+# -D_POSIX_C_SOURCE=200809L doesn't enable all of POSIX 2008, wtf?
+# -D_DEFAULT_SOURCE does enables all of POSIX 2008 (without GNU extensions).
ifeq ($(PEDANTIC),1)
- CFLAGS_STANDARD=-std=c11 -pedantic -D_POSIX_C_SOURCE=200809L -DCONFIG_PEDANTIC
+ CFLAGS_STANDARD=-std=c17 -pedantic -D_DEFAULT_SOURCE -DCONFIG_PEDANTIC
else
CFLAGS_STANDARD=
endif
#include "qstats.h"
struct mempool_s;
struct sizebuf_s;
-// protocolversion_t is defined in common.h
-enum protocolversion_e;
+// protocolversion_t is defined in common.h
enum protocolversion_e Protocol_EnumForName(const char *s);
const char *Protocol_NameForEnum(enum protocolversion_e p);
enum protocolversion_e Protocol_EnumForNumber(int n);
void Sys_MakeProcessNice (void);
void Sys_MakeProcessMean (void);
+int Sys_Main(int argc, char *argv[]);
+
#endif
{
Sys_Error("Called Sys_SDL_Delay on non-SDL target");
}
+
+int main(int argc, char *argv[])
+{
+ return Sys_Main(argc, argv);
+}
{
SDL_Delay(milliseconds);
}
+
+int main(int argc, char *argv[])
+{
+ return Sys_Main(argc, argv);
+}
#include "taskqueue.h"
#include "thread.h"
#include "libcurl.h"
-#if defined(_MSC_VER)
- // Not sure why MS compiler needs this here and gcc doesn't...
- // and gcc fails to build darkplaces-dedicated if it's included here.
- #include "SDL.h"
-#endif
sys_t sys;
#endif
}
-int main (int argc, char **argv)
+/** main() but renamed so we can wrap it in sys_sdl.c and sys_null.c
+ * to avoid needing to include SDL.h in this file (would make the dedicated server require SDL).
+ * SDL builds need SDL.h in the file where main() is defined because SDL renames and wraps main().
+ */
+int Sys_Main(int argc, char *argv[])
{
sys.argc = argc;
sys.argv = (const char **)argv;