Commit graph

1338 commits

Author SHA1 Message Date
Kp f0d3523128 Integrate MacOS no-framework mode into the general argument parser 2020-09-13 21:41:35 +00:00
Kp 969caa8c0c Add configure test to check for usable GL utility library
Rebirth built with OpenGL has a hard dependency on the GL utility
library, but did not have a configure time test to report this.  Add
one.

Reported-by: shoober420 <https://github.com/dxx-rebirth/dxx-rebirth/issues/468>
2020-09-11 03:08:02 +00:00
Kreeblah a4a977e9bc
Added scons option to use libraries instead of frameworks on macOS 2020-09-08 23:37:47 -07:00
Kp 0b141ea122 Show CHOST in show_partial_environ
This can influence other values, so it is useful to see it directly.
2020-08-16 00:43:12 +00:00
Kp 3a9bdbfa6e Use __slots__ for cached_property
Remove the redundant storage of the method's name, since it is only read
once in the getter.
2020-06-15 00:21:35 +00:00
Kp 17b9edcd47 Enable -Wredundant-decls when possible
Add an inclusion of <SDL.h> since, for Windows targets, this triggers a
chain of includes that leads to <intrin.h>, which causes
-Wredundant-decls to print a diagnostic.  This allows Windows targets to
declare -Wredundant-decls as unusable, while enabling it for non-Windows
targets.
2020-05-31 23:04:25 +00:00
Kp 3114874713 Delegate PCX loading to SDL_image
This adds a new dependency, but most systems likely already have
SDL_image installed.  Use of SDL_image can be disabled, but this is
discouraged, because various in-game interfaces assume the use of the
original background.

The old implementation automatically corrected for filename case.  The
new implementation expects that the supplied filename can be passed to
PYHSFS_openRead as-is.  All known uses in-game have been corrected to
satisfy this requirement.  If the new stricter match requirement becomes
a problem, a variant of PHYSFSRWOPS_openRead that adjusts filename case
could be created for use here.

- Update install instructions
- Update ebuild
- Update Arch PKGBUILD
2020-05-17 23:35:26 +00:00
Kp f577788665 Use C++17 fold expressions to simplify serialization code 2020-05-17 23:35:25 +00:00
Kp 9ed64013bc Decorate SConf C++ standard tests
Add per-test comments to ease identifying which test is responsible for
a given section.
2020-05-17 23:35:25 +00:00
Kp 6a4a8a62c9 Add unit tests for serialization code 2020-05-17 23:35:25 +00:00
Kp 619ac0abff Use structured bindings for enumerate+zip 2020-05-02 21:18:43 +00:00
Kp ea0f4eb02a Use C++17, not C++14
This only changes the version of the standard used.  It does not
introduce use of new functionality.
2020-05-02 21:18:43 +00:00
Kp 3ce1f2b3ed Require support for C++11 addressof 2020-05-02 21:18:43 +00:00
Kp 3add38df3d Require support for C++14 std::make_unique 2020-05-02 21:18:42 +00:00
Kp cc38cdf4b8 Qualify uses of std::make_unique 2020-05-02 21:18:42 +00:00
Kp 8839f538e0 Refer to <array> directly, not through "compiler-array.h" 2020-05-02 21:18:42 +00:00
Kp 53761500f1 Qualify uses of std::array 2020-05-02 21:18:42 +00:00
Kp 9cee93abb1 Require support for C++14 std::exchange 2020-05-02 21:18:42 +00:00
Kp e4323bf192 Fix gcc-7 build
The existing test for gcc pr #82541 was insufficient, and allowed using
-Wduplicated-branches with gcc-7 in some cases it should not.  Extend
the test to cover these cases.
2020-05-02 21:18:42 +00:00
Kp f0a47c358b Tell clang that GNU extensions are fine in GNU++14 mode 2020-04-28 04:09:47 +00:00
Kp 49138117e4 OSX: log FRAMEWORKPATH, FRAMEWORKS from the construction environment 2020-04-26 17:26:23 +00:00
Kp 03318382d0 Only search for frameworks in directories that exist
mmontag reported that the OS X linker warns when attempting to search a
framework directory that does not exist.  Suppress this warning by
checking for the directory and not adding it to the search path if it
does not exist.

