66# The full license is in the file LICENSE, distributed with this software. #
77############################################################################
88
9+ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR )
10+ project (xtensor-python-benchmark)
11+
12+ find_package (xtensor-python REQUIRED CONFIG)
13+ set (XTENSOR_PYTHON_INCLUDE_DIR ${xtensor-python_INCLUDE_DIRS})
14+ endif ()
15+
916message (STATUS "Forcing tests build type to Release" )
1017set (CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
1118
@@ -72,7 +79,7 @@ if (APPLE)
7279elseif (MSVC )
7380 target_link_libraries (${XTENSOR_PYTHON_BENCHMARK_TARGET} ${PYTHON_LIBRARIES} )
7481else ()
75- target_link_libraries (${XTENSOR_PYTHON_BENCHMARK_TARGET} "-shared" )
82+ target_link_libraries (${XTENSOR_PYTHON_BENCHMARK_TARGET} PRIVATE xtensor-python )
7683endif ()
7784
7885configure_file (benchmark_pyarray.py benchmark_pyarray.py COPYONLY )
@@ -81,5 +88,11 @@ configure_file(benchmark_pybind_array.py benchmark_pybind_array.py COPYONLY)
8188configure_file (benchmark_pyvectorize.py benchmark_pyvectorize.py COPYONLY )
8289configure_file (benchmark_pybind_vectorize.py benchmark_pybind_vectorize.py COPYONLY )
8390
84- add_custom_target (xbenchmark DEPENDS ${XTENSOR_PYTHON_BENCHMARK_TARGET} )
91+ add_custom_target (xbenchmark
92+ COMMAND "${PYTHON_EXECUTABLE} " "benchmark_pyarray.py"
93+ COMMAND "${PYTHON_EXECUTABLE} " "benchmark_pytensor.py"
94+ COMMAND "${PYTHON_EXECUTABLE} " "benchmark_pybind_array.py"
95+ COMMAND "${PYTHON_EXECUTABLE} " "benchmark_pyvectorize.py"
96+ COMMAND "${PYTHON_EXECUTABLE} " "benchmark_pybind_vectorize.py"
97+ DEPENDS ${XTENSOR_PYTHON_BENCHMARK_TARGET} )
8598
0 commit comments