Commit Graph

220 Commits

Author SHA1 Message Date
Rafael Kitover 9ee6b54a68
cmake: remove invalid opt /std:c++11 for MSVC
Visual Studio 2017 only allows `/std:c++14` and higher, so remove the
`/std:c++11` option, we'll take the default of C++14 standard.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-09-12 03:04:20 +00:00
Rafael Kitover b358c051c9 Fix compilation issue when `ENABLE_DEBUGGER=Off`.
We protect all code relevant to disabling this property with either
`BKPT_SUPPORT` or `NO_DEBUGGER`. This is mostly debugging options or
prints scattered around the code.

We also adjust cmake to ignore the specific files surround it, but
allowing the rest of the GUI to work.

- Fix #431.
2019-09-04 14:31:11 +00:00
Edênis Freindorfer Azevedo f1438e0f0a Check ASAN support when `ENABLE_ASAN=ON`.
We check if the compiler has asan support when the option is enabled.
If it does not, then we stop compiling with the proper message.

To test this, we use `gcc (GCC) 4.4.7` (no asan support) and
`gcc (GCC) 9.1.0` (asan is supported). Call cmake like this:

`cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_ASAN=On` and
`CXX=g++-4.4 cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_ASAN=On`

we then check that it fails for the older version and it works for
the newer gcc, like expected.

- Fix #409.
2019-09-02 20:52:08 +00:00
Rafael Kitover 8b3470507d
cmake: check for ffmpeg >= 4.0.4
Check for the specific `ffmpeg` lib versions in `ffmpeg` `4.0.4` "Wu",

Do not pass `-DENABLE_FFMPEG=OFF` to the xenial travis job, as this is
detected automatically now.

Add a note about the required ffmpeg version to `README.md`.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-09-01 20:37:39 +00:00
Rafael Kitover d9e4a0874d
build fixes: ffmpeg, xbrz, travis, C++ version
Fix the cmake ffmpeg detection and make it not print the detection
messages twice.

Add `-D__STDC_FORMAT_MACROS` to compiler flags, some versions of ffmpeg
require this.

Redefine `static_assert(x)` to the `static_assert(x, msg)` form in
`xbrz.cpp`. This is a C++17 feature and some versions of gcc wrongly set
`__cpp_static_assert` even though they do not support it.

Also we want to stick to C++11 for the time being, until there is
consensus to support a newer a version.

For that reason, change the MSVC flag `/std:c++latest` to `/std:c++11`
as well.

Remove `-DENABLE_OPENAL=ON` and `-DENABLE_LINK=ON` from travis config,
as these are now automatic.

In `installdeps` remove the hacks for supporting the `https://` apt url
for mxe and use an `http://` url instead. This works perfectly on Ubuntu
14 (trusty).

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-08-31 22:58:59 +00:00
Rafael Kitover 381a7bfe78
/std:c++latest for MSVC, fix bool flip, warn opts
Use `/std:c++latest` for Visual Studio because the XBRZ 1.7 code
requires at least C++17.

Replace the use of `bool++` in `GBALink.cpp` which is now apparently an
error with `bool = !bool` to flip the value.

Use `/W4` to enable a good amount of warnings in Debug mode, and `/W0`
to disable warnings entirely in release modes.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-08-30 01:57:01 +00:00
Edênis Freindorfer Azevedo 234f1e9b1a Update to xBRZ `1.7`.
Get files from here `https://sourceforge.net/projects/xbrz/files/xBRZ/`.

Then, update the src to handle pitch params. For our case, the pitch
is necessary because we deal with borders (top and right) of our source
image. Normally, we would want to scale without it, and therefore we
need to adjust the pointers to skip the borders.

If we have a `width + 1 pixel border` per line, the we need to scale
a image with `width` line size, but advancing the pointer for each new
line processed including the border on the count.

Also, since our output pointer also allocates for the border, we need
to adjust the output moving pointer for each line in a custom way.
(output border in this case)

- Fix #164.
2019-08-28 22:07:52 +00:00
Rafael Kitover d9a7e0c964
cmake: auto-detect sfml, ffmpeg and openal
In cmake detect if the dependencies for link (sfml), recording (ffmpeg)
and openal are installed and default the features to `ON` if they are,
otherwise to `OFF`.

This simplifies the cmake usage.

Update the default column in the `README.md` table to `AUTO` as well.

