Clear the `find_program()` cache variable before each use.
On win32 prefer unqualified utility executables.
Add special handling for msys2, where wx-config is a shell script that
cannot be directly run from native cmake.
This is a followup on 2097b5aa.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Instead of ignoring the initial state of axes, which I did to make
triggers work on the 360 controller, set the initial previous value to
the initial state instead.
This fixes the original problem without breaking analog stick movement.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
The `wxEXPAND` flag is necessary for the game area in wxWidgets 3.0 and
earlier, it may be necessary in 3.1.2 as well, but it throws an xrc
error, so we check for windows and at least 3.1.2 to test for the visual
studio and vcpkg environment to avoid the xrc error.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
@denisfa found this due to a warning, this should improve the
functionality of the SDL sound driver.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Do not install the wxGTK-devel package on centos, as the wxGTK3-devel
package does come with a wxrc named wxrc-3.0.
This is a followup on 2097b5aa.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
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#395Closes#297
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>
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>
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>
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>
In a construct such as:
```cmake
if($ENV{FOO} MATCHES bar)
...
endif()
```
if the environment variable is not set, the if statement becomes a
syntax error because there is nothing being compared.
Fix this by quoting the environment variable like so:
```cmake
if("$ENV{FOO}" MATCHES bar)
...
endif()
```
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Use the libXss Xorg screensaver extension library to call
`XResetScreenSaver()` on joystick events to inhibit screen blanking when
for whatever reason the joystick driver or DE (xboxdrv and KDE in this
case) does not do this.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
On wxWidgets 3.1.2, which is what vcpkg uses (and we use vcpkg for
Visual Studio) the wxEXPAND flag for the game area in the sizer throws
an XRC error dialog, removing the flag works correctly on Windows, but
not on wxGTK.
As a workaround, do not use the wxEXPAND flag on Windows.
TODO: with max zoom set, the game area is not centered vertically in
wxGTK.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
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>
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>
* Apply save order for save states and batteries.
The order for save state/battery:
1. StateDir / BatteryDir;
2. The path of the current loaded game;
3. XDG Base Dir fallback.
* Use XDG Base Dir fallback to save screenshots and recordings.
* Apply search order for all dirs except recording (not implemented yet) of SDL port.
The order for battery/save state/screenshot is:
1. StateDir/BatteryDir/ScreenshotDir;
2. The path of the current loaded game;
3. XDG Base Dir (or equivalent) fallback.
* Refactor code.
* Fix freeing and setting pointer to NULL of SDL port.
On the ubuntu and mac jobs, try re-enabling the `--help` check, it
should now work thanks to @denisfa's work on a57e51f6.
If this works we also want to use wine for the mingw jobs to do the
same.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
The mxe package server key has been removed from the keyservers, allow
apt-key to fail and add `--allow-unauthenticated` to the apt-get
options.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
* Add support to save/load geometry options for GUI window.
* Refactor code to use wxWidgets functions to get window geometry.
* Call update_opts() from ::OnSize and ::OnMove functions.
`stretch` mxe binaries are failing due to missing libraries like
`libssl.so.1.1`, try to use the `trusty` repo instead.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Disable the `--help` test for now, for some reason the exit code is 255,
something is still not quite working there.
Update installdeps to force a partial upgrade from trusty to xenial on
travis to get a newer version of libcurl-gnutls, which is necessary to
use the mxe package server.
Fix mxe package server repo url.
Add `mirror.mxe.cc` to list of apt hostnames to ignore SSL errors for.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
The mxe pkg server seems to be back online with some changes, and an
invalid SSL certificate.
Also thanks to @denisfa's work on 7373da15 we can re-enable the `--help`
check on travis.
Let's see if this works.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Store the full relative path to found `.rpi` plugins, relative to the
standard Plugins directory, as specified by wxWidgets.
This fixes the problem of plugins being in a subdirectory while only the
basename was stored, making the plugins unusable.
This is done by using `wxFileName::GetFullPath()` instead of
`wxFileName::GetFullName()` with a relative filename instance.
Make a `GetPluginsDir()` method on the app class to simplify getting
this directory, and for possible future overrides.
Also make some minor, functionally equivalent changes to
`get_config_path()` in `wxvbam.cpp`:
- use the new `GetPluginsDir()` method for the plugins directory when
building the config file search path
- print the XdgConfigDir on all platforms, since the function works on
all platforms
- make a `add_nonstandard_path` macro which duplicates the `add_path`
macro for wxWidgets standard paths but for any arbitrary string path
- use `wxFileName` methods to make the XDG config directory path instead
of string concatenation
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
* Add XDG Base Dir Spec for other Unix alike platform.
* Add XDG Base Dir support for the fallback on SDL port.
* Add migration for Unix configuration file.
We migrate from 'vbam.conf' to 'vbam.ini' automatically.
* Refactor code for portability of dir creation functions.
* Fix for MacOS compilation directive.
Remove the "wrote battery" system message that is painted on the panel,
because it annoys people, and show errors writing the battery with
`wxLogError()`.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
We check if `$HOME/.vbam` exists; if it does, then we use
`$HOME/.vbam/vbam.conf`; otherwise, use
`${XDG_CONFIG_HOME:-$HOME/.config}/visualboyadvance-m/vbam.conf`.