Commit Graph

176 Commits

Author SHA1 Message Date
Miguel A. Colón Vélez c8c22cf6a0 Notify about cross build option upon failure.
Tell the user to use CMAKE_TOOLCHAIN_FILE upon failure.
.
Cleanup detectOperatingSystem. Should be the same but adding
GNU and kFreeBSD from Debian and filtering out pre OS X Apple.
.
libaio is linux only. Also check for the correct header since
aio.h is the POSIX one. Both are in /usr/include/ anyway.
Only build core if (Linux AND NOT AIO_FOUND) == false.
.
Use Unix for GTK and X11. Macs has gtk-quartzs and xquartz or native X11.
*BSD, linux, etc should have both.
2015-01-03 14:51:04 +01:00
Miguel A. Colón Vélez b42c9defb1 Avoid PKG_CONFIG_PATH issues.
Even before this pull request it was required to set PKG_CONFIG_PATH
when cross compiling since pkg-config always searches for native
libraries. This would require to backup an already existing ENV
variable if present, detect the distro specific place the pkgconfig folder is,
and restore the original ENV variable if it was present. Cmake as shown in:
.
http://www.cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3df51470
.
added support for this but requires CMAKE_MINIMUM_REQUIRED_VERSION as 3.1
which is kind of strict since it was released 10 days ago.
.
To avoid the ugliness let just avoid pkg-config when cross compiling. This
means only EGL, SDL2 and GTK3 have to be updated since the rest work w/o
pkg-config.
- EGL is fixed with PR #409
- SDL2 is fixed here and it's trivial.
- GTK3 is non-trivial. For this one use pkg-config for native builds since
  the .pc file is kept up to date automatically. For cross compilation
  use the provided FindGTK3 which I made by using the sed documented
  inside the file and updating the dependencies for GTK3. Since I checked
  each and every single .pc file to make sure they are up to date this
  should have the same behaviour as pkg-config. Prefer the .pc files for
  native builds since it does not need to be manually updated and when
  the native 64bit port gets finished all the cross compile options should
  be removed which is quite easy since most of the code got moved to the
  CMAKE_TOOLCHAIN_FILE.
Note:
Cmake Modules are BSD-3-clause therefore GPL compatible.
2015-01-03 14:51:04 +01:00
Miguel A. Colón Vélez bed7a4f92e Be really strict about dependencies.
The obtained binaries before and after this commit are identical (sha1sum)
when compiled in Debian/Ubuntu/Fedora/ArchLinux.
.
The linker will always pick the 32bit libraries the only thing this does is
make sure we have all the 32bit dependencies installed. Basically we avoid
detecting the 64bit libraries and telling the users the 32bit libraries were
found. We always link with 32bit libraries therefore this avoids having to
wait 5-10min to just be told -lXXX is missing.
.
The only thing really needed are
set(CMAKE_LIBRARY_ARCHITECTURE "../lib32")
set(CMAKE_LIBRARY_ARCHITECTURE ".")
.
which basically ensures we don't pick 64bit headers since
CMAKE_LIBRARY_ARCHITECTURE always gets tested first and for some reason
FindGTK2 test searches lib64 first then lib32/lib. These values are hardcoded.
Right now these arch specific headers are not used but can't say this will
always be true.
.
FIND_LIBRARY_USE_LIB64_PATHS is not needed for native builds and it's covered
by CMAKE_SYSTEM_IGNORE_PATH.
.
NOTE:
We filter out lib32 because multilib is not compatible with multiarch.
2015-01-03 14:51:04 +01:00
Miguel A. Colón Vélez 553536f9cb Fix build in Fedora and print a confimation of cross compilation.
- Fedora only needs --arch if cross compiling.
  + It's only used to select libdir so i386=i686=i986
- Messages are nice to debug build logs.
.
Everything seems to work unless some other distro broke. Other
distros need to add CMAKE_TOOLCHAIN_FILE or --cross-multilib if
they cross compiled amd64 -> i686.
2015-01-03 14:51:04 +01:00
Miguel A. Colón Vélez b03ca5fcf4 Include some rather simple CMAKE_TOOLCHAIN_FILE.
- Update the build.sh and fix some typos.
  + Don't add the OSX ones because I have not tested them and it won't
    even build anyway due to the libaio dependency. Needs to use POSIX AIO
    or something else.