Reported-by: mmontag <https://github.com/dxx-rebirth/dxx-rebirth/issues/503#issuecomment-619457491>
2020-04-26 17:26:23 +00:00
Kp a6590fa496 Update SConstruct test for -Wold-style-cast on OS X
mmontag reports that <HIServices/Processes.h> is no longer available,
and the change from 15b0ec7f42 needs to be
applied to SConstruct as well.

Reported-by: mmontag <https://github.com/dxx-rebirth/dxx-rebirth/issues/503#issuecomment-619463994>
2020-04-26 17:26:23 +00:00
Kp b396445efa Require support for std::index_sequence, std::make_index_sequence
The minimum supported compiler versions now provide a depth-efficient
implementation of std::make_index_sequence, which removes the last
reason to carry a private implementation.  In the case of clang, it
appears to have a special compiler intrinsic used to implement its
std::make_index_sequence.

Switch to the compiler-provided version for both gcc and clang.
2020-04-26 17:26:23 +00:00
Kp 238f529ff4 Clean generated PCH headers
Initialize PCHManager on the clean path, so that the generated headers
are reported to the SCons core.
2020-04-19 20:47:07 +00:00
Kp 7d3f4333be Require support for C++14 template variables 2020-04-19 20:47:07 +00:00
Kp f9b90d4e8c Raise minimum required gcc version to gcc-7
gcc-4.9 support is now difficult to test due to system libraries linking
to newer symbols.  gcc-4.9 is unsupported upstream, as are gcc-5 and
gcc-6.  Raise the minimum required gcc version to the minimum version
supported upstream.

Debian Jessie shipped gcc-4.9.2, and support for this target was the
primary motivator for retaining gcc-4.9 support.  Jessie ended regular
support in June 2018, and will end Long Term Support in June 2020.  It
seems unlikely that Jessie would receive a snapshot build of Rebirth in
the months it has left.

Debian Stretch shipped gcc-6, but is currently considered "oldstable"
and has been superseded by Debian Buster.  Further, Debian Stretch
provides a package for gcc-7, so Stretch users can still build Rebirth
using only packages available from the package manager.
2020-04-19 20:47:07 +00:00
Kp aaaf212dca Add unit test for zip iterator 2020-02-26 05:07:34 +00:00
Kp 8997b5c801 Fix check_header_includes for Python 3 2020-02-11 04:48:14 +00:00
Kp b6e782d128 Add unit tests for xrange 2020-02-01 22:33:31 +00:00
Kp 8fcbb893b7 Rewrite guessed git commit: s/-/_/
In exported archives, the commit will be
`archive-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx` for some hexadecimal
characters `x`.  `-` is not valid in a C identifier, but the commit
needs to be a valid C identifier.  Change `-` to `_` so that it will be
valid.

Reported-by: andrew-strong <https://github.com/dxx-rebirth/dxx-rebirth/issues/484>
Fixes: fafa07a456 ("Instruct git-archive to insert a commit ID in SConstruct")
2020-01-04 22:24:25 +00:00
Kp fafa07a456 Instruct git-archive to insert a commit ID in SConstruct 2019-12-29 22:24:20 +00:00
Kp 4a47e27f08 Apply .decode() to various objects that are embedded in vers_id
Python 2 byte sequences look best when not decoded.  Python 3 byte
sequences look best when decoded.  As Python 2 is near end of life and
most distributions have moved on to Python 3, switch to the style that
looks better in Python 3.  The code still runs in Python 2, but produces
a u'' wrapper around the text because the type is `unicode` in Python 2,
but `str` in Python 3.  This change eliminates the b'' wrapper around
the text in Python 3.
2019-12-29 22:24:20 +00:00
Kp e2a108bbf5 Use base32 instead of base64+extended-identifiers
Extended identifiers have proved to cause more problems than they solve.
Switch to base32 which, while less commonly supported, is available in
Python and uses an alphabet that is almost a subset of the C identifier
alphabet.  Padding characters are still a problem, but can be remapped
to a valid C identifier that is not a valid base32 character.
2019-12-29 22:24:20 +00:00
Kp e20152da11 Remove -Wredundant-decls from the default options
This is primarily a developer option, and it conflicts with some Windows
toolchains that choke on their own headers.  Remove it from the default
options, and rely on developers to set it locally.

