Commit graph

1390 commits

Author SHA1 Message Date
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
Kp 6148327e4b Adapt configure tests to Python 3 filter API change
In Python 3, filter returns an object that can be iterated to get the
filtered content.  However, there is no way to reset the object, so it
is useless for persistence.  Spend the one iteration copying the data
into a tuple, which can be iterated multiple times.
2018-04-30 05:31:16 +00:00
Kp 8b4586bd20 Adapt PreservedEnvironment to Python 3 dictionary API changes
Python 3 `dict.keys()` returns an object that cannot be added to other
instances of itself.  Pass the returned objects as a tuple, then let the
callee use itertools.chain to combine them during iteration.
2018-04-30 05:31:16 +00:00
Kp a3d6bdd3f1 Add compatibility shims for Python 3 dictionary API change
Python 3 removed `dict.keys` and `dict.items`, then renamed
`dict.iterkeys` and `dict.iteritems` to `dict.keys` and `dict.items`,
respectively.  The iteration semantics are preferable here, so add shims
to use the iteration API under a version-appropriate name.

Change PreservedEnvironment.__getitem__ back to a class method, instead
of an instance variable.  Python 3 refuses to search the instance
dictionary for __getitem__, so the optimization of copying
`self.flags.__getitem__` to `self.__getitem__` breaks in Python 3.
2018-04-30 05:31:16 +00:00
Kp 1c0001d31d Fix parsing SConstruct file lists in Python 3
Python 3 changed the rules for list comprehensions, so the comprehension
can no longer see a class-scope variable without a class qualifier.  The
class qualifier is not legal until the class is finished.  Work around
this limitation by expanding the use inline.
2018-04-30 05:31:16 +00:00
Kp 1097630e42 Simplify host_platform normalization
OpenBSD 6 uses `openbsd6` as its sys.platform.  Strip trailing numbers,
then remove the hack for converting `linux2` into `linux`.  This should
prevent compatibility problems when OpenBSD 7 is used.
2018-03-27 03:49:34 +00:00
Kp 4b39cca42e Clarify SConf output when rejecting a header
Commit 265af2b9e5 added an extra test for whether the header could be
preprocessed, but reused the string shown when an empty test program is
compiled.  This can confuse users since the same message is shown twice.
Differentiate the messages.

Fixes: 265af2b9e5 ("Extend SConf diagnostics for failed system headers")
2018-03-27 03:49:34 +00:00
Kp 1527d14c2d Fix SConf png test for gcc-4.9
gcc-4.9 warns (and due to -Werror, errors) for `png_time pt{}` because
the members are not explicitly initialized.  This code is compiled, but
never run, so the explicit initialization is unnecessary.  Later
versions of gcc accept both versions of this code without complaint.

Fixes: 131c1b9f4d ("Add support for PNG screenshots")
2018-03-24 21:33:29 +00:00
Kp 1c92b448c8 Add d_level_object_state to wrap Objects and related data 2018-03-12 03:43:46 +00:00
Kp 4d318b9177 Clarify SDL1 vs SDL2 SConf messages 2018-03-02 03:19:02 +00:00
Kp fab7eb39c3 Flatten GL lists in SConstruct
This is a longstanding cosmetic issue.  Appending a tuple to a list
retains the tuple structure, which is then printed later.  Append it as
a list so that it is flattened.
2018-02-18 18:52:22 +00:00
Kp f904f76c99 Add tool version suboptions show_assembler_version, show_linker_version
OpenBSD clang does not handle `-print-prog-name=as` in a useful manner.
Since this query is purely diagnostic, add an undocumented knob to
suppress the query.
2018-02-18 18:52:22 +00:00
Kp 131c1b9f4d Add support for PNG screenshots 2018-02-18 00:42:42 +00:00
Kp 754d34f750 Fix PCH build 2018-02-18 00:42:42 +00:00
Kp e7aedfff52 Whitelist openbsd6 as valid host_platform in SConstruct
thfrwn reports that OpenBSD (almost) works as-is, except that its
Python `sys.platform` is not in the allowed values list.  Add it to the
list.  By happy accident, unhandled `host_platform` is treated as
`'linux'` and `'linux'` produces the right result for OpenBSD.

Requested-by: thfrwn <https://github.com/dxx-rebirth/dxx-rebirth/pull/359>
2017-12-24 00:28:35 +00:00
Kp f73b783095 Generate kconfig udlr relations at build time 2017-12-24 00:28:35 +00:00
Kp c09aab491b Fix max_buttons_per_joystick=0 max_hats_per_joystick!=0 build
Internally, hats are treated as a group of 4 buttons.  Disabling all
buttons while not disabling all hats caused a build error.  Since no one
reported this, this configuration is likely not used.  Make the simple
fix of coercing max_hats_per_joystick to 0 when max_axes_per_joystick is
0.
2017-12-24 00:28:35 +00:00
Kp 6043168d51 Move various SDL-only texture mapping functions to !DXX_USE_OGL
The OGL build compiles, but does not use, various texture mapping
functions.  Move these to be built only for the SDL build.
2017-11-01 02:01:21 +00:00
Kp 3fbc710ec5 Move various SDL-only scanline functions to !DXX_USE_OGL
The OGL build compiles, but does not use, various scanline functions.
Move these to be built only for the SDL build.
2017-11-01 02:01:20 +00:00
Kp 3276590084 Merge branch 'psyke83/rpi' into master
psyke83 reports that Debian distributions for Raspberry Pi now require a
different name for some video libraries.  Merge psyke83's SCons
enhancements to add support for the new names while retaining support
for the old names.
2017-10-26 02:02:50 +00:00
Kp 1eb29c6e71 Set raspberrypi EnumVariable ignorecase=2 to avoid user confusion
ignorecase=1 coerces the user's input only for validation, but retains
the original case for later processing.

ignorecase=2 coerces the user's input for all purposes, and retains the
coerced form for later processing.

Since other code compares the `raspberrypi` variable to specific values
from the whitelist, user input must be mapped to that whitelist both for
SCons validation and for that later code.  With ignorecase=1, a user
could set `raspberrypi=MESA`, which would pass SCons validation, but
then not be treated as equal to `mesa` when computing default values.
With ignorecase=2, `raspberrypi=MESA` will be recorded as `mesa` and
compute the desired default value.

Fixes: 166b1ecd4d ("RPI: update vendor library names & add Mesa VC4 build support")
2017-10-26 01:58:28 +00:00
Kp 8838b46e65 Suppress PhysFS deprecation errors
PhysFS 2.0 only offers PHYSFS_read/PHYSFS_write for I/O.  PhysFS 3.0
deprecates PHYSFS_read / PHYSFS_write and offers PHYSFS_readBytes /
PHYSFS_writeBytes.  Converting Rebirth to use the new API is somewhat
invasive, and would require dropping support for PhysFS 2.0.

For now, for compatibility with PhysFS 2.0, disable the deprecation
errors and continue to use the older functions.

Reported-by: gabeotisbenson <https://github.com/dxx-rebirth/dxx-rebirth/issues/352>
2017-10-22 04:20:35 +00:00
Conn O'Griofa 166b1ecd4d RPI: update vendor library names & add Mesa VC4 build support
Vendor library has new names to avoid conflicts with Mesa. Update
raspberrypi argument to use new libraries and support Mesa VC4 driver.

* raspberrypi=1 will build against the (newly named) vendor libraries
* raspberrypi=mesa will target building against the VC4 driver.

