Skip to content

Commit d2ea867

Browse files
committed
TEST: Support cnumpy in integration_tests
1 parent 9875f8a commit d2ea867

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

integration_tests/CMakeLists.txt

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
22

33
project(lpython_tests C)
44

@@ -37,14 +37,21 @@ set_property(TARGET lpython_rtlib PROPERTY INTERFACE_LINK_LIBRARIES
3737
${LPYTHON_RTLIB_LIBRARY})
3838
target_link_libraries(lpython_rtlib INTERFACE m)
3939

40-
find_package(Python COMPONENTS Development)
40+
find_package(Python COMPONENTS Interpreter Development)
41+
execute_process(
42+
COMMAND "${Python_EXECUTABLE}"
43+
-c "import numpy; print(numpy.get_include())"
44+
OUTPUT_VARIABLE NUMPY_INCLUDE_DIR
45+
OUTPUT_STRIP_TRAILING_WHITESPACE
46+
)
4147
message("\n")
4248
message("System has the Python development artifacts: ${Python_Development_FOUND}")
4349
message("The Python include directories: ${Python_INCLUDE_DIRS}")
4450
message("The Python libraries: ${Python_LIBRARIES}")
4551
message("The Python library directories: ${Python_LIBRARY_DIRS}")
4652
message("The Python runtime library directories: ${Python_RUNTIME_LIBRARY_DIRS}")
4753
message("Python version: ${Python_VERSION}")
54+
message("Numpy Include Directory: ${NUMPY_INCLUDE_DIR}")
4855

4956
enable_testing()
5057

@@ -125,6 +132,7 @@ macro(RUN_UTIL RUN_FAIL RUN_NAME RUN_FILE_NAME RUN_IMPORT_PATH RUN_LABELS RUN_EN
125132
set_target_properties(${name} PROPERTIES LINKER_LANGUAGE C)
126133
target_link_libraries(${name} lpython_rtlib)
127134
if (run_enable_cpython)
135+
target_include_directories(${name} PRIVATE ${NUMPY_INCLUDE_DIR})
128136
target_link_libraries(${name} Python::Python)
129137
if (extra_files)
130138
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/${extra_files} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
@@ -235,7 +243,7 @@ macro(RUN_UTIL RUN_FAIL RUN_NAME RUN_FILE_NAME RUN_IMPORT_PATH RUN_LABELS RUN_EN
235243
endmacro(RUN_UTIL)
236244

237245
macro(RUN)
238-
set(options FAIL NOFAST ENABLE_CPYTHON)
246+
set(options FAIL NOFAST ENABLE_CPYTHON ENABLE_CNUMPY)
239247
set(oneValueArgs NAME IMPORT_PATH)
240248
set(multiValueArgs LABELS EXTRAFILES)
241249
cmake_parse_arguments(RUN "${options}" "${oneValueArgs}"
@@ -248,6 +256,10 @@ macro(RUN)
248256
set(RUN_EXTRA_ARGS ${RUN_EXTRA_ARGS} --enable-cpython)
249257
endif()
250258

259+
if (RUN_ENABLE_CNUMPY)
260+
set(RUN_EXTRA_ARGS ${RUN_EXTRA_ARGS} --enable-cnumpy)
261+
endif()
262+
251263
RUN_UTIL(RUN_FAIL RUN_NAME RUN_FILE_NAME RUN_IMPORT_PATH RUN_LABELS RUN_ENABLE_CPYTHON RUN_EXTRAFILES RUN_EXTRA_ARGS)
252264

253265
if ((NOT DISABLE_FAST) AND (NOT RUN_NOFAST))

0 commit comments

Comments
 (0)