Reported-by: AlumiuN <https://github.com/dxx-rebirth/dxx-rebirth/issues/473#issuecomment-554935866>
2019-12-28 21:26:37 +00:00
Kp cc144647b5 Make kconfig.ui-table.cpp compile when freestanding
Special macros are used to pass information to
`generate-kconfig-udlr.py`.  Provide default definitions for these
macros in `kconfig.ui-table.cpp`, and override them in the one build
where they need to be special.  This enables `kconfig.ui-table.cpp` to
build cleanly when invoked from the command line in the compilation
database.
2019-12-22 05:34:08 +00:00
Kp 065bcb3da8 Escape more characters when quoting for the command line
Inserting the compile command for vers_id.cpp into a compilation
database does not quote a string with embedded whitespace, although this
string is correctly quoted when used to invoke a shell.  Remove
whitespace from the character whitelist, so that it is always escaped.
2019-12-17 05:01:38 +00:00
Kp c8c5ed9b86 Merge branch osx-build into master
This change was proposed by an external user as a claimed fix for a
failure to build.  This change has not been tested by the core team.
However, it is a simple change and at worst will break the build.

The change is based in part on advice from recurring contributor
@MaddTheSane.  Neither @MaddTheSane nor @kreatordxx have commented on
the correctness of these changes, though the original author of the
commit, @Sottises, is listed as the origin of the most recent prebuilt
OS X package offered from
<https://www.dxx-rebirth.com/download-dxx-rebirth/>.

Reported-by: Sottises <https://github.com/dxx-rebirth/dxx-rebirth/issues/455>
2019-11-16 22:46:48 +00:00
Kp 2bedba0a2c Only register win32/rbaudio.cpp for Win32/SDL2
Instead of preprocessing out the file for SDL1, skip trying to build it.
2019-10-28 00:45:34 +00:00
ziplantil b38f99d7ce modify SConstruct to handle target platform; fix track finish detect code 2019-10-27 14:53:48 +02:00
ziplantil 2c5ab8e739 initial version of this, trying to catch MCI events 2019-10-27 02:47:45 +03:00
Christian Beckhäuser 2cf0085b1d Removed SDL and SDLmain as default libs for Win32/MinGW, fixing SDL2 build on Windows (SDL1.2 build is not broken by this change). 2019-10-24 09:54:00 +02:00
Kp 15b0ec7f42 Fix externally reported Mac OS X build break
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h:10:9: fatal error:
	  'CoreGraphics/CGBase.h' file not found
    #import <CoreGraphics/CGBase.h>
	    ^~~~~~~~~~~~~~~~~~~~~~~
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h:10:9: note: did not
	  find header 'CGBase.h' in framework 'CoreGraphics' (loaded from
	  '/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks')
    similar/misc/physfsx.cpp:20:10: fatal error: 'HIServices/Processes.h' file not found
    #include <HIServices/Processes.h>

Since this is an OS X problem, this has only been tested by the original
reporter.

Reported-by: Sottises <https://github.com/dxx-rebirth/dxx-rebirth/issues/455>
Suggested-by: MaddTheSane <https://github.com/dxx-rebirth/dxx-rebirth/issues/455#issuecomment-536164089> # SConstruct part
2019-10-23 03:02:16 +00:00
Kp fc81a56e68 Add workaround for clang header search limitation
clang searches for its installed headers relative to the path of the
program calling it, which doesn't work when the caller is a custom
program running from directory other than the system clang installation
directory.  Add a hook to the compilation database support to let the
user inject extra flags into the database, which can be used to add
`-isystem $PATH_TO_INSTALLED_CLANG_HEADERS` to the recorded commands, so
that when the clang library loads the compilation database, it finds the
headers.
2019-10-21 03:45:29 +00:00
Kp 950b365b0a Merge psyke83:gcc8_rpifix into master
psyke83 reports that Raspbian Buster with gcc 8.3.0 rejects the
`-isystem=dir` form.  The `=dir` form does not work on any gcc I can
test, so conditionally keeping it for other systems does not seem
worthwhile.

