mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-24 07:05:39 +00:00
Use CMake to generate EmulationStation build files
CMake is much more versatile, providing build support on multiple platforms to generate Makefiles. This should serve as a starting point for CMake builds. Please note the /CMake/* scripts are actually ripped from the ORGE3D repositories, but they seem to be in the Public Domain. Thanks!
This commit is contained in:
parent
af9b9f732f
commit
eb4bafcb2f
49
CMake/Packages/FindFreeImage.cmake
Normal file
49
CMake/Packages/FindFreeImage.cmake
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
#snapped from: https://bitbucket.org/sinbad/ogre/src/0bba4f7cdb95/CMake/Packages/FindFreeImage.cmake?at=default
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
# This file is part of the CMake build system for OGRE
|
||||||
|
# (Object-oriented Graphics Rendering Engine)
|
||||||
|
# For the latest info, see httpwww.ogre3d.org
|
||||||
|
#
|
||||||
|
# The contents of this file are placed in the public domain. Feel
|
||||||
|
# free to make use of it in any way you like.
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
# - Try to find FreeImage
|
||||||
|
# Once done, this will define
|
||||||
|
#
|
||||||
|
# FreeImage_FOUND - system has FreeImage
|
||||||
|
# FreeImage_INCLUDE_DIRS - the FreeImage include directories
|
||||||
|
# FreeImage_LIBRARIES - link these to use FreeImage
|
||||||
|
|
||||||
|
include(FindPkgMacros)
|
||||||
|
findpkg_begin(FreeImage)
|
||||||
|
|
||||||
|
# Get path, convert backslashes as ${ENV_${var}}
|
||||||
|
getenv_path(FREEIMAGE_HOME)
|
||||||
|
|
||||||
|
# construct search paths
|
||||||
|
set(FreeImage_PREFIX_PATH ${FREEIMAGE_HOME} ${ENV_FREEIMAGE_HOME})
|
||||||
|
create_search_paths(FreeImage)
|
||||||
|
# redo search if prefix path changed
|
||||||
|
clear_if_changed(FreeImage_PREFIX_PATH
|
||||||
|
FreeImage_LIBRARY_FWK
|
||||||
|
FreeImage_LIBRARY_REL
|
||||||
|
FreeImage_LIBRARY_DBG
|
||||||
|
FreeImage_INCLUDE_DIR
|
||||||
|
)
|
||||||
|
|
||||||
|
set(FreeImage_LIBRARY_NAMES freeimage freeimageLib)
|
||||||
|
get_debug_names(FreeImage_LIBRARY_NAMES)
|
||||||
|
|
||||||
|
use_pkgconfig(FreeImage_PKGC freeimage)
|
||||||
|
|
||||||
|
findpkg_framework(FreeImage)
|
||||||
|
|
||||||
|
find_path(FreeImage_INCLUDE_DIR NAMES FreeImage.h HINTS ${FreeImage_INC_SEARCH_PATH} ${FreeImage_PKGC_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
find_library(FreeImage_LIBRARY_REL NAMES ${FreeImage_LIBRARY_NAMES} HINTS ${FreeImage_LIB_SEARCH_PATH} ${FreeImage_PKGC_LIBRARY_DIRS} PATH_SUFFIXES release relwithdebinfo minsizerel)
|
||||||
|
find_library(FreeImage_LIBRARY_DBG NAMES ${FreeImage_LIBRARY_NAMES_DBG} HINTS ${FreeImage_LIB_SEARCH_PATH} ${FreeImage_PKGC_LIBRARY_DIRS} PATH_SUFFIXES debug)
|
||||||
|
|
||||||
|
make_library_set(FreeImage_LIBRARY)
|
||||||
|
|
||||||
|
findpkg_finish(FreeImage)
|
62
CMake/Packages/FindFreeType.cmake
Normal file
62
CMake/Packages/FindFreeType.cmake
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
#snapped from: https://bitbucket.org/sinbad/ogre/src/0bba4f7cdb95/CMake/Packages/FindFreetype.cmake?at=default
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
# This file is part of the CMake build system for OGRE
|
||||||
|
# (Object-oriented Graphics Rendering Engine)
|
||||||
|
# For the latest info, see http://www.ogre3d.org/
|
||||||
|
#
|
||||||
|
# The contents of this file are placed in the public domain. Feel
|
||||||
|
# free to make use of it in any way you like.
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
# - Try to find FreeType
|
||||||
|
# Once done, this will define
|
||||||
|
#
|
||||||
|
# FREETYPE_FOUND - system has FreeType
|
||||||
|
# FREETYPE_INCLUDE_DIRS - the FreeType include directories
|
||||||
|
# FREETYPE_LIBRARIES - link these to use FreeType
|
||||||
|
|
||||||
|
include(FindPkgMacros)
|
||||||
|
findpkg_begin(FREETYPE)
|
||||||
|
|
||||||
|
# Get path, convert backslashes as ${ENV_${var}}
|
||||||
|
getenv_path(FREETYPE_HOME)
|
||||||
|
|
||||||
|
# construct search paths
|
||||||
|
set(FREETYPE_PREFIX_PATH ${FREETYPE_HOME} ${ENV_FREETYPE_HOME})
|
||||||
|
create_search_paths(FREETYPE)
|
||||||
|
# redo search if prefix path changed
|
||||||
|
clear_if_changed(FREETYPE_PREFIX_PATH
|
||||||
|
FREETYPE_LIBRARY_FWK
|
||||||
|
FREETYPE_LIBRARY_REL
|
||||||
|
FREETYPE_LIBRARY_DBG
|
||||||
|
FREETYPE_INCLUDE_DIR
|
||||||
|
)
|
||||||
|
|
||||||
|
set(FREETYPE_LIBRARY_NAMES freetype2411 freetype2410 freetype249 freetype248 freetype246 freetype2311 freetype239 freetype238 freetype235 freetype219 freetype)
|
||||||
|
get_debug_names(FREETYPE_LIBRARY_NAMES)
|
||||||
|
|
||||||
|
use_pkgconfig(FREETYPE_PKGC freetype2)
|
||||||
|
|
||||||
|
# prefer static library over framework
|
||||||
|
set(CMAKE_FIND_FRAMEWORK "LAST")
|
||||||
|
|
||||||
|
message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}")
|
||||||
|
findpkg_framework(FREETYPE)
|
||||||
|
message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}")
|
||||||
|
|
||||||
|
find_path(FREETYPE_INCLUDE_DIR NAMES freetype/freetype.h HINTS ${FREETYPE_INC_SEARCH_PATH} ${FREETYPE_PKGC_INCLUDE_DIRS} PATH_SUFFIXES freetype2)
|
||||||
|
find_path(FREETYPE_FT2BUILD_INCLUDE_DIR NAMES ft2build.h HINTS ${FREETYPE_INC_SEARCH_PATH} ${FREETYPE_PKGC_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
find_library(FREETYPE_LIBRARY_REL NAMES ${FREETYPE_LIBRARY_NAMES} HINTS ${FREETYPE_LIB_SEARCH_PATH} ${FREETYPE_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" release relwithdebinfo minsizerel)
|
||||||
|
find_library(FREETYPE_LIBRARY_DBG NAMES ${FREETYPE_LIBRARY_NAMES_DBG} HINTS ${FREETYPE_LIB_SEARCH_PATH} ${FREETYPE_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" debug)
|
||||||
|
|
||||||
|
make_library_set(FREETYPE_LIBRARY)
|
||||||
|
|
||||||
|
findpkg_finish(FREETYPE)
|
||||||
|
mark_as_advanced(FREETYPE_FT2BUILD_INCLUDE_DIR)
|
||||||
|
if (NOT FREETYPE_FT2BUILD_INCLUDE_DIR STREQUAL FREETYPE_INCLUDE_DIR)
|
||||||
|
set(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${FREETYPE_FT2BUILD_INCLUDE_DIR})
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Reset framework finding
|
||||||
|
set(CMAKE_FIND_FRAMEWORK "FIRST")
|
88
CMake/Packages/FindOpenGLES.cmake
Normal file
88
CMake/Packages/FindOpenGLES.cmake
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
#snapped from: https://bitbucket.org/sinbad/ogre/src/0bba4f7cdb95/CMake/Packages/FindOpenGLES.cmake?at=default
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
# This file is part of the CMake build system for OGRE
|
||||||
|
# (Object-oriented Graphics Rendering Engine)
|
||||||
|
# For the latest info, see http://www.ogre3d.org/
|
||||||
|
#
|
||||||
|
# The contents of this file are placed in the public domain. Feel
|
||||||
|
# free to make use of it in any way you like.
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
# - Try to find OpenGLES
|
||||||
|
# Once done this will define
|
||||||
|
#
|
||||||
|
# OPENGLES_FOUND - system has OpenGLES
|
||||||
|
# OPENGLES_INCLUDE_DIR - the GL include directory
|
||||||
|
# OPENGLES_LIBRARIES - Link these to use OpenGLES
|
||||||
|
|
||||||
|
IF (WIN32)
|
||||||
|
IF (CYGWIN)
|
||||||
|
|
||||||
|
FIND_PATH(OPENGLES_INCLUDE_DIR GLES/gl.h )
|
||||||
|
|
||||||
|
FIND_LIBRARY(OPENGLES_gl_LIBRARY libgles_cm )
|
||||||
|
|
||||||
|
ELSE (CYGWIN)
|
||||||
|
|
||||||
|
IF(BORLAND)
|
||||||
|
SET (OPENGLES_gl_LIBRARY import32 CACHE STRING "OpenGL ES 1.x library for win32")
|
||||||
|
ELSE(BORLAND)
|
||||||
|
#MS compiler - todo - fix the following line:
|
||||||
|
SET (OPENGLES_gl_LIBRARY ${OGRE_SOURCE_DIR}/Dependencies/lib/release/libgles_cm.lib CACHE STRING "OpenGL ES 1.x library for win32")
|
||||||
|
ENDIF(BORLAND)
|
||||||
|
|
||||||
|
ENDIF (CYGWIN)
|
||||||
|
|
||||||
|
ELSE (WIN32)
|
||||||
|
|
||||||
|
IF (APPLE)
|
||||||
|
|
||||||
|
create_search_paths(/Developer/Platforms)
|
||||||
|
findpkg_framework(OpenGLES)
|
||||||
|
set(OPENGLES_gl_LIBRARY "-framework OpenGLES")
|
||||||
|
|
||||||
|
ELSE(APPLE)
|
||||||
|
|
||||||
|
FIND_PATH(OPENGLES_INCLUDE_DIR GLES/gl.h
|
||||||
|
/usr/openwin/share/include
|
||||||
|
/opt/graphics/OpenGL/include /usr/X11R6/include
|
||||||
|
/usr/include
|
||||||
|
)
|
||||||
|
|
||||||
|
FIND_LIBRARY(OPENGLES_gl_LIBRARY
|
||||||
|
NAMES GLES_CM GLESv1_CM
|
||||||
|
PATHS /opt/graphics/OpenGL/lib
|
||||||
|
/usr/openwin/lib
|
||||||
|
/usr/shlib /usr/X11R6/lib
|
||||||
|
/usr/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
# On Unix OpenGL most certainly always requires X11.
|
||||||
|
# Feel free to tighten up these conditions if you don't
|
||||||
|
# think this is always true.
|
||||||
|
|
||||||
|
IF (OPENGLES_gl_LIBRARY)
|
||||||
|
IF(NOT X11_FOUND)
|
||||||
|
INCLUDE(FindX11)
|
||||||
|
ENDIF(NOT X11_FOUND)
|
||||||
|
IF (X11_FOUND)
|
||||||
|
SET (OPENGLES_LIBRARIES ${X11_LIBRARIES})
|
||||||
|
ENDIF (X11_FOUND)
|
||||||
|
ENDIF (OPENGLES_gl_LIBRARY)
|
||||||
|
|
||||||
|
ENDIF(APPLE)
|
||||||
|
ENDIF (WIN32)
|
||||||
|
|
||||||
|
SET( OPENGLES_FOUND "NO" )
|
||||||
|
IF(OPENGLES_gl_LIBRARY)
|
||||||
|
|
||||||
|
SET( OPENGLES_LIBRARIES ${OPENGLES_gl_LIBRARY} ${OPENGLES_LIBRARIES})
|
||||||
|
|
||||||
|
SET( OPENGLES_FOUND "YES" )
|
||||||
|
|
||||||
|
ENDIF(OPENGLES_gl_LIBRARY)
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED(
|
||||||
|
OPENGLES_INCLUDE_DIR
|
||||||
|
OPENGLES_gl_LIBRARY
|
||||||
|
)
|
164
CMake/Utils/FindPkgMacros.cmake
Normal file
164
CMake/Utils/FindPkgMacros.cmake
Normal file
|
@ -0,0 +1,164 @@
|
||||||
|
#snapped from: https://bitbucket.org/sinbad/ogre/src/0bba4f7cdb95/CMake/Utils/FindPkgMacros.cmake?at=default
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
# This file is part of the CMake build system for OGRE
|
||||||
|
# (Object-oriented Graphics Rendering Engine)
|
||||||
|
# For the latest info, see http://www.ogre3d.org/
|
||||||
|
#
|
||||||
|
# The contents of this file are placed in the public domain. Feel
|
||||||
|
# free to make use of it in any way you like.
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
# Provides some common functionality for the FindPackage modules
|
||||||
|
##################################################################
|
||||||
|
|
||||||
|
# Begin processing of package
|
||||||
|
macro(findpkg_begin PREFIX)
|
||||||
|
if (NOT ${PREFIX}_FIND_QUIETLY)
|
||||||
|
message(STATUS "Looking for ${PREFIX}...")
|
||||||
|
endif ()
|
||||||
|
endmacro(findpkg_begin)
|
||||||
|
|
||||||
|
# Display a status message unless FIND_QUIETLY is set
|
||||||
|
macro(pkg_message PREFIX)
|
||||||
|
if (NOT ${PREFIX}_FIND_QUIETLY)
|
||||||
|
message(STATUS ${ARGN})
|
||||||
|
endif ()
|
||||||
|
endmacro(pkg_message)
|
||||||
|
|
||||||
|
# Get environment variable, define it as ENV_$var and make sure backslashes are converted to forward slashes
|
||||||
|
macro(getenv_path VAR)
|
||||||
|
set(ENV_${VAR} $ENV{${VAR}})
|
||||||
|
# replace won't work if var is blank
|
||||||
|
if (ENV_${VAR})
|
||||||
|
string( REGEX REPLACE "\\\\" "/" ENV_${VAR} ${ENV_${VAR}} )
|
||||||
|
endif ()
|
||||||
|
endmacro(getenv_path)
|
||||||
|
|
||||||
|
# Construct search paths for includes and libraries from a PREFIX_PATH
|
||||||
|
macro(create_search_paths PREFIX)
|
||||||
|
foreach(dir ${${PREFIX}_PREFIX_PATH})
|
||||||
|
set(${PREFIX}_INC_SEARCH_PATH ${${PREFIX}_INC_SEARCH_PATH}
|
||||||
|
${dir}/include ${dir}/Include ${dir}/include/${PREFIX} ${dir}/Headers)
|
||||||
|
set(${PREFIX}_LIB_SEARCH_PATH ${${PREFIX}_LIB_SEARCH_PATH}
|
||||||
|
${dir}/lib ${dir}/Lib ${dir}/lib/${PREFIX} ${dir}/Libs)
|
||||||
|
set(${PREFIX}_BIN_SEARCH_PATH ${${PREFIX}_BIN_SEARCH_PATH}
|
||||||
|
${dir}/bin)
|
||||||
|
endforeach(dir)
|
||||||
|
if(ANDROID)
|
||||||
|
set(${PREFIX}_LIB_SEARCH_PATH ${${PREFIX}_LIB_SEARCH_PATH} ${OGRE_DEPENDENCIES_DIR}/lib/${ANDROID_ABI})
|
||||||
|
endif()
|
||||||
|
set(${PREFIX}_FRAMEWORK_SEARCH_PATH ${${PREFIX}_PREFIX_PATH})
|
||||||
|
endmacro(create_search_paths)
|
||||||
|
|
||||||
|
# clear cache variables if a certain variable changed
|
||||||
|
macro(clear_if_changed TESTVAR)
|
||||||
|
# test against internal check variable
|
||||||
|
# HACK: Apparently, adding a variable to the cache cleans up the list
|
||||||
|
# a bit. We need to also remove any empty strings from the list, but
|
||||||
|
# at the same time ensure that we are actually dealing with a list.
|
||||||
|
list(APPEND ${TESTVAR} "")
|
||||||
|
list(REMOVE_ITEM ${TESTVAR} "")
|
||||||
|
if (NOT "${${TESTVAR}}" STREQUAL "${${TESTVAR}_INT_CHECK}")
|
||||||
|
message(STATUS "${TESTVAR} changed.")
|
||||||
|
foreach(var ${ARGN})
|
||||||
|
set(${var} "NOTFOUND" CACHE STRING "x" FORCE)
|
||||||
|
endforeach(var)
|
||||||
|
endif ()
|
||||||
|
set(${TESTVAR}_INT_CHECK ${${TESTVAR}} CACHE INTERNAL "x" FORCE)
|
||||||
|
endmacro(clear_if_changed)
|
||||||
|
|
||||||
|
# Try to get some hints from pkg-config, if available
|
||||||
|
macro(use_pkgconfig PREFIX PKGNAME)
|
||||||
|
find_package(PkgConfig)
|
||||||
|
if (PKG_CONFIG_FOUND)
|
||||||
|
pkg_check_modules(${PREFIX} ${PKGNAME})
|
||||||
|
endif ()
|
||||||
|
endmacro (use_pkgconfig)
|
||||||
|
|
||||||
|
# Couple a set of release AND debug libraries (or frameworks)
|
||||||
|
macro(make_library_set PREFIX)
|
||||||
|
if (${PREFIX}_FWK)
|
||||||
|
set(${PREFIX} ${${PREFIX}_FWK})
|
||||||
|
elseif (${PREFIX}_REL AND ${PREFIX}_DBG)
|
||||||
|
set(${PREFIX} optimized ${${PREFIX}_REL} debug ${${PREFIX}_DBG})
|
||||||
|
elseif (${PREFIX}_REL)
|
||||||
|
set(${PREFIX} ${${PREFIX}_REL})
|
||||||
|
elseif (${PREFIX}_DBG)
|
||||||
|
set(${PREFIX} ${${PREFIX}_DBG})
|
||||||
|
endif ()
|
||||||
|
endmacro(make_library_set)
|
||||||
|
|
||||||
|
# Generate debug names from given release names
|
||||||
|
macro(get_debug_names PREFIX)
|
||||||
|
foreach(i ${${PREFIX}})
|
||||||
|
set(${PREFIX}_DBG ${${PREFIX}_DBG} ${i}d ${i}D ${i}_d ${i}_D ${i}_debug ${i})
|
||||||
|
endforeach(i)
|
||||||
|
endmacro(get_debug_names)
|
||||||
|
|
||||||
|
# Add the parent dir from DIR to VAR
|
||||||
|
macro(add_parent_dir VAR DIR)
|
||||||
|
get_filename_component(${DIR}_TEMP "${${DIR}}/.." ABSOLUTE)
|
||||||
|
set(${VAR} ${${VAR}} ${${DIR}_TEMP})
|
||||||
|
endmacro(add_parent_dir)
|
||||||
|
|
||||||
|
# Do the final processing for the package find.
|
||||||
|
macro(findpkg_finish PREFIX)
|
||||||
|
# skip if already processed during this run
|
||||||
|
if (NOT ${PREFIX}_FOUND)
|
||||||
|
if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY)
|
||||||
|
set(${PREFIX}_FOUND TRUE)
|
||||||
|
set(${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR})
|
||||||
|
set(${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY})
|
||||||
|
if (NOT ${PREFIX}_FIND_QUIETLY)
|
||||||
|
message(STATUS "Found ${PREFIX}: ${${PREFIX}_LIBRARIES}")
|
||||||
|
endif ()
|
||||||
|
else ()
|
||||||
|
if (NOT ${PREFIX}_FIND_QUIETLY)
|
||||||
|
message(STATUS "Could not locate ${PREFIX}")
|
||||||
|
endif ()
|
||||||
|
if (${PREFIX}_FIND_REQUIRED)
|
||||||
|
message(FATAL_ERROR "Required library ${PREFIX} not found! Install the library (including dev packages) and try again. If the library is already installed, set the missing variables manually in cmake.")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
mark_as_advanced(${PREFIX}_INCLUDE_DIR ${PREFIX}_LIBRARY ${PREFIX}_LIBRARY_REL ${PREFIX}_LIBRARY_DBG ${PREFIX}_LIBRARY_FWK)
|
||||||
|
endif ()
|
||||||
|
endmacro(findpkg_finish)
|
||||||
|
|
||||||
|
|
||||||
|
# Slightly customised framework finder
|
||||||
|
macro(findpkg_framework fwk)
|
||||||
|
if(APPLE)
|
||||||
|
set(${fwk}_FRAMEWORK_PATH
|
||||||
|
${${fwk}_FRAMEWORK_SEARCH_PATH}
|
||||||
|
${CMAKE_FRAMEWORK_PATH}
|
||||||
|
~/Library/Frameworks
|
||||||
|
/Library/Frameworks
|
||||||
|
/System/Library/Frameworks
|
||||||
|
/Network/Library/Frameworks
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/lib/macosx/Release
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/lib/macosx/Debug
|
||||||
|
)
|
||||||
|
# These could be arrays of paths, add each individually to the search paths
|
||||||
|
foreach(i ${OGRE_PREFIX_PATH})
|
||||||
|
set(${fwk}_FRAMEWORK_PATH ${${fwk}_FRAMEWORK_PATH} ${i}/lib/macosx/Release ${i}/lib/macosx/Debug)
|
||||||
|
endforeach(i)
|
||||||
|
|
||||||
|
foreach(i ${OGRE_PREFIX_BUILD})
|
||||||
|
set(${fwk}_FRAMEWORK_PATH ${${fwk}_FRAMEWORK_PATH} ${i}/lib/macosx/Release ${i}/lib/macosx/Debug)
|
||||||
|
endforeach(i)
|
||||||
|
|
||||||
|
foreach(dir ${${fwk}_FRAMEWORK_PATH})
|
||||||
|
set(fwkpath ${dir}/${fwk}.framework)
|
||||||
|
if(EXISTS ${fwkpath})
|
||||||
|
set(${fwk}_FRAMEWORK_INCLUDES ${${fwk}_FRAMEWORK_INCLUDES}
|
||||||
|
${fwkpath}/Headers ${fwkpath}/PrivateHeaders)
|
||||||
|
set(${fwk}_FRAMEWORK_PATH ${dir})
|
||||||
|
if (NOT ${fwk}_LIBRARY_FWK)
|
||||||
|
set(${fwk}_LIBRARY_FWK "-framework ${fwk}")
|
||||||
|
endif ()
|
||||||
|
endif(EXISTS ${fwkpath})
|
||||||
|
endforeach(dir)
|
||||||
|
endif(APPLE)
|
||||||
|
endmacro(findpkg_framework)
|
222
CMakeLists.txt
Normal file
222
CMakeLists.txt
Normal file
|
@ -0,0 +1,222 @@
|
||||||
|
cmake_minimum_required(VERSION 2.6)
|
||||||
|
|
||||||
|
project(emulationstation)
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
#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
|
||||||
|
set(GLSystem "Desktop OpenGL" CACHE STRING "The OpenGL system to be used")
|
||||||
|
set_property(CACHE GLSystem PROPERTY STRINGS "Desktop OpenGL" "OpenGL ES")
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
#check if we're running on Raspberry Pi
|
||||||
|
MESSAGE("Looking for bcm_host.h")
|
||||||
|
if(EXISTS "/opt/vc/include/bcm_host.h")
|
||||||
|
MESSAGE("bcm_host.h found")
|
||||||
|
set(BCMHOST found)
|
||||||
|
set(GLSystem "OpenGL ES")
|
||||||
|
else()
|
||||||
|
MESSAGE("bcm_host.h not found")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#finding necessary packages
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
if(${GLSystem} MATCHES "Desktop OpenGL")
|
||||||
|
find_package(OpenGL REQUIRED)
|
||||||
|
else()
|
||||||
|
find_package(OpenGLES REQUIRED)
|
||||||
|
endif()
|
||||||
|
find_package(FreeType REQUIRED)
|
||||||
|
find_package(FreeImage REQUIRED)
|
||||||
|
find_package(SDL REQUIRED)
|
||||||
|
find_package(Boost REQUIRED)
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
#set up compiler flags and excutable names
|
||||||
|
if(DEFINED BCMHOST)
|
||||||
|
add_definitions(-D_RPI_)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
set(CMAKE_DEBUG_POSTFIX "d")
|
||||||
|
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
||||||
|
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
set(CMAKE_CXX_FLAGS "-std=c++11") #support C++11
|
||||||
|
set(CMAKE_CXX_FLAGS "-O2") #optimize
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "-s") #strip binary
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(${GLSystem} MATCHES "Desktop OpenGL")
|
||||||
|
add_definitions(-DUSE_OPENGL_DESKTOP)
|
||||||
|
else()
|
||||||
|
add_definitions(-DUSE_OPENGL_ES)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
#add include directories
|
||||||
|
set(ES_INCLUDE_DIRS
|
||||||
|
${FREETYPE_INCLUDE_DIRS}
|
||||||
|
${FreeImage_INCLUDE_DIRS}
|
||||||
|
${SDL_INCLUDE_DIR}
|
||||||
|
${Boost_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(${GLSystem} MATCHES "Desktop OpenGL")
|
||||||
|
LIST(APPEND ES_INCLUDE_DIRS
|
||||||
|
${OPENGL_INCLUDE_DIR}
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
LIST(APPEND ES_INCLUDE_DIRS
|
||||||
|
${OPENGLES_INCLUDE_DIR}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(DEFINED BCMHOST)
|
||||||
|
LIST(APPEND ES_INCLUDE_DIRS
|
||||||
|
"/opt/vc/include"
|
||||||
|
"/opt/vc/include/interface/vcos"
|
||||||
|
"/opt/vc/include/interface/vmcs_host/linux"
|
||||||
|
"/opt/vc/include/interface/vcos/pthreads"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
#define basic sources and headers
|
||||||
|
set(ES_HEADERS
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/AudioManager.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/FileData.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/FolderData.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/Font.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/GameData.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/Gui.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/InputConfig.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/InputManager.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/Log.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/MathExp.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/platform.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/Renderer.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/Sound.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/SystemData.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/Window.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/XMLReader.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiAnimation.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiBox.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiDetectDevice.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiFastSelect.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiGameList.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiImage.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiInputConfig.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiList.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiMenu.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiTheme.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/pugiXML/pugiconfig.hpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/pugiXML/pugixml.hpp
|
||||||
|
)
|
||||||
|
set(ES_SOURCES
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/AudioManager.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/FolderData.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/Font.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/GameData.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/Gui.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/InputConfig.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/InputManager.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/Log.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/MathExp.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/platform.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/Renderer_draw_gl.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/Renderer_init.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/Sound.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/SystemData.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/Window.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/XMLReader.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiAnimation.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiBox.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiDetectDevice.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiFastSelect.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiGameList.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiImage.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiInputConfig.cpp
|
||||||
|
# ${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiList.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiMenu.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiTheme.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/pugiXML/pugixml.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
#add OS specifix sources
|
||||||
|
#if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||||
|
# LIST(APPEND ES_SOURCES
|
||||||
|
# main_windows.cpp
|
||||||
|
# )
|
||||||
|
#endif()
|
||||||
|
#if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||||
|
# LIST(APPEND ES_SOURCES
|
||||||
|
# main_linux.cpp
|
||||||
|
# )
|
||||||
|
#endif()
|
||||||
|
|
||||||
|
#add open gl specific sources
|
||||||
|
if(${GLSystem} MATCHES "Desktop OpenGL")
|
||||||
|
LIST(APPEND ES_SOURCES
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/Renderer_init_sdlgl.cpp
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
LIST(APPEND ES_SOURCES
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/Renderer_init_gles.cpp
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
#define libraries and directories
|
||||||
|
set(ES_LIBRARIES
|
||||||
|
# ${FREETYPE_LIBRARIES}
|
||||||
|
# ${FreeImage_LIBRARIES}
|
||||||
|
# ${SDL_LIBRARY}
|
||||||
|
# ${Boost_LIBRARIES}
|
||||||
|
freetype
|
||||||
|
freeimage
|
||||||
|
SDL
|
||||||
|
boost_filesystem
|
||||||
|
boost_system
|
||||||
|
)
|
||||||
|
|
||||||
|
if(${GLSystem} MATCHES "Desktop OpenGL")
|
||||||
|
LIST(APPEND ES_LIBRARIES
|
||||||
|
${OPENGL_LIBRARIES}
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
LIST(APPEND ES_LIBRARIES
|
||||||
|
${OPENGLES_LIBRARIES}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(DEFINED BCMHOST)
|
||||||
|
LIST(APPEND ES_LIBRARIES
|
||||||
|
bcm_host
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(DEFINED BCMHOST)
|
||||||
|
LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} "/opt/vc/lib")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
#set up build directories
|
||||||
|
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)
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
#define target
|
||||||
|
include_directories(${ES_INCLUDE_DIRS})
|
||||||
|
add_executable(emulationstation ${ES_SOURCES} ${ES_HEADERS})
|
||||||
|
target_link_libraries(emulationstation ${ES_LIBRARIES})
|
Loading…
Reference in a new issue