- They are rather simple and all the magic happens in two lines.
  + First line tells cmake to get ready to compile FOR linux or darwin.
    It also sets CMAKE_CROSSCOMPILING to true which is the only way to
    let cmake known that we are using stuff not from the host.
  + CMAKE_C_COMPILER/CMAKE_CXX_COMPILER are basically used to detect
    the architecture of the target. Since I used generic cc/c++ the
    hardcoded -m32 is needed to ensure we get TARGET=i386. Also
    since I hardcode -m32 and use c++/cc it's to be noted that
    we can only do i386->i386 (trivial), amd64 -> i386, and x32->i386.
    .
    Using something like i586-linux-gnu-{gcc,g++} would also work and
    enable arm -> i386, etc but it's infeasible and impractical to do all
    the combinations. File is simple enough that a distro or user can
    create their own and cross compiling is rather tedious compared
    to using a chroot to compile it.
- I tested it in Debian with "dpkg-buildpackage -ai386" but installing the
  build dependencies was rather tedious.
2015-01-03 14:51:04 +01:00
Miguel A. Colón Vélez d6d06d243c Begin cleaning up the cross build code.
http://www.vtk.org/Wiki/CMake_Cross_Compiling
http://www.cmake.org/cmake/help/v3.0/manual/cmake-toolchains.7.html
.
The official way that cmake does cross compiling is via the use of a
CMAKE_TOOLCHAIN_FILE. This has to be given by the user and can't be
included from within a Cmake file since setting up the toolchain has
to be the first thing that happens.
.
After the file is given and validated cmake behaves nicely and all the
workarounds and hacks are not really needed anymore.
.
The consequence of this change is that without this file cmake will
try to build for the HOST architecture as expected and with the file
it will build for the TARGET architecture of the given toolchain. Due to
this remove 64BIT_BUILD_DONT_WORK and just ERROR out if the user tries
in the same way as before.
2015-01-03 14:51:04 +01:00
Miguel A. Colón Vélez 8ea0766773 Use TargetArch to correctly detect the target.
Currently crosscompiling was broken since we detected the cpu of the host
not of the target. Building arm -> i386, i386->amd64, etc resulted in
interesting stuff.
.
CMAKE_HOST_SYSTEM_PROCESSOR and CMAKE_SYSTEM_PROCESSOR should have done this
but they are incredibly broken and unreliable. I use
CMAKE_HOST_SYSTEM_PROCESSOR just to retain the format of the old message
and is not used for critical stuff so it does not matter.
.
This code also allows scalability so that if one day in the very distant
and unlikely future the x86/x86_64 specific code gets made portable
by replacing asm/MMX/SSE*/AVX/etc code with generic/portable code then
it also would work on all architectures.
.
For *BSD/OS X it probably would need to use POSIX AIO instead of linux
specific libaio but that is a different issue.
.
Error out the x86_64 builds.
Also the 64BIT_BUILD_DONT_WORK option became obsolete more info in following
commit.
2015-01-03 14:51:04 +01:00
Miguel A. Colón Vélez e548ada1e9 Disable the use of multiple architectures in darwin.
- Update copyright due to incoming changes.
- Don't support universal binaries until they actually work therefore
  only allow 1 architecture in CMAKE_OSX_ARCHITECTURES.
- Don't allow an empty ARCH list.
  We probably asked for ppc or ppc64 w/o support for it.
2015-01-03 14:51:04 +01:00
Miguel A. Colón Vélez b18b0fdf28 Add TargetArch.cmake.
For now just dump the original and add the BSD-2-Clause.
.
It's GPL compatible so it's okay.
.
I was writting one myself but found this one and it handles apple
which I did not consider since I can't test it.
2015-01-03 14:51:04 +01:00
Miguel A. Colón Vélez 6dd3094802 Fix the rare case in which EGL is not found.
EGL sometimes is not found. Checklib 1st does
.
string(TOLOWER ${lib} lower_lib)
pkg_search_module(${var} QUIET ${lower_lib})
.
Therefore this part should be equivalent since we always compare lower.
.
This part seems to not find anything and then it does.
.
find_library(${var}_LIBRARIES ${lib})
.
Here it also does not find anything since it tries to find libegl
while the library is called libEGL therefore I changed the name to upper.
to avoid
_internal_message("-- ${lib} not found (miss lib)")
.
It could fail in the unlikely event that someone renamed libEGL to libegl.
This bug is triggered when you combine crosscompiling from amd64 to
i386 with Debian multiarch paths. For other distros it should work with
pkg_search_module normally.
2014-12-24 11:41:04 -05:00
Gregory Hainaut d00666a4d9 cmake: regression to select SDL/GTK + 64bits fix 2014-12-22 19:31:32 +01:00
Gregory Hainaut 0c17d67fa5 cmake: add a new option to select the doc path in package mode
DOC_DIR_COMPILATION=/usr/share/doc/pcsx2

