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.
This commit is contained in:
Miguel A. Colón Vélez 2014-12-28 01:41:57 -05:00 committed by Gregory Hainaut
parent b42c9defb1
commit c8c22cf6a0
5 changed files with 40 additions and 42 deletions

View File

@ -80,7 +80,11 @@ include(TargetArch)
target_architecture(PCSX2_TARGET_ARCHITECTURES)
if(${PCSX2_TARGET_ARCHITECTURES} MATCHES "x86_64" OR ${PCSX2_TARGET_ARCHITECTURES} MATCHES "i386")
if(${PCSX2_TARGET_ARCHITECTURES} MATCHES "x86_64" AND (CMAKE_BUILD_TYPE MATCHES "Release" OR PACKAGE_MODE))
message(FATAL_ERROR "The code for ${PCSX2_TARGET_ARCHITECTURES} support is not ready yet.")
message(FATAL_ERROR "
The code for ${PCSX2_TARGET_ARCHITECTURES} support is not ready yet.
For now compile with -DCMAKE_TOOLCHAIN_FILE=cmake/linux-compiler-i386-multilib.cmake
or with
--cross-multilib passed to build.sh")
endif()
message(STATUS "Compiling a ${PCSX2_TARGET_ARCHITECTURES} build on a ${CMAKE_HOST_SYSTEM_PROCESSOR} host.")
else()

View File

@ -7,42 +7,34 @@
# On linux, it also set a flag for specific distribution (ie Fedora)
#-------------------------------------------------------------------------------
function(detectOperatingSystem)
# nothing detected yet
set(MacOSX FALSE PARENT_SCOPE)
set(Windows FALSE PARENT_SCOPE)
set(Linux FALSE PARENT_SCOPE)
set(Fedora FALSE PARENT_SCOPE)
# check if we are on Linux
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(Linux TRUE PARENT_SCOPE)
if (EXISTS /etc/os-release)
# Read the file without CR character
file(STRINGS /etc/os-release OS_RELEASE)
if ("${OS_RELEASE}" MATCHES "^.*ID=fedora.*$")
set(Fedora TRUE PARENT_SCOPE)
message(STATUS "Build Fedora specific")
endif()
if ("${OS_RELEASE}" MATCHES "^.*ID=.*suse.*$")
set(openSUSE TRUE PARENT_SCOPE)
add_definitions(-DopenSUSE)
message(STATUS "Build openSUSE specific")
endif()
endif()
endif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
# check if we are on MacOSX
if(APPLE)
message(WARNING "Mac OS X isn't supported, build will most likely fail")
set(MacOSX TRUE PARENT_SCOPE)
endif(APPLE)
# check if we are on Windows
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
if(WIN32)
set(Windows TRUE PARENT_SCOPE)
endif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
endfunction(detectOperatingSystem)
elseif(UNIX AND APPLE)
# No easy way to filter out iOS.
message(WARNING "OS X/iOS isn't supported, the build will most likely fail")
set(MacOSX TRUE PARENT_SCOPE)
elseif(UNIX)
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(Linux TRUE PARENT_SCOPE)
if (EXISTS /etc/os-release)
# Read the file without CR character
file(STRINGS /etc/os-release OS_RELEASE)
if("${OS_RELEASE}" MATCHES "^.*ID=fedora.*$")
set(Fedora TRUE PARENT_SCOPE)
message(STATUS "Build Fedora specific")
elseif("${OS_RELEASE}" MATCHES "^.*ID=.*suse.*$")
set(openSUSE TRUE PARENT_SCOPE)
add_definitions(-DopenSUSE)
message(STATUS "Build openSUSE specific")
endif()
endif()
elseif(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD")
set(kFreeBSD TRUE PARENT_SCOPE)
elseif(CMAKE_SYSTEM_NAME STREQUAL "GNU")
set(GNU TRUE PARENT_SCOPE)
endif()
endif()
endfunction()
function(write_svnrev_h)
find_package(Git)

View File

@ -32,7 +32,9 @@ include(FindLibc)
## Use CheckLib package to find module
include(CheckLib)
check_lib(AIO aio aio.h)
if(Linux)
check_lib(AIO aio libaio.h)
endif()
check_lib(EGL EGL EGL/egl.h)
check_lib(GLESV2 GLESv2 GLES3/gl3ext.h) # NOTE: looking for GLESv3, not GLESv2
check_lib(PORTAUDIO portaudio portaudio.h pa_linux_alsa.h)
@ -46,7 +48,7 @@ else()
find_package(SDL)
endif()
if (Linux)
if(UNIX)
find_package(X11)
# Most plugins (if not all) and PCSX2 core need gtk2, so set the required flags
if (GTK3_API)
@ -63,7 +65,7 @@ endif()
#----------------------------------------
# Use system include
#----------------------------------------
if(Linux)
if(UNIX)
if(GTK2_FOUND)
include_directories(${GTK2_INCLUDE_DIRS})
elseif(GTK3_FOUND)

View File

@ -56,7 +56,7 @@ endif()
# -aio
#---------------------------------------
# Common dependancy
if(wxWidgets_FOUND AND ZLIB_FOUND AND common_libs AND AIO_FOUND)
if(wxWidgets_FOUND AND ZLIB_FOUND AND common_libs AND NOT (Linux AND NOT AIO_FOUND))
set(pcsx2_core TRUE)
elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/pcsx2")
set(pcsx2_core FALSE)
@ -66,7 +66,7 @@ else()
message(STATUS "${msg_dep_pcsx2}")
endif()
# Linux need also gtk2
if(Linux AND pcsx2_core AND NOT GTKn_FOUND)
if(UNIX AND pcsx2_core AND NOT GTKn_FOUND)
set(pcsx2_core FALSE)
message(STATUS "Skip build of pcsx2 core: miss some dependencies")
message(STATUS "${msg_dep_pcsx2}")

View File

@ -4,4 +4,4 @@
# zerogs plugin opengl
if(UNIX)
add_subdirectory(opengl)
endif(UNIX)
endif()