Commit Graph

20 Commits

Author SHA1 Message Date
edorax 0791236a8f Improve the method to find SDL2. 2017-02-11 23:48:11 +08:00
Rafael Kitover fdc389c280 fix wx 2.8 compat, debug logging works everywhere
Fix backcompat with wx 2.8. This involved writing
wxPositiveDoubleValidator and rewiring the DrawingPanel inheritance tree
and event handling mechanisms (because 2.8 does not have ->Bind, only
->Connect which is less flexible.) As a result all the event handling
has been gathered into GameArea and the affected code is somewhat
cleaner. 2.8 support is untested on Mac because it requires 32 bit libs
and Carbon.

Add support for cross-compiling for windows using the Fedora MinGW
packages in ./installdeps.

Check for OpenGL support in the wx library being linked, this was
necessary because the Fedora MinGW wx library does not have OpenGL
support.

Remove vbamDebug() in favor of wxLogDebug(), and add an override for it
so that it works in non-debug builds of wx as well as on Windows. Turn
off buffering on stdout and stderr on startup so that debug logging
works in msys2/cygwin mintty as well.

On Windows, build a console binary for debug builds.

Update README.md to reflect Fedora MinGW support and debug logging
support.

Add -Wextra to cflags for debug builds.
2017-01-25 10:53:05 -08:00
Rafael Kitover d06e7afceb full support for cross-compiling to win32 with mxe
Fix all cmake issues related to building for win32 with mxe.

Add support for ./installdeps win32 on Debian/Ubuntu using the mxe apt
repository.

Details:

* default to ENABLE_LTO=OFF on mxe

* set SFML_STATIC_LIBRARIES=TRUE on mxe

* fix the libintl/gettext checking logic

* fix the git dependencies submodule checking logic, and check that it
  triggers for mxe

* revert FindSFML.cmake to upstream version, works fine with mxe

* make 'win32' an alias for the 'MinGW-w64-i686' target for
  ./installdeps, add support for mxe apt repository for Debian/Ubuntu

* change bin2c related cmake code to compile the tool on the host always
  even when cross-compiling

* copy src/win32/res/VBA.ico to src/wx/icons since src/win32 has been
  removed

TODO: generic mxe installer for other unix-likes
2016-12-21 13:02:55 -08:00
Rafael Kitover f83fcfb40f hopefully fix cross-compiling with SFML
Remove "PATH_SUFFIXES include" in the FIND_PATH(SFML_INCLUDE_DIR ...)
call in FindSFML.cmake, this has fixed cross-compiling issues with
FindOpenAL.cmake and FindSDL2.cmake already.
2016-12-18 12:11:37 -08:00
Rafael Kitover 53fb6b4371 ./installdeps + windows cross build improvements
Refactor ./installdeps and add support for mingw-w64 cross builds on
Arch Linux. The latter does not work currently because of a bug in
libuuid in the mingw-w64 crt, and the wxmsw AUR package does not build.
This will hopefully be resolved soon.

Put a copy of FindOpenAL.cmake into our own CMakeScripts/ because
searching for include files with PATH_SUFFIXES of include/ does not work
for cross builds, as it is done in the system version.
2016-12-12 19:46:14 -05:00
Rafael Kitover c216528793 generalize ./installdeps + mac pkg mgrs support
Add a more general purpose ./installdeps script to replace
./installdeps-msys2 that handles: Debian Linux, Arch Linux, MSYS2+MinGW,
Mac Homebrew, MacPorts and Fink for Mac. More OSes and distributions
will be added in the future, and the script may be generalized for use
in other projects.

Move Mac package manager setup code into MacPackageManagers.cmake and
greatly improve it. Handles Homebrew, MacPorts and Fink correctly.

Minor tweaks for FindSDL2.cmake: better include dir searching that works
on cygwin, fix flags for MinGW, and quiet pkg-config program errors.

Add MinGW cross-compilation toolchain files, they can be specified on
the cmake command line with:

-DCMAKE_TOOLCHAIN_FILE=../CMakeScripts/Toolchain-cross-MinGW-w64-i686.cmake

or

-DCMAKE_TOOLCHAIN_FILE=../CMakeScripts/Toolchain-cross-MinGW-w64-x86_64.cmake

these work for Cygwin and should work for MinGW on Linux as well.
2016-12-10 23:41:32 -08:00
Rafael Kitover 349bbd13bc add LTO support, fix libssp link, add -ggdb3 -Og
Add support for Link Time Optimization (LTO) on gcc and Clang.

Link libssp only when it is on the system, some toolchains like Ubuntu's
do not require explicitly linking to libssp. On Win32 try to link it
statically.

In debug builds with GCC, use -ggdb3 -Og, otherwise use -g .

Two new cmake modules were written for this:

* FindSSP.cmake -- this is for finding libssp on the system.

* UseGCCBinUtilsWrappers.cmake -- this is for using gcc binutils
wrappers such as gcc-ar, which is required for gcc LTO to work.

These will be distributed separately as well.
2016-11-21 12:37:21 -08:00
Rafael Kitover 55f6e17f0d compile/link flags improvements
* Bump minimum cmake required to 3.3.2, to make sure generator
  expressions work.

* Force CMAKE_BUILD_TYPE to "Release" if unset, not sure if this
  actually works.

* Merge the older compile flags block with the new one and use generator
  expressions to make sure the relevant flags apply only to C, C++ or
  nasm.

* Add -lssp to the end of the link commands for the -fstack-protector*
  options, this is only needed/done for gcc.

* Add -lversion and -limm32 to SDL2_LIBRARY (Zach asked for this.)

