2014-06-20 01:30:09 +00:00
|
|
|
cmake_minimum_required(VERSION 2.8)
|
2013-05-14 19:40:21 +00:00
|
|
|
|
2017-08-19 12:33:50 +00:00
|
|
|
option(GLES "Set to ON if targeting OpenGL ES" ${GLES})
|
|
|
|
option(GL "Set to ON if targeting Desktop OpenGL" ${GL})
|
|
|
|
|
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)
|
|
|
|
set(GLSystem "OpenGL ES" CACHE STRING "The OpenGL system to be used")
|
|
|
|
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
|
2017-08-19 12:33:50 +00:00
|
|
|
elseif(EXISTS "/opt/vc/include/bcm_host.h")
|
2013-05-14 19:40:21 +00:00
|
|
|
MESSAGE("bcm_host.h found")
|
|
|
|
set(BCMHOST found)
|
2017-08-19 12:33:50 +00:00
|
|
|
set(GLSystem "OpenGL ES" CACHE STRING "The OpenGL system to be used")
|
2015-01-06 20:41:00 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
2016-12-15 17:57:20 +00:00
|
|
|
#check if we're running on olinuxino / odroid / etc
|
2017-08-19 12:33:50 +00:00
|
|
|
elseif(EXISTS "/usr/lib/libMali.so" OR
|
|
|
|
EXISTS "/usr/lib/arm-linux-gnueabihf/libMali.so" OR
|
|
|
|
EXISTS "/usr/lib/aarch64-linux-gnu/libMali.so" OR
|
|
|
|
EXISTS "/usr/lib/arm-linux-gnueabihf/mali-egl/libmali.so" OR
|
|
|
|
EXISTS "/usr/lib/arm-linux-gnueabihf/libmali.so")
|
2015-01-06 20:41:00 +00:00
|
|
|
MESSAGE("libMali.so found")
|
2017-08-19 12:33:50 +00:00
|
|
|
set(GLSystem "OpenGL ES" 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)
|
|
|
|
|
|
|
|
set_property(CACHE GLSystem PROPERTY STRINGS "Desktop OpenGL" "OpenGL ES")
|
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)
|
2016-11-17 20:37:44 +00:00
|
|
|
if(MSVC)
|
2017-10-30 09:29:08 +00:00
|
|
|
find_package(Boost REQUIRED COMPONENTS system date_time)
|
2016-11-17 20:37:44 +00:00
|
|
|
else()
|
2017-10-30 09:29:08 +00:00
|
|
|
find_package(Boost REQUIRED COMPONENTS system filesystem date_time)
|
2016-11-17 20:37:44 +00:00
|
|
|
endif()
|
2013-10-10 18:11:01 +00:00
|
|
|
find_package(CURL REQUIRED)
|
2016-12-04 23:47:34 +00:00
|
|
|
find_package(VLC REQUIRED)
|
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
|
|
|
|
if(DEFINED BCMHOST)
|
|
|
|
add_definitions(-D_RPI_)
|
|
|
|
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)
|
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")
|
|
|
|
add_definitions(-DUSE_OPENGL_DESKTOP)
|
|
|
|
else()
|
|
|
|
add_definitions(-DUSE_OPENGL_ES)
|
|
|
|
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-05-14 19:40:21 +00:00
|
|
|
${Boost_INCLUDE_DIRS}
|
2013-10-10 18:11:01 +00:00
|
|
|
${CURL_INCLUDE_DIR}
|
2016-12-04 23:47:34 +00:00
|
|
|
${VLC_INCLUDE_DIR}
|
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
|
|
|
)
|
|
|
|
|
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
|
2013-05-14 19:40:21 +00:00
|
|
|
"/opt/vc/include"
|
|
|
|
"/opt/vc/include/interface/vcos"
|
|
|
|
"/opt/vc/include/interface/vmcs_host/linux"
|
|
|
|
"/opt/vc/include/interface/vcos/pthreads"
|
|
|
|
)
|
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(
|
|
|
|
${Boost_LIBRARY_DIRS}
|
|
|
|
"/opt/vc/lib"
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
link_directories(
|
|
|
|
${Boost_LIBRARY_DIRS}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2014-06-20 01:30:09 +00:00
|
|
|
set(COMMON_LIBRARIES
|
2013-05-16 10:04:02 +00:00
|
|
|
${Boost_LIBRARIES}
|
|
|
|
${FREETYPE_LIBRARIES}
|
|
|
|
${FreeImage_LIBRARIES}
|
2013-08-18 17:17:24 +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
|
|
|
)
|
|
|
|
|
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
|
|
|
)
|
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")
|