Skip to content

Commit da0995c

Browse files
Remove the workaround via CMAKE_BINARY_DIR from DpctlExtCAPI
1 parent 946ce93 commit da0995c

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

CMakeLists.txt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -347,17 +347,12 @@ endif()
347347
# DpctlExtCAPI: Interface library for dpctl_ext C-API
348348
# Provides access to:
349349
# 1. Public C-API headers from dpctl_ext/apis/include
350-
# 2. Generated Cython headers from a specific build subdirectory
351-
352-
# Set the specific directory for generated Cython headers
353-
set(DPCTL_EXT_GENERATED_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR})
350+
# 2. Generated Cython headers via per-target header interface libraries
354351

355352
add_library(DpctlExtCAPI INTERFACE)
356353
target_include_directories(
357354
DpctlExtCAPI
358-
INTERFACE
359-
${CMAKE_CURRENT_SOURCE_DIR}/dpctl_ext/apis/include
360-
${DPCTL_EXT_GENERATED_INCLUDE_DIR}
355+
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/dpctl_ext/apis/include
361356
)
362357

363358
add_subdirectory(dpctl_ext)

dpctl_ext/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,11 @@ function(build_dpctl_ext _trgt _src _dest)
159159
# TODO: create separate folder inside build folder that contains only
160160
# headers related to this target and appropriate folder structure to
161161
# eliminate shadow dependencies
162-
get_filename_component(_generated_src_dir_dir ${_generated_src_dir} DIRECTORY)
162+
# Go up two levels to build root for "dpctl_ext/tensor/_usmarray.h" resolution
163+
get_filename_component(_parent_dir ${_generated_src_dir} DIRECTORY)
164+
get_filename_component(_build_root ${_parent_dir} DIRECTORY)
163165
# TODO: do not set directory if we did not generate header
164-
target_include_directories(${_trgt} INTERFACE ${_generated_src_dir_dir})
166+
target_include_directories(${_trgt} INTERFACE ${_build_root})
165167
set(_rpath_value "$ORIGIN")
166168
if(BUILD_DPCTL_EXT_RELATIVE_PATH)
167169
set(_rpath_value "${_rpath_value}/${BUILD_DPCTL_EXT_RELATIVE_PATH}")

dpctl_ext/apis/include/dpctl_ext_capi.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666

6767
// Include the generated Cython C-API headers for usm_ndarray
6868
// These headers are generated during build and placed in the build directory
69-
#include <dpctl_ext/tensor/_usmarray.h>
70-
#include <dpctl_ext/tensor/_usmarray_api.h>
69+
#include "dpctl_ext/tensor/_usmarray.h"
70+
#include "dpctl_ext/tensor/_usmarray_api.h"
7171

7272
/*
7373
* Function to import dpctl_ext C-API and make it available.

0 commit comments

Comments
 (0)