From a6534120ae9894f6587cbbf45e27f6c88a38ab44 Mon Sep 17 00:00:00 2001 From: "glennricster@gmail.com" Date: Wed, 10 Nov 2010 01:59:53 +0000 Subject: [PATCH] A couple of changes to the cmake build system. First: Added a DESTDIR option for package building. Second: Change the OpenCL setup. On both linux and windows use CLRun. I completely removed the option here. If CLRun works on MacOSX this should be done there as well, and this change implemented in the scons build also. Then we could remove the HAVE_OPENCL and the new USE_CLRUN definitions. Then we will finally have the dynamic detection of opencl set up cross platform. On a side note, it doesn't seem that the program loaded from TextureDecoder.cl compiles or runs. git-svn-id: http://dolphin-emu.googlecode.com/svn/trunk@6366 8ced0084-cf51-0410-be5f-012b33b47a6e --- CMakeLists.txt | 22 ++++++++-------------- Externals/CLRun/CMakeLists.txt | 3 +++ Source/Core/Common/Src/OpenCL.cpp | 4 ++-- Source/Core/Common/Src/OpenCL.h | 2 +- Source/Core/DolphinWX/CMakeLists.txt | 4 ++-- Source/Plugins/Plugin_DSP_HLE/CMakeLists.txt | 4 ++-- Source/Plugins/Plugin_DSP_LLE/CMakeLists.txt | 4 ++-- Source/Plugins/Plugin_VideoOGL/CMakeLists.txt | 6 +++--- 8 files changed, 23 insertions(+), 26 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d535e82f1..3baec3b2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,7 @@ 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(DESTDIR ${DESTDIR} CACHE STRING "Leave blank unless building packages") # Set up paths set(userdir ".dolphin-emu" CACHE STRING "User directory") @@ -289,19 +290,12 @@ if(WIN32) include_directories(Externals/GLew/include) endif() -find_library(OPENCL OpenCL) -find_path(OPENCL_INCLUDE CL/cl.h) -if(OPENCL AND OPENCL_INCLUDE) - message("OpenCL found") - include_directories(${OPENCL_INCLUDE}) -else() - message("OpenCL not found, using CLRun instead") +if(NOT APPLE) include_directories(Externals/CLRun/include) add_subdirectory(Externals/CLRun) -endif(OPENCL AND OPENCL_INCLUDE) -if(NOT APPLE) + add_definitions(-DUSE_CLRUN) add_definitions(-DHAVE_OPENCL=1) -endif() +endif(NOT APPLE) set(DISABLE_WX FALSE CACHE BOOL "Disable wxWidgets (use CLI interface)") if(NOT DISABLE_WX) @@ -347,9 +341,9 @@ add_subdirectory(Source) ######################################## # Install shared data files # -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}) +install(DIRECTORY Data/User/ DESTINATION ${DESTDIR}${datadir}/user PATTERN .svn EXCLUDE) +install(DIRECTORY Data/Sys/ DESTINATION ${DESTDIR}${datadir}/sys PATTERN .svn EXCLUDE) +install(FILES Data/license.txt DESTINATION ${DESTDIR}${datadir}) # packaging information include(CPack) @@ -361,7 +355,7 @@ set(CPACK_PACKAGE_VERSION_MINOR "0") if(DOLPHIN_IS_STABLE) set(CPACK_PACKAGE_VERSION_PATCH "0") else() - set(CPACK_PACKAGE_VERSION_PATCH ${DOLPHIN_WC_REV}) + set(CPACK_PACKAGE_VERSION_PATCH ${DOLPHIN_WC_REVISION}) endif() # TODO: CPACK_PACKAGE_DESCRIPTION_FILE diff --git a/Externals/CLRun/CMakeLists.txt b/Externals/CLRun/CMakeLists.txt index 454a7703a..7228fb86d 100644 --- a/Externals/CLRun/CMakeLists.txt +++ b/Externals/CLRun/CMakeLists.txt @@ -4,3 +4,6 @@ set(SRCS clrun/clrun.c clrun/genclgl.c) add_library(clrun STATIC ${SRCS}) +if(UNIX) + add_definitions(-fPIC) +endif(UNIX) diff --git a/Source/Core/Common/Src/OpenCL.cpp b/Source/Core/Common/Src/OpenCL.cpp index f196fb5ed..451d43ab4 100644 --- a/Source/Core/Common/Src/OpenCL.cpp +++ b/Source/Core/Common/Src/OpenCL.cpp @@ -21,7 +21,7 @@ #include "Common.h" #include "Timer.h" -#ifdef _WIN32 +#if defined(_WIN32) || defined(USE_CLRUN) #include "clrun.h" #endif @@ -46,7 +46,7 @@ bool Initialize() return false; int err; // error code returned from api calls -#ifdef _WIN32 +#if defined(_WIN32) || defined(USE_CLRUN) clrInit(); if(!clrHasOpenCL()) return false; diff --git a/Source/Core/Common/Src/OpenCL.h b/Source/Core/Common/Src/OpenCL.h index fd9a74c12..e94579a41 100644 --- a/Source/Core/Common/Src/OpenCL.h +++ b/Source/Core/Common/Src/OpenCL.h @@ -22,7 +22,7 @@ // OpenCL on Windows is linked through the CLRun library // It provides the headers and all the imports -#ifdef _WIN32 +#if defined(_WIN32) || defined(USE_CLRUN) #define HAVE_OPENCL 1 #endif diff --git a/Source/Core/DolphinWX/CMakeLists.txt b/Source/Core/DolphinWX/CMakeLists.txt index 56a3bbc50..ea1a0fffe 100644 --- a/Source/Core/DolphinWX/CMakeLists.txt +++ b/Source/Core/DolphinWX/CMakeLists.txt @@ -77,9 +77,9 @@ if(wxWidgets_FOUND) add_library(memcard STATIC ${MEMCARDSRCS}) add_executable(${EXEGUI} ${SRCS}) target_link_libraries(${EXEGUI} ${LIBS} ${WXLIBS}) - install(TARGETS ${EXEGUI} RUNTIME DESTINATION ${bindir}) + install(TARGETS ${EXEGUI} RUNTIME DESTINATION ${DESTDIR}${bindir}) else() add_executable(${EXENOGUI} ${SRCS}) target_link_libraries(${EXENOGUI} ${LIBS}) - install(TARGETS ${EXENOGUI} RUNTIME DESTINATION ${bindir}) + install(TARGETS ${EXENOGUI} RUNTIME DESTINATION ${DESTDIR}${bindir}) endif() diff --git a/Source/Plugins/Plugin_DSP_HLE/CMakeLists.txt b/Source/Plugins/Plugin_DSP_HLE/CMakeLists.txt index 5c6e36a0f..d8cda08db 100644 --- a/Source/Plugins/Plugin_DSP_HLE/CMakeLists.txt +++ b/Source/Plugins/Plugin_DSP_HLE/CMakeLists.txt @@ -23,5 +23,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} - RUNTIME DESTINATION ${plugindir}) + LIBRARY DESTINATION ${DESTDIR}${plugindir} + RUNTIME DESTINATION ${DESTDIR}${plugindir}) diff --git a/Source/Plugins/Plugin_DSP_LLE/CMakeLists.txt b/Source/Plugins/Plugin_DSP_LLE/CMakeLists.txt index aa2843020..16805d10b 100644 --- a/Source/Plugins/Plugin_DSP_LLE/CMakeLists.txt +++ b/Source/Plugins/Plugin_DSP_LLE/CMakeLists.txt @@ -21,6 +21,6 @@ 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} - RUNTIME DESTINATION ${plugindir}) + LIBRARY DESTINATION ${DESTDIR}${plugindir} + RUNTIME DESTINATION ${DESTDIR}${plugindir}) diff --git a/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt b/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt index 33d4fafc5..71126a8e0 100644 --- a/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt +++ b/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt @@ -31,11 +31,11 @@ if(APPLE AND NOT wxWidgets_FOUND) elseif(WIN32) set(SRCS ${SRCS} Src/OS/Win32.cpp) elseif(NOT APPLE) - set(LIBS ${LIBS} OpenCL) + set(LIBS ${LIBS} clrun) endif() add_library(Plugin_VideoOGL SHARED ${SRCS}) target_link_libraries(Plugin_VideoOGL ${LIBS}) install(TARGETS Plugin_VideoOGL - LIBRARY DESTINATION ${plugindir} - RUNTIME DESTINATION ${plugindir}) + LIBRARY DESTINATION ${DESTDIR}${plugindir} + RUNTIME DESTINATION ${DESTDIR}${plugindir}) -- 2.11.4.GIT