Requested-by: psyke83 <https://github.com/dxx-rebirth/dxx-rebirth/pull/453>
2019-09-29 22:04:02 +00:00
Kp b438f0f704 Fix TypeError in default_opengles, default_sdl2
Commit 452d58a0b5 switched from passing a list of strings as the
right-hand side of `in` to passing a parenthesized string.  The new form
causes a TypeError if the left hand side is None:

```
>>> None in ('1', '2')
False
>>> None in ('1')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'in <string>' requires string as left operand, not NoneType
```

Add a trailing comma to turn the right hand side back into a list of
strings, as it was before the Raspberry Pi commit.

Fixes: 452d58a0b5 ("Update Raspberry Pi Mesa build for Buster & Pi 4B")
2019-09-18 02:19:23 +00:00
Conn O'Griofa 452d58a0b5 Update Raspberry Pi Mesa build for Buster & Pi 4B
The new Raspberry Pi 4B revision has a minimum requirement of Raspbian
buster, and uses the Mesa V3D driver by default; in fact, the legacy
Broadcom drivers are no longer compatible with its VideoCore VC6 chip, so
building against Mesa is mandatory for this Pi revision.

Unfortunately, the Debian buster version of the Mesa packages
have intentionally dropped the GLESv1 headers, making building of GLESv1
software impractical (even though the VC4/V3D driver can still run GLESv1
applications).

The OpenGL driver in conjunction with SDL2* runs at full
speed on Raspberry Pi 3B & 4B, so it makes sense to modify the "mesa"
build to this configuration in light of these facts.

* SDL2 is highly desirable due to the availability of the KMSDRM driver, which is
the only way to run dxx-rebirth outside of X (we can no longer use
the dispmanx/rpi driver of SDL1).
2019-09-17 13:45:11 +01:00
Conn O'Griofa b30833196c SConstruct: remove equals sign from RPI -isystem definitions
When targeting Raspberry Pi with legacy drivers, the following error
is observed on Raspbian buster with gcc 8.3.0:

cc1plus: error: =/opt/vc/include: No such file or directory [-Werror=missing-include-dirs]
cc1plus: error: =/opt/vc/include/interface/vcos/pthreads: No such file or directory [-Werror=missing-include-dirs]
cc1plus: error: =/opt/vc/include/interface/vmcs_host/linux: No such file or directory [-Werror=missing-include-dirs]

The error can be resolved by removing the equals sign from these definitions.
2019-09-17 03:33:27 +01:00
Kp 95abeb0d64 Fix SConf for Windows/SDL2
On all platforms, libSDL redefined `main` in a way that interfered with
SConf tests.  On some platforms, but not on Linux, libSDL2 does not
redefine `main`.  Based on a remark in the SDL2 migration guide, and the
apparent success (on Linux) after removing the `#undef`, I removed use
of `#undef` when building for SDL2.  As privately reported by zico,
libSDL2 on Windows still redefines `main`, so it still needs an explicit
`#undef` to let the SConf tests build correctly.  For platforms where
`#undef` is not needed, it is harmless.  Add this `#undef`
unconditionally, and update the inline comment.

Fixes: f491059ed7 ("Enable building with SDL2")
Reported-by: zicodxx <private>
2019-09-05 01:55:41 +00:00
Kp 4295eb7e4a Pass CPPDEFINES into compilation database 2019-08-06 02:59:41 +00:00
Kp 4e18ed1ac9 Fix install with register_compile_target=0 register_install_target=1
If register_compile_target=0, `self.builddir` on DXXProgram was used but
not set.