Both will select GLES by default, but you can target GL for the VC4 driver
via "raspberrypi=mesa opengles=0"
2017-10-22 02:50:13 +00:00
Kp 8d80300e0a Remove obsolete D1 hostage editor code
This code was part of a feature abandoned before retail.  It cannot be
usefully used in campaigns.  Remove it to reduce code size and simplify
later changes.
2017-10-14 17:10:31 +00:00
Kp 3ad6972a03 Read pkg-config modversion before flags, not after
Reading modversion after flags can cause confusing output if the flags
load successfully, but the modversion call fails.
2017-10-14 17:10:30 +00:00
Kp 12369d2dd8 Add SConstruct modeline to set tabstop=4 2017-10-14 17:10:30 +00:00
Kp 8f4a20e65b Set Environment CXX earlier
SCons tries to probe the compiler designated by CXX before Environment()
returns.  Set CXX in the call to Environment so that it probes the
correct tool.
2017-10-14 17:10:30 +00:00
Kp 49da5bd5f7 Suppress blank builddir from CPPPATH 2017-10-14 17:10:30 +00:00
Kp e9d8c3c784 Only include linker version if linker path is available
If resolving the linker path fails, ld_path is not usable to run an
external program, but DXXProgram tried to use it as such.  Test ld_path
before using it.
2017-10-14 17:10:29 +00:00
Kp b9af2dbedb Only shlex.split pkg-config paths from user
Splitting auto-generated paths is wasteful, but almost always harmless
on Linux.  However, Windows uses backslash as a path separator, which
conflicts with its standard meaning as an escape character.  Using
shlex.split on a generated Windows path strips required backslashes,
causing a later failure to find the command.  Move the shlex.split call
to apply only to user-specified paths.

Reported-by: ef314159 <https://github.com/dxx-rebirth/dxx-rebirth/issues/349>
2017-10-14 17:10:29 +00:00
Kp d0f709381d Fix build break when using Windows as a host platform
ef314159 reports that running SCons on Windows fails with an
AttributeError exception.  `os.uname` is not available on Windows, but
SConstruct assumed it was.  Trap the error and report a machine of
`None`, since this is purely for logging.

Reported-by: ef314159 <https://github.com/dxx-rebirth/dxx-rebirth/issues/348#issuecomment-334657171>
Fixes: 1ed7cec714 ("Tighten __builtin_constant_p check to handle gcc-7")
2017-10-07 00:54:55 +00:00
Kp af863fdef7 Parenthesize SCons message() call to print
When print_function is imported (or Python 3 is used), print without
parentheses is an error.  Historically, SCons has used only Python 2 and
has not enabled print_function.  This may change, so add parentheses to
the one affected site.  None of the print_function features are used, so
this should work in both Python 2 and Python 3.
2017-10-07 00:54:55 +00:00
Kp f2a8be23a9 Prefer dict.get() over try/except KeyError in SConstruct 2017-09-26 04:15:50 +00:00
Kp a6a5f7be82 Make vers_id.cpp depend on ${SOURCE_DATE_EPOCH-None} 2017-08-02 02:49:12 +00:00
Kp c9d733dd10 Add experimental Windows manifest 2017-08-02 02:49:12 +00:00
Kp 7b12619c3a Unify resource file compilation 2017-08-02 02:49:12 +00:00
Kp 7378179663 Fix __builtin_constant_p test in LTO mode
LTO allows the compiler to prove variable values that non-LTO mode
cannot prove.  The workaround for the gcc-7 __builtin_constant_p
quirk incorrectly caused LTO on older gcc to report __builtin_constant_p
as unsupported.  Fix this by adding a stub asm() statement to hide the
value of the input parameter from the compiler.

Fixes: 1ed7cec714 ("Tighten __builtin_constant_p check to handle gcc-7")
2017-08-02 02:49:12 +00:00
Kp 4128ce2971 Use compiler-provided integer_sequence when it is depth-efficient
Early implementations of integer_sequence used a naive implementation
that required one level of template depth per additional integer in the
sequence.  Rebirth uses a private alternate implementation named
make_tree_index_sequence that requires only log(N) steps for an
N-element index_sequence.  Recent versions of gcc ship a log(N) version
of integer_sequence.  Probe for that version and, if found, use it
instead of the private implementation, on the theory that the compiler
writers did at least as good a job as I did, and possibly better if they
were able to leverage compiler implementation details.
2017-07-26 03:15:59 +00:00
Kp 8ccf0e5301 Add PHYSFS_read wrapper support
- Add wrappers for PHYSFS_read and its convenience functions.  Poison
  the memory before calling PHYSFS, so that any uninitialized bytes
  (likely caused by a short read) are reported if the caller tries to
  access the value anyway.
- Add SConstruct options to enable wrapping, so that users do not need
  to enumerate the wrapped functions manually.
- Fix link failure when using LTO+wrappers.
2017-07-26 03:15:58 +00:00
Kp b83ac0acfa Update SConstruct comment regarding gcc bug #70844 (-Wuseless-cast) 2017-06-17 23:05:16 +00:00
Kp 57b67078da Exclude valptridx.tcc from PCH
It is not meant to be included in every file.  Starting in gcc-7, static
functions declared in valptridx.tcc generate -Wunused-function warnings
if the including file does not instantiate any templates that use the
static function.  Avoid these warnings by including the tcc only in a
file that is guaranteed to instantiate templates that use these
functions.
2017-06-10 03:31:04 +00:00
Kp 73057ad8ec Suppress unhelpful gcc-7 warnings for now
gcc-7 warning -Wformat-truncation would be good to fix, but the compiler
does not offer an acceptable solution yet.

gcc-7 warning -Wimplicit-fallthrough requires more analysis of the
diagnosed sites to identify which, if any, require a resolution other
than suppressing the warning.
2017-06-10 03:31:04 +00:00
Kp 5b12f28564 Add workaround for unwanted gcc-6 "used but never defined" warning
gcc-6 issues a "used but never defined" warning for functions which are
declared, never defined, and used only in contexts which are later
deleted by the optimizer.  If the function were actually used, the link
would fail.  Switch to a complicated mechanism to define the function
while keeping it out of line so that __attribute__((__error__)) is
triggered as intended.
2017-06-10 03:31:03 +00:00
Kp 1ed7cec714 Tighten __builtin_constant_p check to handle gcc-7
Compile time sanity checks are built on gcc's __builtin_constant_p.
This intrinsic is useful for optimization and for some simple forms of
compile-time checks (such as the infamous open(2) missing mode), but
upstream does not guarantee that it will work reliably for more
complicated checks.  Starting in gcc-7.1, __builtin_constant_p returns
an incorrect result of true for the vm_vec_sub expression

    `(a.x == b.x && a.y == b.y && a.z == b.z)`

even when the blamed sites clearly cannot prove that the inputs are
equal.  The useful result would be to return true if, and only if, the
inputs were provably identical; inputs which might be identical at
runtime, or might not, would return false.  Based on a bug filed with
gcc and the developer comments there, it appears many projects have
assumed this intrinsic is usable in this way, but the gcc developers do
not guarantee that it can be used this way.  Additionally, they believe
affected projects are rare and were wrong to use this intrinsic, so they
have no plans to fix this regression.

For more details, see gcc bug #72785
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72785>.  For some more
pointed commentary on this change in gcc, see Linus' kernel commit
474c90156c8dcc2fa815e6716cc9394d7930cb9c
<https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=474c90156c8dcc2fa815e6716cc9394d7930cb9c>.

Update the SConf test to include the reproducer shown by Markus
Trippelsdorf in gcc bug #72785, comment #0.  This reproducer compiles
cleanly on <gcc-7, causing no change in semantics on older compilers.
Affected versions of gcc-7 will miscompile this reproducer into a link
error, causing SConf to record that the compiler does not optimize
__builtin_constant_p.  This is pessimistic, since even affected versions
of gcc-7 can handle some simple uses of __builtin_constant_p correctly.

This is a quick fix to get gcc-7 users working.  Upstream seems
disinclined to revert to the more useful semantics of <gcc-7 or to
introduce an alternative intrinsic with more helpful semantics.  As a
minor enhancement for Rebirth, it would be nice to probe the limits of
gcc-7's handling of __builtin_constant_p so that cases it handles
correctly could be enabled for gcc-7 users, while still blacklisting the
more complicated checks that gcc-7 miscompiles.