close issue #402
2014-12-21 16:51:41 +01:00
Gregory Hainaut dc1cd3eb25 cmake: forbid user to use experimental flags
Namely GTK3_API and 64BIT_BUILD_DONT_WORK

The former was barely tested and doesn't compile with standard wx
The latter doesn't work at all

Note: I was very close to disable SDL2 too.  If wxWidget was built with
SDL1 support it will crash
2014-12-21 10:46:33 +01:00
Gregory Hainaut 1f54bb73aa cmake: enable some aggressive warning
Allow to track strict aliasing issue and overflow
2014-12-20 13:43:25 +01:00
Gregory Hainaut 66d7aa75e2 cmake: move -DNDEBUG to global option 2014-12-20 13:43:25 +01:00
Gregory Hainaut 63ba78b664 remove zzogl-pg-cg
superseeded by zzogl-pg
2014-12-13 12:28:37 +01:00
Gregory Hainaut 800262fc14 cmake: add a new GTK3.0 option
Thanks #micove for the patch
2014-12-10 22:07:48 +01:00
Gregory Hainaut 0a4f9e43d9 cmake: clean sdl management
* sdl is mandatory for spu2x
* cmake will include either /usr/include/SDL or /usr/include/SDL2 so no
  need to add extra ifdef
2014-12-07 21:06:21 +01:00
Gregory Hainaut 9e8b0b59ba cmake: remove a duplicated line 2014-12-07 12:47:35 +01:00
Gregory Hainaut c945aead54 cmake: better support of SDL2
Description: Building with SDL2_API=TRUE is incomplete
 SDL_FOUND does not imply SDL2_FOUND
 Use check_libs for detection
 Only include ${SDL_INCLUDE_DIR} when needed
 Use SDL2_LIBRARIES
Author: Miguel A. Colón Vélez

Gregory: add back SDL_BUILDING_LIBRARY
2014-12-07 12:19:14 +01:00
Gregory Hainaut 4b6632edf4 linux: use wx3.0 by default
+ Wx3.0 fixes various issue on linux (better sizing of box)
+ Debian doesn't provide wx2.8 anymore. Ubuntu will probably follow soon (close issue #342)

If you want to use wx2.8:
* Either you remove wx3.0 from your system
* Either you use the cmake option -DWX28_API=TRUE

Please don't hesitate to report any regresions.
2014-12-06 19:59:32 +01:00
3kinox 06f53b2689 use -fabi_version=6 only for GSdx, solve bug with wxwidget
reenable avx build for GSdx
2014-11-11 15:55:31 +01:00
Gregory Hainaut ec1da2805c pcsx2/GSdx: disable AVX for the moment on linux
I need to check carefully the consequence of ABI change. So far wx is very unhappy!

Fatal Error: Mismatch between the program and library build versions detected.
The library used 2.8 (no debug,Unicode,compiler with C++ ABI 1002,wx containers,compatible with 2.6),
and your program used 2.8 (no debug,Unicode,compiler with C++ ABI 1006,wx containers,compatible with 2.6).
2014-11-09 15:45:54 +01:00
Gregory Hainaut 679fa65b84 cmake: By default optimize for current arch
Note: it requires GCC 4.7. Otherwise use -DDISABLE_ADVANCE_SIMD=OFF to restore
previous behavior. It will impact Ubuntu precise (12.04)
2014-10-26 14:47:35 +01:00
nE0sIghT 7f57692ee3 Use cmake variable "BIN_DIR" for binaries installation 2014-09-27 22:26:42 +04:00
Gregory Hainaut 5b3f031654 cmake: fix commit f3a50a01a7
* link common with c lib (required for gold linker)
* fix the macro to properly set the library variable
  => use the variable instead to hardcoded value