```
AttributeError: 'D1XProgram' object has no attribute 'builddir':
  File "/s/SConstruct", line 5263:
    main(register_program)
  File "/s/SConstruct", line 5218:
    ''.join(['%s:\n%s' % (d.program_message_prefix, d.init(substenv)) for d in dxx])
  File "/s/SConstruct", line 4853:
    self.register_program()
  File "/s/SConstruct", line 4895:
    exe_target = self.builddir.File(exe_target)
```
2019-06-01 21:13:49 +00:00
Kp 65cd43e7d0 Add FreeBSD to allowed platforms
pkubaj proposed extending the if/elif tree.  This patch instead switches
to a loop, which avoids repeating any strings and is cleaner to extend
when another platform shows up needing normalization.

Requested-by: pkubaj <https://github.com/dxx-rebirth/dxx-rebirth/pull/426>
2019-05-28 03:39:23 +00:00
Kp 340e679cd5 Suppress bogus -Wunused-lambda-capture warning to fix clang build
clang treats -Wunused as a request for -Wunused-lambda-capture, which is
good, except that -Wunused-lambda-capture is overzealous.  It should
warn for captures that are not used in the body.  It should not, but
does, warn for captures which are used in the body when such captures
are not required by the standard.  Since 4 of the supported gcc versions
require that capture, removing the capture is not an option at this
point.  Add a test to suppress the clang warning in this case, and hope
that eventually clang will warn only for uses that are actually unused.

This removes the need for parts of <https://github.com/dxx-rebirth/dxx-rebirth/pull/426> (by pkubaj).
2019-05-28 03:39:23 +00:00
Kp 1f03083b68 Add support for generating clang compilation database 2019-05-26 00:44:37 +00:00
Kp c43b9cd430 Fix builddir prefix/suffix confusion
Commit 0e81c05 moved the offending line, but it was already wrong in
54d57a37c9.

Fixes: 0e81c0594e ("Move settings that affect the build to UserBuildSettings")
2019-05-26 00:44:37 +00:00
Kp 7e01a658c6 Prefer storing .sconsign in a build/ subdirectory 2019-05-26 00:44:37 +00:00
Kp 39303358c8 Fix subsequent tests after detecting Boost.Config
Fixes: 1131868f61 ("Fix -Wimplicit-fallthrough for non-Boost users")
2019-05-06 00:36:16 +00:00
Kp 1131868f61 Fix -Wimplicit-fallthrough for non-Boost users
Users who do not install Boost cannot include <boost/config.hpp>.
SConstruct handled this by disabling the macro DXX_BOOST_FALLTHROUGH,
but did not override gcc's default-enabled (via -Wextra)
use of -Wimplicit-fallthrough=3, so users would get a fallthrough
warning and the build would fail.  Adjust this area to explicitly probe
for -Wno-implicit-fallthrough when Boost.Config is not available.

Fixes: 063bf29225 ("Enable -Wimplicit-fallthrough=5; fix resulting breaks")
Reported-by: Jayman2000 <https://github.com/dxx-rebirth/dxx-rebirth/issues/417>
2019-05-04 21:58:18 +00:00
Kp d6b2ba1775 Fix gcc-4.9 build
gcc-4.9 lacks std::cbegin, std::cend.  Fortunately, nothing in the code
uses those, so remove tests for them.