Remove the cmake options from `installdeps` instructions, since they are
auto-detected.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-08-20 08:21:38 +00:00
Rafael Kitover 2958af01ca
builder: mingw improvements + misc.
- default ENABLE_NLS to ON except for vcpkg, broken in e2f06210

- update zlib URL

- use openssl 1.1.1c instead of 1.0.2p, parallel build works now!

- add osslsigncode for mingw to codesign windows binaries, and
  automatically sign in `build_project()`

- add curl (for osslsigncode, which needs libcurl)

- use current master for wxwidgets instead of 3.1.2

- make the `translations.zip` in `build_project()` for windows

- on mac, unlock the login keychain before codesigning (this is
necessary if using e.g. ssh.)

- do not fail if the user does not have codesigning or gpg keys

- fix wxwidgets configure options on mac (need to append to
  `DIST_CONFIGURE_OVERRIDES` instead of `DIST_ARGS`.)

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-08-19 13:15:01 -07:00
Edênis Freindorfer Azevedo 5848feaea2 Fix video/audio recording.
We create a namespace to deal with most of our recording solution.

Besides that, we also add some functions to remove the need of
including libavutil headers on other part of the code. This is meant to
isolate most of recording solution components on the proper files.

We will start with a limited number of codecs supported; slowly we
should add them as they are tested (the previous one did not work for
most codecs listed).

This should support `ffmpeg 4.1` and further, including removing
all compilation warnings related to versions discrepancy.
2019-08-14 08:27:51 -01:00
Edênis Freindorfer Azevedo 060da968eb [LINUX] Add option to disable the online updater.
Add option to remove all configuration related to checking for updates
online. Although it is not implemented at the moment, these options
appeared on our menu `Options` > `General ...`.

- Fix need of patch on #140.
2019-07-25 00:41:34 +00:00
Rafael Kitover e2f06210e0
update Visual Studio support
Replace the vcpkg code with a newer and better version. In this version
the `vcpkg` directory is on the same level as the source directory, so
that IntelliSense does not get confused scanning for files.

The cmake variable `VCPKG_TARGET_TRIPLET` is required to activate vcpkg
support, it must be set to e.g. `x64-windows` or `x86-windows`.

Update `CMakeSettings.json` for the new code for the GUI.

Fix a problem copying the `SDL2.dll` file to the binary directory.

Update `README.md` with commandline instructions.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-07-03 23:28:48 +00:00
Rafael Kitover a4eae8025e
cmake: use LEGACY OpenGL on FreeBSD only 2fedaa63
Black screen reported on linux with `LEGACY` OpenGL type, set it back to
`GLVND` and only use `LEGACY` on FreeBSD.

Broken in 2fedaa63.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-04-27 22:52:42 +00:00
Rafael Kitover 2fedaa63a6
support FreeBSD
Make some changes to support out-of-the-box builds on FreeBSD:

- set cmake OpenGL type to `LEGACY`, the new `GLVND` type produces
  unusable binaries on FreeBSD

- on FreeBSD add -I/usr/local/include to compiler flags, why this is
  necessary I don't know

- look for llvm tools such as `llvm-ar` in `/usr/local/llvm-devel/bin`,
  LTO works

- improve the `find_wx_util()` cmake function to handle `wx-config`
  scripts named in the form e.g. `wxgtk3u-3.1-config`

- add FreeBSD support to `installdeps`

- make some minor changes to included headers based on macros such as
  `__FreeBSD__` to compile on FreeBSD, including adding a `BSD.h` header
  with some defines for e.g. `fseeko64`

- move the cmake X11 detection to before the wx compile tests, because
  otherwise the extra compile flags for the wx tests make the X11 tests
  fail

- make some minor changes to fix wx 2.8 compatibilty again, we don't
  actually use 2.8 for FreeBSD but I was testing it

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-04-25 16:22:07 +00:00
Rafael Kitover 8abbb070e8
cmake: use Win32Deps when mingw cross compiling
So that dependencies submodule is cloned.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-04-16 13:07:51 +00:00
Rafael Kitover d28fd302aa
cmake: only link SetupAPI on win32 if it's found
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-04-15 13:11:00 +00:00
Rafael Kitover af63a1194f
cmake: add -lSetupAPI to SDL2 libs for win32
Fix for undefined reference errors linking for msys2 mingw build using
the scripts.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-04-15 03:28:18 +00:00
Rafael Kitover 2097b5aaa5
wx 2.8 compat fixes, centos support, cmake fixes
Add support for RHEL/centos to installdeps. There is no SFML package.