Thanks to Markus Trippelsdorf for providing a minimal reproducer to
detect the affected gcc versions.

Reported-by: parkerlreed <https://github.com/dxx-rebirth/dxx-rebirth/issues/337>
2017-06-03 17:11:12 +00:00
Kp fc53137237 Extend SDL test to check for OpenGL mismatch
When Rebirth is configured to use OpenGL, it cannot start with an SDL
that lacks OpenGL support.  Detect this mismatch at build time.  Require
the user to resolve the conflict by disabling Rebirth OpenGL or by
enabling SDL OpenGL.
2017-06-03 17:11:11 +00:00
Kp 9478d1e6a5 Add custom terminate handler on Windows 2017-04-22 21:23:56 +00:00
Kp b98053a34f Fix Windows net_udp.cpp build
The Windows implementation of inet_ntop incorrectly omits the `const`
qualifier on the input address.  This broke the Windows build, since
Rebirth passes a const-qualified input address, as permitted by POSIX.

Some Windows cross-compilers, such as mingw32, lack a definition of
inet_ntop entirely.  For such environments, fall back to inet_ntoa and
disallow building with IPv6.

Rework the formatting and add a Windows-specific test for whether
inet_ntop is available.  As inet_ntop is specified by POSIX, assume all
modern non-Windows platforms support it.
2017-04-22 21:23:56 +00:00
Kp 2dd4384d9d Move _WIN32_WINNT setup to SConf 2017-04-22 21:23:55 +00:00
Kp 6c98a3d61b Summarize failed nodes 2017-04-22 21:23:55 +00:00
Kp d0747bd481 Rename user_settings.LDFLAGS to user_settings.LINKFLAGS
SConstruct prefers to refer to linker flags for the main executable as
LINKFLAGS, not LDFLAGS.  Rename the internal storage to eliminate a
special case in accessing it.  Continue to use the environment variable
$LDFLAGS as an initial value, since many tools expect to pass linker
flags through $LDFLAGS.
2017-04-22 21:23:54 +00:00
Kp 9688c50e7e Add warning when build arguments override unknown variable warning 2017-04-08 16:48:18 +00:00
Kp c7a510df22 Only print toolchain information if compilation is enabled 2017-04-08 16:48:18 +00:00
Kp a815541ef5 Fix check_header_includes=1 poison.h 2017-02-19 19:33:36 +00:00
Kp 625bfde977 Tighten test for warning -Wuseless-cast
zicodxx reported a compiler error when using inheriting constructors
when using an unspecified environment.  Investigation shows that gcc-6.x
has a regression that causes spurious -Wuseless-cast warnings where the
compiler automatically synthesizes a cast, then warns the user that the
synthesized cast is useless.

Compensate for this by extending the -Wuseless-cast testcase to provoke
this bug, if present.  Affected users will lose -Wuseless-cast, but
their build will succeed.

Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/316>
2017-02-08 23:34:41 +00:00
Kp 51710ba9db Default to -fno-omit-frame-pointer for Windows
Popular Windows tools for stack unwinding lack support for the DWARF
debug format.  Unwinding the stack without DWARF is unreliable without
frame pointers.  Default frame pointers to enabled for Windows so that
these tools work despite their lack of DWARF support.
2017-01-11 03:03:19 +00:00
Kp d2dc321528 Fix sconf.log version output 2017-01-08 22:32:01 +00:00
Kp 55822d0b4d Add wrappers for more precise Valgrind physfs diagnostics 2017-01-01 23:19:21 +00:00
Kp 61fe5c2bbd Add undocumented CPP/CXX/LINK flags that bypass SConf testing
These flags are passed through to the underlying build, but not checked
by the SConf tests.  They are meant for options which will work in the
main build, but fail in the configure environment, such as `-Wl,--wrap`.
2017-01-01 23:19:21 +00:00
Kp 265af2b9e5 Extend SConf diagnostics for failed system headers 2016-12-22 05:21:17 +00:00
Kp 9a45534ccc Require support for reference qualified methods 2016-12-10 17:51:07 +00:00
Kp ea040f100d Cache SConstruct startup variables 2016-12-10 17:51:07 +00:00
Kp aaea5411e1 Only set -Wunused if __attribute__((unused)) works 2016-12-05 00:26:08 +00:00
Kp 16d2a3f866 Fix pch build
Move DXX_VERSION_SEQ from DXXProgram to DXXCommon to make it visible to
DXXArchive.configure_environment().  If pch is enabled, define
DXX_VERSION_SEQ in dxxsconf.h and remove it from the command line.  This
fixes a build failure where gcc ignored ownpch.cpp.gch because it was
built without DXX_VERSION_SEQ, but some files were built with
DXX_VERSION_SEQ.
2016-11-26 22:51:47 +00:00
Kp da50b79fb9 Fix syspch build 2016-11-26 22:51:47 +00:00
Kp 73d014c048 Tighten getaddrinfo test
To recognize getaddrinfo as supported, require that the AI_* flags
passed to it be usable:
- AI_NUMERICSERV must be defined as a number or be undefined
- If ipv6=1, then AI_V4MAPPED and AI_ALL must be defined as numbers

When getaddrinfo is used, raise _WIN32_WINNT from 0x501 to 0x600.
Otherwise, lower it to 0x500.
2016-11-12 20:58:16 +00:00
zico ad638539d6 Setting version number to 0.59.100 for upcoming public BETA. 2016-11-12 16:07:21 +01:00
Kp 1ba67c0d30 Test whether SDL_endian.h provokes -Wuseless-cast warning
derhass reports that SDL on Raspbian provokes a warning from
-Wuseless-cast.  Add a test that will report -Wuseless-cast as unusable
when SDL causes this warning.  Developers on Raspbian will not get the
benefit of -Wuseless-cast, but their build will succeed.

Reported-by: derhass <https://github.com/dxx-rebirth/dxx-rebirth/issues/257>
2016-10-30 18:37:28 +00:00
Kp 458070a080 Add test and fallback for extended identifiers
Extended identifiers are convenient when supported, but derhass reports
that the latest stable gcc on Raspbian stable fails the test for
mandatory extended identifier support.  Replace the Cxx11RequiredFeature
test for extended identifiers with an SConf test to selectively enable
-fextended-identifiers.

