General cleanup of the CMake configuration files.

This commit is contained in:
Leon Styhre 2021-09-19 18:53:20 +02:00
parent dacda90186
commit fc78f8ee18
3 changed files with 400 additions and 380 deletions

View file

@ -25,8 +25,7 @@ set(CMAKE_VERBOSE_MAKEFILE OFF CACHE BOOL "Show verbose compiler output" FORCE)
set(LINUX_CPACK_GENERATOR "DEB" CACHE STRING "CPack generator, DEB or RPM") set(LINUX_CPACK_GENERATOR "DEB" CACHE STRING "CPack generator, DEB or RPM")
# Add local find modules to the CMake path. # Add local find modules to the CMake path.
list(APPEND CMAKE_MODULE_PATH list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake/Utils
${CMAKE_CURRENT_SOURCE_DIR}/CMake/Utils
${CMAKE_CURRENT_SOURCE_DIR}/CMake/Packages) ${CMAKE_CURRENT_SOURCE_DIR}/CMake/Packages)
# Define the options. # Define the options.
@ -39,14 +38,20 @@ option(CLANG_TIDY "Set to ON to build using the clang-tidy static analyzer" ${CL
if(CLANG_TIDY) if(CLANG_TIDY)
find_program(CLANG_TIDY_BINARY NAMES clang-tidy) find_program(CLANG_TIDY_BINARY NAMES clang-tidy)
if("${CLANG_TIDY_BINARY}" STREQUAL "CLANG_TIDY_BINARY-NOTFOUND") if(CLANG_TIDY_BINARY STREQUAL "CLANG_TIDY_BINARY-NOTFOUND")
message("-- CLANG_TIDY was set but the clang-tidy binary was not found") message("-- CLANG_TIDY was set but the clang-tidy binary was not found")
else() else()
message("-- Building with the clang-tidy static analyzer") message("-- Building with the clang-tidy static analyzer")
set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=*,-fuchsia-*,-hicpp-*,-llvm-*, \ set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=*,\
-readability-braces-*,-google-readability-braces-*, \ -fuchsia-*,\
-readability-uppercase-literal-suffix,-modernize-use-trailing-return-type, \ -hicpp-*,\
-cppcoreguidelines-avoid-magic-numbers,-readability-magic-numbers") -llvm-*,\
-readability-braces-*,\
-google-readability-braces-*,\
-readability-uppercase-literal-suffix,\
-modernize-use-trailing-return-type,\
-cppcoreguidelines-avoid-magic-numbers,\
-readability-magic-numbers")
endif() endif()
endif() endif()
@ -59,19 +64,19 @@ if(EXISTS "${CMAKE_FIND_ROOT_PATH}/opt/vc/include/bcm_host.h")
# Setting BCMHOST seems to break OpenGL ES on the RPi 4 so set RPI instead. # Setting BCMHOST seems to break OpenGL ES on the RPi 4 so set RPI instead.
#set(BCMHOST found) #set(BCMHOST found)
set(RPI ON) set(RPI ON)
set(GLSystem "Embedded OpenGL" CACHE STRING "The OpenGL system to be used") set(GLSYSTEM "Embedded OpenGL" CACHE STRING "The OpenGL system to be used")
elseif(GLES OR RPI) elseif(GLES OR RPI)
set(GLSystem "Embedded OpenGL" CACHE STRING "The OpenGL system to be used") set(GLSYSTEM "Embedded OpenGL" CACHE STRING "The OpenGL system to be used")
else() else()
set(GLSystem "Desktop OpenGL" CACHE STRING "The OpenGL system to be used") set(GLSYSTEM "Desktop OpenGL" CACHE STRING "The OpenGL system to be used")
endif() endif()
set_property(CACHE GLSystem PROPERTY STRINGS "Desktop OpenGL" "Embedded OpenGL") set_property(CACHE GLSYSTEM PROPERTY STRINGS "Desktop OpenGL" "Embedded OpenGL")
#--------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------
# Package dependencies. # Package dependencies.
if(${GLSystem} MATCHES "Desktop OpenGL") if(GLSYSTEM MATCHES "Desktop OpenGL")
set(OpenGL_GL_PREFERENCE "GLVND") set(OpenGL_GL_PREFERENCE "GLVND")
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)
else() else()
@ -98,27 +103,27 @@ if(CEC)
endif() endif()
# Add ALSA for Linux. # Add ALSA for Linux.
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") if(CMAKE_SYSTEM_NAME MATCHES "Linux")
find_package(ALSA REQUIRED) find_package(ALSA REQUIRED)
endif() endif()
#--------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------
# Compiler and linker settings. # Compiler and linker settings.
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
message("-- Compiler is Clang/LLVM") message("-- Compiler is Clang/LLVM")
if(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 5.0.0) if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0.0)
message(SEND_ERROR "You need at least Clang 5.0.0 to compile EmulationStation-DE") message(SEND_ERROR "You need at least Clang 5.0.0 to compile EmulationStation-DE")
endif() endif()
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message("-- Compiler is GNU/GCC") message("-- Compiler is GNU/GCC")
if(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 7.1) if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.1)
message(SEND_ERROR "You need at least GCC 7.1 to compile EmulationStation-DE") message(SEND_ERROR "You need at least GCC 7.1 to compile EmulationStation-DE")
endif() endif()
if(WIN32) if(WIN32)
set(CMAKE_CXX_FLAGS "-mwindows ${CMAKE_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "-mwindows ${CMAKE_CXX_FLAGS}")
endif() endif()
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
message("-- Compiler is MSVC") message("-- Compiler is MSVC")
# If using the MSVC compiler on Windows, disable the built-in min() and max() macros. # If using the MSVC compiler on Windows, disable the built-in min() and max() macros.
add_definitions(-DNOMINMAX) add_definitions(-DNOMINMAX)
@ -131,7 +136,7 @@ endif()
# Set up compiler and linker flags for debug, profiling or release builds. # Set up compiler and linker flags for debug, profiling or release builds.
if(CMAKE_BUILD_TYPE MATCHES Debug) if(CMAKE_BUILD_TYPE MATCHES Debug)
# Enable the C++17 standard and disable optimizations as it's a debug build. # Enable the C++17 standard and disable optimizations as it's a debug build.
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17 /Od /DEBUG:FULL") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17 /Od /DEBUG:FULL")
else() else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O0 -Wall -Wpedantic -Wsign-compare -Wnarrowing -Wmissing-field-initializers") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O0 -Wall -Wpedantic -Wsign-compare -Wnarrowing -Wmissing-field-initializers")
@ -141,12 +146,12 @@ if(CMAKE_BUILD_TYPE MATCHES Debug)
# Comment this out if you're using LLDB for debugging as this flag makes the binary # Comment this out if you're using LLDB for debugging as this flag makes the binary
# much larger and the application much slower. On macOS this setting is never enabled # much larger and the application much slower. On macOS this setting is never enabled
# as LLDB is the default debugger on this OS. # as LLDB is the default debugger on this OS.
if(NOT APPLE AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") if(NOT APPLE AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_DEBUG") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_DEBUG")
endif() endif()
elseif(CMAKE_BUILD_TYPE MATCHES Profiling) elseif(CMAKE_BUILD_TYPE MATCHES Profiling)
# For the profiling build, we enable optimizations and supply the required profiler flags. # For the profiling build, we enable optimizations and supply the required profiler flags.
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17 /O2 /DEBUG:FULL") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17 /O2 /DEBUG:FULL")
else() else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O2 -pg -g -Wall -Wpedantic -Wsign-compare -Wnarrowing -Wmissing-field-initializers") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O2 -pg -g -Wall -Wpedantic -Wsign-compare -Wnarrowing -Wmissing-field-initializers")
@ -155,7 +160,7 @@ elseif(CMAKE_BUILD_TYPE MATCHES Profiling)
else() else()
# Enable the C++17 standard and enable optimizations as it's a release build. # Enable the C++17 standard and enable optimizations as it's a release build.
# This will also disable all assert() macros. Strip the binary too. # This will also disable all assert() macros. Strip the binary too.
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNDEBUG /std:c++17 /O2 /DEBUG:NONE") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNDEBUG /std:c++17 /O2 /DEBUG:NONE")
else() else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O2 -DNDEBUG -Wall -Wpedantic -Wsign-compare -Wnarrowing -Wmissing-field-initializers") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O2 -DNDEBUG -Wall -Wpedantic -Wsign-compare -Wnarrowing -Wmissing-field-initializers")
@ -178,7 +183,7 @@ if(APPLE)
if(MACOS_CODESIGN_IDENTITY) if(MACOS_CODESIGN_IDENTITY)
message("-- Code signing certificate identity: " ${MACOS_CODESIGN_IDENTITY}) message("-- Code signing certificate identity: " ${MACOS_CODESIGN_IDENTITY})
endif() endif()
if(${CMAKE_OSX_DEPLOYMENT_TARGET} VERSION_LESS 10.14) if(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS 10.14)
message("-- macOS version 10.13 or lower has been set, so if code signing is enabled, Hardened Runtime will not be used") message("-- macOS version 10.13 or lower has been set, so if code signing is enabled, Hardened Runtime will not be used")
endif() endif()
endif() endif()
@ -186,7 +191,7 @@ endif()
#--------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------
# Preprocessor directives. # Preprocessor directives.
if(${GLSystem} MATCHES "Desktop OpenGL") if(GLSYSTEM MATCHES "Desktop OpenGL")
add_definitions(-DUSE_OPENGL_21) add_definitions(-DUSE_OPENGL_21)
else() else()
add_definitions(-DUSE_OPENGLES_10) add_definitions(-DUSE_OPENGLES_10)
@ -212,9 +217,9 @@ add_definitions(-DGLM_FORCE_XYZW_ONLY)
# we use /usr on Linux, /usr/pkg on NetBSD and /usr/local on FreeBSD and OpenBSD. # we use /usr on Linux, /usr/pkg on NetBSD and /usr/local on FreeBSD and OpenBSD.
if(NOT WIN32 AND NOT APPLE) if(NOT WIN32 AND NOT APPLE)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") if(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(CMAKE_INSTALL_PREFIX "/usr" CACHE INTERNAL "CMAKE_INSTALL_PREFIX") set(CMAKE_INSTALL_PREFIX "/usr" CACHE INTERNAL "CMAKE_INSTALL_PREFIX")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD") elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
set(CMAKE_INSTALL_PREFIX "/usr/pkg" CACHE INTERNAL "CMAKE_INSTALL_PREFIX") set(CMAKE_INSTALL_PREFIX "/usr/pkg" CACHE INTERNAL "CMAKE_INSTALL_PREFIX")
else() else()
set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE INTERNAL "CMAKE_INSTALL_PREFIX") set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE INTERNAL "CMAKE_INSTALL_PREFIX")
@ -233,8 +238,7 @@ endif()
#--------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------
# Include files. # Include files.
set(COMMON_INCLUDE_DIRS set(COMMON_INCLUDE_DIRS ${CURL_INCLUDE_DIR}
${CURL_INCLUDE_DIR}
${FFMPEG_INCLUDE_DIRS} ${FFMPEG_INCLUDE_DIRS}
${FreeImage_INCLUDE_DIRS} ${FreeImage_INCLUDE_DIRS}
${FREETYPE_INCLUDE_DIRS} ${FREETYPE_INCLUDE_DIRS}
@ -272,13 +276,12 @@ if(DEFINED libCEC_FOUND)
endif() endif()
# For Linux, add the ALSA include directory. # For Linux, add the ALSA include directory.
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") if(CMAKE_SYSTEM_NAME MATCHES "Linux")
list(APPEND COMMON_INCLUDE_DIRS ${ALSA_INCLUDE_DIRS}) list(APPEND COMMON_INCLUDE_DIRS ${ALSA_INCLUDE_DIRS})
endif() endif()
if(DEFINED BCMHOST OR RPI) if(DEFINED BCMHOST OR RPI)
list(APPEND COMMON_INCLUDE_DIRS list(APPEND COMMON_INCLUDE_DIRS "${CMAKE_FIND_ROOT_PATH}/opt/vc/include"
"${CMAKE_FIND_ROOT_PATH}/opt/vc/include"
"${CMAKE_FIND_ROOT_PATH}/opt/vc/include/interface/vcos" "${CMAKE_FIND_ROOT_PATH}/opt/vc/include/interface/vcos"
"${CMAKE_FIND_ROOT_PATH}/opt/vc/include/interface/vmcs_host/linux" "${CMAKE_FIND_ROOT_PATH}/opt/vc/include/interface/vmcs_host/linux"
"${CMAKE_FIND_ROOT_PATH}/opt/vc/include/interface/vcos/pthreads") "${CMAKE_FIND_ROOT_PATH}/opt/vc/include/interface/vcos/pthreads")
@ -288,8 +291,7 @@ endif()
# Dependency libraries. # Dependency libraries.
if(NOT WIN32) if(NOT WIN32)
set(COMMON_LIBRARIES set(COMMON_LIBRARIES ${CURL_LIBRARIES}
${CURL_LIBRARIES}
${FFMPEG_LIBRARIES} ${FFMPEG_LIBRARIES}
${FreeImage_LIBRARIES} ${FreeImage_LIBRARIES}
${FREETYPE_LIBRARIES} ${FREETYPE_LIBRARIES}
@ -300,8 +302,7 @@ if(NOT WIN32)
endif() endif()
elseif(WIN32) elseif(WIN32)
if(DEFINED MSVC) if(DEFINED MSVC)
set(COMMON_LIBRARIES set(COMMON_LIBRARIES "${PROJECT_SOURCE_DIR}/avcodec.lib"
"${PROJECT_SOURCE_DIR}/avcodec.lib"
"${PROJECT_SOURCE_DIR}/avfilter.lib" "${PROJECT_SOURCE_DIR}/avfilter.lib"
"${PROJECT_SOURCE_DIR}/avformat.lib" "${PROJECT_SOURCE_DIR}/avformat.lib"
"${PROJECT_SOURCE_DIR}/avutil.lib" "${PROJECT_SOURCE_DIR}/avutil.lib"
@ -319,8 +320,7 @@ elseif(WIN32)
set(COMMON_LIBRARIES ${COMMON_LIBRARIES} "${PROJECT_SOURCE_DIR}/libvlc.lib") set(COMMON_LIBRARIES ${COMMON_LIBRARIES} "${PROJECT_SOURCE_DIR}/libvlc.lib")
endif() endif()
else() else()
set(COMMON_LIBRARIES set(COMMON_LIBRARIES "${PROJECT_SOURCE_DIR}/avcodec-58.dll"
"${PROJECT_SOURCE_DIR}/avcodec-58.dll"
"${PROJECT_SOURCE_DIR}/avfilter-7.dll" "${PROJECT_SOURCE_DIR}/avfilter-7.dll"
"${PROJECT_SOURCE_DIR}/avformat-58.dll" "${PROJECT_SOURCE_DIR}/avformat-58.dll"
"${PROJECT_SOURCE_DIR}/avutil-56.dll" "${PROJECT_SOURCE_DIR}/avutil-56.dll"
@ -342,15 +342,13 @@ elseif(WIN32)
endif() endif()
if(APPLE) if(APPLE)
# See es-app/CMakeLists.txt for an explation for why an extra 'Resources' directory # See es-app/CMakeLists.txt for an explation for why an extra "Resources" directory
# has been added to the install prefix. # has been added to the install prefix.
set(CMAKE_INSTALL_PREFIX set(CMAKE_INSTALL_PREFIX "/Applications/EmulationStation Desktop Edition.app/Contents/Resources")
"/Applications/EmulationStation Desktop Edition.app/Contents/Resources")
if(VLC_PLAYER) if(VLC_PLAYER)
# Required as the VLC find module doesn't work properly on macOS. # Required as the VLC find module doesn't work properly on macOS.
set(COMMON_LIBRARIES ${COMMON_LIBRARIES} set(COMMON_LIBRARIES ${COMMON_LIBRARIES} "/Applications/VLC.app/Contents/MacOS/lib/libvlc.dylib")
"/Applications/VLC.app/Contents/MacOS/lib/libvlc.dylib")
endif() endif()
# Set the same rpath links for the install executable as for the build executable. # Set the same rpath links for the install executable as for the build executable.
@ -368,7 +366,7 @@ if(DEFINED libCEC_FOUND)
endif() endif()
# Add ALSA for Linux libraries. # Add ALSA for Linux libraries.
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") if(CMAKE_SYSTEM_NAME MATCHES "Linux")
list(APPEND COMMON_LIBRARIES ${ALSA_LIBRARY}) list(APPEND COMMON_LIBRARIES ${ALSA_LIBRARY})
endif() endif()
@ -380,7 +378,7 @@ elseif(RPI)
list(APPEND COMMON_LIBRARIES ${OPENGLES_LIBRARIES}) list(APPEND COMMON_LIBRARIES ${OPENGLES_LIBRARIES})
endif() endif()
if(${GLSystem} MATCHES "Desktop OpenGL") if(GLSYSTEM MATCHES "Desktop OpenGL")
list(APPEND COMMON_LIBRARIES ${OPENGL_LIBRARIES}) list(APPEND COMMON_LIBRARIES ${OPENGL_LIBRARIES})
else() else()
list(APPEND COMMON_LIBRARIES EGL ${OPENGLES_LIBRARIES}) list(APPEND COMMON_LIBRARIES EGL ${OPENGLES_LIBRARIES})

View file

@ -134,20 +134,48 @@ endif()
# Setup for installation and package generation. # Setup for installation and package generation.
if(WIN32) if(WIN32)
install(TARGETS EmulationStation RUNTIME DESTINATION .) install(TARGETS EmulationStation RUNTIME DESTINATION .)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
install(FILES ../avcodec-58.dll ../avfilter-7.dll ../avformat-58.dll ../avutil-56.dll install(FILES ../avcodec-58.dll
../postproc-55.dll ../swresample-3.dll ../swscale-5.dll ../FreeImage.dll ../avfilter-7.dll
../glew32.dll ../libcrypto-1_1-x64.dll ../libcurl-x64.dll ../freetype.dll ../avformat-58.dll
../pugixml.dll ../libssl-1_1-x64.dll ../SDL2.dll ../MSVCP140.dll ../VCOMP140.DLL ../avutil-56.dll
../VCRUNTIME140.dll ../VCRUNTIME140_1.dll DESTINATION .) ../postproc-55.dll
../swresample-3.dll
../swscale-5.dll
../FreeImage.dll
../freetype.dll
../glew32.dll
../libcrypto-1_1-x64.dll
../libcurl-x64.dll
../libssl-1_1-x64.dll
../MSVCP140.dll
../pugixml.dll
../SDL2.dll
../VCOMP140.DLL
../VCRUNTIME140.dll
../VCRUNTIME140_1.dll
DESTINATION .)
if(VLC_PLAYER) if(VLC_PLAYER)
install(FILES ../libvlc.dll ../libvlccore.dll DESTINATION .) install(FILES ../libvlc.dll ../libvlccore.dll DESTINATION .)
endif() endif()
else() else()
install(FILES ../avcodec-58.dll ../avfilter-7.dll ../avformat-58.dll ../avutil-56.dll install(FILES ../avcodec-58.dll
../postproc-55.dll ../swresample-3.dll ../swscale-5.dll ../FreeImage.dll ../avfilter-7.dll
../glew32.dll ../libcrypto-1_1-x64.dll ../libcurl-x64.dll ../libfreetype.dll ../avformat-58.dll
../libpugixml.dll ../libssl-1_1-x64.dll ../SDL2.dll ../vcomp140.dll DESTINATION .) ../avutil-56.dll
../postproc-55.dll
../swresample-3.dll
../swscale-5.dll
../FreeImage.dll
../glew32.dll
../libcrypto-1_1-x64.dll
../libcurl-x64.dll
../libfreetype.dll
../libpugixml.dll
../libssl-1_1-x64.dll
../SDL2.dll
../vcomp140.dll
DESTINATION .)
if(VLC_PLAYER) if(VLC_PLAYER)
install(FILES ../libvlc.dll ../libvlccore.dll DESTINATION .) install(FILES ../libvlc.dll ../libvlccore.dll DESTINATION .)
endif() endif()
@ -166,12 +194,9 @@ elseif(APPLE)
# So an extra 'Resources' directory was added to the CMAKE_INSTALL_PREFIX variable as well # So an extra 'Resources' directory was added to the CMAKE_INSTALL_PREFIX variable as well
# to compensate for this. It's a bad solution to the problem and there must surely be a # to compensate for this. It's a bad solution to the problem and there must surely be a
# better way to fix this. # better way to fix this.
install(TARGETS EmulationStation RUNTIME install(TARGETS EmulationStation RUNTIME DESTINATION ../MacOS)
DESTINATION ../MacOS) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/assets/EmulationStation-DE.icns DESTINATION ../Resources)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/assets/EmulationStation-DE.icns install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/assets/EmulationStation-DE_Info.plist DESTINATION .. RENAME Info.plist)
DESTINATION ../Resources)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/assets/EmulationStation-DE_Info.plist
DESTINATION .. RENAME Info.plist)
# Another hack/workaround. I have not been able to find any way whatsover to force the # Another hack/workaround. I have not been able to find any way whatsover to force the
# linker to use rpaths for all shared libraries instead of absolute paths. So instead # linker to use rpaths for all shared libraries instead of absolute paths. So instead
@ -192,8 +217,8 @@ elseif(APPLE)
-change /usr/local/opt/libpng/lib/libpng16.16.dylib @rpath/libpng16.16.dylib -change /usr/local/opt/libpng/lib/libpng16.16.dylib @rpath/libpng16.16.dylib
-change /usr/local/opt/sdl2/lib/libSDL2-2.0.0.dylib @rpath/libSDL2-2.0.0.dylib -change /usr/local/opt/sdl2/lib/libSDL2-2.0.0.dylib @rpath/libSDL2-2.0.0.dylib
$<TARGET_FILE:EmulationStation>) $<TARGET_FILE:EmulationStation>)
set(APPLE_DYLIB_PERMISSIONS
OWNER_WRITE OWNER_READ OWNER_EXECUTE set(APPLE_DYLIB_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE) WORLD_READ WORLD_EXECUTE)
@ -221,6 +246,7 @@ elseif(APPLE)
PERMISSIONS ${APPLE_DYLIB_PERMISSIONS} DESTINATION ../MacOS) PERMISSIONS ${APPLE_DYLIB_PERMISSIONS} DESTINATION ../MacOS)
install(FILES ${CMAKE_SOURCE_DIR}/libSDL2-2.0.0.dylib install(FILES ${CMAKE_SOURCE_DIR}/libSDL2-2.0.0.dylib
PERMISSIONS ${APPLE_DYLIB_PERMISSIONS} DESTINATION ../MacOS) PERMISSIONS ${APPLE_DYLIB_PERMISSIONS} DESTINATION ../MacOS)
if(VLC_PLAYER) if(VLC_PLAYER)
install(FILES ${CMAKE_SOURCE_DIR}/libvlc.dylib install(FILES ${CMAKE_SOURCE_DIR}/libvlc.dylib
PERMISSIONS ${APPLE_DYLIB_PERMISSIONS} DESTINATION ../MacOS) PERMISSIONS ${APPLE_DYLIB_PERMISSIONS} DESTINATION ../MacOS)
@ -229,18 +255,14 @@ elseif(APPLE)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/plugins install(DIRECTORY ${CMAKE_SOURCE_DIR}/plugins
DESTINATION ../MacOS) DESTINATION ../MacOS)
endif() endif()
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE
DESTINATION ../Resources) install(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION ../Resources)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/resources install(DIRECTORY ${CMAKE_SOURCE_DIR}/resources DESTINATION ../Resources)
DESTINATION ../Resources) install(DIRECTORY ${CMAKE_SOURCE_DIR}/themes DESTINATION ../Resources)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/themes install(DIRECTORY ${CMAKE_SOURCE_DIR}/licenses DESTINATION ../Resources)
DESTINATION ../Resources)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/licenses
DESTINATION ../Resources)
else() else()
install(TARGETS emulationstation RUNTIME install(TARGETS emulationstation RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) if(CMAKE_SYSTEM_NAME MATCHES "Linux")
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/assets/emulationstation.6.gz install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/assets/emulationstation.6.gz
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man6) DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man6)
else() else()
@ -295,7 +317,7 @@ endif()
# Settings per operating system and generator type. # Settings per operating system and generator type.
if(APPLE) if(APPLE)
set(CPACK_GENERATOR "Bundle") set(CPACK_GENERATOR "Bundle")
if(${CMAKE_OSX_DEPLOYMENT_TARGET} VERSION_LESS 10.14) if(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS 10.14)
set(CPACK_PACKAGE_FILE_NAME "EmulationStation-DE-${CPACK_PACKAGE_VERSION}-${CPU_ARCHITECTURE}_legacy") set(CPACK_PACKAGE_FILE_NAME "EmulationStation-DE-${CPACK_PACKAGE_VERSION}-${CPU_ARCHITECTURE}_legacy")
set(CPACK_DMG_VOLUME_NAME "EmulationStation Desktop Edition ${CPACK_PACKAGE_VERSION}_legacy") set(CPACK_DMG_VOLUME_NAME "EmulationStation Desktop Edition ${CPACK_PACKAGE_VERSION}_legacy")
else() else()
@ -309,7 +331,7 @@ if(APPLE)
set(CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/assets/EmulationStation-DE_Info.plist") set(CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/assets/EmulationStation-DE_Info.plist")
if(MACOS_CODESIGN_IDENTITY) if(MACOS_CODESIGN_IDENTITY)
set(CPACK_BUNDLE_APPLE_CERT_APP "Developer ID Application: ${MACOS_CODESIGN_IDENTITY}") set(CPACK_BUNDLE_APPLE_CERT_APP "Developer ID Application: ${MACOS_CODESIGN_IDENTITY}")
if(${CMAKE_OSX_DEPLOYMENT_TARGET} VERSION_GREATER 10.13) if(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER 10.13)
set(CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER "--deep --force --options runtime") set(CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER "--deep --force --options runtime")
endif() endif()
endif() endif()
@ -332,7 +354,7 @@ elseif(WIN32)
else() else()
set(CPACK_PACKAGE_INSTALL_DIRECTORY "emulationstation_${CMAKE_PACKAGE_VERSION}") set(CPACK_PACKAGE_INSTALL_DIRECTORY "emulationstation_${CMAKE_PACKAGE_VERSION}")
set(CPACK_PACKAGE_EXECUTABLES "emulationstation" "emulationstation") set(CPACK_PACKAGE_EXECUTABLES "emulationstation" "emulationstation")
if("${LINUX_CPACK_GENERATOR}" STREQUAL "DEB") if(LINUX_CPACK_GENERATOR STREQUAL "DEB")
set(CPACK_GENERATOR "DEB") set(CPACK_GENERATOR "DEB")
endif() endif()
set(CPACK_DEBIAN_FILE_NAME "emulationstation-de-${CPACK_PACKAGE_VERSION}-${CPU_ARCHITECTURE}.deb") set(CPACK_DEBIAN_FILE_NAME "emulationstation-de-${CPACK_PACKAGE_VERSION}-${CPU_ARCHITECTURE}.deb")
@ -344,7 +366,7 @@ else()
set(CPACK_DEBIAN_PACKAGE_DEPENDS "vlc") set(CPACK_DEBIAN_PACKAGE_DEPENDS "vlc")
endif() endif()
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
if("${LINUX_CPACK_GENERATOR}" STREQUAL "RPM") if(LINUX_CPACK_GENERATOR STREQUAL "RPM")
set(CPACK_GENERATOR "RPM") set(CPACK_GENERATOR "RPM")
endif() endif()
set(CPACK_RPM_FILE_NAME "emulationstation-de-${CPACK_PACKAGE_VERSION}-${CPU_ARCHITECTURE}.rpm") set(CPACK_RPM_FILE_NAME "emulationstation-de-${CPACK_PACKAGE_VERSION}-${CPU_ARCHITECTURE}.rpm")