Skip to content

Fix boost errors during configuration in CMake 3.5.1 #2771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CMakeModules/boost_package.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ if(NOT
INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIR};${source_dir}/include"
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIR};${source_dir}/include"
)
else()
if(NOT TARGET Boost::boost)
add_library(Boost::boost IMPORTED INTERFACE GLOBAL)
set_target_properties(Boost::boost PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIR}"
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIR}")
endif()
endif()

if(TARGET Boost::boost)
Expand Down
10 changes: 10 additions & 0 deletions src/backend/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,16 @@ endfunction()
arrayfire_get_cuda_cxx_flags(cuda_cxx_flags)
arrayfire_get_platform_definitions(platform_flags)


get_property(boost_includes TARGET Boost::boost PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
get_property(boost_definitions TARGET Boost::boost PROPERTY INTERFACE_COMPILE_DEFINITIONS)

string(REPLACE ";" ";-I" boost_includes "-I${boost_includes}")
string(REPLACE ";" ";-D" boost_definitions "-D${boost_definitions}")

set(cuda_cxx_flags "${cuda_cxx_flags};${boost_includes}")
set(cuda_cxx_flags "${cuda_cxx_flags};${boost_definitions}")

# This definition is required in addition to the definition below because in
# an older verion of cmake definitions added using target_compile_definitions
# were not added to the nvcc flags. This manually adds these definitions and
Expand Down
2 changes: 0 additions & 2 deletions src/backend/cuda/kernel/scan_by_key/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ foreach(SBK_BINARY_OP ${SBK_BINARY_OPS})
"${CMAKE_CURRENT_SOURCE_DIR}/kernel/scan_dim_by_key_impl.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/kernel/scan_first_by_key_impl.hpp"
OPTIONS
-I$<JOIN:$<TARGET_PROPERTY:Boost::boost,INTERFACE_INCLUDE_DIRECTORIES>, -I>
-D$<JOIN:$<TARGET_PROPERTY:Boost::boost,INTERFACE_COMPILE_DEFINITIONS>, -D>
-DSBK_BINARY_OP=${SBK_BINARY_OP} "${platform_flags} ${cuda_cxx_flags} -DAFDLL"
)

Expand Down
10 changes: 4 additions & 6 deletions src/backend/cuda/kernel/thrust_sort_by_key/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/kernel/thrust_sort_by_key/thrust_sort_

foreach(STR ${FILESTRINGS})
if(${STR} MATCHES "// SBK_TYPES")
STRING(REPLACE "// SBK_TYPES:" "" TEMP ${STR})
STRING(REPLACE " " ";" SBK_TYPES ${TEMP})
string(REPLACE "// SBK_TYPES:" "" TEMP ${STR})
string(REPLACE " " ";" SBK_TYPES ${TEMP})
elseif(${STR} MATCHES "// SBK_INSTS:")
STRING(REPLACE "// SBK_INSTS:" "" TEMP ${STR})
STRING(REPLACE " " ";" SBK_INSTS ${TEMP})
string(REPLACE "// SBK_INSTS:" "" TEMP ${STR})
string(REPLACE " " ";" SBK_INSTS ${TEMP})
endif()
endforeach()

Expand All @@ -34,8 +34,6 @@ foreach(SBK_TYPE ${SBK_TYPES})
${CMAKE_CURRENT_BINARY_DIR}/kernel/thrust_sort_by_key/thrust_sort_by_key_impl_${SBK_TYPE}_${SBK_INST}.cu
${CMAKE_CURRENT_SOURCE_DIR}/kernel/thrust_sort_by_key_impl.hpp
OPTIONS
-I$<JOIN:$<TARGET_PROPERTY:Boost::boost,INTERFACE_INCLUDE_DIRECTORIES>, -I>
-D$<JOIN:$<TARGET_PROPERTY:Boost::boost,INTERFACE_COMPILE_DEFINITIONS>, -D>
-DSBK_TYPE=${SBK_TYPE}
-DINSTANTIATESBK_INST=INSTANTIATE${SBK_INST}
"${platform_flags} ${cuda_cxx_flags} -DAFDLL"
Expand Down