2014-09-24 09:02:56 +02:00
Johannes Obermayr 9fd2f3dd8a Don't use build date on openSUSE.
Fixes RPMLINT warning:
pcsx2.i586: W: file-contains-date-and-time /usr/bin/pcsx2
Your file uses  __DATE and __TIME__ this causes the package to rebuild when not needed
2014-09-17 22:37:34 +02:00
Johannes Obermayr 7b1d3ba7ea Do commits 2bc2047 and f287754 the right way ... 2014-09-16 19:11:11 +02:00
Johannes Obermayr 2bc2047770 cmake: Fix RPATH/RUNPATH issue with openSuse wxWidgets libdir.
Gregory: Add an if clause to only change the rpath on openSuse

For me it doesn't follow the FHS => http://www.tldp.org/HOWTO/HighQuality-Apps-HOWTO/fhs.html
2014-09-14 13:12:26 +02:00
Gregory Hainaut 9c81272278 cmake: oups forget to change the usage of 64BIT_BUILD variable 2014-09-13 14:22:41 +02:00
Gregory Hainaut e101a1d77a linux build: let's be clear that 64 bit is not supported
* rename the cmake option to 64BIT_BUILD_DONT_WORK
* add --64-bit-dont-work to build.sh
2014-09-12 20:10:14 +02:00
Gregory Hainaut b9fba8005a cmake: failed to get git version
* add a fallback when the git version can't be fetched

Close issue #122
2014-09-10 14:19:50 +02:00
uyjulian e8d13090b0 Look for GLESv3 header instead of GLESv2 header 2014-09-05 20:16:50 +02:00
uyjulian f3a50a01a7 cmake: Use previous macros in CMakeLists.txt files
Gregory: add a c lib for zzogl-pg-cg replayer
2014-09-05 20:16:23 +02:00
uyjulian 1290d0b1a3 Remove unneeded comments 2014-09-05 20:14:09 +02:00
uyjulian 82dfed1512 Remove unneeded Check*.cmake 2014-09-05 20:14:09 +02:00
uyjulian 53e57766c9 Use CheckLib for some libs 2014-09-05 20:14:09 +02:00
uyjulian dde94da94f Add cleaner svnrev.h code, add macros 2014-09-05 20:14:09 +02:00
uyjulian 5f4fc4701f Add CheckLib.cmake 2014-09-05 20:14:08 +02:00
Gregory Hainaut bf52a4c737 build.sh: allow to replace build directory by a symlink
Use case: redirect the build into a ramdisk (less write on sdd and potentially faster io)
2014-09-02 21:21:46 +02:00
aga c963e0b62b "!64BIT_BUILD" is a variable name. Changed to "NOT 64BIT_BUILD" which is
the negation of the 64BIT_BUILD variable defined in
BuildParameters.cmake.
2014-08-16 12:00:50 -06:00
Gregory Hainaut 86152668c3 cmake: install mo file into Langs/id_code instead of Langs/id_code/LC_MESSAGES
Therefore it uses the same locations as windows.
2014-08-03 14:43:08 +02:00
Gregory Hainaut 61088b71c6 cmake: gcc warning management
* disable unused value warning (don't like the syntax 0&&)
* remove -Wno-ignored-attributes (c option). It replaces gcc warning
    by an unsupported option warning...
2014-08-03 14:43:08 +02:00
Gregory Hainaut cc0b9bbca9 cmake: drop gtk workaround for ubuntu 10.10
Note: remove also FIND_LIBRARY_USE_LIB64_PATHS that is alredy set in build parameter
2014-07-30 09:21:49 +02:00
Gregory Hainaut f38c6d0995 Merge pull request #142 from Sonicadvance1/fPIC_x86_64
Enable -fPIC on x86_64.
2014-07-30 00:01:08 +02:00
Gregory Hainaut 0706564215 remove sparsehash from 3rdparty
small deps but the less the merrier

Note: could someone check windows builds :p
2014-07-29 21:06:31 +02:00
Gregory Hainaut d09fee90ad wx3.0: add cmake support (2.8 by default)
use ./build.sh --wx30 for wx3.0
2014-07-29 20:45:43 +02:00
Ryan Houdek 8c07d4e7b9 Enable -fPIC on x86_64.
-fPIC is required on x86_64 for shared libraries.
This allows the compilation to get farther in to plugin compiling.
2014-07-26 03:08:35 -05:00
Ryan Houdek a1a0ed0563 Support _M_X86[_32/_64] on Linux.
These go hand in hand with PR #109 but for Linux as well.

These are much more useful defines than what other compilers give us.
2014-07-14 23:58:02 -05:00
Gregory Hainaut f85a4c0467 clang: don't use clang asm tool
-no-integrated-as fixes most of the asm issue :)
2014-07-14 13:58:06 +02:00