Skip to content

Commit

Permalink
* Fix CMake to include PGXP sources. Import updated translations.
Browse files Browse the repository at this point in the history
    Includes some small fixes on CMake, such as prettier status messages,
    host and target arch detection (taken from PCSX2), and various other
    small errors.
  • Loading branch information
loathingKernel committed Jul 31, 2017
1 parent 3912ad3 commit a93c5c5
Show file tree
Hide file tree
Showing 26 changed files with 24,438 additions and 24,255 deletions.
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ project(pcsxr)

set(PCSXR_VERSION_MAJOR "1")
set(PCSXR_VERSION_MINOR "9")
set(PCSXR_VERSION_PATCH "94")
set(PCSXR_VERSION_PATCH "95")
add_definitions(-DPACKAGE_VERSION="${PCSXR_VERSION_MAJOR}.${PCSXR_VERSION_MINOR}.${PCSXR_VERSION_PATCH}")
add_definitions(-DPACKAGE_NAME="PCSXr")
add_definitions(-DPACKAGE_STRING="PCSXr ${PCSXR_VERSION_MAJOR}.${PCSXR_VERSION_MINOR}.${PCSXR_VERSION_PATCH}")
Expand All @@ -38,14 +38,15 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
endif()
endif()

option(BUILD_SIO1 "Build SIO1 plugin." On)
option(BUILD_OPENGL "Build OpenGL plugin." On)
option(BUILD_SIO1 "Build SIO1 plugin." ON)
option(BUILD_OPENGL "Build OpenGL plugin." ON)

if (BUILD_SIO1)
add_definitions(-DENABLE_SIO1API)
endif()

#components
add_subdirectory(po)
add_subdirectory(libpcsxcore)
add_subdirectory(gui)
add_subdirectory(plugins)
Expand Down
6 changes: 3 additions & 3 deletions cmake/FindCdio.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
#

# This module defines
# CDIO_INCLUDE_DIR, where to find iso9660.h, etc.
# CDIO_INCLUDE_DIR, where to find cdio.h, etc.
# CDIO_LIBRARIES, the libraries to link against.
# CDIO_FOUND, If false, do not try to use cdio.

SET(CDIO_FOUND FALSE)

FIND_PATH(CDIO_INCLUDE_DIR iso9660.h
FIND_PATH(CDIO_INCLUDE_DIR cdio.h
/usr/include/cdio
/usr/local/include/cdio
)

FIND_LIBRARY(CDIO_C_LIB iso9660
FIND_LIBRARY(CDIO_C_LIB cdio
/usr/lib
/usr/local/lib
)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindFFMPEG.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ MACRO(FFMPEG_FIND varname shortname headername)
ENDIF()

IF(${varname}_INCLUDE_DIR STREQUAL "${varname}_INCLUDE_DIR-NOTFOUND")
message(STATUS "look for newer strcture")
message(STATUS "Look for newer structure")
IF(NOT WIN32)
PKG_CHECK_MODULES(PC_${varname} "lib${shortname}")

Expand Down
169 changes: 169 additions & 0 deletions cmake/macros/TargetArch.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
# Copyright (c) 2014 PCSX2 Dev Team
# Copyright (c) 2012 Petroules Corporation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# https://github.com/petroules/solar-cmake/blob/master/TargetArch.cmake
#
# Based on the Qt 5 processor detection code, so should be very accurate
# https://qt.gitorious.org/qt/qtbase/blobs/master/src/corelib/global/qprocessordetection.h
# Currently handles arm (v5, v6, v7), x86 (32/64), ia64, and ppc (32/64)

# Regarding POWER/PowerPC, just as is noted in the Qt source,
# "There are many more known variants/revisions that we do not handle/detect."

set(archdetect_c_code "
#if defined(__arm__) || defined(__TARGET_ARCH_ARM)
#if defined(__ARM_ARCH_7__) \\
|| defined(__ARM_ARCH_7A__) \\
|| defined(__ARM_ARCH_7R__) \\
|| defined(__ARM_ARCH_7M__) \\
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 7)
#error cmake_ARCH armv7
#elif defined(__ARM_ARCH_6__) \\
|| defined(__ARM_ARCH_6J__) \\
|| defined(__ARM_ARCH_6T2__) \\
|| defined(__ARM_ARCH_6Z__) \\
|| defined(__ARM_ARCH_6K__) \\
|| defined(__ARM_ARCH_6ZK__) \\
|| defined(__ARM_ARCH_6M__) \\
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 6)
#error cmake_ARCH armv6
#elif defined(__ARM_ARCH_5TEJ__) \\
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 5)
#error cmake_ARCH armv5
#else
#error cmake_ARCH arm
#endif
#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
#error cmake_ARCH i386
#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64)
#error cmake_ARCH x86_64
#elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
#error cmake_ARCH ia64
#elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__) \\
|| defined(_ARCH_COM) || defined(_ARCH_PWR) || defined(_ARCH_PPC) \\
|| defined(_M_MPPC) || defined(_M_PPC)
#if defined(__ppc64__) || defined(__powerpc64__) || defined(__64BIT__)
#error cmake_ARCH ppc64
#else
#error cmake_ARCH ppc
#endif
#endif
#error cmake_ARCH unknown
")

