Skip to content

Commit

Permalink
merge latest master changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tinob committed Feb 14, 2017
1 parent e139b66 commit 70dd516
Show file tree
Hide file tree
Showing 851 changed files with 84,526 additions and 87,325 deletions.
8 changes: 8 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[main]
host = https://www.transifex.com

[dolphin-emu.emulator]
file_filter = Languages/po/<lang>.po
source_file = Languages/po/dolphin-emu.pot
source_lang = en-US
type = PO
11 changes: 11 additions & 0 deletions CMake/CCache.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
find_program(CCACHE_BIN ccache)
if(CCACHE_BIN)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_BIN})
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE_BIN})

# ccache uses -I when compiling without preprocessor, which makes clang complain.
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -fcolor-diagnostics")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments -fcolor-diagnostics")
endif()
endif()
39 changes: 39 additions & 0 deletions CMake/CheckAndAddFlag.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)

# check_add_add_flag(<variable> <flag> [DEBUG_ONLY | RELEASE_ONLY])
#
# Add a C or C++ compilation flag to the current scope
#
# Can optionally add the flag to Debug or Release configurations only, use this when
# targeting multi-configuration generators like Visual Studio or Xcode.
# Release configurations means NOT Debug, so it will work for RelWithDebInfo or MinSizeRel too.
#
# If the flag is added successfully, the variables FLAG_C_<variable> and FLAG_CXX_<variable>
# may be set to ON.
#
# Examples:
# check_and_add_flag(FOO -foo)
# check_and_add_flag(ONLYDEBUG -onlydebug DEBUG_ONLY)
# check_and_add_flag(OPTMAX -O9001 RELEASE_ONLY)

function(check_and_add_flag var flag)
set(genexp_config_test "1")
if(ARGV2 STREQUAL "DEBUG_ONLY")
set(genexp_config_test "$<CONFIG:Debug>")
elseif(ARGV2 STREQUAL "RELEASE_ONLY")
set(genexp_config_test "$<NOT:$<CONFIG:Debug>>")
elseif(ARGV2)
message(FATAL_ERROR "check_and_add_flag called with incorrect arguments: ${ARGN}")
endif()

check_c_compiler_flag(${flag} FLAG_C_${var})
if(FLAG_C_${var})
add_compile_options("$<$<AND:$<COMPILE_LANGUAGE:C>,${genexp_config_test}>:${flag}>")
endif()

check_cxx_compiler_flag(${flag} FLAG_CXX_${var})
if(FLAG_CXX_${var})
add_compile_options("$<$<AND:$<COMPILE_LANGUAGE:CXX>,${genexp_config_test}>:${flag}>")
endif()
endfunction()
126 changes: 126 additions & 0 deletions CMake/CheckLib.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
find_package(PkgConfig)

macro(_internal_message msg)
if(NOT ${_is_quiet})
message(STATUS "${msg}")
endif()
endmacro()

macro(check_lib var pc lib)
set(_is_required 0)
set(_is_quiet 0)
set(_arg_list ${ARGN})
foreach(_arg ${ARGN})
if(_arg STREQUAL "REQUIRED")
list(REMOVE_ITEM _arg_list "REQUIRED")
set(_is_required 1)
endif()
if(_arg STREQUAL "QUIET")
list(REMOVE_ITEM _arg_list "QUIET")
set(_is_quiet 1)
endif()
endforeach()

if(PKG_CONFIG_FOUND AND NOT ${var}_FOUND)
pkg_search_module(${var} QUIET ${pc})
endif()

if(${var}_FOUND)
if(${var}_INCLUDE_DIRS)
include_directories(${${var}_INCLUDE_DIRS})
endif()
# Make sure include directories for headers found using find_path below
# are re-added when reconfiguring
if(${var}_INCLUDE)
include_directories(${${var}_INCLUDE})
endif()
_internal_message("${lib} found")
else()
find_library(${var} ${lib})
if(_arg_list)
find_path(${var}_INCLUDE ${_arg_list})
else()
set(${var}_INCLUDE FALSE)
endif()
if(${var} AND ${var}_INCLUDE)
include_directories(${${var}_INCLUDE})
_internal_message("${lib} found")
set(${var}_FOUND 1 CACHE INTERNAL "")
else()
if(_is_required)
message(FATAL_ERROR "${lib} is required but not found")
else()
_internal_message("${lib} not found")
endif()
endif()
endif()
endmacro()

macro(check_libav)
if(PKG_CONFIG_FOUND)
pkg_check_modules(LIBAV libavcodec>=54.35.0 libavformat>=54.20.4
libswscale>=2.1.1 libavutil>=52.3.0)
else()
if(WIN32)
add_library(avcodec STATIC IMPORTED)
set_target_properties(avcodec PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/include
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/lib/avcodec.lib
)

