Skip to content

Commit

Permalink
[DFT] Add includes when linking directly to a DFT backend
Browse files Browse the repository at this point in the history
  • Loading branch information
hjabird committed Jun 24, 2024
1 parent 6c23467 commit 311f064
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 13 deletions.
11 changes: 8 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ set(ENABLE_PORTBLAS_BACKEND_NVIDIA_GPU OFF CACHE INTERNAL "")
# store path to CMAKE_CURRENT_BINARY_DIR to use it later (makes FetchContent_Declare workable)
set(ONEMKL_GENERATED_INCLUDE_PATH ${CMAKE_CURRENT_BINARY_DIR})


set(ONEMKL_INTERFACE_INCLUDE_DIRS
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<INSTALL_INTERFACE:include>
)

# Build loader and backends for each domain
add_custom_target(onemkl_backend_libs)
foreach(domain ${TARGET_DOMAINS})
Expand Down Expand Up @@ -60,9 +67,7 @@ if(BUILD_SHARED_LIBS)
add_dependencies(onemkl onemkl_backend_libs)

target_include_directories(onemkl
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<INSTALL_INTERFACE:include>
PUBLIC ${ONEMKL_INTERFACE_INCLUDE_DIRS}
)
set_target_properties(onemkl PROPERTIES
SOVERSION ${PROJECT_VERSION_MAJOR}
Expand Down
6 changes: 4 additions & 2 deletions src/dft/backends/cufft/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ add_library(${LIB_OBJ} OBJECT
add_dependencies(onemkl_backend_libs_dft ${LIB_NAME})

target_include_directories(${LIB_OBJ}
PRIVATE ${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/src
PUBLIC ${ONEMKL_INTERFACE_INCLUDE_DIRS}
)
target_include_directories(${LIB_OBJ}
PRIVATE ${PROJECT_SOURCE_DIR}/src
${CMAKE_BINARY_DIR}/bin
${ONEMKL_GENERATED_INCLUDE_PATH}
)
Expand Down
6 changes: 4 additions & 2 deletions src/dft/backends/mklcpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ add_library(${LIB_OBJ} OBJECT
add_dependencies(onemkl_backend_libs_dft ${LIB_NAME})

target_include_directories(${LIB_OBJ}
PRIVATE ${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/src
PUBLIC ${ONEMKL_INTERFACE_INCLUDE_DIRS}
)
target_include_directories(${LIB_OBJ}
PRIVATE ${PROJECT_SOURCE_DIR}/src
${CMAKE_BINARY_DIR}/bin
${ONEMKL_GENERATED_INCLUDE_PATH}
)
Expand Down
6 changes: 4 additions & 2 deletions src/dft/backends/mklgpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ add_library(${LIB_OBJ} OBJECT
add_dependencies(onemkl_backend_libs_dft ${LIB_NAME})

target_include_directories(${LIB_OBJ}
PRIVATE ${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/src
PUBLIC ${ONEMKL_INTERFACE_INCLUDE_DIRS}
)
target_include_directories(${LIB_OBJ}
PRIVATE ${PROJECT_SOURCE_DIR}/src
${CMAKE_BINARY_DIR}/bin
${ONEMKL_GENERATED_INCLUDE_PATH}
)
Expand Down
6 changes: 4 additions & 2 deletions src/dft/backends/portfft/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ endif()
target_link_libraries(${LIB_OBJ} PRIVATE onemkl_warnings)

target_include_directories(${LIB_OBJ}
PRIVATE ${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/src
PUBLIC ${ONEMKL_INTERFACE_INCLUDE_DIRS}
)
target_include_directories(${LIB_OBJ}
PRIVATE ${PROJECT_SOURCE_DIR}/src
${CMAKE_BINARY_DIR}/bin
)

Expand Down
6 changes: 4 additions & 2 deletions src/dft/backends/rocfft/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ add_library(${LIB_OBJ} OBJECT
add_dependencies(onemkl_backend_libs_dft ${LIB_NAME})

target_include_directories(${LIB_OBJ}
PRIVATE ${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/src
PUBLIC ${ONEMKL_INTERFACE_INCLUDE_DIRS}
)
target_include_directories(${LIB_OBJ}
PRIVATE ${PROJECT_SOURCE_DIR}/src
${CMAKE_BINARY_DIR}/bin
${ONEMKL_GENERATED_INCLUDE_PATH}
)
Expand Down

0 comments on commit 311f064

Please sign in to comment.