# Set ppc_support to TRUE before including this file or ppc and ppc64
# will be treated as invalid architectures since they are no longer supported by Apple

function(target_architecture output_var)
if(APPLE AND CMAKE_OSX_ARCHITECTURES)
# On OS X we use CMAKE_OSX_ARCHITECTURES *if* it was set
# First let's normalize the order of the values

# Note that it's not possible to compile PowerPC applications if you are using
# the OS X SDK version 10.6 or later - you'll need 10.4/10.5 for that, so we
# disable it by default
# See this page for more information:
# http://stackoverflow.com/questions/5333490/how-can-we-restore-ppc-ppc64-as-well-as-full-10-4-10-5-sdk-support-to-xcode-4

# Architecture defaults to i386 or ppc on OS X 10.5 and earlier, depending on the CPU type detected at runtime.
# On OS X 10.6+ the default is x86_64 if the CPU supports it, i386 otherwise.

LIST(LENGTH CMAKE_OSX_ARCHITECTURES osx_arch_num)
if(NOT (osx_arch_num EQUAL 1))
message(FATAL_ERROR "Currently ${CMAKE_PROJECT_NAME} does not support multiple architectures in CMAKE_OSX_ARCHITECTURES")
endif()

foreach(osx_arch ${CMAKE_OSX_ARCHITECTURES})
if("${osx_arch}" STREQUAL "ppc" AND ppc_support)
set(osx_arch_ppc TRUE)
elseif("${osx_arch}" STREQUAL "i386")
set(osx_arch_i386 TRUE)
elseif("${osx_arch}" STREQUAL "x86_64")
set(osx_arch_x86_64 TRUE)
elseif("${osx_arch}" STREQUAL "ppc64" AND ppc_support)
set(osx_arch_ppc64 TRUE)
else()
message(FATAL_ERROR "Invalid OS X arch name: ${osx_arch}")
endif()
endforeach()

# Now add all the architectures in our normalized order
if(osx_arch_ppc)
list(APPEND ARCH ppc)
endif()

if(osx_arch_i386)
list(APPEND ARCH i386)
endif()

if(osx_arch_x86_64)
list(APPEND ARCH x86_64)
endif()

if(osx_arch_ppc64)
list(APPEND ARCH ppc64)
endif()

LIST(LENGTH ARCH osx_arch_num)
if(osx_arch_num LESS 1)
message(FATAL_ERROR "Invalid CMAKE_OSX_ARCHITECTURES: ${CMAKE_OSX_ARCHITECTURES}")
endif()
else()
file(WRITE "${CMAKE_BINARY_DIR}/arch.c" "${archdetect_c_code}")

enable_language(C)