* Builds on msys2 again!
2016-11-20 11:11:52 -08:00
Rafael Kitover 3c30d59aba msys2 build improvements
* Enable ffmpeg by default only on linux and msys2, it will be disabled
for normal windows builds and on mac.

* Set SFML_STATIC_LIBRARIES only for normal non-msys2 windows builds,
because msys2 does not currently have static versions of the SFML
sub-libraries, e.g. system, network, etc.. Dynamic linking works fine
for now.

* Fix quoting for -DLOCALEDIR, on windows spaces were causing errors in
make on msys2.

* Update to upstream FindSFML.cmake .

* Add an ./installdeps-msys2 script to install all necessary tools and
libraries on msys2 for building both 64 and 32 bit windows Wx binaries.

* Add the dependencies/mingw-xaudio/include directory to
INCLUDE_DIRECTORIES so that XAudio compiles on msys2, as mingw-w64 does
not currently have XAudio headers. Also check that the user pulled the
git submodule in the process (the ./installdeps-msys2 script does this
for you.)

TODO:

* Generalize ./installdeps to work on more platforms.

* Make console Wx app in debug mode so that debug prints will work.

* Fix game keyboard input for msys2 builds.

* Add HiDPI support for Windows.

* Fix the -D*DIR defines to have the correct paths on windows.
2016-11-14 10:56:50 -08:00
Rafael Kitover 2d9ec99c11 Mac build improvements
Move closer to allowing an "out of the box" distributable build for Mac:

* fix the icon for the .app

* link SDL2 statically, a PR has been sent to the original repo here:
  https://github.com/tcbrindle/sdl2-cmake-scripts/pull/9

* link SFML statically

TODO:

For a releasable build on OS X, system libs must be linked
dynamically while third party libs are linked statically or bundled. The
goal is to link them statically.

The two remaining libs that need static linking are PNG and wX.

For PNG a similar approach to the one used for SDL2 using pkg-config
should work fine and be simple to implement.

For wX things are more complicated. The default build of wX does not
include static libs, I will need to submit a PR for Homebrew to change
the default build to include both dynamic and static versions.
2016-10-26 16:58:21 -07:00
Zach Bacon c8343267fc <wip> Migration to SDL2 made possible by galtgendo, gtk changes to follow. 2015-11-18 21:34:38 -05:00
Rafael Kitover 3d679c1469 more minor improvements for OS X build
Add Homebrew and MacPorts paths for findings headers and libraries.

Add -x objective-c++ to the C++ compile command so that conditionally
compiled ObjectiveC code for OS X can be supported.

Throw a fatal error if the user tries to enable ENABLE_ASM_CORE,
ENABLE_ASM_SCALERS or ENABLE_MMX on AMD64, as this is not supported yet.

If ENABLE_ASM_SCALERS is enabled, try to find a Homebrew or MacPorts
nasm before using the outdated XCode nasm.

For the future, if the user has only the old XCode nasm which does not
support 64 bit objects and the build is 64 bit, throw a fatal error.

For 32 bit builds with the old XCode nasm, use -f macho instead of -f
macho32, which is used if the version of nasm is > 2.0 .

Pass -DMACHO instead of -DELF and, on AMD64 (for the future) -D__AMD64__
for nasm on OS X.

Pass -D__AMD64__ to C++ compilation as well on AMD64, this will help
when we support AMD64 inline assembly.

Add support for automatically linking Homebrew keg-only gettext from
/usr/local/opt/gettext for ENABLE_NLS.

Fix copying Info.plist and vbam.icns to the .app bundle.

Add a key to the Info.plist to support sharp text on retina displays, as
per:
https://wiki.wxwidgets.org/WxMac-specific_topics#Retina_display_support

Set wxWidgets_USE_DEBUG to ON if CMAKE_BUILD_TYPE is "Debug". I'm not
sure this does anything or if I'm doing this correctly though.

Also set wxWidgets_USE_UNICODE to ON. Again, I'm not sure this does
anything or is in the right place.

Fix a bug in the config dir finding code in
wxvbamApp::GetConfigurationPath() updated in 8b8f2f7 to only use the
more top level dirs if there is a vbam.ini in them, not if they are
writable as well, and use the reverse order (starting with user local
dirs) to check for writable dirs and their writable parents. This fixes
a problem with the vbam.ini being written to the Plugins directory of
the .app bundle if it's writable instead of ~/Library/Application
Support/vbam as was intended.
2015-11-16 21:56:23 -05:00
DoctorWho11 2717803745 added git support to cmakelists.txt 2015-06-12 08:04:26 -04:00
skidau f3e35d16a1 Updated the FindSFML cmake script to the SFML-2.2 version 2015-05-06 01:27:09 +00:00
bgk 32390ac47b NLS: Improve translations build
- wxWidgets translations now work the same as GTK translations.
- Translations for WX and GTK can now be generated at the same time.
2011-12-03 20:29:05 +00:00
squall-leonhart 8e6a51211e all current vba-m Wx patches applied to trunk. 2011-05-25 11:55:46 +00:00
bgk 000f563d59 SVN: Set more properties 2011-02-20 19:06:05 +00:00
bgk 56431351d5 CMAKE: Use built in support for ASM compilers. Bump required version to 2.6.0 2011-02-20 13:31:49 +00:00
shuffle2 f6b049bb2f fix the cmake/linux build
moves dependencies/File_Extractor-1.0.0 to trunk/fex - we can't expect people to have this lib, and fex has dropped support for the "fex_mini".
2010-03-15 03:36:45 +00:00
bgk 65d9ca1d92 Initial version of the GTK GUI (forwardported from VBA's CVS) 2008-04-20 07:28:48 +00:00