Reported-by: derhass <https://github.com/dxx-rebirth/dxx-rebirth/issues/254>
Fixes: a8a41aa2ff ("Move git version into Python class")
2016-10-29 23:16:19 +00:00
Kp c2626ea488 Default poison to 'overwrite' in debug builds 2016-10-29 23:16:16 +00:00
Kp a8a41aa2ff Move git version into Python class 2016-10-21 02:16:47 +00:00
Kp d6ccaf9dec Defer show_partial_environ until after adding -g,-O2 2016-10-15 17:51:48 +00:00
Kp 3dd988d1b6 Pass DXX_VERSION_SEQ only to files that use it 2016-10-15 00:53:19 +00:00
Kp 95cd7fd368 Pass SHAREPATH only to files that use it 2016-10-15 00:53:18 +00:00
Kp 8d98eb474e Move DXX_WORDS_NEED_ALIGNMENT to user settings
Previously, raspberrypi mode forced DXX_WORDS_NEED_ALIGNMENT on and any
other mode forced it off.  Add a specific user setting for
DXX_WORDS_NEED_ALIGNMENT.  Set its default as bool(raspberrypi) to
preserve the previous special case.
2016-10-09 17:35:03 +00:00
Kp 7cf9fc6dd9 Move endian handling into SConf
This allows per-target overrides, instead of a single global override as
the older method provided.
2016-10-09 17:35:03 +00:00
Kp b02375bfbd Rename WORDS_NEED_ALIGNMENT to DXX_WORDS_NEED_ALIGNMENT
Rename symbol WORDS_NEED_ALIGNMENT to DXX_WORDS_NEED_ALIGNMENT to show that it is a DXX
symbol, not one inherited from a library.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -wl WORDS_NEED_ALIGNMENT -- '*.h' '*.cpp' | xargs sed -i -e 's/^\s*#ifdef \(WORDS_NEED_ALIGNMENT\)\>/#if DXX_\1/' -e 's/\s*#\(el\)\?if \(.*\)defined(\(WORDS_NEED_ALIGNMENT\))/#\1if \2DXX_\3/' -e 's/^\s*#ifndef \(WORDS_NEED_ALIGNMENT\)\>/#if !DXX_\1/'
2016-10-09 17:35:03 +00:00
Kp 9dc30c6499 Fix build when poison=None
Fixes: 03dbc96103 ("Switch DXX_HAVE_POISON to 0/1 instead of undef/defined")
2016-10-09 17:35:02 +00:00
Kp b195b3077b Switch DXX_HAVE_POISON_VALGRIND to 0/1 instead of undef/defined 2016-10-08 23:24:21 +00:00
Kp 0ad0a57fea Switch DXX_HAVE_POISON_OVERWRITE to 0/1 instead of undef/defined 2016-10-08 23:24:21 +00:00
Kp 03dbc96103 Switch DXX_HAVE_POISON to 0/1 instead of undef/defined 2016-10-08 23:24:21 +00:00
Kp da4f55f47e Show some environment values before/after sconf runs 2016-10-02 00:34:50 +00:00
Kp 08f6653fcd Split check_builtin_constant_p override 2016-10-02 00:34:39 +00:00
Kp cd4e5441ba Rename WORDS_BIGENDIAN to DXX_WORDS_BIGENDIAN
Rename symbol WORDS_BIGENDIAN to DXX_WORDS_BIGENDIAN to show that it is a DXX
symbol, not one inherited from a library.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -wl WORDS_BIGENDIAN -- '*.h' '*.cpp' | xargs sed -i -e 's/^\s*#ifdef \(WORDS_BIGENDIAN\)\>/#if DXX_\1/' -e 's/\s*#\(el\)\?if \(.*\)defined(\(WORDS_BIGENDIAN\))/#\1if \2DXX_\3/' -e 's/^\s*#ifndef \(WORDS_BIGENDIAN\)\>/#if !DXX_\1/'
2016-09-30 01:49:57 +00:00
Kp 9da6507e82 Remove test DXX_HAVE_CONSTEXPR_UNION_CONSTRUCTOR
Test DXX_HAVE_CONSTEXPR_UNION_CONSTRUCTOR probes for a bug present in
<=gcc-4.7.x.  Rebirth now rejects <=gcc-4.8.x for other reasons, so all
supported gcc versions pass test DXX_HAVE_CONSTEXPR_UNION_CONSTRUCTOR.
Remove the test.
2016-09-25 04:52:49 +00:00
Kp 4894117d70 Rename MAX_HATS_PER_JOYSTICK to DXX_MAX_HATS_PER_JOYSTICK
Rename symbol MAX_HATS_PER_JOYSTICK to DXX_MAX_HATS_PER_JOYSTICK
to show that it is a DXX symbol, not one inherited from a library.

git grep -lzw MAX_HATS_PER_JOYSTICK -- SConstruct '*.h' '*.cpp' | xargs -0 sed -i -e 's/\<MAX_HATS_PER_JOYSTICK\>/DXX_&/g'
2016-09-25 04:52:49 +00:00
Kp 94937de128 Rename MAX_BUTTONS_PER_JOYSTICK to DXX_MAX_BUTTONS_PER_JOYSTICK
Rename symbol MAX_BUTTONS_PER_JOYSTICK to DXX_MAX_BUTTONS_PER_JOYSTICK
to show that it is a DXX symbol, not one inherited from a library.

git grep -lzw MAX_BUTTONS_PER_JOYSTICK -- SConstruct '*.h' '*.cpp' | xargs -0 sed -i -e 's/\<MAX_BUTTONS_PER_JOYSTICK\>/DXX_&/g'
2016-09-25 04:52:49 +00:00
Kp 7d38a9f0be Rename MAX_AXES_PER_JOYSTICK to DXX_MAX_AXES_PER_JOYSTICK
Rename symbol MAX_AXES_PER_JOYSTICK to DXX_MAX_AXES_PER_JOYSTICK to show
that it is a DXX symbol, not one inherited from a library.

git grep -lzw MAX_AXES_PER_JOYSTICK -- SConstruct '*.h' '*.cpp' | xargs -0 sed -i -e 's/\<MAX_AXES_PER_JOYSTICK\>/DXX_&/g'
2016-09-25 04:52:49 +00:00
Kp f24e9f836c Rename MAX_JOYSTICKS to DXX_MAX_JOYSTICKS
Rename symbol MAX_JOYSTICKS to DXX_MAX_JOYSTICKS to show that it is a DXX
symbol, not one inherited from a library.

git grep -lzw MAX_JOYSTICKS -- SConstruct '*.h' '*.cpp' | xargs -0 sed -i -e 's/\<MAX_JOYSTICKS\>/DXX_&/g'
2016-09-25 04:52:48 +00:00
Kp 335a87b994 Probe pkgconfig modversion 2016-09-25 04:52:48 +00:00
Kp 8585bd7d7c Change LazyObjectConstructor to nested comprehension 2016-09-24 18:06:11 +00:00
Kp 62b58e9890 Move OGL to dxxsconf.h; rename to DXX_USE_OGL
Rename symbol OGL to DXX_USE_OGL to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -lzw OGL -- '*.h' '*.cpp' | xargs -0 sed -i -e 's/\(\s*#\s*if\)def\s*OGL/\1 DXX_USE_OGL/' -e 's/\(\s*#\s*if\)ndef OGL/\1 !DXX_USE_OGL/' -e 's/\(\s*#\s*if !\?\)defined(OGL)/\1DXX_USE_OGL/'
2016-09-24 18:06:11 +00:00
Kp 3544ea097d Move OGLES to dxxsconf.h; rename to DXX_USE_OGLES
Rename symbol OGLES to DXX_USE_OGLES to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -lzw OGLES -- '*.h' '*.cpp' | xargs -0 sed -i -e 's/\(\s*#\s*if\)def\s*OGLES/\1 DXX_USE_OGLES/' -e 's/\(\s*#\s*if\)ndef OGLES/\1 !DXX_USE_OGLES/'
2016-09-24 18:06:11 +00:00
Kp 9ef9bd2445 Fix SConstruct pcall cache bug
Caching pcall as a default argument interfered with hotpatching pcall to
become an appropriate implementation after testing for the presence of
git.
2016-09-24 18:06:10 +00:00
Chris Taylor e7bb902d35 Allow frameworks and libraries to be packaged into the DXX-Rebirth app bundle for Mac OS X (under Contents/Frameworks).
Previously this could be achieved by setting the install path to @executable_path/../Frameworks/<path to framework> for each framework or library, but for Mac OS X 10.5 onwards, these frameworks (namely SDL and SDL_mixer) are set by default to install to @rpath for greater flexibility. @rpath is then set by the binary, in this case DXX-Rebirth to @loader_path/../Frameworks via SCons.

