CMakelists: Made tests building rule independent of the python build
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@intel.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
committed by
Brendan Le Foll
parent
ecc04d7511
commit
c564dad68f
@@ -65,11 +65,11 @@ option (USBPLAT "Detection USB platform." OFF)
|
|||||||
option (FTDI4222 "Build with FTDI FT4222 subplatform support." OFF)
|
option (FTDI4222 "Build with FTDI FT4222 subplatform support." OFF)
|
||||||
option (IPK "Generate IPK using CPack" OFF)
|
option (IPK "Generate IPK using CPack" OFF)
|
||||||
option (RPM "Generate RPM using CPack" OFF)
|
option (RPM "Generate RPM using CPack" OFF)
|
||||||
option (BUILDPYTHON3 "Use python3 for building/installing" OFF)
|
option (BUILDPYTHON3 "Use python3 for building/installing/testing" OFF)
|
||||||
option (ENABLEEXAMPLES "Disable building of examples" ON)
|
option (ENABLEEXAMPLES "Disable building of examples" ON)
|
||||||
option (INSTALLGPIOTOOL "Install gpio tool" OFF)
|
option (INSTALLGPIOTOOL "Install gpio tool" OFF)
|
||||||
option (BUILDARCH "Override architecture to build for - override" OFF)
|
option (BUILDARCH "Override architecture to build for - override" OFF)
|
||||||
option (TESTS "Override the addition of tests" ON)
|
option (BUILDTESTS "Override the addition of tests" ON)
|
||||||
|
|
||||||
set (MRAAPLATFORMFORCE "" CACHE STRING "ALL")
|
set (MRAAPLATFORMFORCE "" CACHE STRING "ALL")
|
||||||
|
|
||||||
@@ -97,19 +97,13 @@ else ()
|
|||||||
message(FATAL_ERROR "Only x86 and arm platforms currently supported")
|
message(FATAL_ERROR "Only x86 and arm platforms currently supported")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (BUILDSWIGPYTHON)
|
if (BUILDSWIGPYTHON OR BUILDTESTS)
|
||||||
if (BUILDPYTHON3)
|
if (BUILDPYTHON3)
|
||||||
set (PYTHONBUILD_VERSION 3)
|
set (PYTHONBUILD_VERSION 3)
|
||||||
else ()
|
else ()
|
||||||
set (PYTHONBUILD_VERSION 2.7)
|
set (PYTHONBUILD_VERSION 2.7)
|
||||||
endif ()
|
endif ()
|
||||||
find_package (PythonInterp ${PYTHONBUILD_VERSION} REQUIRED)
|
find_package (PythonInterp ${PYTHONBUILD_VERSION} REQUIRED)
|
||||||
if (TESTS)
|
|
||||||
if (${PYTHONINTERP_FOUND})
|
|
||||||
enable_testing ()
|
|
||||||
add_subdirectory (tests)
|
|
||||||
endif ()
|
|
||||||
endif ()
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (BUILDDOC)
|
if (BUILDDOC)
|
||||||
@@ -192,3 +186,10 @@ add_subdirectory (src)
|
|||||||
if (ENABLEEXAMPLES)
|
if (ENABLEEXAMPLES)
|
||||||
add_subdirectory (examples)
|
add_subdirectory (examples)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
if (BUILDTESTS)
|
||||||
|
if (${PYTHONINTERP_FOUND})
|
||||||
|
enable_testing ()
|
||||||
|
add_subdirectory (tests)
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
add_test (NAME py_general COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/general_checks.py)
|
if (BUILDSWIGPYTHON)
|
||||||
set_tests_properties(py_general PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/src/python/")
|
add_test (NAME py_general COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/general_checks.py)
|
||||||
|
set_tests_properties(py_general PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/src/python/")
|
||||||
|
|
||||||
add_test (NAME py_platform COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/platform_checks.py)
|
add_test (NAME py_platform COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/platform_checks.py)
|
||||||
set_tests_properties(py_platform PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/src/python/")
|
set_tests_properties(py_platform PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/src/python/")
|
||||||
|
|
||||||
add_test (NAME py_gpio COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/gpio_checks.py)
|
|
||||||
set_tests_properties(py_gpio PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/src/python/")
|
|
||||||
|
|
||||||
|
add_test (NAME py_gpio COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/gpio_checks.py)
|
||||||
|
set_tests_properties(py_gpio PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/src/python/")
|
||||||
|
endif()
|
||||||
|
|||||||
Reference in New Issue
Block a user