2014-06-20 01:30:09 +00:00
|
|
|
cmake_minimum_required(VERSION 2.8)
|
2013-05-14 19:40:21 +00:00
|
|
|
|
2019-08-08 20:16:11 +00:00
|
|
|
option(GLES "Set to ON if targeting Embedded OpenGL" ${GLES})
|
2017-08-19 12:33:50 +00:00
|
|
|
option(GL "Set to ON if targeting Desktop OpenGL" ${GL})
|
2019-07-17 11:53:10 +00:00
|
|
|
option(RPI "Set to ON to enable the Raspberry PI video player (omxplayer)" ${RPI})
|
2019-08-29 12:11:09 +00:00
|
|
|
option(CEC "Set to ON to enable CEC" ${CEC})
|
2017-08-19 12:33:50 +00:00
|
|
|
|
2014-06-21 01:03:05 +00:00
|
|
|
project(emulationstation-all)
|
2013-05-14 19:40:21 +00:00
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
#add local find scripts to CMAKE path
|
|
|
|
LIST(APPEND CMAKE_MODULE_PATH
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/CMake/Utils
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/CMake/Packages
|
|
|
|
)
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
#set up OpenGL system variable
|
2017-08-19 12:33:50 +00:00
|
|
|
if(GLES)
|
2019-08-08 20:16:11 +00:00
|
|
|
set(GLSystem "Embedded OpenGL" CACHE STRING "The OpenGL system to be used")
|
2017-08-19 12:33:50 +00:00
|
|
|
elseif(GL)
|
|
|
|
set(GLSystem "Desktop OpenGL" CACHE STRING "The OpenGL system to be used")
|
2013-05-14 19:40:21 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
#check if we're running on Raspberry Pi
|
2019-04-16 15:29:12 +00:00
|
|
|
elseif(EXISTS "${CMAKE_FIND_ROOT_PATH}/opt/vc/include/bcm_host.h")
|
2013-05-14 19:40:21 +00:00
|
|
|
MESSAGE("bcm_host.h found")
|
|
|
|
set(BCMHOST found)
|
2019-08-08 20:16:11 +00:00
|
|
|
set(GLSystem "Embedded OpenGL" CACHE STRING "The OpenGL system to be used")
|
2015-01-06 20:41:00 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
2018-07-26 19:14:11 +00:00
|
|
|
#check if we're running on OSMC Vero4K
|
2019-04-16 15:29:12 +00:00
|
|
|
elseif(EXISTS "${CMAKE_FIND_ROOT_PATH}/opt/vero3/lib/libMali.so")
|
2018-07-26 19:14:11 +00:00
|
|
|
MESSAGE("libMali.so found")
|
|
|
|
set(VERO4K found)
|
2019-08-08 20:16:11 +00:00
|
|
|
set(GLSystem "Embedded OpenGL" CACHE STRING "The OpenGL system to be used")
|
2018-07-26 19:14:11 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
2016-12-15 17:57:20 +00:00
|
|
|
#check if we're running on olinuxino / odroid / etc
|
2019-04-16 15:29:12 +00:00
|
|
|
elseif(EXISTS "${CMAKE_FIND_ROOT_PATH}/usr/lib/libMali.so" OR
|
|
|
|
EXISTS "${CMAKE_FIND_ROOT_PATH}/usr/lib/arm-linux-gnueabihf/libMali.so" OR
|
|
|
|
EXISTS "${CMAKE_FIND_ROOT_PATH}/usr/lib/aarch64-linux-gnu/libMali.so" OR
|
|
|
|
EXISTS "${CMAKE_FIND_ROOT_PATH}/usr/lib/arm-linux-gnueabihf/mali-egl/libmali.so" OR
|
|
|
|
EXISTS "${CMAKE_FIND_ROOT_PATH}/usr/lib/arm-linux-gnueabihf/libmali.so")
|
2015-01-06 20:41:00 +00:00
|
|
|
MESSAGE("libMali.so found")
|
2019-08-08 20:16:11 +00:00
|
|
|
set(GLSystem "Embedded OpenGL" CACHE STRING "The OpenGL system to be used")
|
2015-01-06 20:41:00 +00:00
|
|
|
else()
|
2017-08-19 12:33:50 +00:00
|
|
|
set(GLSystem "Desktop OpenGL" CACHE STRING "The OpenGL system to be used")
|
|
|
|
endif(GLES)
|
|
|
|
|
2019-08-08 20:16:11 +00:00
|
|
|
set_property(CACHE GLSystem PROPERTY STRINGS "Desktop OpenGL" "Embedded OpenGL")
|
2015-01-06 20:41:00 +00:00
|
|
|
|
2013-05-14 19:40:21 +00:00
|
|
|
#finding necessary packages
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
if(${GLSystem} MATCHES "Desktop OpenGL")
|
|
|
|
find_package(OpenGL REQUIRED)
|
|
|
|
else()
|
|
|
|
find_package(OpenGLES REQUIRED)
|
|
|
|
endif()
|
2013-12-15 00:52:12 +00:00
|
|
|
find_package(Freetype REQUIRED)
|
2013-05-14 19:40:21 +00:00
|
|
|
find_package(FreeImage REQUIRED)
|
2013-08-18 17:17:24 +00:00
|
|
|
find_package(SDL2 REQUIRED)
|
2013-10-10 18:11:01 +00:00
|
|
|
find_package(CURL REQUIRED)
|
2016-12-04 23:47:34 +00:00
|
|
|
find_package(VLC REQUIRED)
|
2019-02-08 02:08:11 +00:00
|
|
|
find_package(RapidJSON REQUIRED)
|
2019-08-29 12:11:09 +00:00
|
|
|
|
|
|
|
#add libCEC support
|
|
|
|
if(CEC)
|
|
|
|
find_package(libCEC REQUIRED)
|
|
|
|
endif()
|
2013-05-14 19:40:21 +00:00
|
|
|
|
2013-05-22 17:11:10 +00:00
|
|
|
#add ALSA for Linux
|
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
|
|
find_package(ALSA REQUIRED)
|
|
|
|
endif()
|
|
|
|
|
2013-05-14 19:40:21 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
#set up compiler flags and excutable names
|
2019-07-17 11:53:10 +00:00
|
|
|
if(DEFINED BCMHOST OR RPI)
|
2013-05-14 19:40:21 +00:00
|
|
|
add_definitions(-D_RPI_)
|
|
|
|
endif()
|
|
|
|
|
2018-07-26 19:14:11 +00:00
|
|
|
if(DEFINED VERO4K)
|
|
|
|
add_definitions(-D_VERO4K_)
|
|
|
|
endif()
|
|
|
|
|
2017-11-08 22:22:15 +00:00
|
|
|
if(DEFINED libCEC_FOUND)
|
|
|
|
add_definitions(-DHAVE_LIBCEC)
|
|
|
|
endif()
|
|
|
|
|
2013-09-15 17:56:47 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
|
2013-05-14 19:40:21 +00:00
|
|
|
if(MSVC)
|
|
|
|
set(CMAKE_DEBUG_POSTFIX "d")
|
|
|
|
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
|
|
|
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
|
2017-11-17 11:42:33 +00:00
|
|
|
add_definitions(-DNOMINMAX)
|
2013-05-17 09:58:43 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") #multi-processor compilation
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP") #multi-processor compilation
|
2013-05-14 19:40:21 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
2013-05-24 09:36:29 +00:00
|
|
|
#check for G++ 4.7+
|
|
|
|
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE G++_VERSION)
|
|
|
|
if (G++_VERSION VERSION_LESS 4.7)
|
|
|
|
message(SEND_ERROR "You need at least G++ 4.7 to compile EmulationStation!")
|
2013-05-22 17:15:44 +00:00
|
|
|
endif()
|
2014-06-20 01:30:09 +00:00
|
|
|
|
2013-05-22 17:15:44 +00:00
|
|
|
#set up compiler flags for GCC
|
2016-11-17 20:37:44 +00:00
|
|
|
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
2017-03-13 21:11:07 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-attributes -O0") #support C++11 for std::, optimize
|
2016-11-17 20:37:44 +00:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O0")
|
|
|
|
else()
|
2017-04-04 03:54:04 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-attributes -O2") #support C++11 for std::, optimize
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O2") #-s = strip binary
|
2013-05-14 19:40:21 +00:00
|
|
|
endif()
|
2016-11-17 20:37:44 +00:00
|
|
|
endif()
|
2013-05-14 19:40:21 +00:00
|
|
|
|
|
|
|
if(${GLSystem} MATCHES "Desktop OpenGL")
|
2019-08-08 20:16:11 +00:00
|
|
|
add_definitions(-DUSE_OPENGL_21)
|
2013-05-14 19:40:21 +00:00
|
|
|
else()
|
2019-08-08 20:16:11 +00:00
|
|
|
add_definitions(-DUSE_OPENGLES_10)
|
2013-05-14 19:40:21 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
#add include directories
|
2014-06-20 01:30:09 +00:00
|
|
|
set(COMMON_INCLUDE_DIRS
|
2013-05-14 19:40:21 +00:00
|
|
|
${FREETYPE_INCLUDE_DIRS}
|
|
|
|
${FreeImage_INCLUDE_DIRS}
|
2013-08-18 17:17:24 +00:00
|
|
|
${SDL2_INCLUDE_DIR}
|
2013-10-10 18:11:01 +00:00
|
|
|
${CURL_INCLUDE_DIR}
|
2016-12-04 23:47:34 +00:00
|
|
|
${VLC_INCLUDE_DIR}
|
2019-02-08 02:08:11 +00:00
|
|
|
${RAPIDJSON_INCLUDE_DIRS}
|
2014-06-20 01:30:09 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/external
|
2014-06-21 01:03:05 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/es-core/src
|
2013-05-14 19:40:21 +00:00
|
|
|
)
|
|
|
|
|
2017-11-08 22:22:15 +00:00
|
|
|
#add libCEC_INCLUDE_DIR
|
|
|
|
if(DEFINED libCEC_FOUND)
|
|
|
|
LIST(APPEND COMMON_INCLUDE_DIRS
|
|
|
|
${libCEC_INCLUDE_DIR}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2013-05-22 17:11:10 +00:00
|
|
|
#add ALSA for Linux
|
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
2014-06-20 01:30:09 +00:00
|
|
|
LIST(APPEND COMMON_INCLUDE_DIRS
|
2013-05-22 17:11:10 +00:00
|
|
|
${ALSA_INCLUDE_DIRS}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2013-05-14 19:40:21 +00:00
|
|
|
if(DEFINED BCMHOST)
|
2014-06-20 01:30:09 +00:00
|
|
|
LIST(APPEND COMMON_INCLUDE_DIRS
|
2019-04-16 15:29:12 +00:00
|
|
|
"${CMAKE_FIND_ROOT_PATH}/opt/vc/include"
|
|
|
|
"${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/vcos/pthreads"
|
2013-05-14 19:40:21 +00:00
|
|
|
)
|
2018-07-26 19:14:11 +00:00
|
|
|
#add include directory for Vero4K
|
|
|
|
elseif(DEFINED VERO4K)
|
|
|
|
LIST(APPEND COMMON_INCLUDE_DIRS
|
2019-04-16 15:29:12 +00:00
|
|
|
"${CMAKE_FIND_ROOT_PATH}/opt/vero3/include"
|
2018-07-26 19:14:11 +00:00
|
|
|
)
|
2013-05-15 07:50:59 +00:00
|
|
|
else()
|
|
|
|
if(${GLSystem} MATCHES "Desktop OpenGL")
|
2014-06-20 01:30:09 +00:00
|
|
|
LIST(APPEND COMMON_INCLUDE_DIRS
|
2013-05-15 07:50:59 +00:00
|
|
|
${OPENGL_INCLUDE_DIR}
|
|
|
|
)
|
|
|
|
else()
|
2014-06-20 01:30:09 +00:00
|
|
|
LIST(APPEND COMMON_INCLUDE_DIRS
|
2013-05-15 07:50:59 +00:00
|
|
|
${OPENGLES_INCLUDE_DIR}
|
|
|
|
)
|
|
|
|
endif()
|
2013-05-14 19:40:21 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
#define libraries and directories
|
2013-05-16 10:04:02 +00:00
|
|
|
if(DEFINED BCMHOST)
|
|
|
|
link_directories(
|
2019-04-16 15:29:12 +00:00
|
|
|
"${CMAKE_FIND_ROOT_PATH}/opt/vc/lib"
|
2013-05-16 10:04:02 +00:00
|
|
|
)
|
2018-07-26 19:14:11 +00:00
|
|
|
elseif(DEFINED VERO4K)
|
|
|
|
link_directories(
|
2019-04-16 15:29:12 +00:00
|
|
|
"${CMAKE_FIND_ROOT_PATH}/opt/vero3/lib"
|
2018-07-26 19:14:11 +00:00
|
|
|
)
|
2013-05-16 10:04:02 +00:00
|
|
|
endif()
|
|
|
|
|
2014-06-20 01:30:09 +00:00
|
|
|
set(COMMON_LIBRARIES
|
2013-05-16 10:04:02 +00:00
|
|
|
${FREETYPE_LIBRARIES}
|
|
|
|
${FreeImage_LIBRARIES}
|
2017-11-08 22:22:15 +00:00
|
|
|
${SDL2_LIBRARY}
|
2013-10-10 18:11:01 +00:00
|
|
|
${CURL_LIBRARIES}
|
2016-12-04 23:47:34 +00:00
|
|
|
${VLC_LIBRARIES}
|
2014-06-20 01:30:09 +00:00
|
|
|
pugixml
|
|
|
|
nanosvg
|
2013-05-14 19:40:21 +00:00
|
|
|
)
|
|
|
|
|
2017-11-08 22:22:15 +00:00
|
|
|
#add libCEC_LIBRARIES
|
|
|
|
if(DEFINED libCEC_FOUND)
|
2017-11-19 23:06:04 +00:00
|
|
|
if(DEFINED BCMHOST)
|
|
|
|
LIST(APPEND COMMON_LIBRARIES
|
|
|
|
vchiq_arm
|
|
|
|
)
|
|
|
|
endif()
|
2017-11-08 22:22:15 +00:00
|
|
|
LIST(APPEND COMMON_LIBRARIES
|
|
|
|
dl
|
|
|
|
${libCEC_LIBRARIES}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2013-05-22 17:11:10 +00:00
|
|
|
#add ALSA for Linux
|
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
2014-06-20 01:30:09 +00:00
|
|
|
LIST(APPEND COMMON_LIBRARIES
|
2013-05-22 17:11:10 +00:00
|
|
|
${ALSA_LIBRARY}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2013-05-14 19:40:21 +00:00
|
|
|
if(DEFINED BCMHOST)
|
2014-06-20 01:30:09 +00:00
|
|
|
LIST(APPEND COMMON_LIBRARIES
|
2013-05-14 19:40:21 +00:00
|
|
|
bcm_host
|
2017-10-04 04:19:02 +00:00
|
|
|
brcmEGL
|
2013-05-24 09:36:29 +00:00
|
|
|
${OPENGLES_LIBRARIES}
|
2013-05-14 19:40:21 +00:00
|
|
|
)
|
2018-07-26 19:14:11 +00:00
|
|
|
elseif(DEFINED VERO4K)
|
|
|
|
LIST(APPEND COMMON_LIBRARIES
|
|
|
|
EGL
|
|
|
|
${OPENGLES_LIBRARIES}
|
|
|
|
)
|
2013-05-15 07:50:59 +00:00
|
|
|
else()
|
2013-05-22 17:11:10 +00:00
|
|
|
if(MSVC)
|
2014-06-20 01:30:09 +00:00
|
|
|
LIST(APPEND COMMON_LIBRARIES
|
2013-05-22 17:11:10 +00:00
|
|
|
winmm
|
|
|
|
)
|
|
|
|
endif()
|
2013-05-15 07:50:59 +00:00
|
|
|
if(${GLSystem} MATCHES "Desktop OpenGL")
|
2014-06-20 01:30:09 +00:00
|
|
|
LIST(APPEND COMMON_LIBRARIES
|
2013-05-15 07:50:59 +00:00
|
|
|
${OPENGL_LIBRARIES}
|
|
|
|
)
|
|
|
|
else()
|
2014-06-20 01:30:09 +00:00
|
|
|
LIST(APPEND COMMON_LIBRARIES
|
2015-01-06 20:41:00 +00:00
|
|
|
EGL
|
2013-05-15 07:50:59 +00:00
|
|
|
${OPENGLES_LIBRARIES}
|
|
|
|
)
|
|
|
|
endif()
|
2013-05-14 19:40:21 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------
|
2014-06-20 01:30:09 +00:00
|
|
|
# set up build directories
|
2013-05-14 19:40:21 +00:00
|
|
|
set(dir ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
set(EXECUTABLE_OUTPUT_PATH ${dir} CACHE PATH "Build directory" FORCE)
|
|
|
|
set(LIBRARY_OUTPUT_PATH ${dir} CACHE PATH "Build directory" FORCE)
|
|
|
|
|
2014-06-03 18:57:44 +00:00
|
|
|
|
2014-06-20 01:30:09 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# add each component
|
2014-06-03 01:33:59 +00:00
|
|
|
|
2014-06-20 01:30:09 +00:00
|
|
|
add_subdirectory("external")
|
2014-06-21 01:03:05 +00:00
|
|
|
add_subdirectory("es-core")
|
2014-06-25 16:29:58 +00:00
|
|
|
add_subdirectory("es-app")
|