Add some string compatibility stuff so that everything builds on wx 2.8
unicode builds.

TODO: add travis slaves for 2.8, with and without unicode

Disable the game frame spacer code on 2.8 because it does not work (the
frame does not expand.)

cmake improvements:

- set ENABLE_LTO=OFF for Debug builds by default

- set ENABLE_LINK=OFF if SFML cannot be found and continue

- use better logic for finding wx utilities wx-config and wxrc

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Closes #395
Closes #297
2019-03-28 21:45:06 +00:00
Rafael Kitover b69fced749
cmake: refactor, better clang support
Do some reformatting towards the more modern cmake style.

Clean up some code.

Support linking to gcc compiled wxWidgets by setting
`-D__GXX_ABI_VERSION=` appropriately for clang.

Use the new method of calling `FindwxWidgets.cmake`, the old method
causes some problems now.

Set all necessary policies in both cmake files.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-27 03:25:43 +00:00
Rafael Kitover 7fb27c4df9
cmake: check for broken LTO
When using LTO with gcc or clang, try to compile and link something to
make sure it works, and disable it if it doesn't.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-26 14:49:48 +00:00
Rafael Kitover f2e9dc5530
cmake: check for policy CMP0077 existence
Check `if(POLICY CMP0077)` before trying to set it, because setting a
policy a version of cmake does not know about is an error.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-26 13:40:35 +00:00
Rafael Kitover ae38a70d1e
cmake: gcc/clang colors with ninja, fix warnings
Ninja requires `-fdiagnostics-color=always` instead of
`-fdiagnostics-color=auto` with gcc because it pipes output from the
compiler unlike regular makes.

Use `-fcolor-diagnostics` for clang, which also works correctly with
ninja to show colors.

Information for this taken from here:

https://medium.com/@alasher/colored-c-compiler-output-with-ninja-clang-gcc-10bfe7f2b949

Set all cmake policies in both the root `CMakeLists.txt` and
`src/wx/CMakeLists.txt` to silence warnings about unset policies from
cmake.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-26 00:35:23 +00:00
Rafael Kitover f1ecd7c322
auto deps for visual studio, take 1
Use vcpkg to build deps when Visual Studio on Windows is detected, this
only happens on first build, but does take a while because things like
wxWidgets need to be built. Building from the developer command line is
also supported.

I considered making a pre-built tarball available, but the resulting
files are just too big for this to be practical.

Make the necessary cmake code changes for this to work and to use the
vcpkg packages, which work just like on linux or have other cmake glue
code available.

To do this, we make vcpkg a submodule, use git to checkout all
submodules, then just build and use the `vcpkg.exe`. Then we set the
CMAKE_TOOLCHAIN_FILE to the vcpkg toolchain and also include it
directly, why this is necessary I don't know, without it it doesn't work
in the IDE but does on the command line.

All of this requires no vcpkg integration with either the user or the
project. A user-wide `ENV{VCPKG_ROOT}` is also supported.

Fix the dynamic arrays in the GBA core, MSVC follows the C++ standard on
this and gcc does not.

TODO: add the necessary gcc flags to make this an error in cmake.

Use `wxArrayString` instead of `std::vector<wxString>` in
`src/wx/strutils.cpp` which is used in options parsing. This was
necessary because of a bizarre linker error with wxWidgets when using
Visual Studio:

https://trac.wxwidgets.org/ticket/10884#comment:46

In `src/wx/panel.cpp` make sure the unimplemented D3D renderer code does
not get compiled if it's actually `OFF`.

Also fix the new spacer code for the drawing panel to not combine
`wxEXPAND` with `wxALIGN_CENTER`, which is an error on wxWidgets 3.1.2,
which is what vcpkg uses. The drawing panel seems to be automatically
stretched to the max size automatically anyway.

