File: Python.mk

package info (click to toggle)
consensuscore 1.1.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,384 kB
  • sloc: cpp: 38,940; python: 2,083; ansic: 542; sh: 184; makefile: 82; cs: 10
file content (32 lines) | stat: -rw-r--r-- 1,061 bytes parent folder | download | duplicates (3)
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
CONFIG_MAKE  = make/Config.mk
ifneq ("$(wildcard $(CONFIG_MAKE))","")
include $(CONFIG_MAKE)
else
$(error Run ./configure first!)
endif

include make/Defs.mk

ifeq (,$(wildcard $(PYTHON_INCLUDE)/Python.h))
$(error python3 include not configured properly, cannot build python3 module!)
endif

ifeq (,$(wildcard $(NUMPY_INCLUDE)/numpy/arrayobject.h))
$(error numpy include not configured properly, cannot build python3 module!)
endif

SWIG_CMD   := SWIG_LIB=$(SWIG_LIB) $(SWIG) -Wall -c++ -python -builtin
GEN_CXX    := $(PYTHON_BUILD_DIR)/ConsensusCore_wrap.cxx
PYTHON_DLL := $(PYTHON_BUILD_DIR)/_ConsensusCore.so

all: $(PYTHON_DLL)

$(PYTHON_DLL): $(SWIG_INTERFACES) $(CXX_LIB)
	-mkdir -p $(PYTHON_BUILD_DIR)
	$(SWIG_CMD) $(INCLUDES) -module ConsensusCore -o $(GEN_CXX) $(SWIG_INTERFACE)
	$(CXX) $(SHLIB_FLAGS) $(INCLUDES) -I $(PYTHON_INCLUDE) -I $(NUMPY_INCLUDE) $(GEN_CXX) $(CXX_LIB) -o $(PYTHON_DLL)

test-python: $(PYTHON_DLL)
	@PYTHONPATH=$(PYTHON_BUILD_DIR) python3 src/Demos/Demo.py && echo "Python3 build is OK!"

.PHONY: all test-python $(PYTHON_DLL)