# Detect the architecture in a rather creative way...
# This compiles a small C program which is a series of ifdefs that selects a
# particular #error preprocessor directive whose message string contains the
# target architecture. The program will always fail to compile (both because
# file is not a valid C program, and obviously because of the presence of the
# #error preprocessor directives... but by exploiting the preprocessor in this
# way, we can detect the correct target architecture even when cross-compiling,
# since the program itself never needs to be run (only the compiler/preprocessor)
try_run(
run_result_unused
compile_result_unused
"${CMAKE_BINARY_DIR}"
"${CMAKE_BINARY_DIR}/arch.c"
COMPILE_OUTPUT_VARIABLE ARCH
CMAKE_FLAGS CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
)

# Parse the architecture name from the compiler output
string(REGEX MATCH "cmake_ARCH ([a-zA-Z0-9_]+)" ARCH "${ARCH}")

# Get rid of the value marker leaving just the architecture name
string(REPLACE "cmake_ARCH " "" ARCH "${ARCH}")

# If we are compiling with an unknown architecture this variable should
# already be set to "unknown" but in the case that it's empty (i.e. due
# to a typo in the code), then set it to unknown
if (NOT ARCH)
set(ARCH unknown)
endif()
endif()

set(${output_var} "${ARCH}" PARENT_SCOPE)
endfunction()
7 changes: 5 additions & 2 deletions gui/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
message("Configuring gui")
message(STATUS "* Configuring gui")

include(GlibCompileResourcesSupport)

Expand Down Expand Up @@ -27,6 +27,10 @@ find_library(RT_LIB rt REQUIRED)
find_package(X11 REQUIRED)
include_directories(${X11_XTest_INCLUDE_PATH})

if (${DYNAREC} STREQUAL "no")
message(STATUS "User selected to not build dynarec")
add_definitions(-DNOPSXREC)
endif()

#defs
add_definitions(-DLOCALE_DIR="${CMAKE_INSTALL_FULL_DATAROOTDIR}/locale/" -DPSEMU_DATA_DIR="${CMAKE_INSTALL_FULL_DATAROOTDIR}/psemu" -DDEF_PLUGIN_DIR="${CMAKE_INSTALL_FULL_LIBDIR}/games/psemu")
Expand Down Expand Up @@ -95,4 +99,3 @@ install(TARGETS pcsxr RUNTIME DESTINATION bin)
install(FILES data/pcsxr.desktop DESTINATION share/applications)
install(FILES data/pixmaps/pcsxr-icon.png DESTINATION share/icons/hicolor/48x48/apps)

add_subdirectory("po")
41 changes: 25 additions & 16 deletions libpcsxcore/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
message("Configuring core")
message(STATUS "* Configuring core")

set(DYNAREC "auto" CACHE STRING "Build dynarec for arch.")
set_property(CACHE DYNAREC PROPERTY STRINGS auto x86_64 x86 ppc no)
Expand All @@ -19,44 +19,47 @@ if (USE_LIBARCHIVE)
endif()

# Architecture detection and arch specific settings
message(${CMAKE_SYSTEM_PROCESSOR})
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^powerpc")
message(STATUS "Building PCSXr on arch " ${CMAKE_SYSTEM_PROCESSOR})
include(TargetArch)
target_architecture(PCSXR_TARGET_ARCH)
message(STATUS "Targeting arch " ${PCSXR_TARGET_ARCH})
if (${PCSXR_TARGET_ARCH} MATCHES "ppc")
set(_ARCH_PPC 1)
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^i.86")
elseif(${PCSXR_TARGET_ARCH} MATCHES "i386")
set(_ARCH_32 1)
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^x86_64")
elseif(${PCSXR_TARGET_ARCH} MATCHES "x86_64")
set(_ARCH_64 1)
else()
message("Unsupported arch. Will not build dynarec")
message(STATUS "Unsupported arch. Will not build dynarec")
add_definitions(-DNOPSXREC)
endif()

set(CMAKE_POSITION_INDEPENDENT_CODE OFF) #for x86