TODO: if all of this works, we'll need an Appveyor set up for visual
studio.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-21 16:01:46 -07:00
Rafael Kitover 3da07f4083
detect llvm toolchain utilities #392
Use `clang -print-prog-path=<tool>` to find the locations of llvm
toolchain utilities such as `llvm-ranlib` and set the appropriate cmake
variables to the resultant paths.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-03-19 18:41:25 -07:00
Rafael Kitover 7dda58097a cmake: do not use -fPIC on 32 bit x86, breaks asm
Do not add the -fPIC (position independent code) compiler flag on 32 bit
x86 architectures because that breaks inline assembly, and some included
libraries like fex require inline assembly to work.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-02-22 14:53:51 +00:00
Rafael Kitover 5a77d8f4ba
cmake: don't use ccache on msys2+ninja
When using msys ccache with a mingw ninja, the compiler fails to
execute.

Don't try to detect ccache when using the Ninja generator on msys2, it
can still be specified through cmake variables.

Do not check for the mingw ccache because it is broken and I will assume
not being used.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2019-02-14 14:58:13 -08:00
Rafael Kitover c6fa7246de cmake: use color gcc/clang output when possible
Test for the -fdiagnostics-color=auto compiler option supported by gcc
and probably clang, and turn it on if it's available.

This option colorizes compiler warnings/errors/etc. when output to a
terminal.

Also fix a typo above when adding the -fopenmp flag.
2019-01-30 14:29:06 -08:00
Rafael Kitover de0e8d6ba3 cmake: support libasan/-fsanitize
Add the ENABLE_ASAN cmake option, defaulting to `-fsanitize=address` if
ON, or the value specified for the option.
2019-01-02 08:23:26 -08:00
Rafael Kitover 6f1df2ddea rename mingw include dir mingw-include in deps 2018-10-23 20:07:04 -07:00
Rafael Kitover 26b15b2c1e add mingw dependencies/include to include path
Older versions of mingw64 do not have the versionhelpers.h header, add
it to the dependencies submodule include/ directory and add it to
include_directories() for mingw in cmake.
2018-10-23 16:32:34 -07:00
Rafael Kitover 0092dc16ac msys2: don't try to link msys librt and libpthread
In cmake on Win32, don't try to find librt or libpthread using
find_library(), and on mingw just include -lpthread.

For some reason the msys versions of librt and libpthread were being
picked up when find_library() was being used.
2018-08-10 16:47:17 -07:00
Rafael Kitover 65e1ab041d disable gcc stack protector, segfault on 8.2.0
Make gcc -fstack-protector-strong and associated options controlled by
the cmake option ENABLE_SSP which defaults to OFF.

This option causes a segfault on startup with gcc 8.2.0.
2018-08-10 16:35:49 -07:00
Rafael Kitover bfe21aee3e remove -fpermissive compiler flag
Remove -fpermissive from the list of flags passed to gcc and clang.

Remove -fpermissive from the cxxflags from wxWidgets config as well.

When checking wxWidgets ABI compatibility version, temporarily add
-fpermissive to compiler flags on Win32 because minhook requires it.
2018-08-10 06:46:51 -07:00
Rafael Kitover 498019a39b support older 32 bit macs running 10.7, fix build
Make mac builder use -m32 in CFLAGS etc. to produce a 32 bit binary
targetting 10.7 (Lion.) This provides the greatest backward
compatibility for older macs, and also allows for asm filters.

Fix an issue with m4 on 10.13 using a patch from macports.

Support `-pX` patch level args in DIST_PATCHES in builder.

Fix an issue with bison on 10.13 by bumping the version to 3.0.5.

Build libxslt `--without-crypto` so that it doesn't try to link the brew
libgcrypt.

Invoke cmake for dists with -DCMAKE_C_COMPILER_LAUNCHER=ccache and
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache to use ccache, and set
CMAKE_C_COMPILER and CMAKE_CXX_COMPILER to the actual compilers not
prefixed by ccache.

When checking for ccache in vbam cmake code, check that
CMAKE_CXX_COMPILER_LAUNCHER and CMAKE_C_COMPILER_LAUNCHER were not
already defined (generally on the command line.)

Remove align attributes from sections in 2xSaImmx.asm, macho format on
mac does not support this and the filter works fine without them.

In the Quartz2D renderer, pass the NSRect view.bounds through
NSRectToCGRect when calling CGContextDrawImage(), this is necessary for
the 32 bit API.

Bump openssl to 1.0.2o.

Bump libxml2 to 2.9.8.

Update URL for urw fonts, and improve the dist downloading/unpacking
code to handle URLs that do not contain the filename (for .tar.gz and
.zip as identified by `file`.)

