Skip to content

Commit 54d61fa

Browse files
committed
Update cmake to configure added c++ + openmp kernels + add llvm-openmp to native conda environment
1 parent 502d4b9 commit 54d61fa

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,13 @@ endif()
107107

108108
find_package(argparse REQUIRED)
109109
find_package(pugixml REQUIRED)
110+
find_package(OpenMP)
111+
112+
# Used to configure OpenMP kernels such that Cpp::loadlibrary knows where OpenMP library is
113+
if (NOT WIN32)
114+
list(GET OpenMP_CXX_LIBRARIES 0 FirstOpenMPLibrary)
115+
get_filename_component(OpenMPLibraryDir "${FirstOpenMPLibrary}" DIRECTORY)
116+
endif()
110117

111118
# Configuration
112119
# =============
@@ -127,6 +134,9 @@ function(configure_kernel kernel)
127134
set(XEUS_CPP_PATH "$ENV{PATH}")
128135
set(XEUS_CPP_LD_LIBRARY_PATH "$ENV{LD_LIBRARY_PATH}")
129136
set(XEUS_CPP_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include)
137+
if(${kernel} MATCHES "omp/$")
138+
set(XEUS_CPP_OMP "${OpenMP_CXX_FLAGS}")
139+
endif()
130140
endif()
131141
if (WIN32)
132142
string(REPLACE "\\" "/" kernel "${kernel}")
@@ -163,6 +173,11 @@ configure_kernel("/share/jupyter/kernels/xcpp23/")
163173
configure_kernel("/share/jupyter/kernels/xc11/")
164174
configure_kernel("/share/jupyter/kernels/xc17/")
165175
configure_kernel("/share/jupyter/kernels/xc23/")
176+
if(NOT EMSCRIPTEN)
177+
configure_kernel("/share/jupyter/kernels/xcpp17-omp/")
178+
configure_kernel("/share/jupyter/kernels/xcpp20-omp/")
179+
configure_kernel("/share/jupyter/kernels/xcpp23-omp/")
180+
endif()
166181

167182
# Source files
168183
# ============

environment-dev.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ dependencies:
1414
- CppInterOp
1515
- pugixml
1616
- cpp-argparse
17+
- llvm-openmp
1718
# Test dependencies
1819
- pytest
1920
- jupyter_kernel_test<0.8

0 commit comments

Comments
 (0)