On Mac OS X it is common practice to distribute applications with any frameworks or libraries specific to that application within the application bundle.
2016-09-20 15:18:50 +08:00
Kp 94cc8c4d78 Blacklist -Wold-style-cast on buggy clang versions
clang on OS X incorrectly diagnoses mistakes in Apple system headers
even when -Wsystem-headers is not specified.  Move -Wold-style-cast from
the forced CXXFLAGS section to an SConf test that includes one of the
deficient headers.  This should cause SConf to declare OS X clang as
unable to use -Wold-style-cast, which is necessary to avoid spurious
failures when including Apple headers that use old style casts.
2016-09-15 01:50:56 +00:00
Kp 2ccb4e7066 Fix SCons OS X get_platform_objects build error 2016-09-14 01:59:32 +00:00
Kp 9a8bd1aecb Add disabled tests for curl/jsoncpp
The legacy UDP tracker does not need either curl or jsoncpp.
The new HTTP tracker requires both.  Add tests for both, guarded by
`use_tracker`.  Force `use_tracker` to False for now.  When the HTTP
tracker is made active, remove the assignment so that use_tracker=1 will
enable the new tests.
2016-09-11 18:49:16 +00:00
Kp be691aba0b Move git extra version from DXXProgram to Git 2016-09-11 18:49:16 +00:00
Kp 6a3ded191f Move EDITOR to dxxsconf.h; rename to DXX_USE_EDITOR
Rename symbol EDITOR to DXX_USE_EDITOR to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -wl EDITOR -- '*.h' '*.cpp' | xargs sed -i -e 's/^\s*#ifdef \(EDITOR\)\>/#if DXX_USE_\1/' -e 's/\s*#\(el\)\?if \(.*\)defined(\(EDITOR\))/#\1if \2DXX_USE_\3/' -e 's/^\s*#ifndef \(EDITOR\)\>/#if !DXX_USE_\1/'
2016-09-11 18:49:16 +00:00
Kp 0015b4282c Move IPv6 to dxxsconf.h; rename to DXX_USE_IPv6
Rename symbol IPv6 to DXX_USE_IPv6 to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -wl IPv6 -- '*.h' '*.cpp' | xargs sed -i -e 's/^\s*#ifdef \(IPv6\)$/#if DXX_USE_\1/' -e 's/\s*#\(el\)\?if \(.*\)defined(\(IPv6\))/#\1if \2DXX_USE_\3/'
2016-09-11 18:49:15 +00:00
Kp 435aa5a020 Move USE_UDP to dxxsconf.h; rename to DXX_USE_UDP
Rename symbol USE_UDP to DXX_USE_UDP to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -l USE_UDP -- '*.h' '*.cpp' | xargs sed -i -e 's/^\s*#ifdef \(USE_UDP\)$/#if DXX_\1/' -e 's/\s*#\(el\)\?if \(.*\)defined(\(USE_UDP\))/#\1if \2DXX_\3/'
2016-09-11 18:49:15 +00:00
Kp 7c8c2b5aa4 Move USE_TRACKER to dxxsconf.h; rename to DXX_USE_TRACKER
Rename symbol USE_TRACKER to DXX_USE_TRACKER to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -l USE_TRACKER -- '*.h' '*.cpp' | xargs sed -i -e 's/^#ifdef \(USE_TRACKER\)$/#if DXX_\1/' -e 's/#\(el\)\?if \(.*\)defined(\(USE_TRACKER\))/#\1if \2DXX_\3/'
2016-09-11 18:49:15 +00:00
Kp ddf888cd72 Move USE_SDLMIXER to dxxsconf.h; rename to DXX_USE_SDLMIXER
Rename symbol USE_SDLMIXER to DXX_USE_SDLMIXER to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct and
inferno.cpp were manual.

git grep -l USE_SDLMIXER -- '*.h' '*.cpp' | xargs sed -i -e 's/^#ifdef \(USE_SDLMIXER\)$/#if DXX_\1/' -e 's/#\(el\)\?if \(.*\)defined(\(USE_SDLMIXER\))/#\1if \2DXX_\3/'
2016-09-11 18:49:15 +00:00
Kp baa8831bce Test whether compiler handles -Wuseless-cast
clang does not understand -Wuseless-cast.  Passing -Wuseless-cast to
clang causes clang to fail the compile.  Resolve this by adding an SConf
test for -Wuseless-cast instead of adding it unconditionally.  It cannot
be put in the compiler preferred options tuple since it must be set
before the test for whether casting a ptrdiff to int is useless.
2016-09-11 18:49:14 +00:00
Kp 8f9b9d7504 Unfold register_program comprehension
The folded form combined multiple targets into one, which is not the
desired result.

'''
unfolded
l=['gcc5,', 'mingw5,'] e='gcc5,' p=('gcc5', '')
l=['gcc5,', 'mingw5,'] e='mingw5,' p=('mingw5', '')
folded
l=['gcc5,', 'mingw5,'] e='mingw5,' p=('gcc5', '', 'mingw5', '')
'''

    import itertools
    l = ['gcc5,', 'mingw5,']
    print('unfolded')
    for e in l:
	    for p in itertools.product(*[v.split('+') for v in e.split(',')]):
		    print("l=%r e=%r p=%r" % (l, e, p))
    print('folded')
    for p in itertools.product(*[
		    v.split('+')    \
			    for e in l  \
			    for v in e.split(',')	\
	    ]):
	    print("l=%r e=%r p=%r" % (l, e, p))
2016-09-07 04:24:33 +00:00
Kp dee78671dc Enable -Wold-style-cast 2016-09-04 19:10:43 +00:00
Kp d851ee988d Fix wording of linker diagnostic report 2016-08-22 00:31:15 +00:00
Kp 63c5b5f9ea Clean up SConstruct global namespace 2016-08-20 22:28:43 +00:00
Kp ef93feca38 Enable -Wuseless-cast 2016-08-19 03:41:42 +00:00
Kp bbdecad649 Add helper macro to handle printf .* conversion for 32/64
Field width conversion `.*` always takes an `int`.

On Win32, casting `long` to `int` triggers a `-Wuseless-cast` warning.
Omitting the cast works correctly.

On Linux/amd64, casting `long` to `int` works correctly.
Omitting the cast triggers a `-Wformat` warning.

