diff --git a/CMakeLists.txt b/CMakeLists.txt index 102cdb41a9..b204310fdd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -226,9 +226,21 @@ INSTALL(FILES ) IF(FORGE_FOUND AND NOT USE_SYSTEM_FORGE) - INSTALL(DIRECTORY "${PROJECT_BINARY_DIR}/third_party/forge/lib/" DESTINATION "${AF_INSTALL_LIB_DIR}" - COMPONENT libraries + OPTION(INSTALL_FORGE_DEV "Install Forge Header and Share Files with ArrayFire" OFF) + INSTALL(DIRECTORY "${PROJECT_BINARY_DIR}/third_party/forge/lib/" + DESTINATION "${AF_INSTALL_LIB_DIR}" + COMPONENT libraries ) + IF(${INSTALL_FORGE_DEV}) + INSTALL(DIRECTORY "${PROJECT_BINARY_DIR}/third_party/forge/include/" + DESTINATION "${AF_INSTALL_INC_DIR}" + COMPONENT headers + ) + INSTALL(DIRECTORY "${PROJECT_BINARY_DIR}/third_party/forge/share/Forge/" + DESTINATION "${AF_INSTALL_DATA_DIR}/../Forge" + COMPONENT share + ) + ENDIF(${INSTALL_FORGE_DEV}) ENDIF(FORGE_FOUND AND NOT USE_SYSTEM_FORGE) ## configuration to be used from the binary directory directly diff --git a/CMakeModules/build_forge.cmake b/CMakeModules/build_forge.cmake index 0f6574a36e..61f5df39e3 100644 --- a/CMakeModules/build_forge.cmake +++ b/CMakeModules/build_forge.cmake @@ -58,6 +58,7 @@ ExternalProject_Add( -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_EXAMPLES:BOOL=OFF + -DBUILD_DOCUMENTATION:BOOL=${BUILD_DOCS} -DUSE_SYSTEM_GLBINDING:BOOL=TRUE -Dglbinding_DIR:STRING=${glbinding_DIR} -DGLFW_ROOT_DIR:STRING=${GLFW_ROOT_DIR} diff --git a/CMakeModules/osx_install/OSXInstaller.cmake b/CMakeModules/osx_install/OSXInstaller.cmake index f916536874..729f5a4996 100644 --- a/CMakeModules/osx_install/OSXInstaller.cmake +++ b/CMakeModules/osx_install/OSXInstaller.cmake @@ -13,8 +13,7 @@ SET(OSX_INSTALL_SOURCE ${PROJECT_SOURCE_DIR}/CMakeModules/osx_install) ################################################################################ SET(OSX_TEMP "${PROJECT_BINARY_DIR}/osx_install_files") -# Common files - libforge, ArrayFireConfig*.cmake -FILE(GLOB COMMONLIB "${CMAKE_INSTALL_PREFIX}/${AF_INSTALL_LIB_DIR}/libforge*.dylib") +# Common files - ArrayFireConfig*.cmake FILE(GLOB COMMONCMAKE "${CMAKE_INSTALL_PREFIX}/${AF_INSTALL_CMAKE_DIR}/ArrayFireConfig*.cmake") ADD_CUSTOM_TARGET(OSX_INSTALL_SETUP_COMMON) @@ -53,7 +52,9 @@ OSX_INSTALL_SETUP(Unified af) # Headers ADD_CUSTOM_TARGET(OSX_INSTALL_SETUP_INCLUDE COMMAND ${CMAKE_COMMAND} -E copy_directory - ${CMAKE_INSTALL_PREFIX}/include "${OSX_TEMP}/include" + ${CMAKE_INSTALL_PREFIX}/include/af "${OSX_TEMP}/include/af" + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_INSTALL_PREFIX}/include/arrayfire.h "${OSX_TEMP}/include/arrayfire.h" WORKING_DIRECTORY ${PROJECT_BINARY_DIR} COMMENT "Copying header files to temporary OSX Install Dir" ) @@ -73,6 +74,58 @@ ADD_CUSTOM_TARGET(OSX_INSTALL_SETUP_DOC WORKING_DIRECTORY ${PROJECT_BINARY_DIR} COMMENT "Copying documentation files to temporary OSX Install Dir" ) + +IF(BUILD_GRAPHICS) + MAKE_DIRECTORY("${OSX_TEMP}/Forge") + + # Forge Library + FILE(GLOB FORGE_LIB "${CMAKE_INSTALL_PREFIX}/${AF_INSTALL_LIB_DIR}/libforge*.dylib") + ADD_CUSTOM_TARGET(OSX_INSTALL_SETUP_FORGE_LIB) + FOREACH(SRC ${FORGE_LIB}) + FILE(RELATIVE_PATH SRC_REL ${CMAKE_INSTALL_PREFIX} ${SRC}) + ADD_CUSTOM_COMMAND(TARGET OSX_INSTALL_SETUP_FORGE_LIB PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + ${SRC} "${OSX_TEMP}/Forge/${SRC_REL}" + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + COMMENT "Copying libforge files to temporary OSX Install Dir" + ) + ENDFOREACH() + + # Forge Headers + ADD_CUSTOM_TARGET(OSX_INSTALL_SETUP_FORGE_INCLUDE + COMMAND ${CMAKE_COMMAND} -E copy_directory + "${CMAKE_INSTALL_PREFIX}/include/fg" "${OSX_TEMP}/Forge/include/fg" + COMMAND ${CMAKE_COMMAND} -E copy + "${CMAKE_INSTALL_PREFIX}/include/forge.h" "${OSX_TEMP}/Forge/include/forge.h" + COMMAND ${CMAKE_COMMAND} -E copy + "${CMAKE_INSTALL_PREFIX}/include/ComputeCopy.h" "${OSX_TEMP}/Forge/include/ComputeCopy.h" + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + COMMENT "Copying examples files to temporary OSX Install Dir" + ) + # Forge Examples + ADD_CUSTOM_TARGET(OSX_INSTALL_SETUP_FORGE_EXAMPLES + COMMAND ${CMAKE_COMMAND} -E copy_directory + "${CMAKE_INSTALL_PREFIX}/share/Forge/examples" "${OSX_TEMP}/Forge/examples" + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + COMMENT "Copying examples files to temporary OSX Install Dir" + ) + + # Documentation + ADD_CUSTOM_TARGET(OSX_INSTALL_SETUP_FORGE_DOC + COMMAND ${CMAKE_COMMAND} -E copy_directory + "${CMAKE_INSTALL_PREFIX}/share/Forge/doc" "${OSX_TEMP}/Forge/doc" + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + COMMENT "Copying documentation files to temporary OSX Install Dir" + ) + + # Forge CMake + ADD_CUSTOM_TARGET(OSX_INSTALL_SETUP_FORGE_CMAKE + COMMAND ${CMAKE_COMMAND} -E copy_directory + "${CMAKE_INSTALL_PREFIX}/share/Forge/cmake" "${OSX_TEMP}/Forge/cmake" + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + COMMENT "Copying documentation files to temporary OSX Install Dir" + ) +ENDIF(BUILD_GRAPHICS) ################################################################################ FUNCTION(PKG_BUILD) @@ -105,7 +158,12 @@ ENDFUNCTION(PKG_BUILD) FUNCTION(PRODUCT_BUILD) CMAKE_PARSE_ARGUMENTS(ARGS "" "" "DEPENDS" ${ARGN}) - SET(DISTRIBUTION_FILE "${OSX_INSTALL_SOURCE}/distribution.dist") + IF(BUILD_GRAPHICS) + SET(DISTRIBUTION_FILE "${OSX_INSTALL_SOURCE}/distribution.dist") + ELSE(BUILD_GRAPHICS) + SET(DISTRIBUTION_FILE "${OSX_INSTALL_SOURCE}/distribution-no-gl.dist") + ENDIF(BUILD_GRAPHICS) + SET(DISTRIBUTION_FILE_OUT "${CMAKE_CURRENT_BINARY_DIR}/distribution.dist.out") SET(WELCOME_FILE "${OSX_INSTALL_SOURCE}/welcome.html") @@ -140,7 +198,6 @@ PKG_BUILD( PKG_NAME ArrayFireCPU DEPENDS OSX_INSTALL_SETUP_CPU TARGETS cpu_package INSTALL_LOCATION /usr/local - SCRIPT_DIR ${OSX_INSTALL_SOURCE}/cpu_scripts IDENTIFIER com.arrayfire.pkg.arrayfire.cpu.lib PATH_TO_FILES ${OSX_TEMP}/CPU FILTERS opencl cuda unified) @@ -149,7 +206,6 @@ PKG_BUILD( PKG_NAME ArrayFireCUDA DEPENDS OSX_INSTALL_SETUP_CUDA TARGETS cuda_package INSTALL_LOCATION /usr/local - SCRIPT_DIR ${OSX_INSTALL_SOURCE}/cuda_scripts IDENTIFIER com.arrayfire.pkg.arrayfire.cuda.lib PATH_TO_FILES ${OSX_TEMP}/CUDA FILTERS cpu opencl unified) @@ -158,7 +214,6 @@ PKG_BUILD( PKG_NAME ArrayFireOPENCL DEPENDS OSX_INSTALL_SETUP_OpenCL TARGETS opencl_package INSTALL_LOCATION /usr/local - SCRIPT_DIR ${OSX_INSTALL_SOURCE}/opencl_scripts IDENTIFIER com.arrayfire.pkg.arrayfire.opencl.lib PATH_TO_FILES ${OSX_TEMP}/OpenCL FILTERS cpu cuda unified) @@ -202,5 +257,55 @@ PKG_BUILD( PKG_NAME ArrayFireDoc PATH_TO_FILES ${OSX_TEMP}/doc FILTERS cmake) -PRODUCT_BUILD(DEPENDS ${cpu_package} ${cuda_package} ${opencl_package} ${unified_package} ${common_package} ${header_package} ${examples_package} ${doc_package}) +IF(BUILD_GRAPHICS) + PKG_BUILD( PKG_NAME ForgeLibrary + DEPENDS OSX_INSTALL_SETUP_FORGE_LIB + TARGETS forge_lib_package + INSTALL_LOCATION /usr/local/ + SCRIPT_DIR ${OSX_INSTALL_SOURCE}/forge_scripts + IDENTIFIER com.arrayfire.pkg.forge.lib + PATH_TO_FILES ${OSX_TEMP}/Forge) + + PKG_BUILD( PKG_NAME ForgeHeaders + DEPENDS OSX_INSTALL_SETUP_FORGE_INCLUDE + TARGETS forge_header_package + INSTALL_LOCATION /usr/local/include + IDENTIFIER com.arrayfire.pkg.forge.inc + PATH_TO_FILES ${OSX_TEMP}/Forge/include) + + PKG_BUILD( PKG_NAME ForgeExamples + DEPENDS OSX_INSTALL_SETUP_FORGE_EXAMPLES + TARGETS forge_examples_package + INSTALL_LOCATION /usr/local/share/Forge/examples + IDENTIFIER com.arrayfire.pkg.forge.examples + PATH_TO_FILES ${OSX_TEMP}/Forge/examples + ) + + PKG_BUILD( PKG_NAME ForgeDoc + DEPENDS OSX_INSTALL_SETUP_FORGE_DOC + TARGETS forge_doc_package + INSTALL_LOCATION /usr/local/share/Forge/doc + IDENTIFIER com.arrayfire.pkg.forge.doc + PATH_TO_FILES ${OSX_TEMP}/Forge/doc + ) + + PKG_BUILD( PKG_NAME ForgeCMake + DEPENDS OSX_INSTALL_SETUP_FORGE_CMAKE + TARGETS forge_cmake_package + INSTALL_LOCATION /usr/local/share/Forge/cmake + IDENTIFIER com.arrayfire.pkg.forge.cmake + PATH_TO_FILES ${OSX_TEMP}/Forge/cmake + ) +ENDIF(BUILD_GRAPHICS) + +IF(BUILD_GRAPHICS) + PRODUCT_BUILD(DEPENDS ${cpu_package} ${cuda_package} ${opencl_package} ${unified_package} + ${common_package} ${header_package} ${examples_package} ${doc_package} + ${forge_lib_package} ${forge_header_package} ${forge_examples_package} ${forge_doc_package} ${forge_cmake_package} + ) +ELSE(BUILD_GRAPHICS) + PRODUCT_BUILD(DEPENDS ${cpu_package} ${cuda_package} ${opencl_package} ${unified_package} + ${common_package} ${header_package} ${examples_package} ${doc_package} + ) +ENDIF(BUILD_GRAPHICS) diff --git a/CMakeModules/osx_install/cpu_scripts/postinstall b/CMakeModules/osx_install/cpu_scripts/postinstall deleted file mode 100755 index a9bce9de8e..0000000000 --- a/CMakeModules/osx_install/cpu_scripts/postinstall +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -set -e -set -o pipefail - -err_file=/tmp/AFInstallerCPU.err -brew=/usr/local/bin/brew - -echo $(date) > $err_file - -if [ ! -f $brew ]; then - osascript -e 'tell app "Installer" to display dialog "Brew not installed. Please install brew at http://brew.sh"' - open http://brew.sh - echo "Brew not found" >> $err_file - exit 1 -fi - -user=$(ps aux | grep console | grep -v 'grep\|root' | cut -d' ' -f1 | head -n1) - -if [ -z $user ]; then - echo "User not found" >> $err_file - exit 1 -fi - -function deps_err -{ - osascript -e 'tell app "Installer" to display dialog "ArrayFire files installed but failed to install ArrayFire dependencies using Brew."' - osascript -e 'tell app "Installer" to display dialog "Visit https://github.com/arrayfire/arrayfire/wiki/Fixing-Common-OS-X-Installer-Failures to fix errors manually."' - open https://github.com/arrayfire/arrayfire/wiki/Fixing-Common-OS-X-Installer-Failures - echo "Dependencies failed to install" >> $err_file - exit 1 -} - -su $user -c "$brew tap homebrew/versions" >> $err_file 2>&1 -su $user -c "$brew install fftw glfw3 fontconfig" >> $err_file 2>&1 || deps_err diff --git a/CMakeModules/osx_install/distribution-no-gl.dist b/CMakeModules/osx_install/distribution-no-gl.dist new file mode 100644 index 0000000000..81734358c7 --- /dev/null +++ b/CMakeModules/osx_install/distribution-no-gl.dist @@ -0,0 +1,78 @@ + + + ${AF_TITLE} + + + + + + ArrayFireCPU.pkg + ArrayFireCUDA.pkg + ArrayFireOPENCL.pkg + ArrayFireUNIFIED.pkg + ArrayFireHeaders.pkg + ArrayFireExamples.pkg + ArrayFireDoc.pkg + ArrayFireCommon.pkg + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CMakeModules/osx_install/distribution.dist b/CMakeModules/osx_install/distribution.dist index 1494e7efde..9117d250db 100644 --- a/CMakeModules/osx_install/distribution.dist +++ b/CMakeModules/osx_install/distribution.dist @@ -10,6 +10,22 @@ choices.cuda_lib.selected || choices.cpu_lib.selected; } + function CheckBackendOrForgeSelected() { + return choices.opencl_lib.selected || + choices.cuda_lib.selected || + choices.cpu_lib.selected || + choices.forge_inc.selected || + choices.forge_examples.selected; + } + function EnableForgeLibOption() { + return !(choices.opencl_lib.selected || + choices.cuda_lib.selected || + choices.cpu_lib.selected || + choices.forge_inc.selected); + } + function CheckForgeSelected() { + return choices.forge_lib.selected; + } ArrayFireCPU.pkg @@ -20,6 +36,11 @@ ArrayFireExamples.pkg ArrayFireDoc.pkg ArrayFireCommon.pkg + ForgeHeaders.pkg + ForgeLibrary.pkg + ForgeExamples.pkg + ForgeDoc.pkg + ForgeCMake.pkg @@ -32,8 +53,15 @@ + + + + + + + - + @@ -58,20 +86,63 @@ - + - + - + + + + + + + + + + + + + + + + + + diff --git a/CMakeModules/osx_install/cuda_scripts/postinstall b/CMakeModules/osx_install/forge_scripts/postinstall old mode 100755 new mode 100644 similarity index 89% rename from CMakeModules/osx_install/cuda_scripts/postinstall rename to CMakeModules/osx_install/forge_scripts/postinstall index 49f0fd2e2f..88ef20b231 --- a/CMakeModules/osx_install/cuda_scripts/postinstall +++ b/CMakeModules/osx_install/forge_scripts/postinstall @@ -3,7 +3,7 @@ set -e set -o pipefail -err_file=/tmp/AFInstallerCUDA.err +err_file=/tmp/AFInstallerForge.err brew=/usr/local/bin/brew echo $(date) > $err_file @@ -23,7 +23,7 @@ fi function deps_err { - osascript -e 'tell app "Installer" to display dialog "ArrayFire files installed but failed to install ArrayFire dependencies using Brew."' + osascript -e 'tell app "Installer" to display dialog "ArrayFire files installed but failed to install ArrayFire/Forge dependencies using Brew."' osascript -e 'tell app "Installer" to display dialog "Visit https://github.com/arrayfire/arrayfire/wiki/Fixing-Common-OS-X-Installer-Failures to fix errors manually."' open https://github.com/arrayfire/arrayfire/wiki/Fixing-Common-OS-X-Installer-Failures echo "Dependencies failed to install" >> $err_file diff --git a/CMakeModules/osx_install/opencl_scripts/postinstall b/CMakeModules/osx_install/opencl_scripts/postinstall deleted file mode 100755 index 54ecb4df19..0000000000 --- a/CMakeModules/osx_install/opencl_scripts/postinstall +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -set -e -set -o pipefail - -err_file=/tmp/AFInstallerOpenCL.err -brew=/usr/local/bin/brew - -echo $(date) > $err_file - -if [ ! -f $brew ]; then - osascript -e 'tell app "Installer" to display dialog "Brew not installed. Please install brew at brew.sh"' - echo "Brew not found" >> $err_file - exit 1 -fi - -user=$(ps aux | grep console | grep -v 'grep\|root' | cut -d' ' -f1 | head -n1) - -if [ -z $user ]; then - echo "User not found" >> $err_file - exit 1 -fi - -function deps_err -{ - osascript -e 'tell app "Installer" to display dialog "ArrayFire files installed but failed to install ArrayFire dependencies using Brew."' - osascript -e 'tell app "Installer" to display dialog "Visit https://github.com/arrayfire/arrayfire/wiki/Fixing-Common-OS-X-Installer-Failures to fix errors manually."' - open https://github.com/arrayfire/arrayfire/wiki/Fixing-Common-OS-X-Installer-Failures - echo "Dependencies failed to install" >> $err_file - exit 1 -} - -su $user -c "$brew tap homebrew/versions" >> $err_file 2>&1 -su $user -c "$brew install fftw glfw3 fontconfig" >> $err_file 2>&1 || deps_err diff --git a/src/backend/cuda/CMakeLists.txt b/src/backend/cuda/CMakeLists.txt index e8759496da..8b890741ec 100644 --- a/src/backend/cuda/CMakeLists.txt +++ b/src/backend/cuda/CMakeLists.txt @@ -42,10 +42,15 @@ ENDIF() LIST(LENGTH COMPUTES_DETECTED_LIST COMPUTES_LEN) IF(${COMPUTES_LEN} EQUAL 0 AND ${FALLBACK}) - MESSAGE(STATUS "No computes detected. Fall back to 20, 30, 50, 60") MESSAGE(STATUS "You can use -DCOMPUTES_DETECTED_LIST=\"AB;XY\" (semicolon separated list of CUDA Compute versions to enable the specified computes") MESSAGE(STATUS "Individual compute versions flags are also available under CMake Advance options") - LIST(APPEND COMPUTES_DETECTED_LIST "20" "30" "50" "60") + LIST(APPEND COMPUTES_DETECTED_LIST "20" "30" "50") + IF(${CUDA_VERSION_MAJOR} GREATER 7) # Enable 60 only if CUDA 8 or greater + MESSAGE(STATUS "No computes detected. Fall back to 20, 30, 50, 60") + LIST(APPEND COMPUTES_DETECTED_LIST "60") + ELSE(${CUDA_VERSION_MAJOR} GREATER 7) + MESSAGE(STATUS "No computes detected. Fall back to 20, 30, 50") + ENDIF(${CUDA_VERSION_MAJOR} GREATER 7) ENDIF() LIST(LENGTH COMPUTES_DETECTED_LIST COMPUTES_LEN)