Skip to content

Commit

Permalink
Clean up CMakeLists
Browse files Browse the repository at this point in the history
  • Loading branch information
ZzEeKkAa committed Mar 28, 2024
1 parent fafc50a commit a66e5e2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
10 changes: 6 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ This ``CMakeLists.txt`` file will be used by ``setup.py``.

cmake_minimum_required(VERSION 3.21...3.27 FATAL_ERROR)

message(STATUS "NUMBA_DPEX_VERSION=" "${NUMBA_DPEX_VERSION}")

project(numba-dpex
DESCRIPTION "An extension for Numba to add data-parallel offload capability"
VERSION ${NUMBA_DPEX_VERSION}
DESCRIPTION "An extension for Numba to add data-parallel offload capability"
)

add_subdirectory(numba_dpex)
# Help conda build find path from both host and build env.
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)

add_subdirectory(numba_dpex/core/runtime)
1 change: 0 additions & 1 deletion numba_dpex/CMakeLists.txt

This file was deleted.

30 changes: 14 additions & 16 deletions numba_dpex/core/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ project(_dpexrt_python
DESCRIPTION "A Python C extension for numba-dpex runtime."
)

# Help conda build find path from both host and build env.
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)

# Get numba include path
if(NOT DEFINED Numba_INCLUDE_DIRS)
execute_process(
Expand Down Expand Up @@ -78,23 +74,12 @@ endif()
set(SKBUILD_MODULE_PATH ${SKBUILD_PATH}/resources/cmake)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${SKBUILD_MODULE_PATH})

# Check CMAKE_MODULE_PATH
message(STATUS "CMAKE_MODULE_PATH=" "${CMAKE_MODULE_PATH}")

# Add packages
find_package(Python 3.9 REQUIRED
COMPONENTS Interpreter Development.Module NumPy)
find_package(Dpctl REQUIRED)
find_package(IntelSYCL REQUIRED)

# Includes
include(GNUInstallDirs)
include_directories(${Python_INCLUDE_DIRS})
include_directories(${Python_NumPy_INCLUDE_DIRS})
include_directories(${Numba_INCLUDE_DIRS})
include_directories(${Dpctl_INCLUDE_DIRS})
include_directories(.)

# Source files, *.c
file(GLOB_RECURSE DPEXRT_SOURCES CONFIGURE_DEPENDS "*.c")
file(GLOB_RECURSE KERNEL_SOURCES CONFIGURE_DEPENDS "*.cpp")
Expand All @@ -109,7 +94,20 @@ python_add_library(${PROJECT_NAME} MODULE ${SOURCES})
# Add SYCL to target, this must come after python_add_library()
add_sycl_to_target(TARGET ${PROJECT_NAME} SOURCES ${KERNEL_SOURCES})

# Link the DPCTLSyclInterface library to target
# Add source headers
target_include_directories(${PROJECT_NAME} PRIVATE .)

# Add Numba Runtime headers
target_include_directories(${PROJECT_NAME} PRIVATE ${Numba_INCLUDE_DIRS})

# Link numpy
target_link_libraries(${PROJECT_NAME} PRIVATE Python::NumPy)

# TODO: switch to CMake, once dpctl supports it.
# Include DPCTL libraray
target_include_directories(${PROJECT_NAME} PRIVATE ${Dpctl_INCLUDE_DIRS})
# Linking target binary with DPCTLSyclInterface.so/.dll so the symbols could
# be found during runtime.
target_link_libraries(${PROJECT_NAME} PRIVATE DPCTLSyclInterface)

# Install
Expand Down

0 comments on commit a66e5e2

Please sign in to comment.