if (${DYNAREC} STREQUAL "auto")
if (_ARCH_PPC)
set(DYNAREC_PPC 1)
message("Using PPC Dynarec")
message(STATUS "Autodetected PPC dynarec.")
elseif(_ARCH_64)
set(DYNAREC_64 1)
message("Using x86_64 Dynarec")
message(STATUS "Autodetected x86_64 dynarec.")
elseif(_ARCH_32)
set(DYNAREC_32 1)
message("Using x86 Dynarec")
message(STATUS "Autodetected x86 dynarec.")
endif()
elseif (${DYNAREC} STREQUAL "ppc")
#if anyone ever fixes ppc dynarec
# set(DYNAREC_PPC 1)
# message("Using PPC Dynarec")
message("PPC Dynarec is broken, sorry.")
# message(STATUS "User selected PPC dynarec")
message(STATUS "User selected PPC dynarec is broken, sorry.")
add_definitions(-DNOPSXREC)
elseif (${DYNAREC} STREQUAL "x86_64")
set(DYNAREC_64 1)
message("Using x86_64 Dynarec")
message(STATUS "User selected x86_64 dynarec.")
elseif (${DYNAREC} STREQUAL "x86")
set(DYNAREC_32 1)
message("Using x86 Dynarec")
message(STATUS "User selected x86 dynarec.")
elseif (${DYNAREC} STREQUAL "no")
message("Will not build dynarec")
message(STATUS "User selected to not build dynarec.")
add_definitions(-DNOPSXREC)
endif()

Expand Down Expand Up @@ -84,7 +87,13 @@ set(SRCS psxbios.c
cdriso.c
cheat.c
socket.c
ppf.c)
ppf.c
pgxp_cpu.c
pgxp_debug.c
pgxp_gte.c
pgxp_mem.c
pgxp_value.c
)

set(LIBS "-lm")

Expand Down
6 changes: 3 additions & 3 deletions libpcsxcore/ix86/iR3000A.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@

#include "ix86.h"
#include <sys/mman.h>
#include "pgxp_cpu.h"
#include "pgxp_gte.h"
#include "pgxp_debug.h"
#include "../pgxp_cpu.h"
#include "../pgxp_gte.h"
#include "../pgxp_debug.h"

#ifndef MAP_ANONYMOUS
#define MAP_ANONYMOUS MAP_ANON
Expand Down
6 changes: 3 additions & 3 deletions libpcsxcore/ix86_64/iR3000A-64.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
#include "../r3000a.h"
#include "../psxhle.h"

#include "pgxp_cpu.h"
#include "pgxp_gte.h"
#include "pgxp_debug.h"
#include "../pgxp_cpu.h"
#include "../pgxp_gte.h"
#include "../pgxp_debug.h"

#include <sys/mman.h>

Expand Down
2 changes: 1 addition & 1 deletion plugins/bladesio1/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
message("Configuring bladesio1")
message(STATUS "* Configuring bladesio1")

include(GlibCompileResourcesSupport)

Expand Down
2 changes: 1 addition & 1 deletion plugins/dfcdrom/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
message("Configuring dfcdrom")
message(STATUS "* Configuring dfcdrom")

include(GlibCompileResourcesSupport)

Expand Down
6 changes: 3 additions & 3 deletions plugins/dfinput/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
message("Configuring dfinput")
message(STATUS "* Configuring dfinput")

include(GlibCompileResourcesSupport)

Expand All @@ -24,12 +24,12 @@ if(NOT SDL2_FOUND)
if(NOT SDL_FOUND)
message(FATAL_ERROR "SDL or SDL2 library not found")
else(NOT SDL_FOUND)
message("Using SDL")
message(STATUS "Using SDL")
include_directories(${SDL_INCLUDE_DIR})
endif(NOT SDL_FOUND)
else(NOT SDL2_FOUND)
set(USE_SDL2 1)
message("Using SDL2")
message(STATUS "Using SDL2")
include_directories(${SDL2_INCLUDE_DIR})
endif(NOT SDL2_FOUND)

Expand Down
2 changes: 1 addition & 1 deletion plugins/dfnet/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
message("Configuring dfnet")
message(STATUS "* Configuring dfnet")

include(GlibCompileResourcesSupport)

Expand Down
Loading

0 comments on commit a93c5c5

Please sign in to comment.