Fixes: 5e434cbe95 ("Require availability of C++11 begin")
2019-04-28 00:53:40 +00:00
Kp 063bf29225 Enable -Wimplicit-fallthrough=5; fix resulting breaks
This enables using -Wimplicit-fallthrough with ccache+distcc, which
strip the fallthrough comments, but do not strip the attribute
annotationns.
2019-04-04 04:29:03 +00:00
Kp 5e434cbe95 Require availability of C++11 begin
Remove the fallback to Boost.Begin.  C++14 is now the minimum supported
standard, and any conforming C++14 compiler should have a working C++11
std::begin.
2019-04-04 04:29:03 +00:00
Kp ca1ed8602f Add test for gcc bug #82541 2019-02-11 01:53:44 +00:00
Kp 7558795edd Fix sharepath confusion when building both targets
Processing sharepath in SConf is incorrect, because targets can share a
build directory (and therefore an SConf run), but not share a sharepath.
Move sharepath handling out of SConf.  Move DXX_USE_SHAREPATH handling
from CGameArg to GameArg, since one game can be built with a sharepath
while the other is built without.
2019-01-20 05:36:56 +00:00
Kp 20c56cd50b Fix missing comma in SConstruct test
The comma was omitted to discourage putting anything after the last
element.  This was fine when there were multiple elements, but with only
one value, the missing comma causes this not to be a tuple as intended.
Add a comma to fix the test.  Add some additional comments on supported
C++ versions by gcc major version.
2019-01-01 04:54:34 +00:00
Kp bc666fb9e0 Require C++14 in SConstruct tests
Recent code changes require use of return type deduction, which is only
standard in C++14 and later.  Require C++14.  In practice, this changes
nothing, because the minimum supported compiler versions were already
choosing C++14.  This change rejects older compilers that were already
unsupported.
2018-12-31 04:46:16 +00:00
Kp 82f2f17c66 Add comment to SConstruct __preferred_win32_linker_options 2018-12-30 00:43:58 +00:00
Kp a705104e84 Check PHYSFS_init return value
PHYSFS_init is not guaranteed to succeed.  Using PHYSFS functions after
PHYSFS_init fails is likely to fail badly.  On Windows, failure may take
the form of a crash in ntdll.  Avoid this by exiting gracefully.
2018-12-08 23:36:18 +00:00
Kp 24cc62caa3 Increase version to 0.61.0
Using 0.59.100 on master, which is well ahead of the 0.59.100 beta tag,
leads to confusing reports.  Raise the version number to disambiguate
this.
2018-12-01 17:14:52 +00:00
Kp 4d3612e453 Do not modify UserBuildSettings in SConf
Creating an attribute on UserBuildSettings during SConf breaks
clean/help, which do not run configure tests.  Remove that and add a
method to return the value the attribute would have had.

Reported-by: derhass <https://github.com/dxx-rebirth/dxx-rebirth/issues/412>
Fixes: 1be414217c ("Add build time flag to choose whether to enable ADL MIDI support")
2018-10-21 20:09:49 +00:00
Kp 1be414217c Add build time flag to choose whether to enable ADL MIDI support
Since ADL MIDI is not packaged on some distributions, default the option
to off.
2018-10-15 00:51:53 +00:00
JP Cimalando ccb91d7362 allow libADLMIDI to be loaded dynamically 2018-10-08 05:02:02 +02:00
JP Cimalando cabe06e895 WIP ADLMIDI 2018-10-04 12:06:27 +02:00
Kp eab2bf4105 Enable -Wduplicated-branches, -Wduplicated-cond when supported 2018-10-01 03:52:05 +00:00
Kp 56d44459d4 Enable SHAREPATH for non-LinuxPlatformSettings 2018-09-14 02:20:55 +00:00
Kp 45ee65bc7e Make host_platform msys an alias for win32
User jammer1 reports that Python under MSYS2[1] reports a `sys.platform`
of `msys`.  For the limited purposes Rebirth requires, this platform can
be treated as if it were `win32`.  Add a mapping to apply this change
automatically, so that users do not need to set it on the command line.

Reported-by: jammer1 <https://github.com/dxx-rebirth/dxx-rebirth/issues/405>

