-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
142 lines (106 loc) · 4.04 KB
/
Makefile
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
SHELL := /bin/bash
TESTS :=
OPTIONS :=
PACKAGE_NAME := $(shell cat package.txt)
PACKAGE_VERSION := $(shell cat version.txt)
BUILD_TYPE := Release
PYTHON := python3.10
PYTHON_VERSION := 3.10.0 #3.8.12
VENV_NAME := $(shell cat .python-version)
ENABLE_CONAN := ON
ENABLE_COVERAGE := OFF
ENABLE_SANITIZER_ADDRESS := OFF
ENABLE_SANITIZER_LEAK := OFF
ENABLE_SANITIZER_UNDEFINED_BEHAVIOR := OFF
ENABLE_SANITIZER_THREAD := OFF
ENABLE_SANITIZER_MEMORY := OFF
ENABLE_R := OFF
ENABLE_TESTING := ON
ENABLE_PYTHON := OFF
PIP_OPTIONS :=
#CONAN_OPTIONS := -s:b compiler.cppstd=17 -s:h compiler.cppstd=17 --profile:build=default --build=catch2/3.4.0 --build=missing
CONAN_OPTIONS := -s:b compiler.cppstd=20 -s:h compiler.cppstd=20 --profile:build=default --profile:host=default --build=missing
.PHONY: all
all: build
.PHONY: clean
clean:
make -C build/${BUILD_TYPE} clean
.PHONY: very-clean
very-clean:
rm -fr ./build ./test_package/build
.PHONY: configure
configure:
mkdir -p build; cd build; conan install .. ${CONAN_OPTIONS} -o '&:ENABLE_COVERAGE=${ENABLE_COVERAGE}' -o '&:ENABLE_TESTING=${ENABLE_TESTING}' -o '(&:ENABLE_R=${ENABLE_R}' -o '&:ENABLE_PYTHON=${ENABLE_PYTHON}'
.PHONY: build
build: configure
cd build; conan build .. ${CONAN_OPTIONS} -o '&:ENABLE_COVERAGE=${ENABLE_COVERAGE}' -o '&:ENABLE_TESTING=${ENABLE_TESTING}' -o '(&:ENABLE_R=${ENABLE_R}' -o '&:ENABLE_PYTHON=${ENABLE_PYTHON}'
.PHONY: tests
tests:
source build/${BUILD_TYPE}/generators/conanrun.sh; cd tests; ../build/${BUILD_TYPE}/tests/tests ${TESTS} --skip-benchmarks
.PHONY: coverage
coverage:
@gcovr --version
@mkdir -p coverage
cd build; gcovr --delete --print-summary --merge-mode-functions separate --exclude-unreachable-branches --html --html-details -o ../coverage/index.html --xml-pretty --xml ../coverage/coverage.xml --filter '../src/' --filter '../include/' --exclude '../test/'
.PHONY: conan-package
conan-package:
export CONAN_REVISIONS_ENABLED=1; export LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH; conan create . ${CONAN_OPTIONS} --build-require #--format=json
clang-format:
clang-format --verbose -i $(shell find include src tests test_package -name '*pp' -not -path 'test_package/build/*') --style=LLVM
.PHONY: pyenv pyenv-download pyenv-python pyenv-venv
pyenv: pyenv-download pyenv-python pyenv-venv
pyenv-download:
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
pyenv-python:
export PYTHON_CONFIGURE_OPTS="--enable-shared"; ~/.pyenv/bin/pyenv install --force $(PYTHON_VERSION)
pyenv-venv:
~/.pyenv/bin/pyenv virtualenv $(PYTHON_VERSION) $(VENV_NAME)
.PHONY: pyenv-setup
pyenv-setup: pyenv-conan pyenv-tests
.PHONY: pyenv-conan
pyenv-conan:
python3 -m pip install $(PIP_OPTIONS) --upgrade pip
pip3 install $(PIP_OPTIONS) conan --upgrade
pip3 install $(PIP_OPTIONS) wheel setuptools gcovr==5.0 'numpy<2.0.0' cmaketools
.PHONY: pyenv-tests
pyenv-tests:
pip3 install $(PIP_OPTIONS) gcovr
.PHONY: codechecker
codechecker:
rm -fr codechecker
CodeChecker analyze build/Release/compile_commands.json -o ./codechecker || true
CodeChecker parse ./codechecker -e html -o ./codechecker || true
.PHONY: build-python
build-python:
make -C . build ENABLE_PYTHON=ON
.PHONY: build-R
build-R:
make -C R build
pyenv-activate:
source $PYENV_VIRTUAL_ENV/bin/activate
pyenv-init:
#source $(PYENV_VIRTUAL_ENV)/bin/activate
#python3 setup.py develop
pip3 install -e .
.PHONY: tests-python tests-python-install tests-python-run
tests-python-install:
#pip3 install -e ".[tests]"
source build/${BUILD_TYPE}/generators/conanrun.sh; pip3 install ".[tests]"
tests-python-run:
coverage run --source pycppsas7bdat -m pytest $(OPTIONS) $(TESTS) --junitxml=./reports/pytest.xml
tests-python: tests-python-install tests-python-run
coverage report --show-missing
coverage html
coverage xml -o build/coverage-python.xml
.PHONY: tests-R
tests-R: build-R
cd test; Rscript testthat.R
.PHONY: lint
lint:
yamllint -f colored .github
conan-profile:
conan profile detect
conan profile path default
.PHONY: benchmark
benchmark:
source build/${BUILD_TYPE}/generators/conanrun.sh; make -C benchmark