Updates to the CMakeLists.txt files.

This commit is contained in:
Leon Styhre 2021-01-21 21:44:51 +01:00
parent 1143e66ab0
commit 5b31c9dedc
3 changed files with 60 additions and 49 deletions

View file

@ -4,21 +4,22 @@ project(emulationstation-de)
# Set this to ON to show verbose compiler output (e.g. compiler flags, include directories etc.) # Set this to ON to show verbose compiler output (e.g. compiler flags, include directories etc.)
set(CMAKE_VERBOSE_MAKEFILE OFF CACHE BOOL "Show verbose compiler output" FORCE) set(CMAKE_VERBOSE_MAKEFILE OFF CACHE BOOL "Show verbose compiler output" FORCE)
# Add local find modules to 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)
# Options. # Define the options.
option(GLES "Set to ON if targeting Embedded OpenGL" ${GLES}) option(GLES "Set to ON if targeting Embedded OpenGL" ${GLES})
option(GL "Set to ON if targeting Desktop OpenGL" ${GL}) option(GL "Set to ON if targeting Desktop OpenGL" ${GL})
option(RPI "Set to ON to enable the Raspberry PI video player (omxplayer)" ${RPI}) option(RPI "Set to ON to enable Raspberry Pi specific build" ${RPI})
option(CEC "Set to ON to enable CEC" ${CEC}) option(CEC "Set to ON to enable CEC" ${CEC})
option(APPLE_SKIP_INSTALL_LIBS "Set to ON to skip installation of shared libraries (macOS only)." option(APPLE_SKIP_INSTALL_LIBS "Set to ON to skip installation of shared libraries (macOS only)"
${APPLE_SKIP_INSTALL_LIBS}) ${APPLE_SKIP_INSTALL_LIBS})
#--------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------
# Set up OpenGL system variable. # OpenGL setup.
if(GLES) if(GLES)
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(GL) elseif(GL)
@ -52,6 +53,7 @@ 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)
@ -80,32 +82,20 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
find_package(ALSA REQUIRED) find_package(ALSA REQUIRED)
endif() endif()
# Set up compiler flags.
if(DEFINED BCMHOST OR RPI)
add_definitions(-D_RPI_)
endif()
if(DEFINED VERO4K)
add_definitions(-D_VERO4K_)
endif()
if(DEFINED libCEC_FOUND)
add_definitions(-DHAVE_LIBCEC)
endif()
#--------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------
# Check for compiler type and version and apply specific compiler 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")
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE CLANG_VERSION) execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE CLANG_VERSION)
if(CLANG_VERSION VERSION_LESS 4.2.1) if(CLANG_VERSION VERSION_LESS 4.2.1)
message(SEND_ERROR "You need at least Clang 4.2.1 to compile EmulationStation-DE!") message(SEND_ERROR "You need at least Clang 4.2.1 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")
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpfullversion OUTPUT_VARIABLE G++_VERSION) execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpfullversion OUTPUT_VARIABLE G++_VERSION)
if(G++_VERSION VERSION_LESS 4.8) if(G++_VERSION VERSION_LESS 4.8)
message(SEND_ERROR "You need at least GCC 4.8 to compile EmulationStation-DE!") message(SEND_ERROR "You need at least GCC 4.8 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}")
@ -131,7 +121,7 @@ if(CMAKE_BUILD_TYPE MATCHES Debug)
endif() endif()
# If using Clang, then add additional debug data needed by GDB. # If using Clang, then add additional debug data needed by GDB.
# 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 macoOS 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")
@ -166,29 +156,41 @@ if(APPLE)
SET(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>") SET(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
endif() endif()
#---------------------------------------------------------------------------------------------------
# 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)
endif() endif()
# For Unix systems (except for macOS), assign the installation prefix to the local if(DEFINED BCMHOST OR RPI)
# $ES_INSTALL_PREFIX variable. add_definitions(-D_RPI_)
endif()
if(DEFINED VERO4K)
add_definitions(-D_VERO4K_)
endif()
if(DEFINED libCEC_FOUND)
add_definitions(-DHAVE_LIBCEC)
endif()
# For Unix systems, assign the installation prefix.
if(NOT WIN32 AND NOT APPLE) if(NOT WIN32 AND NOT APPLE)
add_definitions(-DES_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}") add_definitions(-DES_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}")
endif() endif()
# Handle additional (required) include files for dependency packages on Windows. # For Windows, set the minimum OS version to Windows 7.
if(WIN32) if(WIN32)
set(WIN32_INCLUDE_DIR "NOT_DEFINED" CACHE FILEPATH "") add_compile_definitions(_WIN32_WINNT=0x0601)
if(NOT EXISTS ${WIN32_INCLUDE_DIR}) add_compile_definitions(WINVER=0x0601)
message(SEND_ERROR "Can't find WIN32 include directory: ${WIN32_INCLUDE_DIR}")
endif()
#include_directories(${WIN32_INCLUDE_DIR})
endif() endif()
#--------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------
# Add include directories. # Include files.
set(COMMON_INCLUDE_DIRS set(COMMON_INCLUDE_DIRS
${CURL_INCLUDE_DIR} ${CURL_INCLUDE_DIR}
${FreeImage_INCLUDE_DIRS} ${FreeImage_INCLUDE_DIRS}
@ -200,10 +202,18 @@ set(COMMON_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/external ${CMAKE_CURRENT_SOURCE_DIR}/external
${CMAKE_CURRENT_SOURCE_DIR}/es-core/src) ${CMAKE_CURRENT_SOURCE_DIR}/es-core/src)
# For Windows we need to add local include files for the dependency packages.
if(WIN32)
set(WIN32_INCLUDE_DIR "NOT_DEFINED" CACHE FILEPATH "")
if(NOT EXISTS ${WIN32_INCLUDE_DIR})
message(SEND_ERROR "Can't find WIN32 include directory: ${WIN32_INCLUDE_DIR}")
endif()
#include_directories(${WIN32_INCLUDE_DIR})
endif()
# Temporary solution until the VLC find module has been updated to work properly on macOS. # Temporary solution until the VLC find module has been updated to work properly on macOS.
if(APPLE) if(APPLE)
set(COMMON_INCLUDE_DIRS ${COMMON_INCLUDE_DIRS} set(COMMON_INCLUDE_DIRS ${COMMON_INCLUDE_DIRS} "/Applications/VLC.app/Contents/MacOS/include")
"/Applications/VLC.app/Contents/MacOS/include")
endif() endif()
if(WIN32) if(WIN32)
@ -215,7 +225,7 @@ if(DEFINED libCEC_FOUND)
list(APPEND COMMON_INCLUDE_DIRS ${libCEC_INCLUDE_DIR}) list(APPEND COMMON_INCLUDE_DIRS ${libCEC_INCLUDE_DIR})
endif() endif()
# Add ALSA for Linux 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()
@ -239,12 +249,8 @@ else()
endif() endif()
endif() endif()
# Define libraries and directories. #---------------------------------------------------------------------------------------------------
if(DEFINED BCMHOST) # Dependency libraries.
link_directories("${CMAKE_FIND_ROOT_PATH}/opt/vc/lib")
elseif(DEFINED VERO4K)
link_directories("${CMAKE_FIND_ROOT_PATH}/opt/vero3/lib")
endif()
if(NOT WIN32) if(NOT WIN32)
set(COMMON_LIBRARIES set(COMMON_LIBRARIES
@ -316,8 +322,10 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
endif() endif()
if(DEFINED BCMHOST) if(DEFINED BCMHOST)
link_directories("${CMAKE_FIND_ROOT_PATH}/opt/vc/lib")
list(APPEND COMMON_LIBRARIES bcm_host brcmEGL ${OPENGLES_LIBRARIES}) list(APPEND COMMON_LIBRARIES bcm_host brcmEGL ${OPENGLES_LIBRARIES})
elseif(DEFINED VERO4K) elseif(DEFINED VERO4K)
link_directories("${CMAKE_FIND_ROOT_PATH}/opt/vero3/lib")
list(APPEND COMMON_LIBRARIES EGL ${OPENGLES_LIBRARIES}) list(APPEND COMMON_LIBRARIES EGL ${OPENGLES_LIBRARIES})
else() else()
if(${GLSystem} MATCHES "Desktop OpenGL") if(${GLSystem} MATCHES "Desktop OpenGL")
@ -328,7 +336,8 @@ else()
endif() endif()
#--------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------
# Set up build directories. # Build directories.
set(dir ${CMAKE_CURRENT_SOURCE_DIR}) set(dir ${CMAKE_CURRENT_SOURCE_DIR})
set(EXECUTABLE_OUTPUT_PATH ${dir} CACHE PATH "Build directory" FORCE) set(EXECUTABLE_OUTPUT_PATH ${dir} CACHE PATH "Build directory" FORCE)
set(LIBRARY_OUTPUT_PATH ${dir} CACHE PATH "Build directory" FORCE) set(LIBRARY_OUTPUT_PATH ${dir} CACHE PATH "Build directory" FORCE)

View file

@ -13,7 +13,7 @@ set(ES_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/src/SystemScreensaver.h ${CMAKE_CURRENT_SOURCE_DIR}/src/SystemScreensaver.h
${CMAKE_CURRENT_SOURCE_DIR}/src/CollectionSystemsManager.h ${CMAKE_CURRENT_SOURCE_DIR}/src/CollectionSystemsManager.h
# Guis # GUIs
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMetaDataEd.h ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMetaDataEd.h
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGameScraper.h ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGameScraper.h
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGamelistOptions.h ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGamelistOptions.h
@ -61,7 +61,7 @@ set(ES_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/SystemScreensaver.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/SystemScreensaver.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/CollectionSystemsManager.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/CollectionSystemsManager.cpp
# Guis # GUIs
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMetaDataEd.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMetaDataEd.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGameScraper.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGameScraper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGamelistOptions.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGamelistOptions.cpp
@ -93,12 +93,13 @@ set(ES_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/views/UIModeController.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/views/UIModeController.cpp
) )
#---------------------------------------------------------------------------------------------------
# Define OS specific sources and headers.
if(WIN32) if(WIN32)
LIST(APPEND ES_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/assets/EmulationStation.rc) LIST(APPEND ES_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/assets/EmulationStation.rc)
endif() endif()
#---------------------------------------------------------------------------------------------------
# OS-specific installation and package generation setup.
# Define target. # Define target.
if(APPLE OR WIN32) if(APPLE OR WIN32)
include_directories(${COMMON_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/src) include_directories(${COMMON_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/src)
@ -210,6 +211,7 @@ include(InstallRequiredSystemLibraries)
#--------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------
# General CPack settings. # General CPack settings.
set(CPACK_PACKAGE_NAME "emulationstation-de") set(CPACK_PACKAGE_NAME "emulationstation-de")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "EmulationStation Desktop Edition is a front-end for browsing and launching games from your multi-platform game collection") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "EmulationStation Desktop Edition is a front-end for browsing and launching games from your multi-platform game collection")
set(CPACK_PACKAGE_DESCRIPTION "ES-DE is a feature-rich gaming front-end that is intended to be used in conjunction with emulators such as the RetroArch cores.") set(CPACK_PACKAGE_DESCRIPTION "ES-DE is a feature-rich gaming front-end that is intended to be used in conjunction with emulators such as the RetroArch cores.")

View file

@ -23,7 +23,7 @@ set(CORE_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/src/animations/AnimationController.h ${CMAKE_CURRENT_SOURCE_DIR}/src/animations/AnimationController.h
${CMAKE_CURRENT_SOURCE_DIR}/src/animations/LambdaAnimation.h ${CMAKE_CURRENT_SOURCE_DIR}/src/animations/LambdaAnimation.h
# GuiComponents # GUI components
${CMAKE_CURRENT_SOURCE_DIR}/src/components/AnimatedImageComponent.h ${CMAKE_CURRENT_SOURCE_DIR}/src/components/AnimatedImageComponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/BusyComponent.h ${CMAKE_CURRENT_SOURCE_DIR}/src/components/BusyComponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/ButtonComponent.h ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ButtonComponent.h
@ -50,7 +50,7 @@ set(CORE_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/src/components/VideoOmxComponent.h ${CMAKE_CURRENT_SOURCE_DIR}/src/components/VideoOmxComponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/VideoVlcComponent.h ${CMAKE_CURRENT_SOURCE_DIR}/src/components/VideoVlcComponent.h
# Guis # GUIs
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiDetectDevice.h ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiDetectDevice.h
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiInputConfig.h ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiInputConfig.h
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMsgBox.h ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMsgBox.h
@ -103,7 +103,7 @@ set(CORE_SOURCES
# Animations # Animations
${CMAKE_CURRENT_SOURCE_DIR}/src/animations/AnimationController.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/animations/AnimationController.cpp
# GuiComponents # GUI components
${CMAKE_CURRENT_SOURCE_DIR}/src/components/AnimatedImageComponent.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/components/AnimatedImageComponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/BusyComponent.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/components/BusyComponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/ButtonComponent.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/components/ButtonComponent.cpp
@ -126,7 +126,7 @@ set(CORE_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/components/VideoOmxComponent.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/components/VideoOmxComponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/VideoVlcComponent.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/components/VideoVlcComponent.cpp
# Guis # GUIs
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiDetectDevice.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiDetectDevice.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiInputConfig.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiInputConfig.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMsgBox.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMsgBox.cpp