Change post-build for harfbuzz from `rebuild_dist freetype;` to
`rebuild_dist freetype --with-harfbuzz=yes;` as it was supposed to have
been.

Build cmake itself with --parallel and --enable-ccache.

Silence errors from killed jobs due to tmp directory being gone.

Write a couple of string functions, rtrim() and gsub().

Make path_exists() handle globs with spaces in them, by escaping the
space.

Use --host and --build args to autoconf configure to "cross-compile" for
32 bits, this is necessary for some dists, and does not work for others,
remove it for dists where it does not work.

Add COMMAND_MODE=unix2003 to the build environment, this is necessary to
fix some build errors, why I have no clue, found it on stackoverflow.

Pass -Wl,-no_compact_unwind in LDFLAGS to openssl, this is necessary for
32 bits.

Force sfml to compile as 32 bit, it normally does not allow this.

Remove shared-mime-info from this build, it's not necessary for anything
and there are issues XML::Parser linked to our expat and brew perl that
need to be resolved.
2018-06-30 03:40:47 -07:00
Rafael Kitover 8778837c83 add Travis CI support
Use a matrix of 4 jobs, linux (ubuntu trusty), mingw i686, mingw x86-64
and mac.

Automatically detect ccache in the cmake config and cache the
`~/.ccache` directory for faster rebuilds.

Instructions for ccache in cmake are here:
https://stackoverflow.com/a/24305849

Change build status badge in README.md to Travis.
2018-06-26 19:15:22 -07:00
Rafael Kitover 66980934b2 add multi-platform build system
under `tools/` add some scripts to invoke the build system to build all
deps for vbam and vbam itself:

- `tools/linux/builder`

This builds a mostly static linux binary with a few dynamic deps for
xorg and wayland. Using gtk3. This will run on just about any dist.

- `tools/osx/builder`

Builds a static mac app targetting 10.7.

- `tools/win/linux-cross-builder`

Builds a static windows binary using the mingw-w64 toolchain.

- `tools/win/msys2-builder`

Builds a static windows binary in the MSYS2 environment, this may be
suffering from a few regressions.

Change some cmake code to support the build system, refactor a few
things in it.
2018-02-24 14:39:29 -05:00
Rafael Kitover df0bd439fb fix deps submodule init on windows
`git submodule update --remote --recursive` must be called with `--init`
if the submodules have never been initialized, add the flag to the cmake
code that does this. If they are already initialized, it will not cause
any harm.
2017-10-25 06:25:29 -07:00
Rafael Kitover 420450255c mac build/builder improvements
Improve, refactor and clean up `tools/osx/builder` to build a relatively
full-featured ffmpeg as well. This requires lots of other dists. It's
kind of like a mini port system now. Will generalize it shortly to a
sourced library for using with both the mac and the mingw builds. Will
hopefully become a separate repo on github at some point.

Add perl dist support to the builder.

Add an `--env` flag to the builder to print the build environment
variables so that they can be read in with `eval` for debugging
purposes.

Also add the `FFMPEG_STATIC` cmake option to link static ffmpeg
libraries correctly.

Move the codesigning and zipping of the `.app` bundle to the builder
script and out of cmake, as this is something most users don't need.
2017-10-22 15:35:56 -07:00
Rafael Kitover 21926d6230 add -mfpmath=sse -msse2 compiler flags: x86/amd64
This may speed things up a little in some places, or maybe not, but
should be safe as few if any users are likely to be using a CPU without
SSE2.
2017-10-17 10:26:37 -07:00
Rafael Kitover d7ff2afb80 add mac release builder script
Add `tools/osx/builder`, a POSIX sh script to build all dependant
libraries as static, targetted to OS X 10.7, and build the project with
them (also targetted to OS X 10.7.)

ffmpeg currently does not link, as recording functionality is currently
non-functional anyway, this will be fixed later.

MISC:

- set WORKING_DIRECTORY and ERROR_QUIET for all git commands, for the
  cases when the build directory is not under the git checkout

- #include <cerrno> in ConfigManager.cpp as it uses errno

- change `build*` in `.gitignore` to `build/*` so that files starting
  with "build" are not affected
2017-10-12 01:32:18 -07:00
Rafael Kitover 46486381f0 read version info from CHANGELOG.md if no git
If git tags are not available, set the version and revision by finding
the first version tag in `CHANGELOG.md` of the form

