Okay. Big (possible controversial changes) to the cmake build system.

I am officially killing the local/global build crap.  The "local" build thing should never have existed.  There is now only one build that is essentially what the "global" build was before.  This is the way a proper build system should work.  I will soon write a wiki page to describe how to properly use the cmake build system, and how you can still set things up to get the "local" build from before.  However, that type of build should be considered a developer tool, and not the way that dolphin-emu should be built.
Briefly, to use cmake now do the following from the toplevel of dolphin's source:
mkdir Builddir
cd Builddir
cmake ..
make
make install (you may need superuser privileges)

Note that the scons build is still building dolphin in the old way.



git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6341 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2010-11-04 13:47:17 +00:00
parent 45c92d27f2
commit 4ac40687ea
7 changed files with 34 additions and 28 deletions

View File

@ -5,11 +5,23 @@ cmake_minimum_required (VERSION 2.6)
project (dolphin-emu)
set(DOLPHIN_IS_STABLE FALSE)
set(DOLPHIN_BIN_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Binary/${CMAKE_HOST_SYSTEM_NAME})
set(DOLPHIN_PLUGINS_DIR ${DOLPHIN_BIN_DIR}/plugins)
set(DOLPHIN_USER_DIR ${DOLPHIN_BIN_DIR})
set(DOLPHIN_SYS_DIR ${DOLPHIN_BIN_DIR})
set(DOLPHIN_LICENSE_DIR ${DOLPHIN_BIN_DIR})
set(prefix ${CMAKE_INSTALL_PREFIX} CACHE PATH "prefix")
set(bindir ${CMAKE_INSTALL_PREFIX}/bin CACHE PATH "bindir")
set(libdir ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} CACHE PATH "libdir")
set(plugindir ${libdir}/dolphin-emu CACHE PATH "plugindir")
set(datadir ${CMAKE_INSTALL_PREFIX}/share/dolphin-emu CACHE PATH "datadir")
# Set up paths
set(userdir ".dolphin-emu" CACHE STRING "User directory")
add_definitions(-DUSER_DIR="${userdir}")
add_definitions(-DDATA_DIR="${datadir}/")
add_definitions(-DLIBS_DIR="${plugindir}/")
# These just set where the binary files will be built. The program will not
# execute from here. You must run "make install" to install these to the
# proper location as defined above.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Binaries)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Binaries/plugins)
include(FindSubversion OPTIONAL) # for revision info
if(Subversion_FOUND)
@ -18,10 +30,6 @@ endif()
include(FindPkgConfig REQUIRED) # TODO: Make this optional or even implement our own package detection
# setup paths
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${DOLPHIN_BIN_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${DOLPHIN_PLUGINS_DIR})
# Various compile flags - TODO: Can these be simplified with a more general CMake variable?
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2")
@ -196,7 +204,7 @@ add_subdirectory(Externals/Lua)
include_directories(Externals/Lua)
find_library(LZO lzo2)
find_file(LZO_INCLUDE lzo/lzo1x.h)
find_path(LZO_INCLUDE lzo/lzo1x.h)
if(LZO AND LZO_INCLUDE)
message("Using shared lzo")
include_directories(LZO_INCLUDE)
@ -218,7 +226,7 @@ else(SDL_FOUND)
endif(SDL_FOUND)
find_library(SFML_NETWORK sfml-network)
find_file(SFML_INCLUDE SFML/Network/Ftp.hpp)
find_path(SFML_INCLUDE SFML/Network/Ftp.hpp)
if(SFML_NETWORK AND SFML_INCLUDE)
message("Using shared sfml-network")
include_directories(SFML_INCLUDE)
@ -229,7 +237,7 @@ else()
endif(SFML_NETWORK AND SFML_INCLUDE)
find_library(SOIL SOIL)
find_file(SOIL_INCLUDE SOIL/SOIL.h)
find_path(SOIL_INCLUDE SOIL/SOIL.h)
if(SOIL AND SOIL_INCLUDE)
message("Using shared SOIL")
include_directories(SOIL_INCLUDE)
@ -266,19 +274,11 @@ add_subdirectory(Source)
########################################
# copy over the Data folder
# Install shared data files
#
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/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?
install(DIRECTORY Data/User/ DESTINATION ${datadir}/user PATTERN .svn EXCLUDE)
install(DIRECTORY Data/Sys/ DESTINATION ${datadir}/sys PATTERN .svn EXCLUDE)
install(FILES Data/license.txt DESTINATION ${datadir})
# packaging information
include(CPack)

View File

@ -314,7 +314,7 @@ else:
env['data_dir'] = env['prefix'] + "/share/dolphin-emu"
env['plugin_dir'] = env['prefix'] + '/lib/dolphin-emu'
conf.Define('DATA_DIR', "\"" + env['data_dir'] + "/\"")
conf.Define('LIBS_DIR', "\"" + env['prefix'] + '/lib/' + "\"")
conf.Define('LIBS_DIR', "\"" + env['prefix'] + '/lib/dolphin-emu/' + "\"")
# Setup destdir for package building
# Warning: The program will not run from this location.
# It is assumed the package will later install it to the prefix.

View File

@ -44,7 +44,7 @@
#define PLUGINS_DIR "Contents/PlugIns"
#else
#ifdef LIBS_DIR
#define PLUGINS_DIR LIBS_DIR "dolphin-emu"
#define PLUGINS_DIR LIBS_DIR
#else
#define PLUGINS_DIR "plugins"
#endif

View File

@ -75,9 +75,9 @@ if(wxWidgets_FOUND)
add_library(memcard STATIC ${MEMCARDSRCS})
add_executable(${EXEGUI} ${SRCS})
target_link_libraries(${EXEGUI} ${LIBS} ${WXLIBS})
install(TARGETS ${EXEGUI} RUNTIME DESTINATION bin) # TODO: Move to root dir?
install(TARGETS ${EXEGUI} RUNTIME DESTINATION ${bindir})
else()
add_executable(${EXENOGUI} ${SRCS})
target_link_libraries(${EXENOGUI} ${LIBS})
install(TARGETS ${EXENOGUI} RUNTIME DESTINATION bin) # TODO: Move to root dir?
install(TARGETS ${EXENOGUI} RUNTIME DESTINATION ${bindir})
endif()

View File

@ -22,3 +22,5 @@ endif(wxWidgets_FOUND)
add_library(Plugin_DSP_HLE SHARED ${SRCS})
target_link_libraries(Plugin_DSP_HLE common audiocommon)
install(TARGETS Plugin_DSP_HLE LIBRARY DESTINATION ${plugindir})

View File

@ -20,3 +20,5 @@ endif(wxWidgets_FOUND)
add_library(Plugin_DSP_LLE SHARED ${SRCS})
target_link_libraries(Plugin_DSP_LLE ${LIBS})
install(TARGETS Plugin_DSP_LLE LIBRARY DESTINATION ${plugindir})

View File

@ -36,3 +36,5 @@ endif()
add_library(Plugin_VideoOGL SHARED ${SRCS})
target_link_libraries(Plugin_VideoOGL ${LIBS})
install(TARGETS Plugin_VideoOGL LIBRARY DESTINATION ${plugindir})