-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
38 lines (28 loc) · 993 Bytes
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
cmake_minimum_required(VERSION 3.12)
# Also update version in nihtest/__main__.py and pyproject.toml
project(nihtest
VERSION 1.9.1
DESCRIPTION "NiH testing framework"
HOMEPAGE_URL "https://github.com/nih-at/nihtest"
LANGUAGES C)
enable_testing()
find_package(Python3 REQUIRED COMPONENTS Interpreter)
set(VENV ${CMAKE_BINARY_DIR}/venv)
if (WIN32)
set(VENV_BIN_DIR ${VENV}/Scripts)
set(VENV_PYTHON ${VENV_BIN_DIR}/python.exe)
else () # assume Linux
set(VENV_BIN_DIR ${VENV}/bin)
set(VENV_PYTHON ${VENV_BIN_DIR}/python)
endif ()
set(NIHTEST ${VENV_BIN_DIR}/nihtest)
file(GLOB SOURCES ${CMAKE_SOURCE_DIR}/nihtest/*.py)
add_custom_command(
OUTPUT ${NIHTEST}
COMMAND ${Python3_EXECUTABLE} -m venv ${VENV}
COMMAND ${VENV_BIN_DIR}/pip install -q --disable-pip-version-check ${CMAKE_SOURCE_DIR}
DEPENDS ${SOURCES}
)
add_custom_target(venv ALL DEPENDS ${NIHTEST})
# TODO: target for wheel
add_subdirectory(tests)