add_library(avformat STATIC IMPORTED)
set_target_properties(avformat PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/include
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/lib/avformat.lib
)

add_library(avutil STATIC IMPORTED)
set_target_properties(avutil PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/include
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/lib/avutil.lib
)

add_library(swresample STATIC IMPORTED)
set_target_properties(swresample PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/include
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/lib/swresample.lib
)

add_library(swscale STATIC IMPORTED)
set_target_properties(swscale PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/include
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/lib/swscale.lib
)

set(LIBAV_FOUND ON)
set(LIBAV_LIBRARIES avcodec avformat avutil swresample swscale)
else()
# Attempt to find it through static means
set(LIBAV_LDFLAGS avformat avcodec swscale avutil)
set(CMAKE_REQUIRED_LIBRARIES ${LIBAV_LDFLAGS})
CHECK_CXX_SOURCE_COMPILES(
"extern \"C\" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/mathematics.h>
#include <libswscale/swscale.h>
}
int main(int argc, char **argv)
{
av_register_all();
return 0;
}"
LIBAV_FOUND)
unset(CMAKE_REQUIRED_LIBRARIES)
endif()
endif()
if(LIBAV_FOUND)
message(STATUS "libav/ffmpeg found, enabling AVI frame dumps")
add_definitions(-DHAVE_LIBAV)
if(LIBAV_INCLUDE_DIRS)
include_directories(${LIBAV_INCLUDE_DIRS})
endif()
else()
message(STATUS "libav/ffmpeg not found, disabling AVI frame dumps")
endif()
endmacro()
34 changes: 34 additions & 0 deletions CMake/DolphinCompileDefinitions.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Add a C or C++ compile definitions to the current scope
#
# dolphin_compile_definitions(def [def ...] [DEBUG_ONLY | RELEASE_ONLY])
#
# Can optionally add the definitions to Debug or Release configurations only, use this so we can
# target multi-configuration generators like Visual Studio or Xcode.
# Release configurations means NOT Debug, so it will work for RelWithDebInfo or MinSizeRel too.
# The definitions are added to the COMPILE_DEFINITIONS folder property.
# Supports generator expressions, unlike add_definitions()
#
# Examples:
# dolphin_compile_definitions(FOO) -> -DFOO
# dolphin_compile_definitions(_DEBUG DEBUG_ONLY) -> -D_DEBUG
# dolphin_compile_definitions(NDEBUG RELEASE_ONLY) -> -DNDEBUG
# dolphin_compile_definitions($<$<COMPILE_LANGUAGE:C>:THISISONLYFORC>)

function(dolphin_compile_definitions)
set(defs ${ARGN})

list(GET defs -1 last_def)
list(REMOVE_AT defs -1)

set(genexp_config_test "1")
if(last_def STREQUAL "DEBUG_ONLY")
set(genexp_config_test "$<CONFIG:Debug>")
elseif(last_def STREQUAL "RELEASE_ONLY")
set(genexp_config_test "$<NOT:$<CONFIG:Debug>>")
else()
list(APPEND defs ${last_def})
endif()

set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS
"$<${genexp_config_test}:${ARGN}>")
endfunction()
46 changes: 46 additions & 0 deletions CMake/DolphinPostprocessBundle.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This module can be used in two different ways.
#
# When invoked as `cmake -P DolphinPostprocessBundle.cmake`, it fixes up an
# application folder to be standalone. It bundles all required libraries from
# the system and fixes up library IDs. Any additional shared libraries, like
# plugins, that are found under Contents/MacOS/ will be made standalone as well.
#
# When called with `include(DolphinPostprocessBundle)`, it defines a helper
# function `dolphin_postprocess_bundle` that sets up the command form of the
# module as a post-build step.

if(CMAKE_GENERATOR)
# Being called as include(DolphinPostprocessBundle), so define a helper function.
set(_DOLPHIN_POSTPROCESS_BUNDLE_MODULE_LOCATION "${CMAKE_CURRENT_LIST_FILE}")
function(dolphin_postprocess_bundle target)
add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -DDOLPHIN_BUNDLE_PATH="$<TARGET_FILE_DIR:${target}>/../.."
-P "${_DOLPHIN_POSTPROCESS_BUNDLE_MODULE_LOCATION}"
)
endfunction()
return()
endif()

get_filename_component(DOLPHIN_BUNDLE_PATH "${DOLPHIN_BUNDLE_PATH}" REALPATH)
message(STATUS "Fixing up application bundle: ${DOLPHIN_BUNDLE_PATH}")

