-
Notifications
You must be signed in to change notification settings - Fork 3
/
makefile
118 lines (96 loc) · 3.44 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
CC=clang++
CC_GCC=g++
CC_CLANG=clang++
#CC=clang++
#CPPSTD=-std=c++20 # -fconcepts-diagnostics-depth=2 # -Wfatal-errors
CPPSTD=--std=c++17 # TODO REMOVE # -Wfatal-errors
##########################################
# SUBMODULE LOCATION
#
OPTFRAME_SRC=./thirdparty/optframe-external
#
# LOCAL file (only hot dev in same project...)
#
#OPTFRAME_SRC=./thirdparty/optframe-local
#
#@echo "IMPORTANT: Remember to point src/optframe-src to optframe project /include directory"
#@echo "EXAMPLE: ln -s my/full/optframe/include ./thirdparty/optframe-local"
##########################################
all: load_thirdparty optframe_lib demo_local
OPTFRAME_C_LIB=thirdparty/optframe-external/src/OptFrameLib/OptFrameLib.cpp
optframe_lib:
# mkdir -p build/
# -Wextra
#
@echo "BUILD WITH ${CC_GCC} (PART 1/2)"
$(CC_GCC) $(CPPSTD) -g -I${OPTFRAME_SRC}/include -Wall -pedantic -Ofast --shared optframe/optframe_lib.cpp $(OPTFRAME_C_LIB) -o optframe/optframe_lib.so -fPIC
#
@echo "BUILD WITH ${CC_CLANG} (PART 2/2)"
$(CC_CLANG) $(CPPSTD) -g -I${OPTFRAME_SRC}/include -Wall -pedantic -Ofast --shared optframe/optframe_lib.cpp $(OPTFRAME_C_LIB) -o optframe/optframe_lib.so -fPIC
#
# readelf -s optframe/optframe_lib.so | grep fcore
ls -la optframe/optframe_lib.so
optframe_lib_cmake:
@echo "BUILD WITH CL (default)"
cmake -S. -Bbuild -GNinja
ninja -Cbuild
mv optframe/liboptframe_lib.so optframe/optframe_lib.so
publish_test:
rm -f dist/*
python -m build
rm -f dist/*.whl
twine check dist/*
twine upload -r testpypi dist/* --verbose
demo_local: optframe/optframe_lib.so
python3 demo/demo_kp.py
demo_local_tiny: optframe/optframe_lib.so
echo "TEST Demo KP Tiny SA"
python3 demo/demo_kp_tiny_sa.py
echo "TEST Demo KP Tiny"
python3 demo/demo_kp_tiny.py
# echo "DEMO 02: KP"
# (cd demo/02_QuickstartKP_SA/ && ./join.sh)
# python3 demo/02_QuickstartKP_SA/mainKP-fcore-ex.py
.PHONY: docs
docs:
cd docs && make clean && make html
test_local: load_thirdparty
# echo "test_local: Check if library exists..."
# ls -la optframe/optframe_lib.so
echo ""
echo "Running DEV Demos as tests..."
echo ""
(cd demo/02_QuickstartKP_SA/ && ./join.sh && python3 dev-mainKP-fcore-ex.py > /dev/null)
(cd demo/03_QuickstartTSP_VNS_BRKGA/ && ./join.sh && python3 dev-mainTSP-fcore-brkga.py > /dev/null)
(cd demo/03_QuickstartTSP_VNS_BRKGA/ && ./join.sh && python3 dev-mainTSP-fcore-ils.py > /dev/null)
echo "Finished 'make test_local'"
test: optframe_lib test_local test_package
test_package: clean install
# (cd demo/ && python3 demo_pyfcore.py)
(cd tests/ && python3 test_pkg_engine_kp.py)
echo ""
echo "Running PACKAGE Demos as tests..."
echo ""
(cd demo/02_QuickstartKP_SA/ && ./join.sh && python3 mainKP-fcore-ex.py > /dev/null)
(cd demo/03_QuickstartTSP_VNS_BRKGA/ && ./join.sh && python3 mainTSP-fcore-brkga.py > /dev/null)
(cd demo/03_QuickstartTSP_VNS_BRKGA/ && ./join.sh && python3 mainTSP-fcore-ils.py > /dev/null)
echo "Finished 'make test_package'"
install: clean
echo "***** BUILDING AND INSTALLING ***** "
python3 -m pip install build twine
(cd docs && python3 -m pip install -r requirements.txt)
python3 -m build
python3 -m pip install --no-cache-dir .
clean:
echo "***** CLEANING ***** "
rm -f optframe/*.so
rm -rf optframe/__pycache__
rm -f dist/*
rm -rf ./optframe-git/
rm -rf ./optframe.egg-info
rm -rf venv/
rm -rf build/
load_thirdparty:
git submodule update --init --recursive
git pull --recurse-submodules
pip install numpy # for demos