More cmake work.

Added autodetection of shared libraries.
Added a check for Xrandr.
Fix OpenAL linkage.
Copy User and Sys directories to lower case in the binary directory.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6338 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2010-11-04 02:01:07 +00:00
parent 7b23bf666f
commit 4b0d4ded98
3 changed files with 55 additions and 19 deletions

View File

@ -13,7 +13,7 @@ set(DOLPHIN_LICENSE_DIR ${DOLPHIN_BIN_DIR})
include(FindSubversion OPTIONAL) # for revision info
if(Subversion_FOUND)
Subversion_WC_INFO(${PROJECT_SOURCE_DIR} DOLPHIN) # defines DOLPHIN_WC_REVISION
Subversion_WC_INFO(${CMAKE_CURRENT_SOURCE_DIR} DOLPHIN) # defines DOLPHIN_WC_REVISION
endif()
include(FindPkgConfig REQUIRED) # TODO: Make this optional or even implement our own package detection
@ -41,7 +41,6 @@ if(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif(UNIX)
########################################
# Dependency checking
#
@ -72,6 +71,7 @@ endif(UNIX)
pkg_search_module(PULSEAUDIO libpulse)
pkg_search_module(AO ao)
pkg_search_module(BLUEZ bluez)
pkg_search_module(XRANDR xrandr)
# TODO: Make some of these optional like explained above
if(ALSA_FOUND)
@ -149,6 +149,14 @@ else()
message("X11 NOT found")
endif(X11_FOUND)
if(XRANDR_FOUND)
add_definitions(-DHAVE_XRANDR=1)
message("Xrandr found")
else()
add_definitions(-DHAVE_XRANDR=0)
message("Xrandr NOT found")
endif(XRANDR_FOUND)
########################################
# Setup include directories (and make sure they are preferred over the Externals)
@ -182,29 +190,54 @@ add_subdirectory(Externals/Bochs_disasm)
include_directories(Externals/Bochs_disasm)
# TODO: Try using the native lib first
# To use the native lib for Lua the dolphin code will need to be changed.
# Currently the file lstate.h is improperly included.
add_subdirectory(Externals/Lua)
include_directories(Externals/Lua)
# TODO: Try using the native lib first
add_subdirectory(Externals/LZO)
include_directories(Externals/LZO)
find_library(LZO lzo2)
find_file(LZO_INCLUDE lzo/lzo1x.h)
if(LZO AND LZO_INCLUDE)
message("Using shared lzo")
include_directories(LZO_INCLUDE)
else()
message("Shared lzo not found, falling back to the static library")
add_subdirectory(Externals/LZO)
include_directories(Externals/LZO)
endif(LZO AND LZO_INCLUDE)
include(FindSDL OPTIONAL)
if(SDL_FOUND)
message("Using shared SDL")
include_directories(SDL_INCLUDE_DIR)
else(SDL_FOUND)
# TODO: No CMakeLists.txt there, yet...
message("Shared SDL not found, falling back to the static library")
add_subdirectory(Externals/SDL)
include_directories(Externals/SDL/include)
endif(SDL_FOUND)
# TODO: Try using the native lib first
add_subdirectory(Externals/SFML)
include_directories(Externals/SFML/include)
find_library(SFML_NETWORK sfml-network)
find_file(SFML_INCLUDE SFML/Network/Ftp.hpp)
if(SFML_NETWORK AND SFML_INCLUDE)
message("Using shared sfml-network")
include_directories(SFML_INCLUDE)
else()
message("Shared sfml-network not found, falling back to the static library")
add_subdirectory(Externals/SFML)
include_directories(Externals/SFML/include)
endif(SFML_NETWORK AND SFML_INCLUDE)
# TODO: Try using the native lib first
add_subdirectory(Externals/SOIL)
include_directories(Externals/SOIL) # TODO: Or Externals/SOIL/SOIL?
find_library(SOIL SOIL)
find_file(SOIL_INCLUDE SOIL/SOIL.h)
if(SOIL AND SOIL_INCLUDE)
message("Using shared SOIL")
include_directories(SOIL_INCLUDE)
else()
message("Shared SOIL not found, falling back to the static library")
add_subdirectory(Externals/SOIL)
include_directories(Externals/SOIL)
endif(SOIL AND SOIL_INCLUDE)
include(FindZLIB OPTIONAL) # TODO: Move to top
if(ZLIB_FOUND)
@ -233,18 +266,17 @@ add_subdirectory(Source)
########################################
# copy over the Data folder ... TODO: Don't copy .svn dirs!
# copy over the Data folder
#
file(COPY Data/User DESTINATION ${DOLPHIN_USER_DIR})
file(COPY Data/Sys DESTINATION ${DOLPHIN_SYS_DIR})
file(COPY Data/User/ DESTINATION ${DOLPHIN_USER_DIR}/user PATTERN .svn EXCLUDE)
file(COPY Data/Sys/ DESTINATION ${DOLPHIN_SYS_DIR}/sys PATTERN .svn EXCLUDE)
file(COPY Data/license.txt DESTINATION ${DOLPHIN_LICENSE_DIR})
########################################
# Install and CPack information
#
install(DIRECTORY Data/User DESTINATION share/dolphin-emu)
install(DIRECTORY Data/Sys DESTINATION share/dolphin-emu)
install(DIRECTORY Data/User/ DESTINATION share/dolphin-emu/user PATTERN .svn EXCLUDE)
install(DIRECTORY Data/Sys/ DESTINATION share/dolphin-emu/sys PATTERN .svn EXCLUDE)
install(FILES Data/license.txt DESTINATION share/dolphin-emu)
# TODO: Move childrens's install commands here?

View File

@ -20,8 +20,8 @@ else()
endif(AO_FOUND)
if(OPENAL_FOUND OR WIN32)
set(SRCS ${SRCS} Src/OpenALStream.cpp)
set(LIBS ${LIBS} ${OPENAL_LIBRARIES})
set(SRCS ${SRCS} Src/OpenALStream.cpp Src/aldlist.cpp)
set(LIBS ${LIBS} openal)
endif(OPENAL_FOUND OR WIN32)
if(PULSEAUDIO_FOUND)

View File

@ -53,6 +53,10 @@ else(wxWidgets_FOUND)
Src/cmdline.c)
endif()
if(XRANDR_FOUND)
set(LIBS ${LIBS} ${XRANDR_LIBRARIES})
endif(XRANDR_FOUND)
if(WIN32)
set(SRCS ${SRCS} Src/stdafx.cpp)
elseif(APPLE AND NOT wxWidgets_FOUND)