Add the Catch2 headers to third_party/include/catch2.
Add Catch.cmake and CatchAddTests.cmake to cmake/.
Add unit tests src/wx/tests/strutils.cpp using Catch2 to test
src/wx/strutils.cpp.
Make some code changes to strutils.cpp to make the tests pass.
See src/wx/tests/CMakeLists.txt for how to set up unit test files; they
plug into the normal CTest mechanism in cmake.
The test binaries are written to the tests/ subdirectory of the build
directory.
Building the tests and enabling the CTest support can be turned off by
passing -DBUILD_TESTING=OFF to cmake, the default is ON, this is the
standard mechanism.
Start running ctest on travis and appveyor.
Move stb to third_party/include where Catch2 is now as well.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
In the Turbo config dialog, remove the selection list for entering the
value and leave only the spin control. Allow values above 600%, up to
4000%.
Reintroduce the speedup_frame_skip config variable, defaulting to 9, use
it for turbo selection values > 600%, with speedup_throttle == 0.
The rationale for this is that on average modern hardware, throttle
values above 500% or 600% will not be effective.
The default is now shown as 1000%, which is:
frame_skip == 9 && speedup == 1,
where:
speedup == 1 is equivalent to throttle == 0,
as was the case before the turbo config changes.
Values above 600% are automatically rounded up or down to the nearest
100%, on entry and on click of the up/down arrows of the spin control.
The frame skip checkbox is cleared and disabled for the "Unlimited"
setting (throttle == 0), and set and disabled for values > 600%, to
reflect the mechanism to the user.
When the value again enters the modifiable range in the spin control,
the previous value of the checkbox is restored.
Misc:
- Turn off translation of percentage values in the xrc.
- Remove the size element for the throttle selection list in the general
config dialog xrc, it breaks the layout on GTK3.
- Add a note about passing wxWidgets_CONFIG_EXECUTABLE to cmake to
select wxWidgets version to README.md.
Hopefully this will reduce confusion and present a nicer UI.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
- Remove forum link until it's back up.
- Add nightly builds link.
- Use ninja for build instructions instead of make.
- Note that wx 2.8 and non-stl builds are no longer supported.
- Mention fprintf(stderr, ...) in the debug messages section.
- Misc. minor edits.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Start a developer manual for the project where we will keep policies,
guides and processes for the project in DEVELOPER-MANUAL.md.
Describe the policies for receiving and resolving github issues.
Describe the policy for git commit messages on pull requests and add git
notes for collaborating on a branch.
Describe the policy for commits from maintainers.
Describe how to set up a native windows powershell development
environment and some powershell tips.
Describe the requirements and steps for the current release process.
Replace the CONTRIBUTING section of the README.md with a link to this
manual.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Remove snap build status since we are not using that anymore.
Use the png instead of the svg for the snap store badge as it's not as
large.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Use ENV{MSYSTEM_PREFIX} instead of ENV{MSYSTEM} to check for msys2 as
that is more reliable.
Generate the translations.zip when building for Windows from the
generated .gmo files.
Add the UPSTREAM_RELEASE option to perform some additional release
automation steps:
- Codesign for Windows with either the Visual Studio signtool or
osslsigncode when using MinGW.
- On Windows zip up the .exe into the appropriate zip file for release.
- Generate the gpg signature .asc files for the translations zip and the
.exe zip on Windows.
- On Mac codesign the app, zip it and sign the zip.
- On all platforms try to strip the binary.
Remove the release automation steps from the builder script as they are
now in cmake.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This allows linux users that use snapd and for distro's like ubuntu that do not have vba-m in their repo's to install it to their system without having to compile their own releases.
Add support for vcpkg ffmpeg, this requires using someone's
FindFFmpeg.cmake instead of relying on pkg-config, since vcpkg does not
have pkg-config.
Do not use the ffmpeg from vcpkg on appveyor however, because that
pushes the build cache generation over the time limit for jobs.
Add secur32 and bcrypt to the list of ffmpeg libs on windows, these are
standard windows libraries.
Change some code in ffmpeg.cpp to remove C-style casts of struct
initializers, which are illegal in MSVC.
Add the INT64_C and UINT64_C macros missing in MSVC's stdint.h (if not
defined) to ffmpeg.h before the ffmpeg headers are included, because
they rely on them.
Rewrite the wxWidgets finding code for the vcpkg wxWidgets to be nicer
and work correctly for debug and static builds.
Remove all /W* and /w* warnings options from cmake compiler flags, and
replace them with /W4 for debug builds, and /w (no warnings) for release
modes.
When building a static binary, remove all /MD* flags from cmake compiler
flags, and use /MT for static release builds and /MTd for static debug
builds.
Improve the vcpkg toolchain wrapper to only rebuild the vcpkg binary if
there were git updates.
Redo the handling of SDL2 and SDL_main. Only link SDL2Main to the SDL
binary and don't use the definitions.
Update CMakeSettings.json to use Ninja and include static
configurations.
Use CMAKE_PROJECT_DIR instead of CMAKE_SOURCE_DIR to determine the vcpkg
root, as CMAKE_SOURCE_DIR is sometimes set incorrectly in the 2017 GUI.
Add /nodefaultlib:libcmt to the debug build link flags, as in debug
builds libcmtd is used and libcmt should not be.
Add /subsystem:console to debug build link flags to produce a windows
console app for debug builds, like we do for mingw builds. To do this,
define a WIN32_CONSOLE_APP macro and if set, define a main() that calls
WinMain().
Call wxMesdsageOutput::Set() in OnInit with an instance of
wxMessageOutputStderr for windows debug builds to make sure the --help
text etc. goes to the console instead of a popup box.
Update the Visual Studio related text in README.md.
Fix dynamic debug builds by linking to the debug version of SDL2 and
copying the debug version of the dll to the build dir.
Fix issue in MainFrame::BindAppIcon with the function we are using not
being found in a Windows DLL in debug builds by using
wxDynamicLibrary::GetSymboolAorW() instead of GetSymbol().
Enable LTO for MSVC in Release modes, if the option is set.
Change appveyor config to use an 8 item build matrix of
x64/x86 / Release/Debug / Static/Dynamic. And test the binary in debug
modes by running --help.
When copying the wxrc.exe out of the build tree, copy both the release
and debug versions, this is so that appveyor caching of vcpkg works,
since the build trees are not cached.
Add some necessary win32 libraries to the SDL binary. And enable
building it on appveyor.
Fix#465.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Only set CMAKE_GENERATOR_PLATFORM to "x64" for 64 bit toolchains for any
of the "Visual Studio" generators, which use msbuild.
For other generators such as Ninja or NMake (jom) set
CMAKE_C[XX]_COMPILER to "cl" to let cmake find the compiler in the
user's PATH and set up the toolchain appropriately. On the user's part,
all that is required is running the 64 bit dev tools command prompt, or
setting up the equivalent environment in powershell.
We are no longer restricted to msbuild, and other generators such as
Ninja will work correctly.
Switch the appveyor job to Ninja, this requires some wrangling because
the appveyor environment does not include ninja. I used this:
https://github.com/boostorg/hana/blob/master/.appveyor.yml
Also update the README.md instructions to use Ninja.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Add `-p:BuildInParallel=true` to the Visual Studio instructions for
`msbuild`, to build subprojects in parallel, without which the `-m`
option has no effect, both must be used.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
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>
Replace the Windows instructions for deleting the config file with the
much simpler `Help -> Factory Reset` option, which does the same thing.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
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>
See #465
To compile the build tool `bin2c`, add a target with `add_executable()`
on visual studio instead of using `HostCompile.cmake` because running
`cl.exe` fails in the appveyor visual studio environment, see:
https://developercommunity.visualstudio.com/content/problem/325122/c1356-unable-to-find-mspdbcoredll.html
Also update the dependencies module to latest.
appveyor build now tested to work.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
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.
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>
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
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>
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.
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.
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.
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.
Note that LTO now defaults to ON, and ENABLE_ASM does not turn on
ENABLE_ASM_CORE.
Trim the wxLogDebug() section.
Titlecase headings.
Generate a TOC with `doctoc`.
Fix building with wx 2.8 by rewriting some more string related code.
Replace all calls to .c_str() with .mb_str().
Remove some of the .c_str()/.mb_str() calls where the target is already
wxString.
Move the split()/enum_idx() functions from opts.cpp into
str_split()/vec_find() in strutils.h/strutils.cpp for use in other
files.
Replace the C-style string parsing code in a couple of places in
wxvbam.cpp for processing possible command line options by splitting on
'='.
Also replace a couple of places that use pointer arithmetic in
widgets/joyedit.cpp and widgets/keyedit.cpp with wxString methods.
Use the g++ `-fabi-version=2` compiler option, as suggested by @ArtiiP
to fix problems similar to:
```
Fatal Error: Mismatch between the program and library build versions
detected.
The library used 3.0 (wchar_t,compiler with C++ ABI 1002,wx
containers,compatible with 2.8),
and your program used 3.0 (wchar_t,compiler with C++ ABI 1009,wx
containers,compatible with 2.8).
Aborted
```
Turn LTO off by default until I fix it for newer gcc/binutils, currently
with gcc7 ar segfaults linking vbamcore.
Add a "REPORTING CRASH BUGS" section to the README.md with instructions
for how to provide a symbolic backtrace on Linux and MSYS2.
Add a "Crash bugs" section the the issue template with a link to said
README.md section.
Add the `m32` parameter to ./installdeps to fetch 32 bit multilib
dependencies on Fedora, Arch and Solus linuxes and add a cmake toolchain
file to build with them.
For MSYS2 support both an `m32` and an `m64` to choose deps for 32 bit
or 64 bit mingw targets.
Adjust build instructions from ./installdeps to support both usages.
Other changes:
- use --nogpgcheck --best --allowerasing for dnf invocations for Fedora,
the --nogpgcheck is necessary when Rawhide is confused about which
keys it has, and the latter two are needed for upgrades that remove
unneeded deps etc
- when finding GTK2, first try using pkg-config, and only fall back to
the cmake script when that fails, pkg-config works better for cross
builds
- add cairo to dep lists in ./installdeps for the time being
- for arch, list individual packages from base-devel instead of
base-devel that do not require gcc-libs because of potential conflicts
between gcc and gcc-multilib