Skip to content

Commit

Permalink
Search only Python3 package when building pybgcode
Browse files Browse the repository at this point in the history
  • Loading branch information
tamasmeszaros committed Oct 27, 2023
1 parent 04556c4 commit ca0ca6d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pybgcode/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ project(PyBGCode VERSION 0.1)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)


option(PyBGCode_LINK_SYSTEM_LIBBGCODE "Link libbgcode installed in the system" ON)

# Default values for libbgcode subproject
Expand All @@ -21,7 +20,7 @@ else ()
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR}/upstream)
endif ()

find_package(Python REQUIRED COMPONENTS Interpreter Development)
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
find_package(pybind11 REQUIRED)

set(PY_VERSION_SUFFIX "")
Expand Down Expand Up @@ -79,7 +78,7 @@ set (TEST_DATA_DIR ${CMAKE_CURRENT_LIST_DIR}/../tests/data)
configure_file(${TEST_DATA_DIR}/mini_cube_b_ref.gcode ${CMAKE_CURRENT_BINARY_DIR}/test.gcode)

# Define the test for ctest and inject the correct PYTHONPATH env var for its runtime
add_test(NAME test_pybgcode COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_convert.py CONFIGURATIONS ${CMAKE_CONFIGURATION_TYPES})
add_test(NAME test_pybgcode COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_convert.py CONFIGURATIONS ${CMAKE_CONFIGURATION_TYPES})
set_property(TEST test_pybgcode PROPERTY ENVIRONMENT PYTHONPATH=$<TARGET_FILE_DIR:pybgcode>)

add_custom_target(build_and_test COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS pybgcode)

0 comments on commit ca0ca6d

Please sign in to comment.