# Make sure to fix up any additional shared libraries (like plugins) that are
# needed.
file(GLOB_RECURSE extra_libs "${DOLPHIN_BUNDLE_PATH}/Contents/MacOS/*.dylib")

# BundleUtilities doesn't support DYLD_FALLBACK_LIBRARY_PATH behavior, which
# makes it sometimes break on libraries that do weird things with @rpath. Specify
# equivalent search directories until https://gitlab.kitware.com/cmake/cmake/issues/16625
# is fixed and in our minimum CMake version.
set(extra_dirs "/usr/local/lib" "/lib" "/usr/lib")

# BundleUtilities is overly verbose, so disable most of its messages
function(message)
if(NOT ARGV MATCHES "^STATUS;")
_message(${ARGV})
endif()
endfunction()

include(BundleUtilities)
set(BU_CHMOD_BUNDLE_ITEMS ON)
fixup_bundle("${DOLPHIN_BUNDLE_PATH}" "${extra_libs}" "${extra_dirs}")
59 changes: 59 additions & 0 deletions CMake/FindALSA.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

#.rst:
# FindALSA
# --------
#
# Find alsa
#
# Find the alsa libraries (asound)
#
# ::
#
# This module defines the following variables:
# ALSA_FOUND - True if ALSA_INCLUDE_DIR & ALSA_LIBRARY are found
# ALSA_LIBRARIES - Set when ALSA_LIBRARY is found
# ALSA_INCLUDE_DIRS - Set when ALSA_INCLUDE_DIR is found
#
#
#
# ::
#
# ALSA_INCLUDE_DIR - where to find asoundlib.h, etc.
# ALSA_LIBRARY - the asound library
# ALSA_VERSION_STRING - the version of alsa found (since CMake 2.8.8)

find_path(ALSA_INCLUDE_DIR NAMES alsa/asoundlib.h
DOC "The ALSA (asound) include directory"
)

find_library(ALSA_LIBRARY NAMES asound
DOC "The ALSA (asound) library"
)

if(ALSA_INCLUDE_DIR AND EXISTS "${ALSA_INCLUDE_DIR}/alsa/version.h")
file(STRINGS "${ALSA_INCLUDE_DIR}/alsa/version.h" alsa_version_str REGEX "^#define[\t ]+SND_LIB_VERSION_STR[\t ]+\".*\"")

string(REGEX REPLACE "^.*SND_LIB_VERSION_STR[\t ]+\"([^\"]*)\".*$" "\\1" ALSA_VERSION_STRING "${alsa_version_str}")
unset(alsa_version_str)
endif()

include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALSA
REQUIRED_VARS ALSA_LIBRARY ALSA_INCLUDE_DIR
VERSION_VAR ALSA_VERSION_STRING)

if(ALSA_FOUND)
set( ALSA_LIBRARIES ${ALSA_LIBRARY} )
set( ALSA_INCLUDE_DIRS ${ALSA_INCLUDE_DIR} )
if(NOT TARGET ALSA::ALSA)
add_library(ALSA::ALSA UNKNOWN IMPORTED)
set_target_properties(ALSA::ALSA PROPERTIES
IMPORTED_LOCATION ${ALSA_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${ALSA_INCLUDE_DIR}
)
endif()
endif()

mark_as_advanced(ALSA_INCLUDE_DIR ALSA_LIBRARY)
42 changes: 42 additions & 0 deletions CMake/FindAO.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# - Find AO library
# This module defines
# AO_INCLUDE_DIR
# AO_LIBRARIES
# AO_FOUND
#
# vim: expandtab sw=4 ts=4 sts=4:

include(FindPkgConfig)
pkg_check_modules (AO_PKG QUIET ao)

find_path(AO_INCLUDE_DIR NAMES ao/ao.h
PATHS
${AO_PKG_INCLUDE_DIRS}
/usr/include/ao
/usr/include
/usr/local/include/ao
/usr/local/include
)

find_library(AO_LIBRARIES NAMES ao
PATHS
${AO_PKG_LIBRARY_DIRS}
/usr/lib
/usr/local/lib
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(AO
REQUIRED_VARS AO_LIBRARIES AO_INCLUDE_DIR)

if(AO_FOUND)
if(NOT TARGET AO::AO)
add_library(AO::AO UNKNOWN IMPORTED)
set_target_properties(AO::AO PROPERTIES
IMPORTED_LOCATION ${AO_LIBRARIES}
INTERFACE_INCLUDE_DIRECTORIES ${AO_INCLUDE_DIR}
)
endif()
endif()

mark_as_advanced(AO_INCLUDE_DIR AO_LIBRARIES)
Loading

0 comments on commit 70dd516

Please sign in to comment.