[1]: http://www.msys2.org/
2018-09-11 01:10:57 +00:00
Kp 38d5bd6b86 Fix Windows build
Fixes: e6e0d525b6 ("Use SCons.Node in place of bare path strings")
2018-09-11 01:10:57 +00:00
Kp e6e0d525b6 Use SCons.Node in place of bare path strings 2018-09-09 01:00:39 +00:00
Kp e27f341acd Fix display of failed PCH node generation
enable_build_failure_summary=1 assumed that the command to display was a
list.  For internal pseudo-commands, such as write_pch_inclusion_file,
the command was a string, so calling ' '.join() was incorrect.  When the
output is not a list, pass it through unchanged.
2018-08-29 01:47:42 +00:00
Kp ec1cf005b6 Enable -Wformat-truncation
Add macro cf_assert ("control flow" assert) to hint to gcc that certain
conditions are impossible.  Use it to avoid generating range checks for
situations that never happen.  If the event did happen, the only
consequence would be truncated UI text, rather than a correctness
problem.
2018-08-26 18:10:36 +00:00
Kp 6be3c0e13a Fix PCH conditional nesting 2018-08-24 02:58:21 +00:00
Kp bba8a327a0 Remove use of -Wno-implicit-fallthrough 2018-08-24 02:58:21 +00:00
Kp be18f54d06 Simplify SConstruct StaticObject hook
The prior design was meant to allow the hook to be called instead of the
normal function, with the hook chaining to the normal function and then
performing other work as needed.  This flexibility is unnecessary, and
complicates improvements elsewhere.  Replace it with a hook that is
called with the result of the regular StaticObject call.
2018-08-24 02:58:21 +00:00
Kp 3f164f494d Unpack LazyObjectConstructor loops
Use of the comprehensions makes the code less readable and harder to
modify.  The performance benefit, if any, is in the noise.  Switch to
an unpacked form.
2018-08-24 02:58:21 +00:00
Kp 92cc4bd4ff Handle Python3 bytes vs. str in Git.__compute_extra_version 2018-08-24 02:58:21 +00:00
Kp 1197f568bc Add CHOST qualifier to CXX, RC 2018-08-20 00:34:15 +00:00
Kp 8eff5802b6 Add explicit check for SDL_JOYSTICK_DISABLED 2018-08-03 04:08:12 +00:00
Kp f491059ed7 Enable building with SDL2
This commit enables Rebirth to build with SDL2, but the result is not
perfect.

- SDL2 removed some sticky key support.  Rebirth may behave differently
  now in this area.
- SDL2 removed some key-repeat related support.  Rebirth may behave
  differently now in this area.
- SDL2 gained the ability to make a window fullscreen by sizing it to
  the desktop instead of by changing the desktop resolution.  Rebirth
  uses this, and it mostly works.
  - Resizing while in the automap does not notify the automap code, so
    the view is wrong until the player switches out of automap mode and
    back in.
- SDL2 changed how to enumerate available resolutions.  Since
  fitting the window to the desktop is generally more useful than
  fitting the desktop to the window, I chose to drop support for
  enumerating resolutions instead of porting to the new API.  Users can
  now enter an arbitrary window dimension and Rebirth will make an
  attempt to use it.
  - It might be useful to cap the window dimension at the desktop
    dimension, but that is not done yet.
  - Entering fullscreen mode through the Controls->Graphics submenu
    failed to notify the relevant subsystems, causing the rendered
    content not to rescale.  For now, compile out the option to toggle
    full screen through that menu.  Toggling through Alt+Enter works
    properly.

Despite these quirks, this is a substantial improvement over the prior
commit, where SDL2 cannot be used at all.  The remaining issues can be
resolved in future work.

References: <https://github.com/dxx-rebirth/dxx-rebirth/issues/82>
2018-07-28 23:22:58 +00:00
Kp 19699037ce Move d2x-rebirth/main/bmread.cpp -> similar/main/bmread.cpp 2018-07-18 04:39:28 +00:00
Kp 20f1934312 Move Redbook audio behind DXX_USE_SDL_REDBOOK_AUDIO
Currently, DXX_USE_SDL_REDBOOK_AUDIO is an alias for !SDL2.  However,
this patch enables interested users to readily patch out Redbook even
for SDL1.

References: <https://github.com/dxx-rebirth/dxx-rebirth/issues/82>
2018-07-14 17:23:15 +00:00
Kp 7d4c521382 Fix SConf tests for Windows target
On Windows, SDL headers define `main` to `SDL_main` in addition to doing
it through `pkg-config`.  The countering `#undef` must occur after the
headers are included.  Commit 2a82207 changed the `#undef` to occur too
early.  Linux works fine, but Windows broke.

Move the `#undef` back down.  Switch to named format parameters to make
it easier to maintain.