```
```

Where N.N.N is the number version (number of components can vary) and
the revision (as speicified by -REV) is optional.

TODO: support named revision without a version number of the form
`[REV]`.
2017-10-11 19:17:25 -07:00
Rafael Kitover 52439cee0e fix error and version info in shallow git clones
Fix `cmake/GitTagVersion.cmake` to not throw errors when in a shallow
git clone, or any git clone that has no tags.

And when either git or git tag version info is not available, set the
version variables to the defaults, which are:

```
VERSION         = '2.0.0'
REVISION        = 'unknown'
VERSION_RELEASE = 0
```
2017-10-07 18:17:52 -07:00
Rafael Kitover f5379ab806 read version and subversion info from Git
To get the version, find the last tag in git tag of the form "v2.0.0" or
"2.0.0". If this is the last tag and the current commit matches the ref
of this tag, the revision will be empty.

In the case that the current commit is not tagged with a version, to get
the revision, use the short sha unless the current commit is tagged with
something that is not a version string, e.g.  "feature-foo", in which
case the revision will be "feature-foo".

If the current commit is tagged as e.g. "v2.0.1-foo" or "2.0.1-foo" then
the version will be "2.0.1" and the revision will be "foo". Tags of this
form are also checked when finding the current version.

This is all done in cmake. If there is no git detected, the version will
be "2.0.0" and the revision will be "unknown".
2017-10-07 14:00:47 -07:00
Rafael Kitover f069f0c02d default LTO to OFF on 64 bit MinGW
64 bit MinGW (e.g. msys2 64 bit) produces a binary that immediately
segfaults when built with LTO.

Make ENABLE_LTO default to OFF on 64 bit MinGW (32 bit will still
default to ON.)
2017-09-22 00:42:49 -07:00
ZachBacon 75ef0aa26d Added executable extension
* Allows the SDL binary to be installed if it's cross compiled from
within linux or macOS for windows for packaging purposes.
2017-09-22 02:46:20 -04:00
Rafael Kitover de89bd0561 use num cpu cores to parallelize LTO link with gcc
Use the `cmake` `ProcessorCount` module to determine the number of CPU
threads, and set the `-flto` flag for gcc to `-flto=${num_cpus}` if the
number of CPU threads is detected and is greater than `1`.

clang does not support this.
2017-09-19 06:58:48 -07:00
Rafael Kitover 268c638456 improve win32 dependencies git submodule handling
Use `git submodule update --remote --recursive` instead of `git
submodule update --init --recursive` so that the latest version of the
repo is always installed.

Run the command from cmake instead of throwing an error if the submodule
is not checked out. Only throw an error if the checkout failed or the
source tree is not a git checkout.

Don't add the `mingw-xaudio` include directory if using MSVC.

Remove the submodule check from src/wx/CMakeLists.txt, having it in the
main CMakeLists.txt is enough.
2017-09-19 06:11:41 -07:00
Rafael Kitover 7f1fec88af work around gcc lto wrappers bug with gcc 7.x
gcc lto wrapper commands such as `gcc-ar` will segfault with some
versions of gcc 7.x when called via an absolute path, see:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80717

Generalize the mechanism for compiling a small C program on the host
(currently used for bin2c for Wx resources) and use it to wrap the gcc
wrappers in a little executable that prepends their dirname to PATH and
runs them with `execvp()`.

Make LTO default to ON again, except on win32 with gcc < 7, because
those toolchains produce broken binaries with LTO enabled.

Also add `-ffat-lto-objects` to compiler flags for gcc when LTO is
enabled, this will increase the chances that the LTO build will succeed
even if there are issues with the binutils wrappers. Clang does not
support this.
2017-09-16 19:47:39 -07:00
Rafael Kitover b82cab14e2 rename CMakeScripts/ to cmake/
Most projects nowadays call the project specific cmake scripts directory
just `cmake/` and we will do so as well.
2017-09-13 20:30:33 -07:00
Rafael Kitover 2ad204619b compile/run test to detect Wx ABI version #142
In 4e665ae I hardcoded -fabi-version=2 for g++ flags, and @ArtiiP
pointed out that this is wrong, because Wx may be compiled with other
ABI versions.

Add cmake check_cxx_source_runs() tests to determine the correct ABI
version flag to use with Wx.
2017-09-01 21:51:24 -07:00