diff --git a/CMakeLists.txt b/CMakeLists.txt index 7256d9e562..55f14e30bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/SConstruct b/SConstruct index c27a3a1cc1..7e987f1da3 100644 --- a/SConstruct +++ b/SConstruct @@ -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. diff --git a/Source/Core/Common/Src/CommonPaths.h b/Source/Core/Common/Src/CommonPaths.h index a7f13c3ebd..38d909e012 100644 --- a/Source/Core/Common/Src/CommonPaths.h +++ b/Source/Core/Common/Src/CommonPaths.h @@ -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 diff --git a/Source/Core/DolphinWX/CMakeLists.txt b/Source/Core/DolphinWX/CMakeLists.txt index c10dc69b55..8f89e29939 100644 --- a/Source/Core/DolphinWX/CMakeLists.txt +++ b/Source/Core/DolphinWX/CMakeLists.txt @@ -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() diff --git a/Source/Plugins/Plugin_DSP_HLE/CMakeLists.txt b/Source/Plugins/Plugin_DSP_HLE/CMakeLists.txt index 46d5d820e8..e00a5762f0 100644 --- a/Source/Plugins/Plugin_DSP_HLE/CMakeLists.txt +++ b/Source/Plugins/Plugin_DSP_HLE/CMakeLists.txt @@ -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}) + diff --git a/Source/Plugins/Plugin_DSP_LLE/CMakeLists.txt b/Source/Plugins/Plugin_DSP_LLE/CMakeLists.txt index 23801d5fc8..d34c44f5c0 100644 --- a/Source/Plugins/Plugin_DSP_LLE/CMakeLists.txt +++ b/Source/Plugins/Plugin_DSP_LLE/CMakeLists.txt @@ -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}) + diff --git a/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt b/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt index 5e6f9e0c45..f67aa1f27e 100644 --- a/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt +++ b/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt @@ -36,3 +36,5 @@ endif() add_library(Plugin_VideoOGL SHARED ${SRCS}) target_link_libraries(Plugin_VideoOGL ${LIBS}) +install(TARGETS Plugin_VideoOGL LIBRARY DESTINATION ${plugindir}) +