vcpkg/ports/arrayfire/build.patch

212 lines
7.9 KiB
Diff
Raw Normal View History

[arrayfire] New Port (#14240) * [arrayfire] New Port * Format manifest file * Remove nvidia cub, forge, and spdlog submodules and use vcpkg ports - add patch * Remove arrayfire/assets and don't build examples * Remove arrayfire/glad submodule, use port, update patch * Add optional freeimage dependency for graphics lib * Remove rename of arrayfire threads/pass path to build * Update ports/arrayfire/portfile.cmake Co-authored-by: Phoebe <20694052+PhoebeHui@users.noreply.github.com> * Fix up cmake targets files, install bin/dlls to the proper location * Use debug bin dir if in debug mode * Fixes for unified, Windows dlls, and more - Make the unified backend its own feature - Make the unified and CPU backend default features - Conditionally create a bin directory if a Windows non-static build for the unified dll - Remove fftw dependency (relies on MKL) - Only support x64 * Add warning for Windows static builds * Ensure CMake assets are in the proper dir for non-Windows builds * Actually, don't change cmake targets in non-Windows systems * Remove port-version * Use MKL for CPU and OpenCL backends * Patch arrayfire/threads - fix duplicate include * Use newer af/threads, replace include path to fix Windows builds * Fix binary dir for output DLLs * Update select_compute_arch to work with CUDA 11 * Don't include CUB if using CUDA >= 11 * Bump port verison to 3.7.3 to handle CUDA 11+ * Update port to use 3.7.3 * Update to include MSVC 2019 fixes, fixup CMake targets on *nix * Apply suggestions from code review * Update ports/arrayfire/portfile.cmake * Change AF CMake dir since targets.cmake are included by other targets * Bump to commit with fixed AF version for bits The v3.7 branch tip was still outputting shared objects with 3.7.2 versions attached to them. It's now fixed Co-authored-by: Phoebe <20694052+PhoebeHui@users.noreply.github.com> Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
2020-11-20 02:50:38 +08:00
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1f30a5b3..f93e4ed9 100644
[arrayfire] New Port (#14240) * [arrayfire] New Port * Format manifest file * Remove nvidia cub, forge, and spdlog submodules and use vcpkg ports - add patch * Remove arrayfire/assets and don't build examples * Remove arrayfire/glad submodule, use port, update patch * Add optional freeimage dependency for graphics lib * Remove rename of arrayfire threads/pass path to build * Update ports/arrayfire/portfile.cmake Co-authored-by: Phoebe <20694052+PhoebeHui@users.noreply.github.com> * Fix up cmake targets files, install bin/dlls to the proper location * Use debug bin dir if in debug mode * Fixes for unified, Windows dlls, and more - Make the unified backend its own feature - Make the unified and CPU backend default features - Conditionally create a bin directory if a Windows non-static build for the unified dll - Remove fftw dependency (relies on MKL) - Only support x64 * Add warning for Windows static builds * Ensure CMake assets are in the proper dir for non-Windows builds * Actually, don't change cmake targets in non-Windows systems * Remove port-version * Use MKL for CPU and OpenCL backends * Patch arrayfire/threads - fix duplicate include * Use newer af/threads, replace include path to fix Windows builds * Fix binary dir for output DLLs * Update select_compute_arch to work with CUDA 11 * Don't include CUB if using CUDA >= 11 * Bump port verison to 3.7.3 to handle CUDA 11+ * Update port to use 3.7.3 * Update to include MSVC 2019 fixes, fixup CMake targets on *nix * Apply suggestions from code review * Update ports/arrayfire/portfile.cmake * Change AF CMake dir since targets.cmake are included by other targets * Bump to commit with fixed AF version for bits The v3.7 branch tip was still outputting shared objects with 3.7.2 versions attached to them. It's now fixed Co-authored-by: Phoebe <20694052+PhoebeHui@users.noreply.github.com> Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
2020-11-20 02:50:38 +08:00
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -104,18 +104,11 @@ mark_as_advanced(
CUDA_HOST_COMPILER
CUDA_USE_STATIC_CUDA_RUNTIME
CUDA_rt_LIBRARY
- SPDLOG_BUILD_EXAMPLES
- SPDLOG_BUILD_TESTING
ADDR2LINE_PROGRAM
Backtrace_LIBRARY
AF_WITH_STATIC_MKL
)
-#Configure forge submodule
-#forge is included in ALL target if AF_BUILD_FORGE is ON
-#otherwise, forge is not built at all
-include(AFconfigure_forge_submodule)
-
configure_file(
${ArrayFire_SOURCE_DIR}/CMakeModules/version.hpp.in
${ArrayFire_BINARY_DIR}/version.hpp
@@ -159,9 +152,7 @@ if(NOT LAPACK_FOUND)
endif()
endif()
-set(SPDLOG_BUILD_TESTING OFF CACHE INTERNAL "Disable testing in spdlog")
-add_subdirectory(extern/spdlog EXCLUDE_FROM_ALL)
-add_subdirectory(extern/glad)
+find_package(spdlog CONFIG REQUIRED)
add_subdirectory(src/backend/common)
add_subdirectory(src/api/c)
add_subdirectory(src/api/cpp)
@@ -269,10 +260,6 @@ install(DIRECTORY examples/ #NOTE The slash at the end is important
DESTINATION ${AF_INSTALL_EXAMPLE_DIR}
COMPONENT examples)
-install(DIRECTORY assets/examples/ #NOTE The slash at the end is important
- DESTINATION ${AF_INSTALL_EXAMPLE_DIR}
- COMPONENT examples)
-
install(DIRECTORY "${ArrayFire_SOURCE_DIR}/LICENSES/"
DESTINATION LICENSES
COMPONENT licenses)
diff --git a/CMakeModules/AFInstallDirs.cmake b/CMakeModules/AFInstallDirs.cmake
index 2c7b96ea..b5006ee0 100644
--- a/CMakeModules/AFInstallDirs.cmake
+++ b/CMakeModules/AFInstallDirs.cmake
@@ -7,8 +7,12 @@ include(GNUInstallDirs)
# NOTE: These paths are all relative to the project installation prefix.
# Executables
-if(NOT DEFINED AF_INSTALL_BIN_DIR)
- set(AF_INSTALL_BIN_DIR "lib" CACHE PATH "Installation path for executables")
+if(CMAKE_BUILD_TYPE MATCHES Debug)
+ set(AF_INSTALL_BIN_DIR "${AF_BIN_DIR}/debug/bin")
+ message(STATUS " Setting install to debug path ${AF_INSTALL_BIN_DIR}")
+else()
+ set(AF_INSTALL_BIN_DIR "${AF_BIN_DIR}/bin")
+ message(STATUS " Setting install to release path ${AF_INSTALL_BIN_DIR}")
endif()
# Libraries
diff --git a/src/api/unified/CMakeLists.txt b/src/api/unified/CMakeLists.txt
index 967eaa63..ff04392c 100644
--- a/src/api/unified/CMakeLists.txt
+++ b/src/api/unified/CMakeLists.txt
@@ -96,7 +96,7 @@ target_include_directories(af
target_link_libraries(af
PRIVATE
cpp_api_interface
- spdlog
+ spdlog::spdlog spdlog::spdlog_header_only
Threads::Threads
Boost::boost
${CMAKE_DL_LIBS}
diff --git a/src/backend/common/CMakeLists.txt b/src/backend/common/CMakeLists.txt
index c9fe0889..4fdfeb66 100644
--- a/src/backend/common/CMakeLists.txt
+++ b/src/backend/common/CMakeLists.txt
@@ -77,12 +77,15 @@ else()
target_sources(afcommon_interface INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/module_loading_unix.cpp)
endif()
+find_package(glad CONFIG REQUIRED)
+
target_link_libraries(afcommon_interface
INTERFACE
- spdlog
+ spdlog::spdlog
+ spdlog::spdlog_header_only
Boost::boost
- af_glad_interface
${CMAKE_DL_LIBS}
+ glad::glad
)
if(AF_BUILD_FORGE)
@@ -95,8 +98,6 @@ target_include_directories(afcommon_interface
${ArrayFire_BINARY_DIR}
SYSTEM INTERFACE
$<$<PLATFORM_ID:Darwin>:${OPENGL_INCLUDE_DIR}>
- ${ArrayFire_SOURCE_DIR}/extern/forge/include
- ${ArrayFire_BINARY_DIR}/extern/forge/include
)
if(APPLE AND NOT USE_MKL)
diff --git a/src/backend/cpu/CMakeLists.txt b/src/backend/cpu/CMakeLists.txt
index 170bb0f3..c6e20177 100644
--- a/src/backend/cpu/CMakeLists.txt
+++ b/src/backend/cpu/CMakeLists.txt
@@ -266,9 +266,10 @@ endif(AF_WITH_CPUID)
target_sources(afcpu
PRIVATE
- ${CMAKE_CURRENT_SOURCE_DIR}/threads/async_queue.hpp
- ${CMAKE_CURRENT_SOURCE_DIR}/threads/event.hpp
+ ${AF_CPU_THREAD_PATH}/include/threads/async_queue.hpp
+ ${AF_CPU_THREAD_PATH}/include/threads/event.hpp
)
+target_include_directories(afcpu PRIVATE ${AF_CPU_THREAD_PATH}/include)
arrayfire_set_default_cxx_flags(afcpu)
diff --git a/src/backend/cuda/CMakeLists.txt b/src/backend/cuda/CMakeLists.txt
index 7e3e4089..a3a53087 100644
[arrayfire] New Port (#14240) * [arrayfire] New Port * Format manifest file * Remove nvidia cub, forge, and spdlog submodules and use vcpkg ports - add patch * Remove arrayfire/assets and don't build examples * Remove arrayfire/glad submodule, use port, update patch * Add optional freeimage dependency for graphics lib * Remove rename of arrayfire threads/pass path to build * Update ports/arrayfire/portfile.cmake Co-authored-by: Phoebe <20694052+PhoebeHui@users.noreply.github.com> * Fix up cmake targets files, install bin/dlls to the proper location * Use debug bin dir if in debug mode * Fixes for unified, Windows dlls, and more - Make the unified backend its own feature - Make the unified and CPU backend default features - Conditionally create a bin directory if a Windows non-static build for the unified dll - Remove fftw dependency (relies on MKL) - Only support x64 * Add warning for Windows static builds * Ensure CMake assets are in the proper dir for non-Windows builds * Actually, don't change cmake targets in non-Windows systems * Remove port-version * Use MKL for CPU and OpenCL backends * Patch arrayfire/threads - fix duplicate include * Use newer af/threads, replace include path to fix Windows builds * Fix binary dir for output DLLs * Update select_compute_arch to work with CUDA 11 * Don't include CUB if using CUDA >= 11 * Bump port verison to 3.7.3 to handle CUDA 11+ * Update port to use 3.7.3 * Update to include MSVC 2019 fixes, fixup CMake targets on *nix * Apply suggestions from code review * Update ports/arrayfire/portfile.cmake * Change AF CMake dir since targets.cmake are included by other targets * Bump to commit with fixed AF version for bits The v3.7 branch tip was still outputting shared objects with 3.7.2 versions attached to them. It's now fixed Co-authored-by: Phoebe <20694052+PhoebeHui@users.noreply.github.com> Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
2020-11-20 02:50:38 +08:00
--- a/src/backend/cuda/CMakeLists.txt
+++ b/src/backend/cuda/CMakeLists.txt
@@ -110,7 +110,11 @@ cuda_include_directories(
${COMMON_INTERFACE_DIRS}
)
if(CUDA_VERSION_MAJOR VERSION_LESS 11)
- cuda_include_directories(${ArrayFire_SOURCE_DIR}/extern/cub)
+ find_path(CUB_INCLUDE_DIRS "cub/agent/agent_histogram.cuh")
+ if (${CUB_INCLUDE_DIRS} EQUAL "CUB_INCLUDE_DIRS-NOTFOUND")
+ set(CUB_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/cub)
+ endif()
+ cuda_include_directories(${CUB_INCLUDE_DIRS})
endif()
file(GLOB jit_src "kernel/jit.cuh")
@@ -240,9 +244,14 @@ if(AF_WITH_NONFREE)
set(cxx_definitions -DAF_WITH_NONFREE_SIFT)
endif()
+# New API of cuSparse was introduced in 10.1.168 for Linux and the older
+# 10.1.105 fix version doesn't it. Unfortunately, the new API was introduced in
+# in a fix release of CUDA - unconventionally. As CMake's FindCUDA module
+# doesn't provide patch/fix version number, we use 10.2 as the minimum
+# CUDA version to enable this new cuSparse API.
if(CUDA_VERSION_MAJOR VERSION_GREATER 10 OR
(UNIX AND
- CUDA_VERSION_MAJOR VERSION_EQUAL 10 AND CUDA_VERSION_MINOR VERSION_GREATER 0))
+ CUDA_VERSION_MAJOR VERSION_EQUAL 10 AND CUDA_VERSION_MINOR VERSION_GREATER 1))
list(APPEND cxx_definitions -DAF_USE_NEW_CUSPARSE_API)
endif()
@@ -301,7 +310,7 @@ set_target_properties(af_cuda_static_cuda_library
if(CUDA_VERSION_MAJOR VERSION_GREATER 10 OR
(UNIX AND
- CUDA_VERSION_MAJOR VERSION_EQUAL 10 AND CUDA_VERSION_MINOR VERSION_GREATER 0))
+ CUDA_VERSION_MAJOR VERSION_EQUAL 10 AND CUDA_VERSION_MINOR VERSION_GREATER 1))
target_compile_definitions(af_cuda_static_cuda_library PRIVATE AF_USE_NEW_CUSPARSE_API)
endif()
[arrayfire] New Port (#14240) * [arrayfire] New Port * Format manifest file * Remove nvidia cub, forge, and spdlog submodules and use vcpkg ports - add patch * Remove arrayfire/assets and don't build examples * Remove arrayfire/glad submodule, use port, update patch * Add optional freeimage dependency for graphics lib * Remove rename of arrayfire threads/pass path to build * Update ports/arrayfire/portfile.cmake Co-authored-by: Phoebe <20694052+PhoebeHui@users.noreply.github.com> * Fix up cmake targets files, install bin/dlls to the proper location * Use debug bin dir if in debug mode * Fixes for unified, Windows dlls, and more - Make the unified backend its own feature - Make the unified and CPU backend default features - Conditionally create a bin directory if a Windows non-static build for the unified dll - Remove fftw dependency (relies on MKL) - Only support x64 * Add warning for Windows static builds * Ensure CMake assets are in the proper dir for non-Windows builds * Actually, don't change cmake targets in non-Windows systems * Remove port-version * Use MKL for CPU and OpenCL backends * Patch arrayfire/threads - fix duplicate include * Use newer af/threads, replace include path to fix Windows builds * Fix binary dir for output DLLs * Update select_compute_arch to work with CUDA 11 * Don't include CUB if using CUDA >= 11 * Bump port verison to 3.7.3 to handle CUDA 11+ * Update port to use 3.7.3 * Update to include MSVC 2019 fixes, fixup CMake targets on *nix * Apply suggestions from code review * Update ports/arrayfire/portfile.cmake * Change AF CMake dir since targets.cmake are included by other targets * Bump to commit with fixed AF version for bits The v3.7 branch tip was still outputting shared objects with 3.7.2 versions attached to them. It's now fixed Co-authored-by: Phoebe <20694052+PhoebeHui@users.noreply.github.com> Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
2020-11-20 02:50:38 +08:00
diff --git a/src/backend/opencl/kernel/scan_by_key/CMakeLists.txt b/src/backend/opencl/kernel/scan_by_key/CMakeLists.txt
index 9a796c9e..d9864b00 100644
--- a/src/backend/opencl/kernel/scan_by_key/CMakeLists.txt
+++ b/src/backend/opencl/kernel/scan_by_key/CMakeLists.txt
@@ -27,6 +27,7 @@ foreach(SBK_BINARY_OP ${SBK_BINARY_OPS})
add_dependencies(opencl_scan_by_key_${SBK_BINARY_OP}
${cl_kernel_targets} OpenCL::cl2hpp Boost::boost)
+ find_package(glad CONFIG REQUIRED)
target_include_directories(opencl_scan_by_key_${SBK_BINARY_OP}
PRIVATE
.
@@ -39,9 +40,7 @@ foreach(SBK_BINARY_OP ${SBK_BINARY_OPS})
$<TARGET_PROPERTY:OpenCL::OpenCL,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:OpenCL::cl2hpp,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:Boost::boost,INTERFACE_INCLUDE_DIRECTORIES>
- $<TARGET_PROPERTY:af_glad_interface,INTERFACE_INCLUDE_DIRECTORIES>
- ${ArrayFire_SOURCE_DIR}/extern/forge/include
- ${ArrayFire_BINARY_DIR}/extern/forge/include
+ $<TARGET_PROPERTY:glad::glad,INTERFACE_INCLUDE_DIRECTORIES>
)
set_target_properties(opencl_scan_by_key_${SBK_BINARY_OP}
diff --git a/src/backend/opencl/kernel/sort_by_key/CMakeLists.txt b/src/backend/opencl/kernel/sort_by_key/CMakeLists.txt
index d618ff2f..9f517398 100644
--- a/src/backend/opencl/kernel/sort_by_key/CMakeLists.txt
+++ b/src/backend/opencl/kernel/sort_by_key/CMakeLists.txt
@@ -32,14 +32,13 @@ foreach(SBK_TYPE ${SBK_TYPES})
../../../include
${CMAKE_CURRENT_BINARY_DIR})
+ find_package(glad CONFIG REQUIRED)
target_include_directories(opencl_sort_by_key_${SBK_TYPE}
SYSTEM PRIVATE
$<TARGET_PROPERTY:OpenCL::OpenCL,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:OpenCL::cl2hpp,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:Boost::boost,INTERFACE_INCLUDE_DIRECTORIES>
- $<TARGET_PROPERTY:af_glad_interface,INTERFACE_INCLUDE_DIRECTORIES>
- ${ArrayFire_SOURCE_DIR}/extern/forge/include
- ${ArrayFire_BINARY_DIR}/extern/forge/include
+ $<TARGET_PROPERTY:glad::glad,INTERFACE_INCLUDE_DIRECTORIES>
)
set_target_properties(opencl_sort_by_key_${SBK_TYPE}