* Import CMake build system from codeplex

This commit is contained in:
Stelios Tsampas 2017-07-31 16:14:45 +03:00
parent 01f4990887
commit 3912ad309e
35 changed files with 2732 additions and 0 deletions

14
.gitattributes vendored Normal file
View File

@ -0,0 +1,14 @@
* text=auto
*.h text=auto
*.c text=auto
*.cpp text=auto
*.m text=lf
*.swift text=lf
*.rc text=crlf
*.pdf binary
*.gif binary
*.jpg binary
*.png binary
*.bmp binary
*.ico binary

3
.gitignore vendored
View File

@ -8,3 +8,6 @@ xcuserdata
macosx/Info.plistvers.plist
*.kdev4
linux_build.sh
.DS_Store
*.o
build/

55
CMakeLists.txt Normal file
View File

@ -0,0 +1,55 @@
cmake_minimum_required(VERSION 3.4.0)
cmake_policy(SET CMP0065 NEW)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/macros)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build")
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release RelWithDebInfo MinSizeRel)
project(pcsxr)
set(PCSXR_VERSION_MAJOR "1")
set(PCSXR_VERSION_MINOR "9")
set(PCSXR_VERSION_PATCH "94")
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}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
include(CheckCCompilerFlag)
include(GNUInstallDirs)
include_directories(${CMAKE_SOURCE_DIR})
add_definitions(-DENABLE_NLS -DGETTEXT_PACKAGE="pcsxr")
#WARNING! this is required for dynarec to work!
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fno-pie")
if(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
CHECK_C_COMPILER_FLAG("-no-pie" NO_PIE_UPSTREAM)
if(NO_PIE_UPSTREAM)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie")
endif()
CHECK_C_COMPILER_FLAG("-nopie" NO_PIE_PATCHED)
if(NO_PIE_PATCHED)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -nopie")
endif()
endif()
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(libpcsxcore)
add_subdirectory(gui)
add_subdirectory(plugins)
add_subdirectory(doc)

86
cmake/FindATK.cmake Normal file
View File

@ -0,0 +1,86 @@
# FindPango.cmake
# <https://github.com/nemequ/gnome-cmake>
#
# CMake support for ATK.
#
# License:
#
# Copyright (c) 2016 Evan Nemerson <evan@nemerson.com>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use, copy,
# modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
find_package(PkgConfig)
set(ATK_DEPS
GLib)
if(PKG_CONFIG_FOUND)
pkg_search_module(ATK_PKG atk)
endif()
find_library(ATK_LIBRARY atk-1.0 HINTS ${ATK_PKG_LIBRARY_DIRS})
set(ATK "atk-1.0")
if(ATK_LIBRARY AND NOT ATK_FOUND)
add_library(${ATK} SHARED IMPORTED)
set_property(TARGET ${ATK} PROPERTY IMPORTED_LOCATION "${ATK_LIBRARY}")
set_property(TARGET ${ATK} PROPERTY INTERFACE_COMPILE_OPTIONS "${ATK_PKG_CFLAGS_OTHER}")
find_path(ATK_INCLUDE_DIR "atk/atk.h"
HINTS ${ATK_PKG_INCLUDE_DIRS})
if(ATK_INCLUDE_DIR)
file(STRINGS "${ATK_INCLUDE_DIR}/atk/atkversion.h" ATK_MAJOR_VERSION REGEX "^#define ATK_MAJOR_VERSION +\\(?([0-9]+)\\)?$")
string(REGEX REPLACE "^#define ATK_MAJOR_VERSION \\(([0-9]+)\\)$" "\\1" ATK_MAJOR_VERSION "${ATK_MAJOR_VERSION}")
file(STRINGS "${ATK_INCLUDE_DIR}/atk/atkversion.h" ATK_MINOR_VERSION REGEX "^#define ATK_MINOR_VERSION +\\(?([0-9]+)\\)?$")
string(REGEX REPLACE "^#define ATK_MINOR_VERSION \\(([0-9]+)\\)$" "\\1" ATK_MINOR_VERSION "${ATK_MINOR_VERSION}")
file(STRINGS "${ATK_INCLUDE_DIR}/atk/atkversion.h" ATK_MICRO_VERSION REGEX "^#define ATK_MICRO_VERSION +\\(?([0-9]+)\\)?$")
string(REGEX REPLACE "^#define ATK_MICRO_VERSION \\(([0-9]+)\\)$" "\\1" ATK_MICRO_VERSION "${ATK_MICRO_VERSION}")
set(ATK_VERSION "${ATK_MAJOR_VERSION}.${ATK_MINOR_VERSION}.${ATK_MICRO_VERSION}")
unset(ATK_MAJOR_VERSION)
unset(ATK_MINOR_VERSION)
unset(ATK_MICRO_VERSION)
list(APPEND ATK_INCLUDE_DIRS ${ATK_INCLUDE_DIR})
set_property(TARGET ${ATK} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${ATK_INCLUDE_DIR}")
endif()
endif()
set(ATK_DEPS_FOUND_VARS)
foreach(atk_dep ${ATK_DEPS})
find_package(${atk_dep})
list(APPEND ATK_DEPS_FOUND_VARS "${atk_dep}_FOUND")
list(APPEND ATK_INCLUDE_DIRS ${${atk_dep}_INCLUDE_DIRS})
set_property (TARGET "${ATK}" APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${${atk_dep}}")
endforeach(atk_dep)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ATK
REQUIRED_VARS
ATK_LIBRARY
ATK_INCLUDE_DIRS
${ATK_DEPS_FOUND_VARS}
VERSION_VAR
ATK_VERSION)
unset(ATK_DEPS_FOUND_VARS)

87
cmake/FindCairo.cmake Normal file
View File

@ -0,0 +1,87 @@
# FindCairo.cmake
# <https://github.com/nemequ/gnome-cmake>
#
# CMake support for Cairo.
#
# License:
#
# Copyright (c) 2016 Evan Nemerson <evan@nemerson.com>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use, copy,
# modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
find_package(PkgConfig)
set(Cairo_DEPS)
if(PKG_CONFIG_FOUND)
pkg_search_module(Cairo_PKG cairo)
endif()
find_library(Cairo_LIBRARY cairo HINTS ${Cairo_PKG_LIBRARY_DIRS})
set(Cairo cairo)
if(Cairo_LIBRARY)
add_library(${Cairo} SHARED IMPORTED)
set_property(TARGET ${Cairo} PROPERTY IMPORTED_LOCATION "${Cairo_LIBRARY}")
set_property(TARGET ${Cairo} PROPERTY INTERFACE_COMPILE_OPTIONS "${Cairo_PKG_CFLAGS_OTHER}")
set(Cairo_INCLUDE_DIRS)
find_path(Cairo_INCLUDE_DIR "cairo.h"
HINTS ${Cairo_PKG_INCLUDE_DIRS})
if(Cairo_INCLUDE_DIR)
file(STRINGS "${Cairo_INCLUDE_DIR}/cairo-version.h" Cairo_VERSION_MAJOR REGEX "^#define CAIRO_VERSION_MAJOR +\\(?([0-9]+)\\)?$")
string(REGEX REPLACE "^#define CAIRO_VERSION_MAJOR \\(?([0-9]+)\\)?$" "\\1" Cairo_VERSION_MAJOR "${Cairo_VERSION_MAJOR}")
file(STRINGS "${Cairo_INCLUDE_DIR}/cairo-version.h" Cairo_VERSION_MINOR REGEX "^#define CAIRO_VERSION_MINOR +\\(?([0-9]+)\\)?$")
string(REGEX REPLACE "^#define CAIRO_VERSION_MINOR \\(?([0-9]+)\\)?$" "\\1" Cairo_VERSION_MINOR "${Cairo_VERSION_MINOR}")
file(STRINGS "${Cairo_INCLUDE_DIR}/cairo-version.h" Cairo_VERSION_MICRO REGEX "^#define CAIRO_VERSION_MICRO +\\(?([0-9]+)\\)?$")
string(REGEX REPLACE "^#define CAIRO_VERSION_MICRO \\(?([0-9]+)\\)?$" "\\1" Cairo_VERSION_MICRO "${Cairo_VERSION_MICRO}")
set(Cairo_VERSION "${Cairo_VERSION_MAJOR}.${Cairo_VERSION_MINOR}.${Cairo_VERSION_MICRO}")
unset(Cairo_VERSION_MAJOR)
unset(Cairo_VERSION_MINOR)
unset(Cairo_VERSION_MICRO)
list(APPEND Cairo_INCLUDE_DIRS ${Cairo_INCLUDE_DIR})
set_property(TARGET ${Cairo} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${Cairo_INCLUDE_DIR}")
endif()
endif()
set(Cairo_DEPS_FOUND_VARS)
foreach(cairo_dep ${Cairo_DEPS})
find_package(${cairo_dep})
list(APPEND Cairo_DEPS_FOUND_VARS "${cairo_dep}_FOUND")
list(APPEND Cairo_INCLUDE_DIRS ${${cairo_dep}_INCLUDE_DIRS})
set_property (TARGET ${Cairo} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${${cairo_dep}}")
endforeach(cairo_dep)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Cairo
REQUIRED_VARS
Cairo_LIBRARY
Cairo_INCLUDE_DIRS
${Cairo_DEPS_FOUND_VARS}
VERSION_VAR
Cairo_VERSION)
unset(Cairo_DEPS_FOUND_VARS)

35
cmake/FindCdio.cmake Normal file
View File

@ -0,0 +1,35 @@
# - Find the GNU Compact Disc Input and Control Library 'cdio' includes and library
#
# This module defines
# CDIO_INCLUDE_DIR, where to find iso9660.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
/usr/include/cdio
/usr/local/include/cdio
)
FIND_LIBRARY(CDIO_C_LIB iso9660
/usr/lib
/usr/local/lib
)
SET(CDIO_LIBRARIES ${CDIO_C_LIB})
IF (CDIO_INCLUDE_DIR AND CDIO_LIBRARIES)
SET(CDIO_FOUND TRUE)
ENDIF (CDIO_INCLUDE_DIR AND CDIO_LIBRARIES)
IF (CDIO_FOUND)
IF (NOT Cdio_FIND_QUIETLY)
MESSAGE(STATUS "Found cdio: ${CDIO_INCLUDE_DIR} ${CDIO_LIBRARIES}")
ENDIF (NOT Cdio_FIND_QUIETLY)
ELSE (CDIO_FOUND)
IF (Cdio_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find cdio library")
ENDIF (Cdio_FIND_REQUIRED)
ENDIF (CDIO_FOUND)

141
cmake/FindFFMPEG.cmake Normal file
View File

@ -0,0 +1,141 @@
# - Try to find FFMPEG
# Once done this will define
# FFMPEG_FOUND - System has FFMPEG
# FFMPEG_INCLUDE_DIRS - The FFMPEG include directories
# FFMPEG_LIBRARIES - The libraries needed to use FFMPEG
# FFMPEG_LIBRARY_DIRS - The directory to find FFMPEG libraries
#
# written by Roy Shilkrot 2013 http://www.morethantechnical.com/
#
find_package(PkgConfig)
MACRO(FFMPEG_FIND varname shortname headername)
IF(NOT WIN32)
PKG_CHECK_MODULES(PC_${varname} ${shortname})
FIND_PATH(${varname}_INCLUDE_DIR "${shortname}/${headername}"
HINTS ${PC_${varname}_INCLUDEDIR} ${PC_${varname}_INCLUDE_DIRS}
NO_DEFAULT_PATH
)
ELSE()
FIND_PATH(${varname}_INCLUDE_DIR "${shortname}/${headername}")
ENDIF()
IF(${varname}_INCLUDE_DIR STREQUAL "${varname}_INCLUDE_DIR-NOTFOUND")
message(STATUS "look for newer strcture")
IF(NOT WIN32)
PKG_CHECK_MODULES(PC_${varname} "lib${shortname}")
FIND_PATH(${varname}_INCLUDE_DIR "lib${shortname}/${headername}"
HINTS ${PC_${varname}_INCLUDEDIR} ${PC_${varname}_INCLUDE_DIRS}
NO_DEFAULT_PATH
)
ELSE()
FIND_PATH(${varname}_INCLUDE_DIR "lib${shortname}/${headername}")
IF(${${varname}_INCLUDE_DIR} STREQUAL "${varname}_INCLUDE_DIR-NOTFOUND")
#Desperate times call for desperate measures
MESSAGE(STATUS "globbing...")
FILE(GLOB_RECURSE ${varname}_INCLUDE_DIR "/ffmpeg*/${headername}")
MESSAGE(STATUS "found: ${${varname}_INCLUDE_DIR}")
IF(${varname}_INCLUDE_DIR)
GET_FILENAME_COMPONENT(${varname}_INCLUDE_DIR "${${varname}_INCLUDE_DIR}" PATH)
GET_FILENAME_COMPONENT(${varname}_INCLUDE_DIR "${${varname}_INCLUDE_DIR}" PATH)
ELSE()
SET(${varname}_INCLUDE_DIR "${varname}_INCLUDE_DIR-NOTFOUND")
ENDIF()
ENDIF()
ENDIF()
ENDIF()
IF(${${varname}_INCLUDE_DIR} STREQUAL "${varname}_INCLUDE_DIR-NOTFOUND")
MESSAGE(STATUS "Can't find includes for ${shortname}...")
ELSE()
MESSAGE(STATUS "Found ${shortname} include dirs: ${${varname}_INCLUDE_DIR}")
# GET_DIRECTORY_PROPERTY(FFMPEG_PARENT DIRECTORY ${${varname}_INCLUDE_DIR} PARENT_DIRECTORY)
GET_FILENAME_COMPONENT(FFMPEG_PARENT ${${varname}_INCLUDE_DIR} PATH)
MESSAGE(STATUS "Using FFMpeg dir parent as hint: ${FFMPEG_PARENT}")
IF(NOT WIN32)
FIND_LIBRARY(${varname}_LIBRARIES NAMES ${shortname}
HINTS ${PC_${varname}_LIBDIR} ${PC_${varname}_LIBRARY_DIR} ${FFMPEG_PARENT})
ELSE()
# FIND_PATH(${varname}_LIBRARIES "${shortname}.dll.a" HINTS ${FFMPEG_PARENT})
FILE(GLOB_RECURSE ${varname}_LIBRARIES "${FFMPEG_PARENT}/*${shortname}.lib")
# GLOBing is very bad... but windows sux, this is the only thing that works
ENDIF()
IF(${varname}_LIBRARIES STREQUAL "${varname}_LIBRARIES-NOTFOUND")
MESSAGE(STATUS "look for newer structure for library")
FIND_LIBRARY(${varname}_LIBRARIES NAMES lib${shortname}
HINTS ${PC_${varname}_LIBDIR} ${PC_${varname}_LIBRARY_DIR} ${FFMPEG_PARENT})
ENDIF()
IF(${varname}_LIBRARIES STREQUAL "${varname}_LIBRARIES-NOTFOUND")
MESSAGE(STATUS "Can't find lib for ${shortname}...")
ELSE()
MESSAGE(STATUS "Found ${shortname} libs: ${${varname}_LIBRARIES}")
ENDIF()
IF(NOT ${varname}_INCLUDE_DIR STREQUAL "${varname}_INCLUDE_DIR-NOTFOUND"
AND NOT ${varname}_LIBRARIES STREQUAL ${varname}_LIBRARIES-NOTFOUND)
MESSAGE(STATUS "found ${shortname}: include ${${varname}_INCLUDE_DIR} lib ${${varname}_LIBRARIES}")
SET(FFMPEG_${varname}_FOUND 1)
SET(FFMPEG_${varname}_INCLUDE_DIRS ${${varname}_INCLUDE_DIR})
SET(FFMPEG_${varname}_LIBS ${${varname}_LIBRARIES})
ELSE()
MESSAGE(STATUS "Can't find ${shortname}")
ENDIF()
ENDIF()
ENDMACRO(FFMPEG_FIND)
FFMPEG_FIND(LIBAVFORMAT avformat avformat.h)
FFMPEG_FIND(LIBAVCODEC avcodec avcodec.h)
FFMPEG_FIND(LIBAVUTIL avutil avutil.h)
FFMPEG_FIND(LIBSWRESAMPLE swresample swresample.h)
SET(FFMPEG_FOUND "NO")
IF (FFMPEG_LIBAVFORMAT_FOUND AND
FFMPEG_LIBAVCODEC_FOUND AND
FFMPEG_LIBAVUTIL_FOUND AND
FFMPEG_LIBSWRESAMPLE_FOUND
)
SET(FFMPEG_FOUND "YES")
SET(FFMPEG_INCLUDE_DIRS ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS})
SET(FFMPEG_LIBRARY_DIRS ${FFMPEG_LIBAVFORMAT_LIBRARY_DIRS})
SET(FFMPEG_LIBRARIES
${FFMPEG_LIBAVFORMAT_LIBS}
${FFMPEG_LIBAVCODEC_LIBS}
${FFMPEG_LIBAVUTIL_LIBS}
${FFMPEG_LIBSWRESAMPLE_LIBS}
)
ELSE ()
MESSAGE(STATUS "Could not find FFMPEG")
ENDIF()
message(STATUS ${FFMPEG_LIBRARIES} ${FFMPEG_LIBAVFORMAT_LIBRARIES})
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set FFMPEG_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(FFMPEG DEFAULT_MSG
FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIRS)
mark_as_advanced(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARY_DIRS FFMPEG_LIBRARIES)

88
cmake/FindGDK3.cmake Normal file
View File

@ -0,0 +1,88 @@
# FindGDK3.cmake
# <https://github.com/nemequ/gnome-cmake>
#
# CMake support for GDK 3.
#
# License:
#
# Copyright (c) 2016 Evan Nemerson <evan@nemerson.com>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use, copy,
# modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
find_package(PkgConfig)
set(GDK3_DEPS
Pango)
if(PKG_CONFIG_FOUND)
pkg_search_module(GDK3_PKG gdk-3.0)
endif()
find_library(GDK3_LIBRARY gdk-3 HINTS ${GDK3_PKG_LIBRARY_DIRS})
set(GDK3 "gdk-3")
if(GDK3_LIBRARY)
add_library(${GDK3} SHARED IMPORTED)
set_property(TARGET ${GDK3} PROPERTY IMPORTED_LOCATION "${GDK3_LIBRARY}")
set_property(TARGET ${GDK3} PROPERTY INTERFACE_COMPILE_OPTIONS "${GDK3_PKG_CFLAGS_OTHER}")
set(GDK3_INCLUDE_DIRS)
find_path(GDK3_INCLUDE_DIR "gdk/gdk.h"
HINTS ${GDK3_PKG_INCLUDE_DIRS})
if(GDK3_INCLUDE_DIR)
file(STRINGS "${GDK3_INCLUDE_DIR}/gdk/gdkversionmacros.h" GDK3_MAJOR_VERSION REGEX "^#define GDK_MAJOR_VERSION +\\(?([0-9]+)\\)?$")
string(REGEX REPLACE "^#define GDK_MAJOR_VERSION \\(?([0-9]+)\\)?$" "\\1" GDK3_MAJOR_VERSION "${GDK3_MAJOR_VERSION}")
file(STRINGS "${GDK3_INCLUDE_DIR}/gdk/gdkversionmacros.h" GDK3_MINOR_VERSION REGEX "^#define GDK_MINOR_VERSION +\\(?([0-9]+)\\)?$")
string(REGEX REPLACE "^#define GDK_MINOR_VERSION \\(?([0-9]+)\\)?$" "\\1" GDK3_MINOR_VERSION "${GDK3_MINOR_VERSION}")
file(STRINGS "${GDK3_INCLUDE_DIR}/gdk/gdkversionmacros.h" GDK3_MICRO_VERSION REGEX "^#define GDK_MICRO_VERSION +\\(?([0-9]+)\\)?$")
string(REGEX REPLACE "^#define GDK_MICRO_VERSION \\(?([0-9]+)\\)?$" "\\1" GDK3_MICRO_VERSION "${GDK3_MICRO_VERSION}")
set(GDK3_VERSION "${GDK3_MAJOR_VERSION}.${GDK3_MINOR_VERSION}.${GDK3_MICRO_VERSION}")
unset(GDK3_MAJOR_VERSION)
unset(GDK3_MINOR_VERSION)
unset(GDK3_MICRO_VERSION)
list(APPEND GDK3_INCLUDE_DIRS ${GDK3_INCLUDE_DIR})
set_property(TARGET ${GDK3} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GDK3_INCLUDE_DIR}")
endif()
endif()
set(GDK3_DEPS_FOUND_VARS)
foreach(gdk3_dep ${GDK3_DEPS})
find_package(${gdk3_dep})
list(APPEND GDK3_DEPS_FOUND_VARS "${gdk3_dep}_FOUND")
list(APPEND GDK3_INCLUDE_DIRS ${${gdk3_dep}_INCLUDE_DIRS})
set_property (TARGET ${GDK3} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${${gdk3_dep}}")
endforeach(gdk3_dep)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GDK3
REQUIRED_VARS
GDK3_LIBRARY
GDK3_INCLUDE_DIRS
${GDK3_DEPS_FOUND_VARS}
VERSION_VAR
GDK3_VERSION)
unset(GDK3_DEPS_FOUND_VARS)

80
cmake/FindGDKPixbuf.cmake Normal file
View File

@ -0,0 +1,80 @@
# FindGDKPixbuf.cmake
# <https://github.com/nemequ/gnome-cmake>
#
# CMake support for GDK Pixbuf.
#
# License:
#
# Copyright (c) 2016 Evan Nemerson <evan@nemerson.com>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use, copy,
# modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
find_package(PkgConfig)
set(GDKPixbuf_DEPS
GLib)
if(PKG_CONFIG_FOUND)
pkg_search_module(GDKPixbuf_PKG gdk-pixbuf-2.0)
endif()
find_library(GDKPixbuf_LIBRARY gdk_pixbuf-2.0 HINTS ${GDKPixbuf_PKG_LIBRARY_DIRS})
set(GDKPixbuf "gdk_pixbuf-2.0")
if(GDKPixbuf_LIBRARY)
add_library(${GDKPixbuf} SHARED IMPORTED)
set_property(TARGET ${GDKPixbuf} PROPERTY IMPORTED_LOCATION "${GDKPixbuf_LIBRARY}")
set_property(TARGET ${GDKPixbuf} PROPERTY INTERFACE_COMPILE_OPTIONS "${GDKPixbuf_PKG_CFLAGS_OTHER}")
set(GDKPixbuf_INCLUDE_DIRS)
find_path(GDKPixbuf_INCLUDE_DIR "gdk-pixbuf/gdk-pixbuf.h"
HINTS ${GDKPixbuf_PKG_INCLUDE_DIRS})
if(GDKPixbuf_INCLUDE_DIR)
file(STRINGS "${GDKPixbuf_INCLUDE_DIR}/gdk-pixbuf/gdk-pixbuf-features.h" GDKPixbuf_VERSION REGEX "^#define GDKPIXBUF_VERSION \\\"[^\\\"]+\\\"")
string(REGEX REPLACE "^#define GDKPIXBUF_VERSION \\\"([0-9]+)\\.([0-9]+)\\.([0-9]+)\\\"$" "\\1.\\2.\\3" GDKPixbuf_VERSION "${GDKPixbuf_VERSION}")
list(APPEND GDKPixbuf_INCLUDE_DIRS ${GDKPixbuf_INCLUDE_DIR})
set_property(TARGET ${GDKPixbuf} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GDKPixbuf_INCLUDE_DIR}")
endif()
endif()
set(GDKPixbuf_DEPS_FOUND_VARS)
foreach(gdkpixbuf_dep ${GDKPixbuf_DEPS})
find_package(${gdkpixbuf_dep})
list(APPEND GDKPixbuf_DEPS_FOUND_VARS "${gdkpixbuf_dep}_FOUND")
list(APPEND GDKPixbuf_INCLUDE_DIRS ${${gdkpixbuf_dep}_INCLUDE_DIRS})
set_property (TARGET ${GDKPixbuf} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${${gdkpixbuf_dep}}")
endforeach(gdkpixbuf_dep)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GDKPixbuf
REQUIRED_VARS
GDKPixbuf_LIBRARY
GDKPixbuf_INCLUDE_DIRS
${GDKPixbuf_DEPS_FOUND_VARS}
VERSION_VAR
GDKPixbuf_VERSION)
unset(GDKPixbuf_DEPS_FOUND_VARS)

198
cmake/FindGIO.cmake Normal file
View File

@ -0,0 +1,198 @@
# FindGIO.cmake
# <https://github.com/nemequ/gnome-cmake>
#
# CMake support for GIO.
#
# License:
#
# Copyright (c) 2016 Evan Nemerson <evan@nemerson.com>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use, copy,
# modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
find_package(PkgConfig)
set(GIO_DEPS
GObject)
if(PKG_CONFIG_FOUND)
pkg_search_module(GIO_PKG gio-2.0)
endif()
find_library(GIO_LIBRARY gio-2.0 HINTS ${GIO_PKG_LIBRARY_DIRS})
set(GIO "gio-2.0")
if(GIO_LIBRARY AND NOT GIO_FOUND)
add_library(${GIO} SHARED IMPORTED)
set_property(TARGET ${GIO} PROPERTY IMPORTED_LOCATION "${GIO_LIBRARY}")
set_property(TARGET ${GIO} PROPERTY INTERFACE_COMPILE_OPTIONS "${GIO_PKG_CFLAGS_OTHER}")
find_path(GIO_INCLUDE_DIR "gio/gio.h"
HINTS ${GIO_PKG_INCLUDE_DIRS})
find_package(GLib)
find_package(GObject)
set(GIO_VERSION "${GLib_VERSION}")
list(APPEND GIO_DEPS_FOUND_VARS "GObject_FOUND")
list(APPEND GIO_INCLUDE_DIRS ${GObject_INCLUDE_DIRS})
set_property (TARGET "${GIO}" APPEND PROPERTY INTERFACE_LINK_LIBRARIES "gobject-2.0")
set_property(TARGET ${GIO} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GIO_INCLUDE_DIR}")
endif()
find_program(GLib_COMPILE_SCHEMAS glib-compile-schemas)
if(GLib_COMPILE_SCHEMAS AND NOT GLib_FOUND)
add_executable(glib-compile-schemas IMPORTED)
set_property(TARGET glib-compile-schemas PROPERTY IMPORTED_LOCATION "${GLib_COMPILE_SCHEMAS}")
endif()
# glib_install_schemas(
# [DESTINATION directory]
# schemas)
#
# Validate and install the listed schemas.
function(glib_install_schemas)
set (options)
set (oneValueArgs DESTINATION)
set (multiValueArgs)
cmake_parse_arguments(GSCHEMA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
unset (options)
unset (oneValueArgs)
unset (multiValueArgs)
foreach(schema ${GSCHEMA_UNPARSED_ARGUMENTS})
get_filename_component(schema_name "${schema}" NAME)
string(REGEX REPLACE "^(.+)\.gschema.xml$" "\\1" schema_name "${schema_name}")
set(schema_output "${CMAKE_CURRENT_BINARY_DIR}/${schema_name}.gschema.xml.valid")
add_custom_command(
OUTPUT "${schema_output}"
COMMAND glib-compile-schemas
--strict
--dry-run
--schema-file="${schema}"
COMMAND "${CMAKE_COMMAND}" ARGS -E touch "${schema_output}"
DEPENDS "${schema}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Validating ${schema}")
add_custom_target("gsettings-schema-${schema_name}" ALL
DEPENDS "${schema_output}")
if(CMAKE_INSTALL_FULL_DATADIR)
set(SCHEMADIR "${CMAKE_INSTALL_FULL_DATADIR}/glib-2.0/schemas")
else()
set(SCHEMADIR "${CMAKE_INSTALL_PREFIX}/share/glib-2.0/schemas")
endif()
install(FILES "${schema}"
DESTINATION "${SCHEMADIR}")
install(CODE "execute_process(COMMAND \"${GLib_COMPILE_SCHEMAS}\" \"${SCHEMADIR}\")")
endforeach()
endfunction()
find_program(GLib_COMPILE_RESOURCES glib-compile-resources)
if(GLib_COMPILE_RESOURCES AND NOT GLib_FOUND)
add_executable(glib-compile-resources IMPORTED)
set_property(TARGET glib-compile-resources PROPERTY IMPORTED_LOCATION "${GLib_COMPILE_RESOURCES}")
endif()
function(glib_compile_resources SPEC_FILE)
set (options INTERNAL)
set (oneValueArgs TARGET SOURCE_DIR HEADER SOURCE C_NAME)
set (multiValueArgs)
cmake_parse_arguments(GLib_COMPILE_RESOURCES "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
unset (options)
unset (oneValueArgs)
unset (multiValueArgs)
if(NOT GLib_COMPILE_RESOURCES_SOURCE_DIR)
set(GLib_COMPILE_RESOURCES_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
set(FLAGS)
if(GLib_COMPILE_RESOURCES_INTERNAL)
list(APPEND FLAGS "--internal")
endif()
if(GLib_COMPILE_RESOURCES_C_NAME)
list(APPEND FLAGS "--c-name" "${GLib_COMPILE_RESOURCES_C_NAME}")
endif()
get_filename_component(SPEC_FILE "${SPEC_FILE}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
execute_process(
COMMAND glib-compile-resources
--generate-dependencies
--sourcedir "${GLib_COMPILE_RESOURCES_SOURCE_DIR}"
"${SPEC_FILE}"
OUTPUT_VARIABLE deps
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE "\n" ";" deps ${deps})
if(GLib_COMPILE_RESOURCES_HEADER)
get_filename_component(GLib_COMPILE_RESOURCES_HEADER "${GLib_COMPILE_RESOURCES_HEADER}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
add_custom_command(
OUTPUT "${GLib_COMPILE_RESOURCES_HEADER}"
COMMAND glib-compile-resources
--sourcedir "${GLib_COMPILE_RESOURCES_SOURCE_DIR}"
--generate-header
--target "${GLib_COMPILE_RESOURCES_HEADER}"
${FLAGS}
"${SPEC_FILE}"
DEPENDS "${SPEC_FILE}" ${deps}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
if(GLib_COMPILE_RESOURCES_SOURCE)
get_filename_component(GLib_COMPILE_RESOURCES_SOURCE "${GLib_COMPILE_RESOURCES_SOURCE}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
add_custom_command(
OUTPUT "${GLib_COMPILE_RESOURCES_SOURCE}"
COMMAND glib-compile-resources
--sourcedir "${GLib_COMPILE_RESOURCES_SOURCE_DIR}"
--generate-source
--target "${GLib_COMPILE_RESOURCES_SOURCE}"
${FLAGS}
"${SPEC_FILE}"
DEPENDS "${SPEC_FILE}" ${deps}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
endfunction()
find_program(GDBUS_CODEGEN gdbus-codegen)
if(GDBUS_CODEGEN AND NOT GLib_FOUND)
add_executable(gdbus-codegen IMPORTED)
set_property(TARGET gdbus-codegen PROPERTY IMPORTED_LOCATION "${GDBUS_CODEGEN}")
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GIO
REQUIRED_VARS
GIO_LIBRARY
GIO_INCLUDE_DIRS
${GIO_DEPS_FOUND_VARS}
VERSION_VAR
GIO_VERSION)
unset(GIO_DEPS_FOUND_VARS)

83
cmake/FindGLib.cmake Normal file
View File

@ -0,0 +1,83 @@
# FindGLib.cmake
# <https://github.com/nemequ/gnome-cmake>
#
# CMake support for GLib/GObject/GIO.
#
# License:
#
# Copyright (c) 2016 Evan Nemerson <evan@nemerson.com>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use, copy,
# modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_search_module(GLib_PKG glib-2.0)
endif()
find_library(GLib_LIBRARY glib-2.0 HINTS ${GLib_PKG_LIBRARY_DIRS})
set(GLib glib-2.0)
if(GLib_LIBRARY AND NOT GLib_FOUND)
add_library(${GLib} SHARED IMPORTED)
set_property(TARGET ${GLib} PROPERTY IMPORTED_LOCATION "${GLib_LIBRARY}")
set_property(TARGET ${GLib} PROPERTY INTERFACE_COMPILE_OPTIONS "${GLib_PKG_CFLAGS_OTHER}")
find_path(GLib_INCLUDE_DIRS "glib.h"
HINTS ${GLib_PKG_INCLUDE_DIRS}
PATH_SUFFIXES "glib-2.0")
get_filename_component(GLib_LIBDIR "${GLib}" DIRECTORY)
find_path(GLib_CONFIG_INCLUDE_DIR "glibconfig.h"
HINTS
${GLib_LIBDIR}
${GLib_PKG_INCLUDE_DIRS}
PATHS
"${CMAKE_LIBRARY_PATH}"
PATH_SUFFIXES
"glib-2.0/include"
"glib-2.0")
unset(GLib_LIBDIR)
if(GLib_CONFIG_INCLUDE_DIR)
file(STRINGS "${GLib_CONFIG_INCLUDE_DIR}/glibconfig.h" GLib_MAJOR_VERSION REGEX "^#define GLIB_MAJOR_VERSION +([0-9]+)")
string(REGEX REPLACE "^#define GLIB_MAJOR_VERSION ([0-9]+)$" "\\1" GLib_MAJOR_VERSION "${GLib_MAJOR_VERSION}")
file(STRINGS "${GLib_CONFIG_INCLUDE_DIR}/glibconfig.h" GLib_MINOR_VERSION REGEX "^#define GLIB_MINOR_VERSION +([0-9]+)")
string(REGEX REPLACE "^#define GLIB_MINOR_VERSION ([0-9]+)$" "\\1" GLib_MINOR_VERSION "${GLib_MINOR_VERSION}")
file(STRINGS "${GLib_CONFIG_INCLUDE_DIR}/glibconfig.h" GLib_MICRO_VERSION REGEX "^#define GLIB_MICRO_VERSION +([0-9]+)")
string(REGEX REPLACE "^#define GLIB_MICRO_VERSION ([0-9]+)$" "\\1" GLib_MICRO_VERSION "${GLib_MICRO_VERSION}")
set(GLib_VERSION "${GLib_MAJOR_VERSION}.${GLib_MINOR_VERSION}.${GLib_MICRO_VERSION}")
unset(GLib_MAJOR_VERSION)
unset(GLib_MINOR_VERSION)
unset(GLib_MICRO_VERSION)
list(APPEND GLib_INCLUDE_DIRS ${GLib_CONFIG_INCLUDE_DIR})
set_property(TARGET ${GLib} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GLib_INCLUDE_DIRS}")
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GLib
REQUIRED_VARS
GLib_LIBRARY
GLib_INCLUDE_DIRS
VERSION_VAR
GLib_VERSION)

81
cmake/FindGObject.cmake Normal file
View File

@ -0,0 +1,81 @@
# FindGObject.cmake
# <https://github.com/nemequ/gnome-cmake>
#
# CMake support for GObject.
#
# License:
#
# Copyright (c) 2016 Evan Nemerson <evan@nemerson.com>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use, copy,
# modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
find_package(PkgConfig)
set(GObject_DEPS
GLib)
if(PKG_CONFIG_FOUND)
pkg_search_module(GObject_PKG gobject-2.0)
endif()
find_library(GObject_LIBRARY gobject-2.0 HINTS ${GObject_PKG_LIBRARY_DIRS})
set(GObject gobject-2.0)
if(GObject_LIBRARY AND NOT GObject_FOUND)
add_library(${GObject} SHARED IMPORTED)
set_property(TARGET ${GObject} PROPERTY IMPORTED_LOCATION "${GObject_LIBRARY}")
set_property(TARGET ${GObject} PROPERTY INTERFACE_COMPILE_OPTIONS "${GObject_PKG_CFLAGS_OTHER}")
find_path(GObject_INCLUDE_DIR "gobject/gobject.h"
HINTS ${GObject_PKG_INCLUDE_DIRS})
find_package(GLib)
set(GObject_VERSION "${GLib_VERSION}")
list(APPEND GObject_DEPS_FOUND_VARS "GLib_FOUND")
list(APPEND GObject_INCLUDE_DIRS ${GLib_INCLUDE_DIRS})
set_property(TARGET ${GObject} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GObject_INCLUDE_DIR}")
set_property (TARGET "${GObject}" APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${GLib}")
endif()
find_program(GLib_GENMARSHAL glib-genmarshal)
if(GLib_GENMARSHAL AND NOT GLib_FOUND)
add_executable(glib-genmarshal IMPORTED)
set_property(TARGET glib-genmarshal PROPERTY IMPORTED_LOCATION "${GLib_GENMARSHAL}")
endif()
find_program(GLib_MKENUMS glib-mkenums)
if(GLib_MKENUMS AND NOT GLib_FOUND)
add_executable(glib-mkenums IMPORTED)
set_property(TARGET glib-mkenums PROPERTY IMPORTED_LOCATION "${GLib_MKENUMS}")
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GObject
REQUIRED_VARS
GObject_LIBRARY
GObject_INCLUDE_DIRS
${GObject_DEPS_FOUND_VARS}
VERSION_VAR
GObject_VERSION)
unset(GObject_DEPS_FOUND_VARS)

93
cmake/FindGTK3.cmake Normal file
View File

@ -0,0 +1,93 @@
# FindGTK3.cmake
# <https://github.com/nemequ/gnome-cmake>
#
# CMake support for GTK+ 3.
#
# License:
#
# Copyright (c) 2016 Evan Nemerson <evan@nemerson.com>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use, copy,
# modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
find_package(PkgConfig)
set(GTK3_DEPS
GIO
ATK
GDK3
Pango
Cairo
GDKPixbuf)
if(PKG_CONFIG_FOUND)
pkg_search_module(GTK3_PKG QUIET gtk+-3.0)
endif()
find_library(GTK3_LIBRARY gtk-3 HINTS ${GTK3_PKG_LIBRARY_DIRS})
set(GTK3 gtk-3)
if(GTK3_LIBRARY)
add_library(${GTK3} SHARED IMPORTED)
set_property(TARGET ${GTK3} PROPERTY IMPORTED_LOCATION "${GTK3_LIBRARY}")
set_property(TARGET ${GTK3} PROPERTY INTERFACE_COMPILE_OPTIONS "${GTK3_PKG_CFLAGS_OTHER}")
set(GTK3_INCLUDE_DIRS)
find_path(GTK3_INCLUDE_DIR "gtk/gtk.h"
HINTS ${GTK3_PKG_INCLUDE_DIRS})
if(GTK3_INCLUDE_DIR)
file(STRINGS "${GTK3_INCLUDE_DIR}/gtk/gtkversion.h" GTK3_MAJOR_VERSION REGEX "^#define GTK_MAJOR_VERSION +\\(?([0-9]+)\\)?$")
string(REGEX REPLACE "^#define GTK_MAJOR_VERSION \\(?([0-9]+)\\)?$" "\\1" GTK3_MAJOR_VERSION "${GTK3_MAJOR_VERSION}")
file(STRINGS "${GTK3_INCLUDE_DIR}/gtk/gtkversion.h" GTK3_MINOR_VERSION REGEX "^#define GTK_MINOR_VERSION +\\(?([0-9]+)\\)?$")
string(REGEX REPLACE "^#define GTK_MINOR_VERSION \\(?([0-9]+)\\)?$" "\\1" GTK3_MINOR_VERSION "${GTK3_MINOR_VERSION}")
file(STRINGS "${GTK3_INCLUDE_DIR}/gtk/gtkversion.h" GTK3_MICRO_VERSION REGEX "^#define GTK_MICRO_VERSION +\\(?([0-9]+)\\)?$")
string(REGEX REPLACE "^#define GTK_MICRO_VERSION \\(?([0-9]+)\\)?$" "\\1" GTK3_MICRO_VERSION "${GTK3_MICRO_VERSION}")
set(GTK3_VERSION "${GTK3_MAJOR_VERSION}.${GTK3_MINOR_VERSION}.${GTK3_MICRO_VERSION}")
unset(GTK3_MAJOR_VERSION)
unset(GTK3_MINOR_VERSION)
unset(GTK3_MICRO_VERSION)
list(APPEND GTK3_INCLUDE_DIRS ${GTK3_INCLUDE_DIR})
set_property(TARGET ${GTK3} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK3_INCLUDE_DIR}")
endif()
endif()
set(GTK3_DEPS_FOUND_VARS)
foreach(gtk3_dep ${GTK3_DEPS})
find_package(${gtk3_dep})
list(APPEND GTK3_DEPS_FOUND_VARS "${gtk3_dep}_FOUND")
list(APPEND GTK3_INCLUDE_DIRS ${${gtk3_dep}_INCLUDE_DIRS})
set_property (TARGET "${GTK3}" APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${${gtk3_dep}}")
endforeach(gtk3_dep)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GTK3
REQUIRED_VARS
GTK3_LIBRARY
GTK3_INCLUDE_DIRS
${GTK3_DEPS_FOUND_VARS}
VERSION_VAR
GTK3_VERSION)
unset(GTK3_DEPS_FOUND_VARS)

46
cmake/FindOSS.cmake Normal file
View File

@ -0,0 +1,46 @@
# - Find Oss
# Find Oss headers and libraries.
#
# OSS_INCLUDE_DIR - where to find soundcard.h, etc.
# OSS_FOUND - True if Oss found.
FIND_PATH(LINUX_OSS_INCLUDE_DIR "linux/soundcard.h"
"/usr/include" "/usr/local/include"
)
FIND_PATH(SYS_OSS_INCLUDE_DIR "sys/soundcard.h"
"/usr/include" "/usr/local/include"
)
FIND_PATH(MACHINE_OSS_INCLUDE_DIR "machine/soundcard.h"
"/usr/include" "/usr/local/include"
)
SET(OSS_FOUND FALSE)
IF(LINUX_OSS_INCLUDE_DIR)
SET(OSS_FOUND TRUE)
SET(OSS_INCLUDE_DIR ${LINUX_OSS_INCLUDE_DIR})
SET(HAVE_LINUX_SOUNDCARD_H 1)
ENDIF()
IF(SYS_OSS_INCLUDE_DIR)
SET(OSS_FOUND TRUE)
SET(OSS_INCLUDE_DIR ${SYS_OSS_INCLUDE_DIR})
SET(HAVE_SYS_SOUNDCARD_H 1)
ENDIF()
IF(MACHINE_OSS_INCLUDE_DIR)
SET(OSS_FOUND TRUE)
SET(OSS_INCLUDE_DIR ${MACHINE_OSS_INCLUDE_DIR})
SET(HAVE_MACHINE_SOUNDCARD_H 1)
ENDIF()
MARK_AS_ADVANCED (
OSS_FOUND
OSS_INCLUDE_DIR
LINUX_OSS_INCLUDE_DIR
SYS_OSS_INCLUDE_DIR
MACHINE_OSS_INCLUDE_DIR
)

86
cmake/FindPango.cmake Normal file
View File

@ -0,0 +1,86 @@
# FindPango.cmake
# <https://github.com/nemequ/gnome-cmake>
#
# CMake support for Pango.
#
# License:
#
# Copyright (c) 2016 Evan Nemerson <evan@nemerson.com>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use, copy,
# modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
find_package(PkgConfig)
set(Pango_DEPS
GLib)
if(PKG_CONFIG_FOUND)
pkg_search_module(Pango_PKG pango)
endif()
find_library(Pango_LIBRARY pango-1.0 HINTS ${Pango_PKG_LIBRARY_DIRS})
set(Pango pango-1.0)
if(Pango_LIBRARY AND NOT Pango_FOUND)
add_library(${Pango} SHARED IMPORTED)
set_property(TARGET ${Pango} PROPERTY IMPORTED_LOCATION "${Pango_LIBRARY}")
set_property(TARGET ${Pango} PROPERTY INTERFACE_COMPILE_OPTIONS "${Pango_PKG_CFLAGS_OTHER}")
find_path(Pango_INCLUDE_DIR "pango/pango.h"
HINTS ${Pango_PKG_INCLUDE_DIRS})
if(Pango_INCLUDE_DIR)
file(STRINGS "${Pango_INCLUDE_DIR}/pango/pango-features.h" Pango_MAJOR_VERSION REGEX "^#define PANGO_VERSION_MAJOR +\\(?([0-9]+)\\)?$")
string(REGEX REPLACE "^#define PANGO_VERSION_MAJOR \\(?([0-9]+)\\)?" "\\1" Pango_MAJOR_VERSION "${Pango_MAJOR_VERSION}")
file(STRINGS "${Pango_INCLUDE_DIR}/pango/pango-features.h" Pango_MINOR_VERSION REGEX "^#define PANGO_VERSION_MINOR +\\(?([0-9]+)\\)?$")
string(REGEX REPLACE "^#define PANGO_VERSION_MINOR \\(?([0-9]+)\\)?" "\\1" Pango_MINOR_VERSION "${Pango_MINOR_VERSION}")
file(STRINGS "${Pango_INCLUDE_DIR}/pango/pango-features.h" Pango_MICRO_VERSION REGEX "^#define PANGO_VERSION_MICRO +\\(?([0-9]+)\\)?$")
string(REGEX REPLACE "^#define PANGO_VERSION_MICRO \\(?([0-9]+)\\)?" "\\1" Pango_MICRO_VERSION "${Pango_MICRO_VERSION}")
set(Pango_VERSION "${Pango_MAJOR_VERSION}.${Pango_MINOR_VERSION}.${Pango_MICRO_VERSION}")
unset(Pango_MAJOR_VERSION)
unset(Pango_MINOR_VERSION)
unset(Pango_MICRO_VERSION)
list(APPEND Pango_INCLUDE_DIRS ${Pango_INCLUDE_DIR})
set_property(TARGET ${Pango} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${Pango_INCLUDE_DIR}")
endif()
endif()
set(Pango_DEPS_FOUND_VARS)
foreach(pango_dep ${Pango_DEPS})
find_package(${pango_dep})
list(APPEND Pango_DEPS_FOUND_VARS "${pango_dep}_FOUND")
list(APPEND Pango_INCLUDE_DIRS ${${pango_dep}_INCLUDE_DIRS})
set_property (TARGET "${Pango}" APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${${pango_dep}}")
endforeach(pango_dep)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Pango
REQUIRED_VARS
Pango_LIBRARY
Pango_INCLUDE_DIRS
${Pango_DEPS_FOUND_VARS}
VERSION_VAR
Pango_VERSION)
unset(Pango_DEPS_FOUND_VARS)

183
cmake/FindSDL2.cmake Normal file
View File

@ -0,0 +1,183 @@
# Locate SDL2 library
# This module defines
# SDL2_LIBRARY, the name of the library to link against
# SDL2_FOUND, if false, do not try to link to SDL2
# SDL2_INCLUDE_DIR, where to find SDL.h
#
# This module responds to the the flag:
# SDL2_BUILDING_LIBRARY
# If this is defined, then no SDL2_main will be linked in because
# only applications need main().
# Otherwise, it is assumed you are building an application and this
# module will attempt to locate and set the the proper link flags
# as part of the returned SDL2_LIBRARY variable.
#
# Don't forget to include SDL2main.h and SDL2main.m your project for the
# OS X framework based version. (Other versions link to -lSDL2main which
# this module will try to find on your behalf.) Also for OS X, this
# module will automatically add the -framework Cocoa on your behalf.
#
#
# Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your configuration
# and no SDL2_LIBRARY, it means CMake did not find your SDL2 library
# (SDL2.dll, libsdl2.so, SDL2.framework, etc).
# Set SDL2_LIBRARY_TEMP to point to your SDL2 library, and configure again.
# Similarly, if you see an empty SDL2MAIN_LIBRARY, you should set this value
# as appropriate. These values are used to generate the final SDL2_LIBRARY
# variable, but when these values are unset, SDL2_LIBRARY does not get created.
#
#
# $SDL2DIR is an environment variable that would
# correspond to the ./configure --prefix=$SDL2DIR
# used in building SDL2.
# l.e.galup 9-20-02
#
# Modified by Eric Wing.
# Added code to assist with automated building by using environmental variables
# and providing a more controlled/consistent search behavior.
# Added new modifications to recognize OS X frameworks and
# additional Unix paths (FreeBSD, etc).
# Also corrected the header search path to follow "proper" SDL2 guidelines.
# Added a search for SDL2main which is needed by some platforms.
# Added a search for threads which is needed by some platforms.
# Added needed compile switches for MinGW.
#
# On OSX, this will prefer the Framework version (if found) over others.
# People will have to manually change the cache values of
# SDL2_LIBRARY to override this selection or set the CMake environment
# CMAKE_INCLUDE_PATH to modify the search paths.
#
# Note that the header path has changed from SDL2/SDL.h to just SDL.h
# This needed to change because "proper" SDL2 convention
# is #include "SDL.h", not <SDL2/SDL.h>. This is done for portability
# reasons because not all systems place things in SDL2/ (see FreeBSD).
#
# Ported by Johnny Patterson. This is a literal port for SDL2 of the FindSDL.cmake
# module with the minor edit of changing "SDL" to "SDL2" where necessary. This
# was not created for redistribution, and exists temporarily pending official
# SDL2 CMake modules.
#=============================================================================
# Copyright 2003-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
FIND_PATH(SDL2_INCLUDE_DIR SDL.h
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES include/SDL2 include
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local/include/SDL2
/usr/include/SDL2
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
${PROJECT_ROOT_DIR}/ext/SDL2
)
#MESSAGE("SDL2_INCLUDE_DIR is ${SDL2_INCLUDE_DIR}")
FIND_LIBRARY(SDL2_LIBRARY_TEMP
NAMES SDL2
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES lib64 lib
PATHS
/sw
/opt/local
/opt/csw
/opt
${PROJECT_ROOT_DIR}/ext/SDL2
)
#MESSAGE("SDL2_LIBRARY_TEMP is ${SDL2_LIBRARY_TEMP}")
IF(NOT SDL2_BUILDING_LIBRARY)
IF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
# Non-OS X framework versions expect you to also dynamically link to
# SDL2main. This is mainly for Windows and OS X. Other (Unix) platforms
# seem to provide SDL2main for compatibility even though they don't
# necessarily need it.
FIND_LIBRARY(SDL2MAIN_LIBRARY
NAMES SDL2main
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES lib64 lib
PATHS
/sw
/opt/local
/opt/csw
/opt
${PROJECT_ROOT_DIR}/ext/SDL2
)
ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
ENDIF(NOT SDL2_BUILDING_LIBRARY)
# SDL2 may require threads on your system.
# The Apple build may not need an explicit flag because one of the
# frameworks may already provide it.
# But for non-OSX systems, I will use the CMake Threads package.
IF(NOT APPLE)
FIND_PACKAGE(Threads)
ENDIF(NOT APPLE)
# MinGW needs an additional library, mwindows
# It's total link flags should look like -lmingw32 -lSDL2main -lSDL2 -lmwindows
# (Actually on second look, I think it only needs one of the m* libraries.)
IF(MINGW)
SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW")
ENDIF(MINGW)
SET(SDL2_FOUND "NO")
IF(SDL2_LIBRARY_TEMP)
# For SDL2main
IF(NOT SDL2_BUILDING_LIBRARY)
IF(SDL2MAIN_LIBRARY)
SET(SDL2_LIBRARY_TEMP ${SDL2MAIN_LIBRARY} ${SDL2_LIBRARY_TEMP})
ENDIF(SDL2MAIN_LIBRARY)
ENDIF(NOT SDL2_BUILDING_LIBRARY)
# For OS X, SDL2 uses Cocoa as a backend so it must link to Cocoa.
# CMake doesn't display the -framework Cocoa string in the UI even
# though it actually is there if I modify a pre-used variable.
# I think it has something to do with the CACHE STRING.
# So I use a temporary variable until the end so I can set the
# "real" variable in one-shot.
IF(APPLE)
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa")
ENDIF(APPLE)
# For threads, as mentioned Apple doesn't need this.
# In fact, there seems to be a problem if I used the Threads package
# and try using this line, so I'm just skipping it entirely for OS X.
IF(NOT APPLE)
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
ENDIF(NOT APPLE)
# For MinGW library
IF(MINGW)
SET(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP})
ENDIF(MINGW)
# Set the final string here so the GUI reflects the final state.
SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found")
# Set the temp variable to INTERNAL so it is not seen in the CMake GUI
SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "")
SET(SDL2_FOUND "YES")
ENDIF(SDL2_LIBRARY_TEMP)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2
REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR)

143
cmake/Gettext.cmake Normal file
View File

@ -0,0 +1,143 @@
# Gettext support: Create/Update pot file and
#
# To use: INCLUDE(Gettext)
#
# Most of the gettext support code is from FindGettext.cmake of cmake,
# but it is included here because:
#
# 1. Some system like RHEL5 does not have FindGettext.cmake
# 2. Bug of GETTEXT_CREATE_TRANSLATIONS make it unable to be include in 'All'
# 3. It does not support xgettext
#
#===================================================================
# Variables:
# XGETTEXT_OPTIONS: Options pass to xgettext
# Default: --language=C --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2
# GETTEXT_MSGMERGE_EXECUTABLE: the full path to the msgmerge tool.
# GETTEXT_MSGFMT_EXECUTABLE: the full path to the msgfmt tool.
# GETTEXT_FOUND: True if gettext has been found.
# XGETTEXT_EXECUTABLE: the full path to the xgettext.
# XGETTEXT_FOUND: True if xgettext has been found.
#
#===================================================================
# Macros:
# GETTEXT_CREATE_POT(potFile
# [OPTION xgettext_options]
# SRC list_of_source_file_that_contains_msgid
# )
#
# Generate .pot file.
# OPTION xgettext_options: Override XGETTEXT_OPTIONS
#
# * Produced targets: pot_file
#
#-------------------------------------------------------------------
# GETTEXT_CREATE_TRANSLATIONS ( outputFile [ALL] locale1 ... localeN
# [COMMENT comment] )
#
# This will create a target "translations" which will convert the
# given input po files into the binary output mo file. If the
# ALL option is used, the translations will also be created when
# building the default target.
#
# * Produced targets: translations
#-------------------------------------------------------------------
FIND_PROGRAM(GETTEXT_MSGMERGE_EXECUTABLE msgmerge)
FIND_PROGRAM(GETTEXT_MSGFMT_EXECUTABLE msgfmt)
FIND_PROGRAM(XGETTEXT_EXECUTABLE xgettext)
IF (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE )
SET(GETTEXT_FOUND TRUE)
ELSE (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE)
SET(GETTEXT_FOUND FALSE)
IF (GetText_REQUIRED)
MESSAGE(FATAL_ERROR "GetText not found")
ENDIF (GetText_REQUIRED)
ENDIF (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE )
IF(XGETTEXT_EXECUTABLE)
SET(XGETTEXT_FOUND TRUE)
ELSE(XGETTEXT_EXECUTABLE)
MESSAGE(STATUS "xgettext not found.")
SET(XGETTTEXT_FOUND FALSE)
ENDIF(XGETTEXT_EXECUTABLE)
IF(NOT DEFINED XGETTEXT_OPTIONS)
SET(XGETTEXT_OPTIONS --language=C --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 -s)
ENDIF(NOT DEFINED XGETTEXT_OPTIONS)
IF(XGETTEXT_FOUND)
MACRO(GETTEXT_CREATE_POT _potFile _pot_options )
SET(_xgettext_options_list)
SET(_src_list)
SET(_src_list_abs)
SET(_stage "SRC")
FOREACH(_pot_option ${_pot_options} ${ARGN})
IF(_pot_option STREQUAL "OPTION")
SET(_stage "OPTION")
ELSEIF(_pot_option STREQUAL "SRC")
SET(_stage "SRC")
ELSE(_pot_option STREQUAL "OPTION")
IF(_stage STREQUAL "OPTION")
SET(_xgettext_options_list ${_xgettext_options_list} ${_pot_option})
ELSE(_stage STREQUAL "OPTION")
FILE(RELATIVE_PATH _relFile ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${_pot_option})
GET_FILENAME_COMPONENT(_absFile ${_pot_option} ABSOLUTE)
SET(_src_list ${_src_list} ${_relFile})
SET(_src_list_abs ${_src_list_abs} ${_absFile})
ENDIF(_stage STREQUAL "OPTION")
ENDIF(_pot_option STREQUAL "OPTION")
ENDFOREACH(_pot_option ${_pot_options} ${ARGN})
IF (_xgettext_options_list)
SET(_xgettext_options ${_xgettext_options_list})
ELSE(_xgettext_options_list)
SET(_xgettext_options ${XGETTEXT_OPTIONS})
ENDIF(_xgettext_options_list)
#MESSAGE("${XGETTEXT_EXECUTABLE} ${_xgettext_options_list} -o ${_potFile} ${_src_list}")
ADD_CUSTOM_COMMAND(OUTPUT ${_potFile}
COMMAND ${XGETTEXT_EXECUTABLE} ${_xgettext_options} -o ${_potFile} ${_src_list}
DEPENDS ${_src_list_abs}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
ADD_CUSTOM_TARGET(pot_file
COMMAND ${XGETTEXT_EXECUTABLE} ${_xgettext_options_list} -o ${_potFile} ${_src_list}
DEPENDS ${_src_list_abs}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Extract translatable messages to ${_potFile}"
)
ENDMACRO(GETTEXT_CREATE_POT _potFile _pot_options)
MACRO(GETTEXT_CREATE_TRANSLATIONS _potFile _firstLang)
SET(_gmoFiles)
GET_FILENAME_COMPONENT(_potBasename ${_potFile} NAME_WE)
GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE)
SET(_addToAll)
SET(_is_comment FALSE)
FOREACH (_currentLang ${_firstLang} ${ARGN})
IF(_currentLang STREQUAL "ALL")
SET(_addToAll "ALL")
ELSEIF(_currentLang STREQUAL "COMMENT")
SET(_is_comment TRUE)
ELSEIF(_is_comment)
SET(_is_comment FALSE)
SET(_comment ${_currentLang})
ELSE()
SET(_lang ${_currentLang})
GET_FILENAME_COMPONENT(_absFile ${_currentLang}.po ABSOLUTE)
GET_FILENAME_COMPONENT(_abs_PATH ${_absFile} PATH)
SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
#MESSAGE("_absFile=${_absFile} _abs_PATH=${_abs_PATH} _lang=${_lang} curr_bin=${CMAKE_CURRENT_BINARY_DIR}")
ADD_CUSTOM_COMMAND(
OUTPUT ${_gmoFile}
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_absFile} ${_absPotFile}
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile}
DEPENDS ${_absPotFile} ${_absFile}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
INSTALL(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
SET(_gmoFiles ${_gmoFiles} ${_gmoFile})
ENDIF()
ENDFOREACH (_currentLang )
IF(DEFINED _comment)
ADD_CUSTOM_TARGET(translations ${_addToAll} DEPENDS ${_gmoFiles} COMMENT ${_comment})
ELSE(DEFINED _comment)
ADD_CUSTOM_TARGET(translations ${_addToAll} DEPENDS ${_gmoFiles})
ENDIF(DEFINED _comment)
ENDMACRO(GETTEXT_CREATE_TRANSLATIONS )
ENDIF(XGETTEXT_FOUND)

View File

@ -0,0 +1,57 @@
# This file is used to be invoked at build time. It generates the needed
# resource XML file.
# Input variables that need to provided when invoking this script:
# GXML_OUTPUT The output file path where to save the XML file.
# GXML_COMPRESS_ALL Sets all COMPRESS flags in all resources in resource
# list.
# GXML_NO_COMPRESS_ALL Removes all COMPRESS flags in all resources in
# resource list.
# GXML_STRIPBLANKS_ALL Sets all STRIPBLANKS flags in all resources in
# resource list.
# GXML_NO_STRIPBLANKS_ALL Removes all STRIPBLANKS flags in all resources in
# resource list.
# GXML_TOPIXDATA_ALL Sets all TOPIXDATA flags i nall resources in resource
# list.
# GXML_NO_TOPIXDATA_ALL Removes all TOPIXDATA flags in all resources in
# resource list.
# GXML_PREFIX Overrides the resource prefix that is prepended to
# each relative name in registered resources.
# GXML_RESOURCES The list of resource files. Whether absolute or
# relative path is equal.
# Include the GENERATE_GXML() function.
include(${CMAKE_CURRENT_LIST_DIR}/GenerateGXML.cmake)
# Set flags to actual invocation flags.
if(GXML_COMPRESS_ALL)
set(GXML_COMPRESS_ALL COMPRESS_ALL)
endif()
if(GXML_NO_COMPRESS_ALL)
set(GXML_NO_COMPRESS_ALL NO_COMPRESS_ALL)
endif()
if(GXML_STRIPBLANKS_ALL)
set(GXML_STRIPBLANKS_ALL STRIPBLANKS_ALL)
endif()
if(GXML_NO_STRIPBLANKS_ALL)
set(GXML_NO_STRIPBLANKS_ALL NO_STRIPBLANKS_ALL)
endif()
if(GXML_TOPIXDATA_ALL)
set(GXML_TOPIXDATA_ALL TOPIXDATA_ALL)
endif()
if(GXML_NO_TOPIXDATA_ALL)
set(GXML_NO_TOPIXDATA_ALL NO_TOPIXDATA_ALL)
endif()
# Replace " " with ";" to import the list over the command line. Otherwise
# CMake would interprete the passed resources as a whole string.
string(REPLACE " " ";" GXML_RESOURCES ${GXML_RESOURCES})
# Invoke the gresource XML generation function.
generate_gxml(${GXML_OUTPUT}
${GXML_COMPRESS_ALL} ${GXML_NO_COMPRESS_ALL}
${GXML_STRIPBLANKS_ALL} ${GXML_NO_STRIPBLANKS_ALL}
${GXML_TOPIXDATA_ALL} ${GXML_NO_TOPIXDATA_ALL}
PREFIX ${GXML_PREFIX}
RESOURCES ${GXML_RESOURCES})

View File

@ -0,0 +1,231 @@
include(CMakeParseArguments)
# Path to this file.
set(GCR_CMAKE_MACRO_DIR ${CMAKE_CURRENT_LIST_DIR})
# Compiles a gresource resource file from given resource files. Automatically
# creates the XML controlling file.
# The type of resource to generate (header, c-file or bundle) is automatically
# determined from TARGET file ending, if no TYPE is explicitly specified.
# The output file is stored in the provided variable "output".
# "xml_out" contains the variable where to output the XML path. Can be used to
# create custom targets or doing postprocessing.
# If you want to use preprocessing, you need to manually check the existence
# of the tools you use. This function doesn't check this for you, it just
# generates the XML file. glib-compile-resources will then throw a
# warning/error.
function(COMPILE_GRESOURCES output xml_out)
# Available options:
# COMPRESS_ALL, NO_COMPRESS_ALL Overrides the COMPRESS flag in all
# registered resources.
# STRIPBLANKS_ALL, NO_STRIPBLANKS_ALL Overrides the STRIPBLANKS flag in all
# registered resources.
# TOPIXDATA_ALL, NO_TOPIXDATA_ALL Overrides the TOPIXDATA flag in all
# registered resources.
set(CG_OPTIONS COMPRESS_ALL NO_COMPRESS_ALL
STRIPBLANKS_ALL NO_STRIPBLANKS_ALL
TOPIXDATA_ALL NO_TOPIXDATA_ALL)
# Available one value options:
# TYPE Type of resource to create. Valid options are:
# EMBED_C: A C-file that can be compiled with your project.
# EMBED_H: A header that can be included into your project.
# BUNDLE: Generates a resource bundle file that can be loaded
# at runtime.
# AUTO: Determine from target file ending. Need to specify
# target argument.
# PREFIX Overrides the resource prefix that is prepended to each
# relative file name in registered resources.
# SOURCE_DIR Overrides the resources base directory to search for resources.
# Normally this is set to the source directory with that CMake
# was invoked (CMAKE_CURRENT_SOURCE_DIR).
# TARGET Overrides the name of the output file/-s. Normally the output
# names from glib-compile-resources tool is taken.
set(CG_ONEVALUEARGS TYPE PREFIX SOURCE_DIR TARGET)
# Available multi-value options:
# RESOURCES The list of resource files. Whether absolute or relative path is
# equal, absolute paths are stripped down to relative ones. If the
# absolute path is not inside the given base directory SOURCE_DIR
# or CMAKE_CURRENT_SOURCE_DIR (if SOURCE_DIR is not overriden),
# this function aborts.
# OPTIONS Extra command line options passed to glib-compile-resources.
set(CG_MULTIVALUEARGS RESOURCES OPTIONS)
# Parse the arguments.
cmake_parse_arguments(CG_ARG
"${CG_OPTIONS}"
"${CG_ONEVALUEARGS}"
"${CG_MULTIVALUEARGS}"
"${ARGN}")
# Variable to store the double-quote (") string. Since escaping
# double-quotes in strings is not possible we need a helper variable that
# does this job for us.
set(Q \")
# Check invocation validity with the <prefix>_UNPARSED_ARGUMENTS variable.
# If other not recognized parameters were passed, throw error.
if (CG_ARG_UNPARSED_ARGUMENTS)
set(CG_WARNMSG "Invocation of COMPILE_GRESOURCES with unrecognized")
set(CG_WARNMSG "${CG_WARNMSG} parameters. Parameters are:")
set(CG_WARNMSG "${CG_WARNMSG} ${CG_ARG_UNPARSED_ARGUMENTS}.")
message(WARNING ${CG_WARNMSG})
endif()
# Check invocation validity depending on generation mode (EMBED_C, EMBED_H
# or BUNDLE).
if ("${CG_ARG_TYPE}" STREQUAL "EMBED_C")
# EMBED_C mode, output compilable C-file.
set(CG_GENERATE_COMMAND_LINE "--generate-source")
set(CG_TARGET_FILE_ENDING "c")
elseif ("${CG_ARG_TYPE}" STREQUAL "EMBED_H")
# EMBED_H mode, output includable header file.
set(CG_GENERATE_COMMAND_LINE "--generate-header")
set(CG_TARGET_FILE_ENDING "h")
elseif ("${CG_ARG_TYPE}" STREQUAL "BUNDLE")
# BUNDLE mode, output resource bundle. Don't do anything since
# glib-compile-resources outputs a bundle when not specifying
# something else.
set(CG_TARGET_FILE_ENDING "gresource")
else()
# Everything else is AUTO mode, determine from target file ending.
if (CG_ARG_TARGET)
set(CG_GENERATE_COMMAND_LINE "--generate")
else()
set(CG_ERRMSG "AUTO mode given, but no target specified. Can't")
set(CG_ERRMSG "${CG_ERRMSG} determine output type. In function")
set(CG_ERRMSG "${CG_ERRMSG} COMPILE_GRESOURCES.")
message(FATAL_ERROR ${CG_ERRMSG})
endif()
endif()
# Check flag validity.
if (CG_ARG_COMPRESS_ALL AND CG_ARG_NO_COMPRESS_ALL)
set(CG_ERRMSG "COMPRESS_ALL and NO_COMPRESS_ALL simultaneously set. In")
set(CG_ERRMSG "${CG_ERRMSG} function COMPILE_GRESOURCES.")
message(FATAL_ERROR ${CG_ERRMSG})
endif()
if (CG_ARG_STRIPBLANKS_ALL AND CG_ARG_NO_STRIPBLANKS_ALL)
set(CG_ERRMSG "STRIPBLANKS_ALL and NO_STRIPBLANKS_ALL simultaneously")
set(CG_ERRMSG "${CG_ERRMSG} set. In function COMPILE_GRESOURCES.")
message(FATAL_ERROR ${CG_ERRMSG})
endif()
if (CG_ARG_TOPIXDATA_ALL AND CG_ARG_NO_TOPIXDATA_ALL)
set(CG_ERRMSG "TOPIXDATA_ALL and NO_TOPIXDATA_ALL simultaneously set.")
set(CG_ERRMSG "${CG_ERRMSG} In function COMPILE_GRESOURCES.")
message(FATAL_ERROR ${CG_ERRMSG})
endif()
# Check if there are any resources.
if (NOT CG_ARG_RESOURCES)
set(CG_ERRMSG "No resource files to process. In function")
set(CG_ERRMSG "${CG_ERRMSG} COMPILE_GRESOURCES.")
message(FATAL_ERROR ${CG_ERRMSG})
endif()
# Extract all dependencies for targets from resource list.
foreach(res ${CG_ARG_RESOURCES})
if (NOT(("${res}" STREQUAL "COMPRESS") OR
("${res}" STREQUAL "STRIPBLANKS") OR
("${res}" STREQUAL "TOPIXDATA")))
list(APPEND CG_RESOURCES_DEPENDENCIES "${res}")
endif()
endforeach()
# Create source directory automatically if not set.
if (NOT CG_ARG_SOURCE_DIR)
set(CG_ARG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
# Replace paths
foreach(res ${CG_ARG_RESOURCES})
if (NOT(("${res}" STREQUAL "COMPRESS") OR
("${res}" STREQUAL "STRIPBLANKS") OR
("${res}" STREQUAL "TOPIXDATA")))
string(REPLACE "${CG_ARG_SOURCE_DIR}/" "" RES_FILTERED "${res}")
list(APPEND CG_RESOURCES_FILTERED "${RES_FILTERED}")
else()
list(APPEND CG_RESOURCES_FILTERED "${res}")
endif()
endforeach()
# Construct .gresource.xml path.
set(CG_XML_FILE_PATH "${CMAKE_CURRENT_BINARY_DIR}/.gresource.xml")
# Generate gresources XML target.
list(APPEND CG_CMAKE_SCRIPT_ARGS "-D")
list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_OUTPUT=${Q}${CG_XML_FILE_PATH}${Q}")
if(CG_ARG_COMPRESS_ALL)
list(APPEND CG_CMAKE_SCRIPT_ARGS "-D")
list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_COMPRESS_ALL")
endif()
if(CG_ARG_NO_COMPRESS_ALL)
list(APPEND CG_CMAKE_SCRIPT_ARGS "-D")
list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_NO_COMPRESS_ALL")
endif()
if(CG_ARG_STRPIBLANKS_ALL)
list(APPEND CG_CMAKE_SCRIPT_ARGS "-D")
list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_STRIPBLANKS_ALL")
endif()
if(CG_ARG_NO_STRIPBLANKS_ALL)
list(APPEND CG_CMAKE_SCRIPT_ARGS "-D")
list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_NO_STRIPBLANKS_ALL")
endif()
if(CG_ARG_TOPIXDATA_ALL)
list(APPEND CG_CMAKE_SCRIPT_ARGS "-D")
list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_TOPIXDATA_ALL")
endif()
if(CG_ARG_NO_TOPIXDATA_ALL)
list(APPEND CG_CMAKE_SCRIPT_ARGS "-D")
list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_NO_TOPIXDATA_ALL")
endif()
list(APPEND CG_CMAKE_SCRIPT_ARGS "-D")
list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_PREFIX=${Q}${CG_ARG_PREFIX}${Q}")
list(APPEND CG_CMAKE_SCRIPT_ARGS "-D")
list(APPEND CG_CMAKE_SCRIPT_ARGS
"GXML_RESOURCES=${Q}${CG_RESOURCES_FILTERED}${Q}")
list(APPEND CG_CMAKE_SCRIPT_ARGS "-P")
list(APPEND CG_CMAKE_SCRIPT_ARGS
"${Q}${GCR_CMAKE_MACRO_DIR}/BuildTargetScript.cmake${Q}")
get_filename_component(CG_XML_FILE_PATH_ONLY_NAME
"${CG_XML_FILE_PATH}" NAME)
set(CG_XML_CUSTOM_COMMAND_COMMENT
"Creating gresources XML file (${CG_XML_FILE_PATH_ONLY_NAME})")
add_custom_command(OUTPUT ${CG_XML_FILE_PATH}
COMMAND ${CMAKE_COMMAND}
ARGS ${CG_CMAKE_SCRIPT_ARGS}
DEPENDS ${CG_RESOURCES_DEPENDENCIES}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT ${CG_XML_CUSTOM_COMMAND_COMMENT})
# Create target manually if not set (to make sure glib-compile-resources
# doesn't change behaviour with it's naming standards).
if (NOT CG_ARG_TARGET)
set(CG_ARG_TARGET "${CMAKE_CURRENT_BINARY_DIR}/resources")
set(CG_ARG_TARGET "${CG_ARG_TARGET}.${CG_TARGET_FILE_ENDING}")
endif()
# Add compilation target for resources.
add_custom_command(OUTPUT ${CG_ARG_TARGET}
COMMAND ${GLIB_COMPILE_RESOURCES_EXECUTABLE}
ARGS
${OPTIONS}
"--target=${Q}${CG_ARG_TARGET}${Q}"
"--sourcedir=${Q}${CG_ARG_SOURCE_DIR}${Q}"
${CG_GENERATE_COMMAND_LINE}
${CG_XML_FILE_PATH}
MAIN_DEPENDENCY ${CG_XML_FILE_PATH}
DEPENDS ${CG_RESOURCES_DEPENDENCIES}
WORKING_DIRECTORY ${CMAKE_BUILD_DIR})
# Set output and XML_OUT to parent scope.
set(${xml_out} ${CG_XML_FILE_PATH} PARENT_SCOPE)
set(${output} ${CG_ARG_TARGET} PARENT_SCOPE)
endfunction()

View File

@ -0,0 +1,124 @@
include(CMakeParseArguments)
# Generates the resource XML controlling file from resource list (and saves it
# to xml_path). It's not recommended to use this function directly, since it
# doesn't handle invalid arguments. It is used by the function
# COMPILE_GRESOURCES() to create a custom command, so that this function is
# invoked at build-time in script mode from CMake.
function(GENERATE_GXML xml_path)
# Available options:
# COMPRESS_ALL, NO_COMPRESS_ALL Overrides the COMPRESS flag in all
# registered resources.
# STRIPBLANKS_ALL, NO_STRIPBLANKS_ALL Overrides the STRIPBLANKS flag in all
# registered resources.
# TOPIXDATA_ALL, NO_TOPIXDATA_ALL Overrides the TOPIXDATA flag in all
# registered resources.
set(GXML_OPTIONS COMPRESS_ALL NO_COMPRESS_ALL
STRIPBLANKS_ALL NO_STRIPBLANKS_ALL
TOPIXDATA_ALL NO_TOPIXDATA_ALL)
# Available one value options:
# PREFIX Overrides the resource prefix that is prepended to each
# relative file name in registered resources.
set(GXML_ONEVALUEARGS PREFIX)
# Available multi-value options:
# RESOURCES The list of resource files. Whether absolute or relative path is
# equal, absolute paths are stripped down to relative ones. If the
# absolute path is not inside the given base directory SOURCE_DIR
# or CMAKE_CURRENT_SOURCE_DIR (if SOURCE_DIR is not overriden),
# this function aborts.
set(GXML_MULTIVALUEARGS RESOURCES)
# Parse the arguments.
cmake_parse_arguments(GXML_ARG
"${GXML_OPTIONS}"
"${GXML_ONEVALUEARGS}"
"${GXML_MULTIVALUEARGS}"
"${ARGN}")
# Variable to store the double-quote (") string. Since escaping
# double-quotes in strings is not possible we need a helper variable that
# does this job for us.
set(Q \")
# Process resources and generate XML file.
# Begin with the XML header and header nodes.
set(GXML_XML_FILE "<?xml version=${Q}1.0${Q} encoding=${Q}UTF-8${Q}?>")
set(GXML_XML_FILE "${GXML_XML_FILE}<gresources><gresource prefix=${Q}")
# Set the prefix for the resources. Depending on the user-override we choose
# the standard prefix "/" or the override.
if (GXML_ARG_PREFIX)
set(GXML_XML_FILE "${GXML_XML_FILE}${GXML_ARG_PREFIX}")
else()
set(GXML_XML_FILE "${GXML_XML_FILE}/")
endif()
set(GXML_XML_FILE "${GXML_XML_FILE}${Q}>")
# Process each resource.
foreach(res ${GXML_ARG_RESOURCES})
if ("${res}" STREQUAL "COMPRESS")
set(GXML_COMPRESSION_FLAG ON)
elseif ("${res}" STREQUAL "STRIPBLANKS")
set(GXML_STRIPBLANKS_FLAG ON)
elseif ("${res}" STREQUAL "TOPIXDATA")
set(GXML_TOPIXDATA_FLAG ON)
else()
# The file name.
set(GXML_RESOURCE_PATH "${res}")
# Append to real resource file dependency list.
list(APPEND GXML_RESOURCES_DEPENDENCIES ${GXML_RESOURCE_PATH})
# Assemble <file> node.
set(GXML_RES_LINE "<file")
if ((GXML_ARG_COMPRESS_ALL OR GXML_COMPRESSION_FLAG) AND NOT
GXML_ARG_NO_COMPRESS_ALL)
set(GXML_RES_LINE "${GXML_RES_LINE} compressed=${Q}true${Q}")
endif()
# Check preprocess flag validity.
if ((GXML_ARG_STRIPBLANKS_ALL OR GXML_STRIPBLANKS_FLAG) AND
(GXML_ARG_TOPIXDATA_ALL OR GXML_TOPIXDATA_FLAG))
set(GXML_ERRMSG "Resource preprocessing option conflict. Tried")
set(GXML_ERRMSG "${GXML_ERRMSG} to specify both, STRIPBLANKS")
set(GXML_ERRMSG "${GXML_ERRMSG} and TOPIXDATA. In resource")
set(GXML_ERRMSG "${GXML_ERRMSG} ${GXML_RESOURCE_PATH} in")
set(GXML_ERRMSG "${GXML_ERRMSG} function COMPILE_GRESOURCES.")
message(FATAL_ERROR ${GXML_ERRMSG})
endif()
if ((GXML_ARG_STRIPBLANKS_ALL OR GXML_STRIPBLANKS_FLAG) AND NOT
GXML_ARG_NO_STRIPBLANKS_ALL)
set(GXML_RES_LINE "${GXML_RES_LINE} preprocess=")
set(GXML_RES_LINE "${GXML_RES_LINE}${Q}xml-stripblanks${Q}")
elseif((GXML_ARG_TOPIXDATA_ALL OR GXML_TOPIXDATA_FLAG) AND NOT
GXML_ARG_NO_TOPIXDATA_ALL)
set(GXML_RES_LINE "${GXML_RES_LINE} preprocess=")
set(GXML_RES_LINE "${GXML_RES_LINE}${Q}to-pixdata${Q}")
endif()
set(GXML_RES_LINE "${GXML_RES_LINE}>${GXML_RESOURCE_PATH}</file>")
# Append to file string.
set(GXML_XML_FILE "${GXML_XML_FILE}${GXML_RES_LINE}")
# Unset variables.
unset(GXML_COMPRESSION_FLAG)
unset(GXML_STRIPBLANKS_FLAG)
unset(GXML_TOPIXDATA_FLAG)
endif()
endforeach()
# Append closing nodes.
set(GXML_XML_FILE "${GXML_XML_FILE}</gresource></gresources>")
# Use "file" function to generate XML controlling file.
get_filename_component(xml_path_only_name "${xml_path}" NAME)
file(WRITE ${xml_path} ${GXML_XML_FILE})
endfunction()

View File

@ -0,0 +1,11 @@
# Path to this file.
set(GCR_CMAKE_MACRO_DIR ${CMAKE_CURRENT_LIST_DIR})
# Finds the glib-compile-resources executable.
find_program(GLIB_COMPILE_RESOURCES_EXECUTABLE glib-compile-resources)
mark_as_advanced(GLIB_COMPILE_RESOURCES_EXECUTABLE)
# Include the cmake files containing the functions.
include(${GCR_CMAKE_MACRO_DIR}/CompileGResources.cmake)
include(${GCR_CMAKE_MACRO_DIR}/GenerateGXML.cmake)

2
config.h Normal file
View File

@ -0,0 +1,2 @@
#include <limits.h>
#define MAXPATHLEN PATH_MAX//4096

8
doc/CMakeLists.txt Normal file
View File

@ -0,0 +1,8 @@
install(FILES pcsxr.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1)
install(FILES keys.txt DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/pcsxr)
install(FILES tweaks.txt DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/pcsxr)
install(FILES ../AUTHORS DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/pcsxr)
install(FILES ../COPYING DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/pcsxr)
install(FILES ../README DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/pcsxr)

98
gui/CMakeLists.txt Normal file
View File

@ -0,0 +1,98 @@
message("Configuring gui")
include(GlibCompileResourcesSupport)
#deps
find_package(GLib REQUIRED)
if(NOT GLib_FOUND)
message(FATAL_ERROR "GLIB2 library not found")
endif(NOT GLib_FOUND)
include_directories(${GLib_INCLUDE_DIRS})
find_package(GTK3 3.14.0 REQUIRED)
if(NOT GTK3_FOUND)
message(FATAL_ERROR "GTK3 library not found")
endif(NOT GTK3_FOUND)
include_directories(${GTK3_INCLUDE_DIRS})
set(GTK_LIBRARIES ${GTK3_LIBRARY} ${GDK3_LIBRARY} ${GDKPixbuf_LIBRARY} ${Pango_LIBRARY} ${Cairo_LIBRARY} ${GObject_LIBRARY} ${GLib_LIBRARY} ${GIO_LIBRARY})
find_package(Threads REQUIRED)
find_package(ZLIB REQUIRED)
include_directories(${ZLIB_INCLUDE_DIRS})
find_library(DL_LIB dl REQUIRED)
find_library(RT_LIB rt REQUIRED)
find_package(X11 REQUIRED)
include_directories(${X11_XTest_INCLUDE_PATH})
#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")
#sources
set(SRCS
AboutDlg.c
Cheat.c
ConfDlg.c
Config.c
DebugMemory.c
GtkGui.c
LnxMain.c
MemcardDlg.c
Plugin.c
resources.c
)
#resources
set(RESOURCE_LIST
${CMAKE_CURRENT_SOURCE_DIR}/data/pcsxr.ui
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr-icon.png
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr-cd-open.png
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr-plugin-cdr.png
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr-plugin-gpu.png
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr-iso-open.png
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr-iso-reopen.png
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr-memcard.png
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr-plugin-pad.png
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr.png
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr-play.png
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr-plugin-sio1.png
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr-run-bios.png
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr-save-state.png
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr-load-state.png
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr-settings.png
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr-plugin-netplay.png
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr-cpu.png
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr-shutdown.png
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr-reset.png
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr-run-exe.png
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr-plugin-spu.png
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr-cheats.png
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr-cheats-search.png
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr-cheats-browse.png
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr-exit.png
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr-about.png
${CMAKE_CURRENT_SOURCE_DIR}/data/pixmaps/pcsxr-memory-dump.png
)
compile_gresources(RESOURCE_FILE
XML_OUT
TYPE EMBED_C
PREFIX /org/pcsxr/gui
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data
RESOURCES ${RESOURCE_LIST})
add_custom_target(resource DEPENDS ${RESOURCE_FILE})
add_executable(pcsxr ${SRCS} ${RESOURCE_FILE} )
add_dependencies(pcsxr resource)
target_link_libraries(pcsxr pcsxcore ${GTK_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES} ${RT_LIB} ${DL_LIB} ${X11_XTest_LIB})
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")

105
libpcsxcore/CMakeLists.txt Normal file
View File

@ -0,0 +1,105 @@
message("Configuring core")
set(DYNAREC "auto" CACHE STRING "Build dynarec for arch.")
set_property(CACHE DYNAREC PROPERTY STRINGS auto x86_64 x86 ppc no)
option(ENABLE_CCDDA "Enables compressed CDDA support." OFF)
option(USE_LIBARCHIVE "Enables compressed data-tracks support." OFF)
if (ENABLE_CCDDA)
find_package(FFMPEG REQUIRED)
include_directories(${FFMPEG_INCLUDE_DIRS})
add_definitions(-DENABLE_CCDDA)
endif()
if (USE_LIBARCHIVE)
find_package(LibArchive REQUIRED)
include_directories(${LibArchive_INCLUDE_DIRS})
add_definitions(-DHAVE_LIBARCHIVE)
endif()
# Architecture detection and arch specific settings
message(${CMAKE_SYSTEM_PROCESSOR})
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^powerpc")
set(_ARCH_PPC 1)
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^i.86")
set(_ARCH_32 1)
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^x86_64")
set(_ARCH_64 1)
else()
message("Unsupported arch. Will not build dynarec")
add_definitions(-DNOPSXREC)
endif()
if (${DYNAREC} STREQUAL "auto")
if (_ARCH_PPC)
set(DYNAREC_PPC 1)
message("Using PPC Dynarec")
elseif(_ARCH_64)
set(DYNAREC_64 1)
message("Using x86_64 Dynarec")
elseif(_ARCH_32)
set(DYNAREC_32 1)
message("Using 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.")
add_definitions(-DNOPSXREC)
elseif (${DYNAREC} STREQUAL "x86_64")
set(DYNAREC_64 1)
message("Using x86_64 Dynarec")
elseif (${DYNAREC} STREQUAL "x86")
set(DYNAREC_32 1)
message("Using x86 Dynarec")
elseif (${DYNAREC} STREQUAL "no")
message("Will not build dynarec")
add_definitions(-DNOPSXREC)
endif()
set(SRCS psxbios.c
cdrom.c
psxcounters.c
psxdma.c
disr3000a.c
gpu.c
spu.c
sio.c
psxhw.c
mdec.c
psxmem.c
misc.c
plugins.c
decode_xa.c
r3000a.c
psxinterpreter.c
gte.c
psxhle.c
debug.c
psxcommon.c
cdriso.c
cheat.c
socket.c
ppf.c)
set(LIBS "-lm")
if(DYNAREC_64)
file(GLOB_RECURSE DYNAREC_SRC ix86_64/*.c)
elseif(DYNAREC_32)
file(GLOB_RECURSE DYNAREC_SRC ix86/*.c)
elseif(DYNAREC_PPC)
enable_language(ASM-ATT)
SET(CMAKE_ASM-ATT_SOURCE_FILE_EXTENSIONS nasm;nas;asm;s)
file(GLOB_RECURSE DYNAREC_SRC ppc/*.c)
set(DYNAREC_SRC ${DYNAREC_SRC} ppc/pasm.s)
endif()
set(SRCS ${SRCS} ${DYNAREC_SRC})
add_library(pcsxcore STATIC ${SRCS})
target_link_libraries(pcsxcore ${FFMPEG_LIBRARIES} ${LibArchive_LIBRARIES} ${LIBS})

13
plugins/CMakeLists.txt Normal file
View File

@ -0,0 +1,13 @@
#plugins
if (BUILD_SIO1)
add_subdirectory(bladesio1)
endif()
add_subdirectory(nullsio1)
add_subdirectory(dfcdrom)
add_subdirectory(dfinput)
add_subdirectory(dfnet)
add_subdirectory(dfsound)
add_subdirectory(dfxvideo)
if (BUILD_OPENGL)
add_subdirectory(peopsxgl)
endif()

View File

@ -0,0 +1,61 @@
message("Configuring bladesio1")
include(GlibCompileResourcesSupport)
#deps
find_package(GLib REQUIRED)
if(NOT GLib_FOUND)
message(FATAL_ERROR "GLIB2 library not found")
endif(NOT GLib_FOUND)
include_directories(${GLib_INCLUDE_DIRS})
find_package(GTK3 REQUIRED)
if(NOT GTK3_FOUND)
message(FATAL_ERROR "GTK3 library not found")
endif(NOT GTK3_FOUND)
include_directories(${GTK3_INCLUDE_DIRS})
set(GTK_LIBRARIES ${GTK3_LIBRARY} ${GDK3_LIBRARY} ${GDKPixbuf_LIBRARY} ${Pango_LIBRARY} ${Cairo_LIBRARY} ${GObject_LIBRARY} ${GLib_LIBRARY} ${GIO_LIBRARY})
#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")
#sources
set(PLUGIN_SRCS
cfg.c
sio1.c
fifo.c
connection.c
)
set(GUI_SRCS
gui.c
)
#resources
set(RESOURCE_LIST
${CMAKE_CURRENT_SOURCE_DIR}/sio1.ui
)
compile_gresources(RESOURCE_FILE
XML_OUT
TYPE EMBED_C
PREFIX /org/pcsxr/bladesio1
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
RESOURCES ${RESOURCE_LIST})
add_custom_target(bladesio1_resource DEPENDS ${RESOURCE_FILE})
include_directories(${CMAKE_SOURCE_DIR}/libpcsxcore)
add_library(BladeSio1 MODULE ${PLUGIN_SRCS})
add_executable(cfgBladeSio1 ${GUI_SRCS} ${RESOURCE_FILE})
add_dependencies(cfgBladeSio1 bladesio1_resource)
target_link_libraries(cfgBladeSio1 ${GTK_LIBRARIES})
install(TARGETS BladeSio1 LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/games/psemu)
install(TARGETS cfgBladeSio1 RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/games/psemu)

View File

@ -0,0 +1,72 @@
message("Configuring dfcdrom")
include(GlibCompileResourcesSupport)
option(USE_LIBCDIO "Use GNU libcdio for CD-ROM support." OFF)
if (USE_LIBCDIO)
find_package(Cdio REQUIRED)
include_directories(${CDIO_INCLUDE_DIR})
add_definitions(-DUSE_LIBCDIO)
endif()
#deps
find_package(GLib REQUIRED)
if(NOT GLib_FOUND)
message(FATAL_ERROR "GLIB2 library not found")
endif(NOT GLib_FOUND)
include_directories(${GLib_INCLUDE_DIRS})
find_package(GTK3 REQUIRED)
if(NOT GTK3_FOUND)
message(FATAL_ERROR "GTK3 library not found")
endif(NOT GTK3_FOUND)
include_directories(${GTK3_INCLUDE_DIRS})
set(GTK_LIBRARIES ${GTK3_LIBRARY} ${GDK3_LIBRARY} ${GDKPixbuf_LIBRARY} ${Pango_LIBRARY} ${Cairo_LIBRARY} ${GObject_LIBRARY} ${GLib_LIBRARY} ${GIO_LIBRARY})
find_package(Threads REQUIRED)
#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")
#sources
set(PLUGIN_SRCS
cdr.c
cdr-libcdio.c
cdr-linux.c
cdr-null.c
cfg.c
util.c
)
set(GUI_SRCS
cdrcfg-0.1df/main.c
)
#resources
set(RESOURCE_LIST
${CMAKE_CURRENT_SOURCE_DIR}/cdrcfg-0.1df/dfcdrom.ui
)
compile_gresources(RESOURCE_FILE
XML_OUT
TYPE EMBED_C
PREFIX /org/pcsxr/dfcdrom
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cdrcfg-0.1df
RESOURCES ${RESOURCE_LIST})
add_custom_target(dfcdrom_resource DEPENDS ${RESOURCE_FILE})
include_directories(${CMAKE_SOURCE_DIR}/libpcsxcore)
add_library(DFCdrom MODULE ${PLUGIN_SRCS})
target_link_libraries(DFCdrom ${CDIO_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
add_executable(cfgDFCdrom ${GUI_SRCS} ${RESOURCE_FILE})
add_dependencies(cfgDFCdrom dfcdrom_resource)
target_link_libraries(cfgDFCdrom ${GTK_LIBRARIES})
install(TARGETS DFCdrom LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/games/psemu)
install(TARGETS cfgDFCdrom RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/games/psemu)

View File

@ -0,0 +1,82 @@
message("Configuring dfinput")
include(GlibCompileResourcesSupport)
#deps
find_package(GLib REQUIRED)
if(NOT GLib_FOUND)
message(FATAL_ERROR "GLIB2 library not found")
endif(NOT GLib_FOUND)
include_directories(${GLib_INCLUDE_DIRS})
find_package(GTK3 REQUIRED)
if(NOT GTK3_FOUND)
message(FATAL_ERROR "GTK3 library not found")
endif(NOT GTK3_FOUND)
include_directories(${GTK3_INCLUDE_DIRS})
set(GTK_LIBRARIES ${GTK3_LIBRARY} ${GDK3_LIBRARY} ${GDKPixbuf_LIBRARY} ${Pango_LIBRARY} ${Cairo_LIBRARY} ${GObject_LIBRARY} ${GLib_LIBRARY} ${GIO_LIBRARY})
set(USE_SDL2 0)
find_package(SDL2)
if(NOT SDL2_FOUND)
find_package(SDL)
if(NOT SDL_FOUND)
message(FATAL_ERROR "SDL or SDL2 library not found")
else(NOT SDL_FOUND)
message("Using SDL")
include_directories(${SDL_INCLUDE_DIR})
endif(NOT SDL_FOUND)
else(NOT SDL2_FOUND)
set(USE_SDL2 1)
message("Using SDL2")
include_directories(${SDL2_INCLUDE_DIR})
endif(NOT SDL2_FOUND)
find_package(X11 REQUIRED)
find_package(Threads REQUIRED)
#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")
#sources
set(PLUGIN_SRCS
analog.c
cfg.c
pad.c
sdljoy.c
util.c
xkb.c
)
set(GUI_SRCS
cfg-gtk.c
)
#resources
set(RESOURCE_LIST
${CMAKE_CURRENT_SOURCE_DIR}/dfinput.ui
)
compile_gresources(RESOURCE_FILE
XML_OUT
TYPE EMBED_C
PREFIX /org/pcsxr/dfinput
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
RESOURCES ${RESOURCE_LIST})
add_custom_target(dfinput_resource DEPENDS ${RESOURCE_FILE})
include_directories(${CMAKE_SOURCE_DIR}/libpcsxcore ${X11_X11_INCLUDE_PATH})
add_library(DFInput MODULE ${PLUGIN_SRCS})
target_link_libraries(DFInput ${SDL_LIBRARY} ${SDL2_LIBRARY} ${X11_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
add_executable(cfgDFInput ${GUI_SRCS} ${RESOURCE_FILE})
add_dependencies(cfgDFInput dfinput_resource)
target_link_libraries(cfgDFInput ${GTK_LIBRARIES} ${SDL_LIBRARY} ${SDL2_LIBRARY} ${X11_LIBRARIES})
install(TARGETS DFInput LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/games/psemu)
install(TARGETS cfgDFInput RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/games/psemu)

View File

@ -0,0 +1,60 @@
message("Configuring dfnet")
include(GlibCompileResourcesSupport)
#deps
find_package(GLib REQUIRED)
if(NOT GLib_FOUND)
message(FATAL_ERROR "GLIB2 library not found")
endif(NOT GLib_FOUND)
include_directories(${GLib_INCLUDE_DIRS})
find_package(GTK3 REQUIRED)
if(NOT GTK3_FOUND)
message(FATAL_ERROR "GTK3 library not found")
endif(NOT GTK3_FOUND)
include_directories(${GTK3_INCLUDE_DIRS})
set(GTK_LIBRARIES ${GTK3_LIBRARY} ${GDK3_LIBRARY} ${GDKPixbuf_LIBRARY} ${Pango_LIBRARY} ${Cairo_LIBRARY} ${GObject_LIBRARY} ${GLib_LIBRARY} ${GIO_LIBRARY})
#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")
#sources
set(PLUGIN_SRCS
cfg.c
dfnet.c
unix.c
)
set(GUI_SRCS
gui.c
)
#resources
set(RESOURCE_LIST
${CMAKE_CURRENT_SOURCE_DIR}/dfnet.ui
)
compile_gresources(RESOURCE_FILE
XML_OUT
TYPE EMBED_C
PREFIX /org/pcsxr/dfnet
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
RESOURCES ${RESOURCE_LIST})
add_custom_target(dfnet_resource DEPENDS ${RESOURCE_FILE})
include_directories(${CMAKE_SOURCE_DIR}/libpcsxcore)
add_library(DFNet MODULE ${PLUGIN_SRCS})
add_executable(cfgDFNet ${GUI_SRCS} ${RESOURCE_FILE})
add_dependencies(cfgDFNet dfnet_resource)
target_link_libraries(cfgDFNet ${GTK_LIBRARIES})
install(TARGETS DFNet LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/games/psemu)
install(TARGETS cfgDFNet RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/games/psemu)

View File

@ -0,0 +1,135 @@
message("Configuring dfsound")
include(GlibCompileResourcesSupport)
set(SND_BACKEND "sdl" CACHE STRING "Sound backend to use.")
set_property(CACHE SND_BACKEND PROPERTY STRINGS oss alsa pulse sdl openal null)
#deps
find_package(GLib REQUIRED)
if(NOT GLib_FOUND)
message(FATAL_ERROR "GLIB2 library not found")
endif(NOT GLib_FOUND)
include_directories(${GLib_INCLUDE_DIRS})
find_package(GTK3 REQUIRED)
if(NOT GTK3_FOUND)
message(FATAL_ERROR "GTK3 library not found")
endif(NOT GTK3_FOUND)
include_directories(${GTK3_INCLUDE_DIRS})
set(GTK_LIBRARIES ${GTK3_LIBRARY} ${GDK3_LIBRARY} ${GDKPixbuf_LIBRARY} ${Pango_LIBRARY} ${Cairo_LIBRARY} ${GObject_LIBRARY} ${GLib_LIBRARY} ${GIO_LIBRARY})
if (${SND_BACKEND} STREQUAL "oss")
find_package(OSS REQUIRED)
include_directories(${OSS_INCLUDE_DIR})
add_definitions(-DUSEOSS=1)
elseif (${SND_BACKEND} STREQUAL "alsa")
find_package(ALSA REQUIRED)
include_directories(${ALSA_INCLUDE_DIRS})
add_definitions(-DUSEALSA=1)
elseif (${SND_BACKEND} STREQUAL "pulse")
find_package(PulseAudio REQUIRED)
include_directories(${PULSEAUDIO_INCLUDE_DIR})
add_definitions(-DUSEPULSEAUDIO=1)
elseif (${SND_BACKEND} STREQUAL "sdl")
find_package(SDL2)
if(NOT SDL2_FOUND)
find_package(SDL)
if(NOT SDL_FOUND)
message(FATAL_ERROR "SDL or SDL2 library not found")
else(NOT SDL_FOUND)
message("Using SDL")
include_directories(${SDL_INCLUDE_DIR})
endif(NOT SDL_FOUND)
else(NOT SDL2_FOUND)
set(USE_SDL2 1)
message("Using SDL2")
include_directories(${SDL2_INCLUDE_DIR})
endif(NOT SDL2_FOUND)
add_definitions(-DUSESDL=1)
elseif (${SND_BACKEND} STREQUAL "openal")
find_package(OpenAL REQUIRED)
include_directories(${OPENAL_INCLUDE_DIR})
add_definitions(-DUSEOPENAL=1)
elseif (${SND_BACKEND} STREQUAL "null")
add_definitions(-DUSENULL=1)
endif()
find_package(Threads REQUIRED)
#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")
#sources
set(PLUGIN_SRCS
adsr.c
cfg.c
dma.c
externals.c
freeze.c
registers.c
reverb.c
spu.c
xa.c
)
set(GUI_SRCS
spucfg-0.1df/main.c
)
#resources
set(RESOURCE_LIST
${CMAKE_CURRENT_SOURCE_DIR}/spucfg-0.1df/dfsound.ui
)
compile_gresources(RESOURCE_FILE
XML_OUT
TYPE EMBED_C
PREFIX /org/pcsxr/dfsound
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/spucfg-0.1df
RESOURCES ${RESOURCE_LIST})
add_custom_target(dfsound_resource DEPENDS ${RESOURCE_FILE})
include_directories(${CMAKE_SOURCE_DIR}/libpcsxcore)
if (${SND_BACKEND} STREQUAL "oss")
add_library(DFSound MODULE ${PLUGIN_SRCS} oss.c)
elseif (${SND_BACKEND} STREQUAL "alsa")
add_library(DFSound MODULE ${PLUGIN_SRCS} alsa.c)
target_link_libraries(DFSound ${ALSA_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
elseif (${SND_BACKEND} STREQUAL "pulse")
add_library(DFSound MODULE ${PLUGIN_SRCS} pulseaudio.c)
target_link_libraries(DFSound ${PULSEAUDIO_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
elseif (${SND_BACKEND} STREQUAL "sdl")
add_library(DFSound MODULE ${PLUGIN_SRCS} sdl.c)
target_link_libraries(DFSound ${SDL_LIBRARY} ${SDL2_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
elseif (${SND_BACKEND} STREQUAL "openal")
add_library(DFSound MODULE ${PLUGIN_SRCS} openal.c)
target_link_libraries(DFSound ${OPENAL_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
elseif (${SND_BACKEND} STREQUAL "null")
add_library(DFSound MODULE ${PLUGIN_SRCS} nullsnd.c)
endif()
add_executable(cfgDFSound ${GUI_SRCS} ${RESOURCE_FILE})
add_dependencies(cfgDFSound dfsound_resource)
target_link_libraries(cfgDFSound ${GTK_LIBRARIES})
install(TARGETS DFSound LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/games/psemu)
install(TARGETS cfgDFSound RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/games/psemu)

View File

@ -0,0 +1,69 @@
message("Configuring dfxvideo")
include(GlibCompileResourcesSupport)
#deps
find_package(GLib REQUIRED)
if(NOT GLib_FOUND)
message(FATAL_ERROR "GLIB2 library not found")
endif(NOT GLib_FOUND)
include_directories(${GLib_INCLUDE_DIRS})
find_package(GTK3 REQUIRED)
if(NOT GTK3_FOUND)
message(FATAL_ERROR "GTK3 library not found")
endif(NOT GTK3_FOUND)
include_directories(${GTK3_INCLUDE_DIRS})
set(GTK_LIBRARIES ${GTK3_LIBRARY} ${GDK3_LIBRARY} ${GDKPixbuf_LIBRARY} ${Pango_LIBRARY} ${Cairo_LIBRARY} ${GObject_LIBRARY} ${GLib_LIBRARY} ${GIO_LIBRARY})
find_package(X11 REQUIRED)
#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")
#sources
set(PLUGIN_SRCS
cfg.c
draw.c
fps.c
gpu.c
key.c
menu.c
prim.c
soft.c
zn.c
)
set(GUI_SRCS
gpucfg-0.1df/main.c
)
#resources
set(RESOURCE_LIST
${CMAKE_CURRENT_SOURCE_DIR}/gpucfg-0.1df/dfxvideo.ui
)
compile_gresources(RESOURCE_FILE
XML_OUT
TYPE EMBED_C
PREFIX /org/pcsxr/dfxvideo
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/gpucfg-0.1df
RESOURCES ${RESOURCE_LIST})
add_custom_target(dfxvideo_resource DEPENDS ${RESOURCE_FILE})
include_directories(${CMAKE_SOURCE_DIR}/libpcsxcore ${X11_X11_INCLUDE_PATH} ${X11_Xv_INCLUDE_PATH} ${X11_XShm_INCLUDE_PATH})
add_library(DFXVideo MODULE ${PLUGIN_SRCS})
target_link_libraries(DFXVideo ${X11_LIBRARIES} ${X11_Xv_LIB} ${X11_Xext_LIB} -lm)
add_executable(cfgDFXVideo ${GUI_SRCS} ${RESOURCE_FILE})
add_dependencies(cfgDFXVideo dfxvideo_resource)
target_link_libraries(cfgDFXVideo ${GTK_LIBRARIES})
install(TARGETS DFXVideo LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/games/psemu)
install(TARGETS cfgDFXVideo RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/games/psemu)

View File

@ -0,0 +1,21 @@
message("Configuring nullsio1")
#deps
#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")
#sources
set(PLUGIN_SRCS
sio1.c
)
include_directories(${CMAKE_SOURCE_DIR}/libpcsxcore)
add_library(NullSio1 MODULE ${PLUGIN_SRCS})
install(TARGETS NullSio1 LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/games/psemu)

View File

@ -0,0 +1,75 @@
message("Configuring peopsxgl")
include(GlibCompileResourcesSupport)
#deps
find_package(GLib REQUIRED)
if(NOT GLib_FOUND)
message(FATAL_ERROR "GLIB2 library not found")
endif(NOT GLib_FOUND)
include_directories(${GLib_INCLUDE_DIRS})
find_package(GTK3 REQUIRED)
if(NOT GTK3_FOUND)
message(FATAL_ERROR "GTK3 library not found")
endif(NOT GTK3_FOUND)
include_directories(${GTK3_INCLUDE_DIRS})
set(GTK_LIBRARIES ${GTK3_LIBRARY} ${GDK3_LIBRARY} ${GDKPixbuf_LIBRARY} ${Pango_LIBRARY} ${Cairo_LIBRARY} ${GObject_LIBRARY} ${GLib_LIBRARY} ${GIO_LIBRARY})
find_package(X11 REQUIRED)
find_package(OpenGL REQUIRED)
if(NOT OPENGL_FOUND)
message(FATAL_ERROR "GL library not found")
endif(NOT OPENGL_FOUND)
include_directories(${OPENGL_INCLUDE_DIR})
#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")
#sources
set(PLUGIN_SRCS
cfg.c
draw.c
fps.c
gpu.c
gte_accuracy.c
key.c
menu.c
prim.c
soft.c
texture.c
)
set(GUI_SRCS
gpucfg/main.c
)
#resources
set(RESOURCE_LIST
${CMAKE_CURRENT_SOURCE_DIR}/gpucfg/peopsxgl.ui
)
compile_gresources(RESOURCE_FILE
XML_OUT
TYPE EMBED_C
PREFIX /org/pcsxr/peopsxgl
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/gpucfg
RESOURCES ${RESOURCE_LIST})
add_custom_target(peopsxgl_resource DEPENDS ${RESOURCE_FILE})
include_directories(${CMAKE_SOURCE_DIR}/libpcsxcore ${X11_X11_INCLUDE_PATH} ${X11_xf86vmode_INCLUDE_PATH} ${OPENGL_INCLUDE_DIR})
add_library(peopsxgl MODULE ${PLUGIN_SRCS})
target_link_libraries(peopsxgl ${X11_LIBRARIES} ${X11_Xxf86vm_LIB} ${OPENGL_gl_LIBRARY})
add_executable(cfgpeopsxgl ${GUI_SRCS} ${RESOURCE_FILE})
add_dependencies(cfgpeopsxgl dfinput_resource)
target_link_libraries(cfgpeopsxgl ${GTK_LIBRARIES})
install(TARGETS peopsxgl LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/games/psemu)
install(TARGETS cfgpeopsxgl RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/games/psemu)

6
po/CMakeLists.txt Normal file
View File

@ -0,0 +1,6 @@
message("Configuring langs")
include(Gettext)
#find_package(LibArchive REQUIRED)
GETTEXT_CREATE_TRANSLATIONS(pcsxr.pot ALL es fr hu it ko_KR pt_BR ru zh_CN zh_TW)