Add a macro that conditionally expands to `static_cast<int>` or to ``,
as necessary for the target platform.
2016-08-19 03:41:41 +00:00
Kp 9be68f4e99 Add SConf test for struct timespec 2016-08-19 03:41:40 +00:00
Kp c6f20901d3 Move lazy object getters into default argument scope 2016-08-19 03:41:40 +00:00
Kp bc7f627a36 Cache Link in SConstruct check_preferred_compiler_options 2016-08-17 04:44:22 +00:00
Kp 9924e66082 Replace implicit getter via property with explicit getter calls
Rename members to reflect that they are now explicit getters.
2016-08-17 04:44:22 +00:00
Kp a44498a1ae Improve reporting of bad $CXXFLAGS/$LDFLAGS/$LIBS 2016-08-17 04:44:22 +00:00
Kp 5df6dc47fb Simplify PCH filename passing 2016-08-17 04:44:22 +00:00
Kp 522c37b898 Move -mwindows from DXXProgram to DXXCommon
Environment tests should use it since it is used for the main
executable.
2016-08-14 23:47:27 +00:00
Kp 11519b4a75 Update documentation and test to exclude <gcc-4.9 2016-08-14 23:47:26 +00:00
Kp 1ca0dacb6c Cache context.sconf.Define 2016-08-13 22:20:13 +00:00
Kp 1cb62b1815 Compute Conftests self.Compile at __init__ time 2016-08-13 22:20:13 +00:00
Kp d3535e8486 Prefilter configure test names 2016-08-13 22:20:13 +00:00
Kp cbf745eb9a Switch DXXProgram._computed_extra_version to staticmethod
It did not use its class argument, so remove it.
2016-08-13 22:20:13 +00:00
Kp 20294a54ac Remove dead statements in DXXCommon.process_user_settings 2016-08-13 22:20:13 +00:00
Kp 74525090e7 Update get_found_includes hook for newer SCons
Newer SCons applied a performance optimization that breaks a technique
used in the check_header_includes=1 build.  Switch to a technique that
should work reliably on old and new SCons, although with slightly
reduced efficiency in both cases.  The effective performance penalty
should be unnoticeable and only applies to developers building with
check_header_includes=1.
2016-08-12 04:08:57 +00:00
Kp 8a4908ea2f Precompute and save C++11 required feature list
The C++11 required feature string was computed once per configured
environment.  When two or more environments were configured in a single
run, this was wasteful.  Reorder the SConf tests to precompute the
string.
2016-08-12 04:08:57 +00:00
Kp 7b173c3570 Fold use of raise StopError 2016-08-12 04:08:57 +00:00
Kp 4cb3d46148 Move <type_traits> test to Cxx11RequiredFeature
Commit 957016621e ("Remove support for
Boost.TypeTraits") removed support for any alternative implementation of
<type_traits>, so C++11 <type_traits> is now required.  Move it to
the Cxx11RequiredFeature array to combine it with the other required
feature tests.
2016-08-08 00:07:20 +00:00
Kp 95a53ed820 Require C++11 range-based for
Fallback support for Boost.Foreach is broken and no one has reported it.
The minimum required gcc version supports range-based for.  Recent Clang
supports range-based for.  No Microsoft compilers are supported.  Remove
support for the fallback Boost.Foreach and move the C++11 range-based
for test to the Cxx11RequiredFeature array.
2016-08-08 00:07:19 +00:00
Kp 7d3c3288a9 Remove support for array other than std::array
Building with Boost.Array fails due to name lookup errors.  These could
be fixed, but since no one has reported them and they are fairly old,
Boost.Array appears to be unused.  Remove support for it.

Building with std::tr1::array fails due to missing features in
std::tr1:array relative to std::array.  No one has reported this either,
so remove support for std::tr1:array.

Move the test for std::array into the Cxx11RequiredFeature list so that
it is run as part of the group test, rather than as a separate
statement.
2016-07-31 22:25:49 +00:00
Kp 1e07e4c566 Remove leading underscore for dxx_constructor_base_type 2016-07-21 01:43:22 +00:00
Kp c9d1928e8c Refactor recording build environment 2016-07-21 01:43:22 +00:00
Kp b0526d6928 Respect verbosebuild=0 for Windows resource files 2016-07-16 16:52:04 +00:00
Kp 3b0d4bf8be Fix lto run of size_type format test 2016-07-16 16:52:04 +00:00
Kp 674a9213f8 Add workaround for Win32 wrong type for size_t
GCC std::array uses std::size_t for its size_type.  On Linux/amd64,
`std::size_t` is `unsigned long`.  On Win32, `std::size_t` is
`unsigned int`.  This provokes format string warnings because an
unsigned int is passed where the format string declares an unsigned
long.  On Win32, `unsigned int` and `unsigned long` are the same size,
so `unsigned long` could have been used to avoid this problem by
maintaining consistency with Linux, but it was not.  This may have been
an attempt to achieve bug compatibility with Microsoft's types.

Add a workaround by defining a macro DXX_PRI_size_type in the style of
inttypes.h PRI* macros.  Use an SConf test to determine the correct
value by inspecting which compilation runs succeed.  Currently, Linux
needs "l", Win32 needs "", and Win64 needs "I64".
2016-07-15 03:43:03 +00:00
Kp a9aa5552b7 Pass SConf test macros into later tests
Some tests may benefit from the results of earlier tests.  Other tests
may give different results if the macros from earlier tests are defined.
SCons dependency checking rejects including dxxsconf.h during testing,
so save the results of self._check_macro and insert them into later
tests.  Some tests define their macros in other ways.  The macros from
those tests and are not yet inserted.
2016-07-15 03:43:03 +00:00
Kp 957016621e Remove support for Boost.TypeTraits
Boost enable_if works differently from std::enable_if, so the build is
broken when using Boost.TypeTraits.  The broken code has been present
for a long time and no one reported it.  Remove the fallback to Boost.
2016-07-15 03:43:01 +00:00
Kp a502342654 Remove -Wl,--insert-timestamp when $SOURCE_DATE_EPOCH is set 2016-07-14 01:59:02 +00:00
Kp a990bd9651 Describe git tag in banner output 2016-06-01 01:52:45 +00:00
Kp de219e3d48 Enable -Wshadow
All shadow warnings in the default build have been fixed.  Enable
-Wshadow by default to flag any new instances.
2016-05-22 17:50:13 +00:00
Kp 443b1f2915 Add file/line to valptridx output when available 2016-04-06 03:34:13 +00:00
Kp 27cef20eb3 Move namespace dsx handling to dsx-ns.h 2016-03-19 19:08:10 +00:00
Kp 20e72128de Add configure test and fallback code to support ancient Windows
Windows 2000 has no support for getaddrinfo.  Five years ago (Apr 5
2011), the addition of tracker support
(7f18afd5d7) brought a requirement for
getaddrinfo.  Recently, someone with a working Windows 2000 system
reported that Rebirth no longer starts on Windows 2000.  Although such
systems should not be connected to the Internet, they may still need
name resolution on a LAN.  Add a configure test to probe for getaddrinfo
support and fall back to gethostbyname if needed.

Compiling a binary that works on Windows 2000 requires one of:
* using an ancient SDK that does not declare getaddrinfo
* defining _WIN32_WINNT to exclude Windows XP support
* overriding the SConf test to force failure

Fixes: 7f18afd5d7 ("Client-side implementation for Tracker support by Matt 1360 Vandermeulen including improvements in udp_dns_filladdr and IPv4/IPv6 compability; Very little adjustments by me, too including IPv6 support for Windows (untested); Actual tracker code will follow later as seperate branch when it's done")
2016-03-18 02:05:16 +00:00
Kp 254feabd3a Tabs are 4 spaces 2016-03-02 02:52:44 +00:00
Kp 401f5581c8 Remove guessed -lSDL on OS X
OS X handles linking differently than other platforms.  Asking to link
to SDL breaks the test.
2016-02-23 04:18:13 +00:00
Kp 42ef6b2e72 Add applelink to Darwin tools 2016-02-23 04:18:13 +00:00
Kp 3cb4d99a49 Remove dsx safety net for clang
Clang becomes confused trying to resolve X::a when:
- both `namespace ::X` and `class ::B::X` exist
- `using namespace B;` is active

even if class ::B::X is only a forward-declaration.  Add an SConf test
to recognize when the compiler rejects this pattern and hide the safety
nets that are implemented using it.
2016-02-06 22:12:55 +00:00
Kp fa8ceaeb5f Use extend for OGL defines
Fixes: 04e3c1e9a3 ("Move OpenGL cpp flag tracking to SConf")
2016-02-03 03:00:32 +00:00
Kp 30783846fe Improve SCons ipv6 option documentation 2016-02-02 03:10:53 +00:00
Kp 42a1c560cd Move UDP cpp processing to sconf 2016-01-26 03:45:08 +00:00
Kp cb4600456d Move IPv6 cpp processing to sconf 2016-01-26 03:45:07 +00:00
Kp d35a51e766 Move editor cpp processing to sconf 2016-01-26 03:45:07 +00:00
Kp 29740cf80c Move memdebug cpp processing to sconf 2016-01-26 03:45:07 +00:00
Kp e73e44de79 Move developer-mode cpp processing to sconf 2016-01-26 03:45:07 +00:00
Kp 04e3c1e9a3 Move OpenGL cpp flag tracking to SConf 2016-01-26 03:45:07 +00:00
Kp 1a11370084 Pass archive to prepare_environment 2016-01-26 03:45:07 +00:00
Kp 7b2426fd3e Add gcc to Darwin tool list 2016-01-21 03:57:38 +00:00
Kp 5d7796c344 Swap single/double quote due to Windows shell bug
Microsoft cmd.exe has strange quoting rules.  Where other shells treat
single quote as a quote character, cmd.exe seems to pass it through to
the underlying process.  This breaks the vers_id compilation with
strange error messages.  In practice, SCons does not need the
no-interpolation semantics that single quote provides, so switch to
double quote for compatibility with Windows.  This is probably slightly
less efficient on Bash, since it will now scan the value for expansions.
However, the efficiency loss is tiny compared to overhead elsewhere in
the build.
2016-01-19 04:29:34 +00:00
Kp 65790ec925 Guess pkg-config flags when pkg-config is missing/broken 2016-01-13 04:33:44 +00:00
Kp 15e4130e1a Write more sconf actions to sconf.log 2016-01-12 03:28:45 +00:00
Kp 1e28cb52e3 Remove explicit assignment of subprocess.Popen(executable)
Windows systems get confused and fail to find the process if the
executable name is assigned.
2016-01-09 16:38:15 +00:00
Kp 0a2ef79242 Remove close_fds=True from StaticSubprocess
Per the documentation, on Linux, the default is true.  On Windows,
setting it to true causes a Python exception because Windows relies on
disabling inheritance as a hack to close all descriptors, but
inheritance needs to be enabled to capture the output of the child
process.

Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/173>
Fixes: bb3f414128 ("Cache scons subprocess calls")
2016-01-03 20:21:36 +00:00
Kp ba17de4cd5 Add -Wuninitialized to default warning options 2016-01-03 20:21:35 +00:00
Kp 26e948d5f1 Uninline namespace dsx 2015-12-13 18:00:49 +00:00
Kp dc8c0323d8 Uninline namespace dcx 2015-12-13 18:00:49 +00:00
Kp 30cb6d8c8d Improve dcx/dsx comments
Move the boilerplate up onto the outer namespace line.  Decorate each
collision with a comment stating its purpose, so that compiler error
output echoes the type of collision.
2015-12-13 18:00:48 +00:00
Kp 80ea17a61c Convert OSError to StopError for failed tool version checks 2015-12-11 03:39:40 +00:00
Kp 69c5a79058 Use inline namespace dcx for common/2d 2015-12-05 22:57:23 +00:00
Kp 60e6c23ccc Always pass tuple for argument prefix list
Fixes: dd59be7163 ("Cache various SConstruct temporaries")
2015-12-04 03:36:33 +00:00
Kp ff51ff5474 Copy sdl-config CPPDEFINES before modification
Fixes: 6111e5adbf ("Allow configuring max joysticks at build time")
2015-12-04 03:36:32 +00:00
Kp dd59be7163 Cache various SConstruct temporaries
This started as a project to make SConstruct take less time on an empty
build.  Unforunately, most of the major gains lie elsewhere and require
deeper changes to the build system.  These changes do not help much, but
they are better than nothing.
2015-12-03 03:26:49 +00:00
Kp 3528acb78d Add $DXX_EFFECTIVE_SOURCE to check_header_includes dependencies 2015-11-24 04:05:35 +00:00
Kp a2b4dcbd9c Use $DXX_EFFECTIVE_SOURCE for quiet header check builds 2015-11-24 04:05:35 +00:00
Kp 7b4eeb8c0c Suppress debug info for check_header_includes outputs 2015-11-17 03:31:21 +00:00
Kp d36e86f8bc Factor out some Scons None assignments 2015-11-14 18:17:22 +00:00
Kp 0c86fd507d Fix mingw32 build
Fixes: 38df160341 ("Create platform_settings, env on first use")
2015-11-07 21:56:00 +00:00
Kp 6111e5adbf Allow configuring max joysticks at build time 2015-11-01 21:15:40 +00:00
Kp 139f2aaa44 Reduce scope of LazyObjectConstructor.__strip_extension 2015-11-01 21:15:39 +00:00
Kp 0a041018c8 Let register_cpp_output_targets see check_header_includes 2015-11-01 21:15:39 +00:00
Kp 83f1a94ec4 Move __shared_header_file_list to create_header_targets 2015-11-01 21:15:39 +00:00
Kp afb1fc3383 Remove special-case for profiler support
Stackable build profiles allow this to be specified without a special
case in SConstruct.
2015-11-01 21:15:39 +00:00
Kp f5dfa1a3b2 Inline banner() 2015-11-01 21:15:39 +00:00
Kp 38df160341 Create platform_settings, env on first use 2015-11-01 21:15:39 +00:00
Kp b35ef80a0f Reduce global lookups 2015-11-01 21:15:38 +00:00
Kp bab5f5f1be Reduce env lookups 2015-11-01 21:15:38 +00:00
Kp e86e1a882a Combine adjacent env.Append calls 2015-10-29 03:01:42 +00:00
Kp fd51188e57 Simplify DXXCommon instance counter 2015-10-29 03:01:42 +00:00
Kp 9c4a4e3cf8 Remove unnecessary __init__ methods 2015-10-28 02:44:36 +00:00
Kp def268faf9 Combine lazy object caches 2015-10-28 02:44:36 +00:00
Kp edea687627 Remove HAVE_STRUCT_TIMEVAL
SConstruct defines it for all platforms.  It is only false on Mac OS 9,
which is no longer supported.
2015-10-27 03:04:49 +00:00
Kp e7c65dbc3f Use property for LinuxPlatformSettings ogllibs
It is only called once per instance, so caching it as an instance
value is not helpful.  Change it to a property so that __init__ can be
removed.
2015-10-27 03:04:49 +00:00
Kp a4eda5e6f7 Include commented tool versions in sconf tests
Encourage SCons not to reuse test results when the printed version
strings have changed.
2015-10-24 03:13:11 +00:00
Kp 4951cb0b8f Fix build break if no git and extra_version='' 2015-10-18 21:01:20 +00:00
Kp 927b14848f Add optional cpp output targets 2015-10-18 21:01:18 +00:00
Kp 091bcbec26 Support skipping configure/compile stages 2015-10-18 21:01:18 +00:00
Kp 2a1e07adfa Detect failure to git ls-files for check_header_includes 2015-10-13 02:43:25 +00:00
Kp d3198ab0bd Use env.Textfile to generate stub check_header_includes.cpp 2015-10-13 02:43:24 +00:00
Kp 365340560d Cache result of checking for .git 2015-10-13 02:43:24 +00:00
Kp c1b1da61e5 Support unusual values of CPP define SHAREPATH
Use the full CPP define quoting function instead of just hoping
sharepath is clean.
2015-10-13 02:43:24 +00:00
Kp 2e17c03c9e Remove unnecessary list comprehension for vers_id.cpp
It was a convenience for binding 's' to one value, but that can be
rewritten without the comprehension.
2015-10-13 02:43:24 +00:00
Kp a71e886fce Add scons option to skip pch optimization
Add option to compute indirect includes even when not necessary, since
indirect includes influence the inclusion count shown in the comments.
Enabling this option makes SCons work harder for the same output binary.
It should only be used by developers who want to see precise file
inclusion counts.
2015-10-09 02:46:10 +00:00
Kp 4041e3ba53 Test whether compiler can use PCHs it generates
Current gcc requires a non-PIE cc1plus for working PCH support.  If the
chosen compiler is PIE, it will succeed in building the PCH, then fail
when trying to use it.
2015-10-03 17:17:49 +00:00
Kp f37e55737c Shorten secondary calls to Git.pcall 2015-09-29 02:41:22 +00:00
Kp 433b80c0b3 Reduce copying of pkg-config result 2015-09-29 02:41:22 +00:00
Kp e2d16844a8 Fix handling of pch_cpp_assume_unchanged 2015-09-26 21:17:14 +00:00
Kp f3470cef5f Show tool versions in sconf output 2015-09-26 21:17:13 +00:00
Kp 51a86c62ef Hide undocumented options
If no help text is defined, hide the associated option from --help.
2015-09-26 21:17:13 +00:00
Kp 0b242833f5 Always set StaticSubprocess.stdout to PIPE 2015-09-26 21:17:13 +00:00
Kp 63dd2656ed Document some SConstruct tests 2015-09-26 21:17:12 +00:00
Kp 76b94de1de Add commented out hook for warning on valptridx exceptions 2015-09-26 21:17:12 +00:00
Kp 4afae87883 Remove -Wcast-align from default compiler options
Per issue from MattWatt, gcc for Raspberry Pi warns about alignment
issues.

Per issue from kreator, clang warns about alignment issues on OS X.
However, it does not warn on x86_64-pc-linux-gnu.

GCC only warns when compiling for a target architecture that requires
alignment, so it does not warn for i686-pc-linux-gnu or
x86_64-pc-linux-gnu.

Using this warning would be nice, but since it only triggers on
architectures not maintained by active developers, it causes more
trouble than it may solve.

Alignment sensitive users will have to get by with software fixups until
an active developer begins targeting alignment sensitive hardware.

Reported-by: MattWatt <https://github.com/dxx-rebirth/dxx-rebirth/issues/119>
Reported-by: kreatordxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/120>
2015-09-19 23:04:36 +00:00
Kp f1021de448 Add SDL_NumJoysticks() to SDL library test
Some builds of SDL lack joystick support.  Rebirth requires joystick
support in SDL, even if the user never connects a joystick.  Add a call
to SDL_NumJoysticks during the SDL test so that systems without SDL
joystick support fail the "usable library SDL" test.
2015-09-19 23:04:36 +00:00
Kp ae5fc1b74b Remove wrapper Cxx11Compile
All compilation is now at least C++11.
2015-09-19 23:04:36 +00:00
Kp 348c656311 Explicitly require C++11 support 2015-09-19 23:04:36 +00:00
Kp 6c49f5b95d Disable ccache/distcc during SConf 2015-09-19 23:04:36 +00:00
Kp d18835bcf9 Invert sense of {} messages
Prefer to always have 'yes' for good results and 'no' for bad results.
2015-09-19 23:04:35 +00:00
Kp 22a7d121f5 Restructure compiler preferred option tests 2015-09-19 23:04:35 +00:00
Kp 61044df4f7 Use string formatting consistently 2015-09-19 23:04:35 +00:00
Kp 451325c89b Improve lazy object setup 2015-09-19 23:04:35 +00:00
Kp 54928db871 Cache os.environ.get 2015-09-19 23:04:35 +00:00
Kp 8f7ed1f5ee Remove unused program_specific_objects 2015-09-19 23:04:35 +00:00
Kp d954cdf279 Look up configure test docstring at record time 2015-09-13 21:02:19 +00:00
Kp 198b8295c4 Force sconf.log verbose for LINKCOMSTR 2015-09-13 21:02:19 +00:00
Kp f2d9ffe48d Rewrite PCH generation 2015-09-13 20:23:05 +00:00
Kp 0ec66ef673 Use collections.defaultdict for successful_flags 2015-09-13 20:23:05 +00:00
Kp 433fc96505 Avoid redefining LazyObjectConstructor.__strip_extension 2015-09-09 03:27:52 +00:00
Kp 80f70fbc34 Remove SConf test check_compiler_template_parentheses_warning
Test check_compiler_template_parentheses_warning probes for a bug in
gcc-4.6.  Upstream fixed the bug in gcc-4.7.  Using gcc-4.6 is no longer
supported, so remove the test for the bug.
2015-08-22 20:43:04 +00:00
Kp 37838329a1 Add SConf hook to check result against expected value 2015-08-22 20:43:04 +00:00
Kp 3bf0c93067 Factor out lookup of sconf overrides 2015-08-22 20:43:03 +00:00
Kp b5bf4cf9cc Change - to _ for check_compiler_option names 2015-08-22 20:43:03 +00:00
Kp 389cd42f47 Default verbosebuild on for non-tty outputs 2015-08-14 03:02:04 +00:00
Kp 41ecab004f Skip message for unknown variables when there is nothing to do
Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/115>
Fixes: 870ed653b5 ("Warn about unknown scons variables")
2015-08-11 03:05:55 +00:00
Kp 001fdfff37 Add workaround for gcc-4.8 ref qualifier quirk
In gcc-4.8, a member method with const lvalue and const rvalue methods
is ambiguous.

	$ cat t.cpp
	class A
	{
	public:
	    void a() const &;
	    void a() const &&;
	};

	A b();
	void c()
	{
	    b().a();	// fails in gcc-4.8, works in later
	}
	$ gcc-4.8 -Wall -Wextra -std=gnu++0x -O2 -c t.cpp
	t.cpp: In function 'void c()':
	t.cpp:11:8: error: call of overloaded 'a()' is ambiguous
	  b().a();
		^
	t.cpp:11:8: note: candidates are:
	t.cpp:4:7: note: void A::a() const &
	  void a() const &;
	       ^
	t.cpp:5:7: note: void A::a() const &&
	  void a() const &&;
	       ^
	$ gcc-4.9 -Wall -Wextra -std=gnu++0x -O2 -c t.cpp
	$

Fixes: bda7fef3a0 ("Use get_local_player to compute reference to local player")
2015-08-05 02:59:03 +00:00
Kp b979f52ebf Centralize required C++11 features 2015-08-03 03:11:25 +00:00
Kp 7086bbae14 Simplify automatic compiler test 2015-08-03 03:11:24 +00:00
Kp 4d8ae44794 Add helper macro DXX_CONSTANT_TRUE 2015-07-29 03:05:28 +00:00
Kp 4a6ae13367 Centralize PCH object hook 2015-07-25 23:10:48 +00:00
Kp d4dc3df3de Support PCH+LTO 2015-07-25 23:10:48 +00:00
Kp 9a5654e002 Move similar/editor/autosave.cpp -> common/editor/autosave.cpp 2015-07-25 23:10:47 +00:00
Kp 15fb75c1c7 Fix check_header_includes build 2015-07-25 23:10:45 +00:00
Kp cdb113a050 Diagnose including compiler-type_traits without dxxsconf.h 2015-07-25 23:10:45 +00:00
Kp 9f84f0851d Enable clang LTO
clang does not support -flto=N syntax for parallel LTO.

Remove -fno-fat-lto-objects too.  clang does not understand it;
gcc 4.9 and later default to non-fat LTO.

Fixes: 1037a92d60 ("Allow parallel lto")
2015-07-18 21:01:56 +00:00
Kp 82e1ea5636 Move similar/mem/mem.cpp -> common/mem/mem.cpp 2015-07-18 21:01:56 +00:00
Kp a58e8f87a0 Move similar/misc/hash.cpp -> common/misc/hash.cpp 2015-07-18 21:01:56 +00:00
Kp cfdffa184f Move similar/arch/sdl/event.cpp -> common/arch/sdl/event.cpp 2015-07-18 21:01:56 +00:00
Kp 04d9f82a50 Move similar/arch/sdl/key.cpp -> common/arch/sdl/key.cpp 2015-07-18 21:01:56 +00:00
Kp c7542fe9fc Move similar/arch/sdl/mouse.cpp -> common/arch/sdl/mouse.cpp 2015-07-18 21:01:56 +00:00
Kp 51ee9d2833 SDL2: skip build of rbaudio.cpp 2015-07-14 02:42:12 +00:00
Kp a2cb5fea6e Add SConf option to use SDL2 2015-07-14 02:42:12 +00:00
Kp 658102a868 Improve static_assert test
Previously, SConstruct tested whether static_assert worked with trivial
constant expressions.  Extend the test to more complicated expressions
like the ones used in the program.

Replace the typedef based approach with an inline enum to avoid warnings
about unused local typedefs.

Allow use with compilers that lack working static_assert or that cannot
accept complicated expressions.  Add a non-checking definition that uses
the input parameter.  This prevents warnings when types or constants are
used only for the static_assert.
2015-07-09 03:12:45 +00:00