Fixes: 2a82207e91 ("Add unit tests for valptridx parameter validation")
2018-06-30 18:59:53 +00:00
Kp 2a82207e91 Add unit tests for valptridx parameter validation 2018-06-17 05:04:38 +00:00
Kp 9b2d5d5162 Add debug hook $DXX_SCONS_DEBUG_USER_SETTINGS to log user_settings init
For the benefit of users less familiar with how setup is handled, add a
hook triggered by $DXX_SCONS_DEBUG_USER_SETTINGS to log initialization
of `user_settings` so that users can trace which values combined to
produce the observed results.
2018-06-17 05:04:38 +00:00
Kp 2f4524d3c2 Add screenshot=none to disable screenshot support
Per comment from kreator, some Apple systems now ship without a working
print screen key.  It makes no sense to provide print screen support
bound to a key which does not exist.  Add `screenshot=none` and activate
it on OS X to remove the unreachable screenshot support.
2018-06-16 04:13:37 +00:00
Kp 479235d5bc Mark variadic forwarding constructor as constexpr
This is safely ignored when the constructor cannot satisfy `constexpr`.
Without this modifier, forwarding to `constexpr` constructors is not
`constexpr`, which causes build failures.

clang-5 with `sconf_cxx11_inherit_constructor=force-failure`:
```
    similar/main/gauges.cpp:553:61: error: constexpr constructor's 1st parameter type 'const (anonymous namespace)::hud_x_scale_float' (aka 'const hud_scale_float<'x'>') is not a literal type
    similar/main/gauges.cpp:432:7: note: 'hud_scale_float<'x'>' is not literal because it is not an aggregate and has no constexpr constructors other than copy or move constructors
```

Fixes: 893e8cde06 ("Combine hud gauge parameters")
2018-06-12 02:53:06 +00:00
Kp bf84c3be4e Improve SCons diagnostics for missing required headers 2018-06-06 04:53:45 +00:00
Kp 784213ec1f Avoid magic strings for LazyObjectConstructor dict keys
Replace magic strings with sentinel objects, so that mistakes are
reported as missing variables, rather than being legal at parse time and
incorrect at runtime.
2018-05-17 05:30:28 +00:00
Kp 09cebc080c Undefine blank SHAREPATH
If user_settings.sharepath is configured to be blank in SConstruct, omit
the C preprocessor macro SHAREPATH instead of defining it to expand to
an empty string.  Adjust the C++ code that uses the macro SHAREPATH to
handle its absence:
- Clearer output in help text
- Skip adding blank SHAREPATH to the PhysFS search path.

As a nice side effect, this enables SHAREPATH on Windows, which could be
helpful for builds shipped with an installer that places game files in a
well-known location (such as "C:\Games\Descent").  Previously,
!defined(__unix__) systems did not add SHAREPATH to the PhysFS search
path, even when one was defined.
2018-05-17 02:49:15 +00:00
Kp 457022db48 Require C++11 static_assert
- Remove the one test that clang-5 still fails.
- Require all remaining tests to pass using only C++11 native
  static_assert.
- Remove preprocessor-based alternative static_assert implementations.

gcc-8 adds calls to static_assert with a comma inside its first
argument in the implementation of std::vector.  This is legal within the
standard, but conflicts with Rebirth's use of static_assert as a
two argument preprocessor macro.  The macro is not substantially useful,
and was only present to compensate for the clang limitation removed in
the previous commit.  Remove the macro.

References: <https://github.com/dxx-rebirth/dxx-rebirth/issues/388>
2018-05-05 22:33:55 +00:00
Kp 7249e4569f Adapt PCHManager to Python 3 __new__ rules
Python 2 permitted defining __new__, then deleting it once it had been
used.  Python 3 does not directly reject that pattern, but instead
always fails with an error about wrong number of arguments to object().
Switch to a simple classmethod that is explicitly invoked by the first
__init__().
2018-04-30 05:31:16 +00:00
Kp 0a5e9eb592 Adapt to Python 3 strict bytes vs str rules 2018-04-30 05:31:16 +00:00