2018-02-22 16:26:26 +01:00
|
|
|
# ---------- Python support using SWIG ----------
|
2018-03-02 13:41:00 +01:00
|
|
|
.PHONY: help_python # Generate list of Python targets with descriptions.
|
2018-02-22 16:26:26 +01:00
|
|
|
help_python:
|
2018-03-02 13:41:00 +01:00
|
|
|
@echo Use one of the following Python targets:
|
2018-02-27 14:49:18 +01:00
|
|
|
ifeq ($(SYSTEM),win)
|
|
|
|
|
@tools\grep.exe "^.PHONY: .* #" $(CURDIR)/makefiles/Makefile.python.mk | tools\sed.exe "s/\.PHONY: \(.*\) # \(.*\)/\1\t\2/"
|
2018-03-06 13:58:23 +01:00
|
|
|
@echo.
|
2018-02-27 14:49:18 +01:00
|
|
|
else
|
2018-02-22 16:26:26 +01:00
|
|
|
@grep "^.PHONY: .* #" $(CURDIR)/makefiles/Makefile.python.mk | sed "s/\.PHONY: \(.*\) # \(.*\)/\1\t\2/" | expand -t24
|
2018-03-06 13:58:23 +01:00
|
|
|
@echo
|
2018-02-27 14:49:18 +01:00
|
|
|
endif
|
2013-12-28 23:11:38 +00:00
|
|
|
|
2017-04-26 17:30:25 +02:00
|
|
|
OR_TOOLS_PYTHONPATH = $(OR_ROOT_FULL)$(CPSEP)$(OR_ROOT_FULL)$Sdependencies$Ssources$Sprotobuf-$(PROTOBUF_TAG)$Spython
|
2016-09-07 15:55:11 +02:00
|
|
|
|
2018-02-22 16:26:26 +01:00
|
|
|
# Check for required build tools
|
2017-01-02 20:53:18 +01:00
|
|
|
ifeq ($(SYSTEM),win)
|
2018-02-22 16:26:26 +01:00
|
|
|
PYTHON_COMPILER ?= python.exe
|
|
|
|
|
ifneq ($(WINDOWS_PATH_TO_PYTHON),)
|
2018-03-05 13:49:24 +01:00
|
|
|
PYTHON_EXECUTABLE := $(WINDOWS_PATH_TO_PYTHON)\$(PYTHON_COMPILER)
|
2018-02-22 16:26:26 +01:00
|
|
|
else
|
2018-02-28 10:11:36 +01:00
|
|
|
PYTHON_EXECUTABLE := $(shell $(WHICH) $(PYTHON_COMPILER) 2>nul)
|
2018-02-22 16:26:26 +01:00
|
|
|
endif
|
|
|
|
|
SET_PYTHONPATH = @set PYTHONPATH=$(OR_TOOLS_PYTHONPATH) &&
|
|
|
|
|
else # UNIX
|
|
|
|
|
PYTHON_COMPILER ?= python$(UNIX_PYTHON_VER)
|
|
|
|
|
PYTHON_EXECUTABLE := $(shell which $(PYTHON_COMPILER))
|
|
|
|
|
SET_PYTHONPATH = @PYTHONPATH=$(OR_TOOLS_PYTHONPATH)
|
2017-01-02 20:53:18 +01:00
|
|
|
endif
|
|
|
|
|
|
2018-02-22 16:26:26 +01:00
|
|
|
# Detect python3
|
|
|
|
|
ifneq ($(PYTHON_EXECUTABLE),)
|
2018-02-27 17:44:44 +01:00
|
|
|
ifeq ($(shell "$(PYTHON_EXECUTABLE)" -c "from sys import version_info as v; print (str(v[0]))"),3)
|
2018-02-22 16:26:26 +01:00
|
|
|
PYTHON3 := true
|
|
|
|
|
SWIG_PYTHON3_FLAG := -py3 -DPY3
|
|
|
|
|
PYTHON3_CFLAGS := -DPY3
|
|
|
|
|
endif
|
2017-01-23 20:59:19 +01:00
|
|
|
endif
|
|
|
|
|
|
2018-02-22 16:26:26 +01:00
|
|
|
.PHONY: python # Build Python OR-Tools.
|
|
|
|
|
.PHONY: test_python # Test Python OR-Tools using various examples.
|
|
|
|
|
ifneq ($(PYTHON_EXECUTABLE),)
|
2017-11-03 23:36:21 +01:00
|
|
|
python: \
|
2018-03-06 11:42:06 +01:00
|
|
|
ortoolslibs \
|
2017-11-03 23:36:21 +01:00
|
|
|
install_python_modules \
|
|
|
|
|
pyinit \
|
|
|
|
|
pycp \
|
|
|
|
|
pyalgorithms \
|
|
|
|
|
pygraph \
|
|
|
|
|
pylp \
|
|
|
|
|
pysat \
|
2017-11-07 15:45:52 +01:00
|
|
|
pyrcpsp
|
2017-01-10 21:05:56 +01:00
|
|
|
test_python: test_python_examples
|
2018-02-22 16:26:26 +01:00
|
|
|
BUILT_LANGUAGES +=, Python$(PYTHON_VERSION)
|
|
|
|
|
else
|
|
|
|
|
python:
|
2018-02-27 17:44:44 +01:00
|
|
|
@echo PYTHON_EXECUTABLE = "${PYTHON_EXECUTABLE}"
|
2018-02-22 16:26:26 +01:00
|
|
|
$(warning Cannot find '$(PYTHON_COMPILER)' command which is needed for build. Please make sure it is installed and in system path.)
|
|
|
|
|
test_python: python
|
2017-01-10 21:05:56 +01:00
|
|
|
endif
|
2012-01-20 16:39:15 +00:00
|
|
|
|
2018-02-22 16:26:26 +01:00
|
|
|
.PHONY: clean_python # Clean Python output from previous build.
|
2012-01-20 16:39:15 +00:00
|
|
|
clean_python:
|
2016-08-04 21:07:14 +02:00
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$S__init__.py
|
2017-11-14 14:28:23 +01:00
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Salgorithms$S*python_wrap*
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Sconstraint_solver$S*python_wrap*
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Sdata$S*python_wrap*
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Sgraph$S*python_wrap*
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Slinear_solver$S*python_wrap*
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Ssat$S*python_wrap*
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Sutil$S*python_wrap*
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Salgorithms$S*.py
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Sconstraint_solver$S*.py
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Sdata$S*.py
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Sgraph$S*.py
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Slinear_solver$S*.py
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Ssat$S*.py
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Sutil$S*.py
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Salgorithms$S*.pyc
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Sconstraint_solver$S*.pyc
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Sdata$S*.pyc
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Sgraph$S*.pyc
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Slinear_solver$S*.pyc
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Ssat$S*.pyc
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Sutil$S*.pyc
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Salgorithms$S_pywrap*
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Sconstraint_solver$S_pywrap*
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Sdata$S_pywrap*
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Sgraph$S_pywrap*
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Slinear_solver$S_pywrap*
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Ssat$S_pywrap*
|
|
|
|
|
-$(DEL) $(GEN_DIR)$Sortools$Sutil$S_pywrap*
|
2016-06-28 10:53:28 +02:00
|
|
|
-$(DEL) $(LIB_DIR)$S_pywrap*.$(SWIG_LIB_SUFFIX)
|
2014-02-09 21:38:17 +00:00
|
|
|
-$(DEL) $(OBJ_DIR)$Sswig$S*python_wrap.$O
|
2017-07-24 10:31:53 -07:00
|
|
|
-$(DELREC) $(PYPI_ARCHIVE_TEMP_DIR)
|
2011-04-06 13:37:23 +00:00
|
|
|
|
2018-02-22 16:26:26 +01:00
|
|
|
.PHONY: install_python_modules pypi_archive pypi_archive_dir pyinit pycp pyalgorithms pygraph pylp pysat pydata
|
2017-01-02 20:53:18 +01:00
|
|
|
|
2018-03-06 12:56:14 +01:00
|
|
|
install_python_modules: dependencies/sources/protobuf-$(PROTOBUF_TAG)/python/google/protobuf/descriptor_pb2.py
|
|
|
|
|
|
|
|
|
|
dependencies/sources/protobuf-$(PROTOBUF_TAG)/python/google/protobuf/descriptor_pb2.py: \
|
2017-01-02 20:53:18 +01:00
|
|
|
dependencies/sources/protobuf-$(PROTOBUF_TAG)/python/setup.py
|
2018-02-22 16:26:26 +01:00
|
|
|
ifeq ($(SYSTEM),win)
|
2017-01-02 20:53:18 +01:00
|
|
|
copy dependencies$Sinstall$Sbin$Sprotoc.exe dependencies$Ssources$Sprotobuf-$(PROTOBUF_TAG)$Ssrc
|
2017-06-01 00:39:58 +02:00
|
|
|
else
|
|
|
|
|
cp dependencies$Sinstall$Sbin$Sprotoc dependencies$Ssources$Sprotobuf-$(PROTOBUF_TAG)$Ssrc
|
2017-01-02 20:53:18 +01:00
|
|
|
endif
|
2018-02-27 17:44:44 +01:00
|
|
|
cd dependencies$Ssources$Sprotobuf-$(PROTOBUF_TAG)$Spython && "$(PYTHON_EXECUTABLE)" setup.py build
|
2017-01-02 20:53:18 +01:00
|
|
|
|
2016-08-04 21:07:14 +02:00
|
|
|
pyinit: $(GEN_DIR)$Sortools$S__init__.py
|
|
|
|
|
|
|
|
|
|
$(GEN_DIR)$Sortools$S__init__.py:
|
|
|
|
|
$(COPY) $(SRC_DIR)$Sortools$S__init__.py $(GEN_DIR)$Sortools$S__init__.py
|
|
|
|
|
|
2012-01-20 16:39:15 +00:00
|
|
|
# pywrapknapsack_solver
|
2016-06-28 10:53:28 +02:00
|
|
|
pyalgorithms: $(LIB_DIR)/_pywrapknapsack_solver.$(SWIG_LIB_SUFFIX) $(GEN_DIR)/ortools/algorithms/pywrapknapsack_solver.py
|
2011-04-06 13:37:23 +00:00
|
|
|
|
2014-01-01 13:58:07 +00:00
|
|
|
$(GEN_DIR)/ortools/algorithms/pywrapknapsack_solver.py: \
|
2017-04-26 17:30:25 +02:00
|
|
|
$(SRC_DIR)/ortools/base/base.i \
|
|
|
|
|
$(SRC_DIR)/ortools/util/python/vector.i \
|
|
|
|
|
$(SRC_DIR)/ortools/algorithms/python/knapsack_solver.i \
|
|
|
|
|
$(SRC_DIR)/ortools/algorithms/knapsack_solver.h
|
|
|
|
|
$(SWIG_BINARY) -I$(INC_DIR) -c++ -python $(SWIG_PYTHON3_FLAG) -o $(GEN_DIR)$Sortools$Salgorithms$Sknapsack_solver_python_wrap.cc -module pywrapknapsack_solver $(SRC_DIR)/ortools/algorithms$Spython$Sknapsack_solver.i
|
2011-04-06 13:37:23 +00:00
|
|
|
|
2013-12-24 11:35:01 +00:00
|
|
|
$(GEN_DIR)/ortools/algorithms/knapsack_solver_python_wrap.cc: $(GEN_DIR)/ortools/algorithms/pywrapknapsack_solver.py
|
2011-04-06 13:37:23 +00:00
|
|
|
|
2016-07-19 13:14:43 -07:00
|
|
|
$(OBJ_DIR)/swig/knapsack_solver_python_wrap.$O: $(GEN_DIR)/ortools/algorithms/knapsack_solver_python_wrap.cc $(ALGORITHMS_DEPS)
|
2017-11-17 00:19:34 +01:00
|
|
|
$(CCC) $(CFLAGS) $(PYTHON_INC) $(PYTHON3_CFLAGS) -c $(GEN_DIR)$Sortools$Salgorithms$Sknapsack_solver_python_wrap.cc $(OBJ_OUT)$(OBJ_DIR)$Sswig$Sknapsack_solver_python_wrap.$O
|
2011-04-06 13:37:23 +00:00
|
|
|
|
2016-06-28 10:53:28 +02:00
|
|
|
$(LIB_DIR)/_pywrapknapsack_solver.$(SWIG_LIB_SUFFIX): $(OBJ_DIR)/swig/knapsack_solver_python_wrap.$O $(OR_TOOLS_LIBS)
|
|
|
|
|
$(DYNAMIC_LD) $(LDOUT)$(LIB_DIR)$S_pywrapknapsack_solver.$(SWIG_LIB_SUFFIX) $(OBJ_DIR)$Sswig$Sknapsack_solver_python_wrap.$O $(OR_TOOLS_LNK) $(SYS_LNK) $(PYTHON_LNK)
|
2018-02-22 16:26:26 +01:00
|
|
|
ifeq ($(SYSTEM),win)
|
2013-12-24 23:26:34 +00:00
|
|
|
copy $(LIB_DIR)\\_pywrapknapsack_solver.dll $(GEN_DIR)\\ortools\\algorithms\\_pywrapknapsack_solver.pyd
|
2013-12-29 14:54:48 +00:00
|
|
|
else
|
2016-06-28 10:53:28 +02:00
|
|
|
cp $(LIB_DIR)/_pywrapknapsack_solver.$(SWIG_LIB_SUFFIX) $(GEN_DIR)/ortools/algorithms
|
2011-04-06 16:26:35 +00:00
|
|
|
endif
|
2011-04-06 13:37:23 +00:00
|
|
|
|
2012-01-20 16:39:15 +00:00
|
|
|
# pywrapgraph
|
2016-06-28 10:53:28 +02:00
|
|
|
pygraph: $(LIB_DIR)/_pywrapgraph.$(SWIG_LIB_SUFFIX) $(GEN_DIR)/ortools/graph/pywrapgraph.py
|
2011-04-06 13:37:23 +00:00
|
|
|
|
2014-01-01 13:58:07 +00:00
|
|
|
$(GEN_DIR)/ortools/graph/pywrapgraph.py: \
|
2017-04-26 17:30:25 +02:00
|
|
|
$(SRC_DIR)/ortools/base/base.i \
|
|
|
|
|
$(SRC_DIR)/ortools/util/python/vector.i \
|
|
|
|
|
$(SRC_DIR)/ortools/graph/python/graph.i \
|
|
|
|
|
$(SRC_DIR)/ortools/graph/min_cost_flow.h \
|
|
|
|
|
$(SRC_DIR)/ortools/graph/max_flow.h \
|
|
|
|
|
$(SRC_DIR)/ortools/graph/ebert_graph.h \
|
|
|
|
|
$(SRC_DIR)/ortools/graph/shortestpaths.h
|
|
|
|
|
$(SWIG_BINARY) -I$(INC_DIR) -c++ -python $(SWIG_PYTHON3_FLAG) -o $(GEN_DIR)$Sortools$Sgraph$Sgraph_python_wrap.cc -module pywrapgraph $(SRC_DIR)/ortools/graph$Spython$Sgraph.i
|
2011-04-06 13:37:23 +00:00
|
|
|
|
2014-01-23 00:57:19 +00:00
|
|
|
$(GEN_DIR)/ortools/graph/graph_python_wrap.cc: $(GEN_DIR)/ortools/graph/pywrapgraph.py
|
2011-04-06 13:37:23 +00:00
|
|
|
|
2016-06-28 00:18:34 +02:00
|
|
|
$(OBJ_DIR)/swig/graph_python_wrap.$O: $(GEN_DIR)/ortools/graph/graph_python_wrap.cc $(GRAPH_DEPS)
|
2017-11-17 00:19:34 +01:00
|
|
|
$(CCC) $(CFLAGS) $(PYTHON_INC) $(PYTHON3_CFLAGS) -c $(GEN_DIR)/ortools/graph/graph_python_wrap.cc $(OBJ_OUT)$(OBJ_DIR)$Sswig$Sgraph_python_wrap.$O
|
2011-04-06 13:37:23 +00:00
|
|
|
|
2016-06-28 10:53:28 +02:00
|
|
|
$(LIB_DIR)/_pywrapgraph.$(SWIG_LIB_SUFFIX): $(OBJ_DIR)/swig/graph_python_wrap.$O $(OR_TOOLS_LIBS)
|
|
|
|
|
$(DYNAMIC_LD) $(LDOUT)$(LIB_DIR)$S_pywrapgraph.$(SWIG_LIB_SUFFIX) $(OBJ_DIR)$Sswig$Sgraph_python_wrap.$O $(OR_TOOLS_LNK) $(SYS_LNK) $(PYTHON_LNK)
|
2018-02-22 16:26:26 +01:00
|
|
|
ifeq ($(SYSTEM),win)
|
2013-12-24 23:26:34 +00:00
|
|
|
copy $(LIB_DIR)\\_pywrapgraph.dll $(GEN_DIR)\\ortools\\graph\\_pywrapgraph.pyd
|
2013-12-29 14:54:48 +00:00
|
|
|
else
|
2016-06-28 10:53:28 +02:00
|
|
|
cp $(LIB_DIR)/_pywrapgraph.$(SWIG_LIB_SUFFIX) $(GEN_DIR)/ortools/graph
|
2011-04-06 16:26:35 +00:00
|
|
|
endif
|
2011-04-06 13:37:23 +00:00
|
|
|
|
|
|
|
|
# pywrapcp
|
|
|
|
|
|
2016-09-01 20:55:08 +02:00
|
|
|
pycp: $(GEN_DIR)/ortools/constraint_solver/pywrapcp.py $(LIB_DIR)/_pywrapcp.$(SWIG_LIB_SUFFIX)
|
2011-04-06 13:37:23 +00:00
|
|
|
|
2017-04-26 17:30:25 +02:00
|
|
|
$(GEN_DIR)/ortools/constraint_solver/search_limit_pb2.py: $(SRC_DIR)/ortools/constraint_solver/search_limit.proto
|
|
|
|
|
$(PROTOBUF_DIR)/bin/protoc --proto_path=$(INC_DIR) --python_out=$(GEN_DIR) $(SRC_DIR)$Sortools$Sconstraint_solver$Ssearch_limit.proto
|
2014-01-01 13:58:07 +00:00
|
|
|
|
2017-04-26 17:30:25 +02:00
|
|
|
$(GEN_DIR)/ortools/constraint_solver/model_pb2.py: $(SRC_DIR)/ortools/constraint_solver/model.proto $(GEN_DIR)/ortools/constraint_solver/search_limit_pb2.py
|
|
|
|
|
$(PROTOBUF_DIR)/bin/protoc --proto_path=$(INC_DIR) --python_out=$(GEN_DIR) $(SRC_DIR)$Sortools$Sconstraint_solver$Smodel.proto
|
2014-01-01 13:58:07 +00:00
|
|
|
|
2017-04-26 17:30:25 +02:00
|
|
|
$(GEN_DIR)/ortools/constraint_solver/assignment_pb2.py: $(SRC_DIR)/ortools/constraint_solver/assignment.proto
|
|
|
|
|
$(PROTOBUF_DIR)/bin/protoc --proto_path=$(INC_DIR) --python_out=$(GEN_DIR) $(SRC_DIR)$Sortools$Sconstraint_solver$Sassignment.proto
|
2014-01-01 14:11:58 +00:00
|
|
|
|
2017-04-26 17:30:25 +02:00
|
|
|
$(GEN_DIR)/ortools/constraint_solver/solver_parameters_pb2.py: $(SRC_DIR)/ortools/constraint_solver/solver_parameters.proto
|
|
|
|
|
$(PROTOBUF_DIR)/bin/protoc --proto_path=$(INC_DIR) --python_out=$(GEN_DIR) $(SRC_DIR)$Sortools$Sconstraint_solver$Ssolver_parameters.proto
|
2016-02-03 15:15:58 +01:00
|
|
|
|
2017-04-26 17:30:25 +02:00
|
|
|
$(GEN_DIR)/ortools/constraint_solver/routing_enums_pb2.py: $(SRC_DIR)/ortools/constraint_solver/routing_enums.proto
|
|
|
|
|
$(PROTOBUF_DIR)/bin/protoc --proto_path=$(INC_DIR) --python_out=$(GEN_DIR) $(SRC_DIR)$Sortools$Sconstraint_solver$Srouting_enums.proto
|
2016-02-03 15:15:58 +01:00
|
|
|
|
2017-04-26 17:30:25 +02:00
|
|
|
$(GEN_DIR)/ortools/constraint_solver/routing_parameters_pb2.py: $(SRC_DIR)/ortools/constraint_solver/routing_parameters.proto $(GEN_DIR)/ortools/constraint_solver/solver_parameters_pb2.py $(GEN_DIR)/ortools/constraint_solver/routing_enums_pb2.py
|
|
|
|
|
$(PROTOBUF_DIR)/bin/protoc --proto_path=$(INC_DIR) --python_out=$(GEN_DIR) $(SRC_DIR)$Sortools$Sconstraint_solver$Srouting_parameters.proto
|
2016-02-03 15:15:58 +01:00
|
|
|
|
2014-01-01 13:58:07 +00:00
|
|
|
$(GEN_DIR)/ortools/constraint_solver/pywrapcp.py: \
|
2017-04-26 17:30:25 +02:00
|
|
|
$(SRC_DIR)/ortools/base/base.i \
|
|
|
|
|
$(SRC_DIR)/ortools/util/python/vector.i \
|
|
|
|
|
$(SRC_DIR)/ortools/constraint_solver/python/constraint_solver.i \
|
|
|
|
|
$(SRC_DIR)/ortools/constraint_solver/python/routing.i \
|
|
|
|
|
$(SRC_DIR)/ortools/constraint_solver/constraint_solver.h \
|
|
|
|
|
$(SRC_DIR)/ortools/constraint_solver/constraint_solveri.h \
|
2014-01-01 14:11:58 +00:00
|
|
|
$(GEN_DIR)/ortools/constraint_solver/assignment_pb2.py \
|
2014-01-01 13:58:07 +00:00
|
|
|
$(GEN_DIR)/ortools/constraint_solver/model_pb2.py \
|
2016-02-03 15:15:58 +01:00
|
|
|
$(GEN_DIR)/ortools/constraint_solver/routing_enums_pb2.py \
|
|
|
|
|
$(GEN_DIR)/ortools/constraint_solver/routing_parameters_pb2.py \
|
|
|
|
|
$(GEN_DIR)/ortools/constraint_solver/search_limit_pb2.py \
|
|
|
|
|
$(GEN_DIR)/ortools/constraint_solver/solver_parameters_pb2.py \
|
2017-04-26 17:30:25 +02:00
|
|
|
$(GEN_DIR)/ortools/constraint_solver/assignment.pb.h \
|
|
|
|
|
$(GEN_DIR)/ortools/constraint_solver/model.pb.h \
|
|
|
|
|
$(GEN_DIR)/ortools/constraint_solver/search_limit.pb.h \
|
2016-09-01 20:55:08 +02:00
|
|
|
$(CP_LIB_OBJS)
|
2017-04-26 17:30:25 +02:00
|
|
|
$(SWIG_BINARY) -I$(INC_DIR) -c++ -python $(SWIG_PYTHON3_FLAG) -o $(GEN_DIR)$Sortools$Sconstraint_solver$Sconstraint_solver_python_wrap.cc -module pywrapcp $(SRC_DIR)/ortools/constraint_solver$Spython$Srouting.i
|
2014-06-13 10:03:03 +00:00
|
|
|
|
2016-08-31 16:25:00 +02:00
|
|
|
# TODO(user): Support pywraprouting as well.
|
2011-04-06 13:37:23 +00:00
|
|
|
|
2013-12-24 11:35:01 +00:00
|
|
|
$(GEN_DIR)/ortools/constraint_solver/constraint_solver_python_wrap.cc: $(GEN_DIR)/ortools/constraint_solver/pywrapcp.py
|
2011-04-06 13:37:23 +00:00
|
|
|
|
2016-07-19 13:14:43 -07:00
|
|
|
$(OBJ_DIR)/swig/constraint_solver_python_wrap.$O: $(GEN_DIR)/ortools/constraint_solver/constraint_solver_python_wrap.cc $(CP_DEPS)
|
2017-11-17 00:19:34 +01:00
|
|
|
$(CCC) $(CFLAGS) $(PYTHON_INC) $(PYTHON3_CFLAGS) -c $(GEN_DIR)$Sortools$Sconstraint_solver$Sconstraint_solver_python_wrap.cc $(OBJ_OUT)$(OBJ_DIR)$Sswig$Sconstraint_solver_python_wrap.$O
|
2011-04-06 13:37:23 +00:00
|
|
|
|
2016-06-28 10:53:28 +02:00
|
|
|
$(LIB_DIR)/_pywrapcp.$(SWIG_LIB_SUFFIX): \
|
2014-02-09 21:38:17 +00:00
|
|
|
$(OBJ_DIR)/swig/constraint_solver_python_wrap.$O \
|
2016-06-28 00:18:34 +02:00
|
|
|
$(OR_TOOLS_LIBS)
|
2016-06-28 10:53:28 +02:00
|
|
|
$(DYNAMIC_LD) $(LDOUT)$(LIB_DIR)$S_pywrapcp.$(SWIG_LIB_SUFFIX) $(OBJ_DIR)$Sswig$Sconstraint_solver_python_wrap.$O $(OR_TOOLS_LNK) $(SYS_LNK) $(PYTHON_LNK)
|
2018-02-22 16:26:26 +01:00
|
|
|
ifeq ($(SYSTEM),win)
|
2013-12-24 23:26:34 +00:00
|
|
|
copy $(LIB_DIR)\\_pywrapcp.dll $(GEN_DIR)\\ortools\\constraint_solver\\_pywrapcp.pyd
|
2013-12-29 14:54:48 +00:00
|
|
|
else
|
2016-06-28 10:53:28 +02:00
|
|
|
cp $(LIB_DIR)/_pywrapcp.$(SWIG_LIB_SUFFIX) $(GEN_DIR)/ortools/constraint_solver
|
2011-04-06 16:26:35 +00:00
|
|
|
endif
|
|
|
|
|
|
2011-04-06 13:37:23 +00:00
|
|
|
# pywraplp
|
|
|
|
|
|
2016-06-28 10:53:28 +02:00
|
|
|
pylp: $(LIB_DIR)/_pywraplp.$(SWIG_LIB_SUFFIX) $(GEN_DIR)/ortools/linear_solver/pywraplp.py
|
2011-04-06 13:37:23 +00:00
|
|
|
|
2017-12-08 14:52:49 +01:00
|
|
|
$(GEN_DIR)/ortools/util/optional_boolean_pb2.py: $(SRC_DIR)/ortools/util/optional_boolean.proto
|
|
|
|
|
$(PROTOBUF_DIR)/bin/protoc --proto_path=$(INC_DIR) --python_out=$(GEN_DIR) $(SRC_DIR)/ortools/util/optional_boolean.proto
|
|
|
|
|
|
|
|
|
|
$(GEN_DIR)/ortools/linear_solver/linear_solver_pb2.py: $(SRC_DIR)/ortools/linear_solver/linear_solver.proto $(GEN_DIR)/ortools/util/optional_boolean_pb2.py
|
2017-04-26 17:30:25 +02:00
|
|
|
$(PROTOBUF_DIR)/bin/protoc --proto_path=$(INC_DIR) --python_out=$(GEN_DIR) $(SRC_DIR)/ortools/linear_solver/linear_solver.proto
|
2014-02-19 15:12:53 +00:00
|
|
|
|
2014-01-01 13:58:07 +00:00
|
|
|
$(GEN_DIR)/ortools/linear_solver/pywraplp.py: \
|
2017-04-26 17:30:25 +02:00
|
|
|
$(SRC_DIR)/ortools/base/base.i \
|
|
|
|
|
$(SRC_DIR)/ortools/util/python/vector.i \
|
|
|
|
|
$(SRC_DIR)/ortools/linear_solver/python/linear_solver.i \
|
|
|
|
|
$(SRC_DIR)/ortools/linear_solver/linear_solver.h \
|
|
|
|
|
$(GEN_DIR)/ortools/linear_solver/linear_solver.pb.h \
|
2015-06-16 10:08:44 +02:00
|
|
|
$(GEN_DIR)/ortools/linear_solver/linear_solver_pb2.py
|
2017-04-26 17:30:25 +02:00
|
|
|
$(SWIG_BINARY) $(SWIG_INC) -I$(INC_DIR) -c++ -python $(SWIG_PYTHON3_FLAG) -o $(GEN_DIR)$Sortools$Slinear_solver$Slinear_solver_python_wrap.cc -module pywraplp $(SRC_DIR)/ortools/linear_solver$Spython$Slinear_solver.i
|
2011-04-06 13:37:23 +00:00
|
|
|
|
2013-12-24 11:35:01 +00:00
|
|
|
$(GEN_DIR)/ortools/linear_solver/linear_solver_python_wrap.cc: $(GEN_DIR)/ortools/linear_solver/pywraplp.py
|
2011-04-06 13:37:23 +00:00
|
|
|
|
2016-06-28 00:18:34 +02:00
|
|
|
$(OBJ_DIR)/swig/linear_solver_python_wrap.$O: $(GEN_DIR)/ortools/linear_solver/linear_solver_python_wrap.cc $(LP_DEPS)
|
2017-11-17 00:19:34 +01:00
|
|
|
$(CCC) $(CFLAGS) $(PYTHON_INC) $(PYTHON3_CFLAGS) -c $(GEN_DIR)$Sortools$Slinear_solver$Slinear_solver_python_wrap.cc $(OBJ_OUT)$(OBJ_DIR)$Sswig$Slinear_solver_python_wrap.$O
|
2011-04-06 13:37:23 +00:00
|
|
|
|
2016-06-28 10:53:28 +02:00
|
|
|
$(LIB_DIR)/_pywraplp.$(SWIG_LIB_SUFFIX): \
|
2014-02-09 21:38:17 +00:00
|
|
|
$(OBJ_DIR)/swig/linear_solver_python_wrap.$O \
|
2016-06-28 00:18:34 +02:00
|
|
|
$(OR_TOOLS_LIBS)
|
2016-06-28 10:53:28 +02:00
|
|
|
$(DYNAMIC_LD) $(LDOUT)$(LIB_DIR)$S_pywraplp.$(SWIG_LIB_SUFFIX) $(OBJ_DIR)$Sswig$Slinear_solver_python_wrap.$O $(OR_TOOLS_LNK) $(SYS_LNK) $(PYTHON_LNK)
|
2018-02-22 16:26:26 +01:00
|
|
|
ifeq ($(SYSTEM),win)
|
2013-12-24 23:26:34 +00:00
|
|
|
copy $(LIB_DIR)\\_pywraplp.dll $(GEN_DIR)\\ortools\\linear_solver\\_pywraplp.pyd
|
2013-12-29 14:54:48 +00:00
|
|
|
else
|
2016-06-28 10:53:28 +02:00
|
|
|
cp $(LIB_DIR)/_pywraplp.$(SWIG_LIB_SUFFIX) $(GEN_DIR)/ortools/linear_solver
|
2011-04-06 16:26:35 +00:00
|
|
|
endif
|
2012-01-08 18:57:31 +00:00
|
|
|
|
2017-09-29 16:33:02 +02:00
|
|
|
# pywrapsat
|
|
|
|
|
|
|
|
|
|
pysat: $(LIB_DIR)/_pywrapsat.$(SWIG_LIB_SUFFIX) $(GEN_DIR)/ortools/sat/pywrapsat.py
|
|
|
|
|
|
|
|
|
|
$(GEN_DIR)/ortools/sat/cp_model_pb2.py: $(SRC_DIR)/ortools/sat/cp_model.proto
|
|
|
|
|
$(PROTOBUF_DIR)/bin/protoc --proto_path=$(INC_DIR) --python_out=$(GEN_DIR) $(SRC_DIR)/ortools/sat/cp_model.proto
|
|
|
|
|
|
|
|
|
|
$(GEN_DIR)/ortools/sat/sat_parameters_pb2.py: $(SRC_DIR)/ortools/sat/sat_parameters.proto
|
|
|
|
|
$(PROTOBUF_DIR)/bin/protoc --proto_path=$(INC_DIR) --python_out=$(GEN_DIR) $(SRC_DIR)/ortools/sat/sat_parameters.proto
|
|
|
|
|
|
|
|
|
|
$(GEN_DIR)/ortools/sat/pywrapsat.py: \
|
|
|
|
|
$(SRC_DIR)/ortools/base/base.i \
|
|
|
|
|
$(SRC_DIR)/ortools/util/python/vector.i \
|
|
|
|
|
$(SRC_DIR)/ortools/sat/python/sat.i \
|
|
|
|
|
$(GEN_DIR)/ortools/sat/cp_model_pb2.py \
|
|
|
|
|
$(GEN_DIR)/ortools/sat/sat_parameters_pb2.py \
|
|
|
|
|
$(SAT_DEPS)
|
2017-10-01 16:54:41 +02:00
|
|
|
$(SWIG_BINARY) $(SWIG_INC) -I$(INC_DIR) -c++ -python $(SWIG_PYTHON3_FLAG) -o $(GEN_DIR)$Sortools$Ssat$Ssat_python_wrap.cc -module pywrapsat $(SRC_DIR)/ortools/sat$Spython$Ssat.i
|
2017-09-29 16:33:02 +02:00
|
|
|
|
|
|
|
|
$(GEN_DIR)/ortools/sat/sat_python_wrap.cc: $(GEN_DIR)/ortools/sat/pywrapsat.py
|
|
|
|
|
|
|
|
|
|
$(OBJ_DIR)/swig/sat_python_wrap.$O: $(GEN_DIR)/ortools/sat/sat_python_wrap.cc $(SAT_DEPS)
|
2017-11-17 00:19:34 +01:00
|
|
|
$(CCC) $(CFLAGS) $(PYTHON_INC) $(PYTHON3_CFLAGS) -c $(GEN_DIR)$Sortools$Ssat$Ssat_python_wrap.cc $(OBJ_OUT)$(OBJ_DIR)$Sswig$Ssat_python_wrap.$O
|
2017-09-29 16:33:02 +02:00
|
|
|
|
|
|
|
|
$(LIB_DIR)/_pywrapsat.$(SWIG_LIB_SUFFIX): \
|
|
|
|
|
$(OBJ_DIR)/swig/sat_python_wrap.$O \
|
|
|
|
|
$(OR_TOOLS_LIBS)
|
|
|
|
|
$(DYNAMIC_LD) $(LDOUT)$(LIB_DIR)$S_pywrapsat.$(SWIG_LIB_SUFFIX) $(OBJ_DIR)$Sswig$Ssat_python_wrap.$O $(OR_TOOLS_LNK) $(SYS_LNK) $(PYTHON_LNK)
|
2018-02-22 16:26:26 +01:00
|
|
|
ifeq ($(SYSTEM),win)
|
2017-09-29 16:33:02 +02:00
|
|
|
copy $(LIB_DIR)\\_pywrapsat.dll $(GEN_DIR)\\ortools\\sat\\_pywrapsat.pyd
|
|
|
|
|
else
|
|
|
|
|
cp $(LIB_DIR)/_pywrapsat.$(SWIG_LIB_SUFFIX) $(GEN_DIR)/ortools/sat
|
|
|
|
|
endif
|
|
|
|
|
|
2017-11-07 15:45:52 +01:00
|
|
|
# pywraprcpsp
|
2017-11-03 23:36:21 +01:00
|
|
|
|
2017-11-07 15:45:52 +01:00
|
|
|
pyrcpsp: $(LIB_DIR)/_pywraprcpsp.$(SWIG_LIB_SUFFIX) $(GEN_DIR)/ortools/data/pywraprcpsp.py
|
2017-11-03 23:36:21 +01:00
|
|
|
|
2017-11-07 15:45:52 +01:00
|
|
|
$(GEN_DIR)/ortools/data/rcpsp_pb2.py: $(SRC_DIR)/ortools/data/rcpsp.proto
|
|
|
|
|
$(PROTOBUF_DIR)/bin/protoc --proto_path=$(INC_DIR) --python_out=$(GEN_DIR) $(SRC_DIR)/ortools/data/rcpsp.proto
|
2017-11-03 23:36:21 +01:00
|
|
|
|
2017-11-07 15:45:52 +01:00
|
|
|
$(GEN_DIR)/ortools/data/pywraprcpsp.py: \
|
|
|
|
|
$(SRC_DIR)/ortools/data/rcpsp_parser.h \
|
2017-11-03 23:36:21 +01:00
|
|
|
$(SRC_DIR)/ortools/base/base.i \
|
2017-11-07 15:45:52 +01:00
|
|
|
$(SRC_DIR)/ortools/data/python/rcpsp.i \
|
|
|
|
|
$(GEN_DIR)/ortools/data/rcpsp_pb2.py \
|
|
|
|
|
$(DATA_DEPS)
|
|
|
|
|
$(SWIG_BINARY) $(SWIG_INC) -I$(INC_DIR) -c++ -python $(SWIG_PYTHON3_FLAG) -o $(GEN_DIR)$Sortools$Sdata$Srcpsp_python_wrap.cc -module pywraprcpsp $(SRC_DIR)/ortools/data$Spython$Srcpsp.i
|
2017-11-03 23:36:21 +01:00
|
|
|
|
2017-11-07 15:45:52 +01:00
|
|
|
$(GEN_DIR)/ortools/data/rcpsp_python_wrap.cc: $(GEN_DIR)/ortools/data/pywraprcpsp.py
|
2017-11-03 23:36:21 +01:00
|
|
|
|
2017-11-07 15:45:52 +01:00
|
|
|
$(OBJ_DIR)/swig/rcpsp_python_wrap.$O: $(GEN_DIR)/ortools/data/rcpsp_python_wrap.cc $(DATA_DEPS)
|
2017-11-17 00:19:34 +01:00
|
|
|
$(CCC) $(CFLAGS) $(PYTHON_INC) $(PYTHON3_CFLAGS) -c $(GEN_DIR)$Sortools$Sdata$Srcpsp_python_wrap.cc $(OBJ_OUT)$(OBJ_DIR)$Sswig$Srcpsp_python_wrap.$O
|
2017-11-03 23:36:21 +01:00
|
|
|
|
2017-11-07 15:45:52 +01:00
|
|
|
$(LIB_DIR)/_pywraprcpsp.$(SWIG_LIB_SUFFIX): \
|
|
|
|
|
$(OBJ_DIR)/swig/rcpsp_python_wrap.$O \
|
2017-11-03 23:36:21 +01:00
|
|
|
$(OR_TOOLS_LIBS)
|
2017-11-07 15:45:52 +01:00
|
|
|
$(DYNAMIC_LD) $(LDOUT)$(LIB_DIR)$S_pywraprcpsp.$(SWIG_LIB_SUFFIX) $(OBJ_DIR)$Sswig$Srcpsp_python_wrap.$O $(OR_TOOLS_LNK) $(SYS_LNK) $(PYTHON_LNK)
|
2018-02-22 16:26:26 +01:00
|
|
|
ifeq ($(SYSTEM),win)
|
2017-11-07 15:45:52 +01:00
|
|
|
copy $(LIB_DIR)\\_pywraprcpsp.dll $(GEN_DIR)\\ortools\\data\\_pywraprcpsp.pyd
|
2017-11-03 23:36:21 +01:00
|
|
|
else
|
2017-11-07 15:45:52 +01:00
|
|
|
cp $(LIB_DIR)/_pywraprcpsp.$(SWIG_LIB_SUFFIX) $(GEN_DIR)/ortools/data
|
2017-11-03 23:36:21 +01:00
|
|
|
endif
|
|
|
|
|
|
2012-01-25 15:24:01 +00:00
|
|
|
# Run a single example
|
|
|
|
|
|
2017-11-07 15:45:52 +01:00
|
|
|
rpy: $(LIB_DIR)/_pywraplp.$(SWIG_LIB_SUFFIX) $(LIB_DIR)/_pywrapcp.$(SWIG_LIB_SUFFIX) $(LIB_DIR)/_pywrapgraph.$(SWIG_LIB_SUFFIX) $(LIB_DIR)/_pywrapknapsack_solver.$(SWIG_LIB_SUFFIX) $(LIB_DIR)/_pywrapsat.$(SWIG_LIB_SUFFIX) $(LIB_DIR)/_pywraprcpsp.$(SWIG_LIB_SUFFIX) $(EX)
|
2016-09-22 14:55:50 +02:00
|
|
|
@echo Running $(EX)
|
2018-02-27 17:44:44 +01:00
|
|
|
$(SET_PYTHONPATH) "$(PYTHON_EXECUTABLE)" $(EX) $(ARGS)
|
2012-01-25 15:24:01 +00:00
|
|
|
|
2018-02-22 16:26:26 +01:00
|
|
|
.PHONY: python_examples_archive # Build stand-alone Python examples archive file for redistribution.
|
2014-02-02 19:05:09 +00:00
|
|
|
python_examples_archive:
|
2014-01-04 09:30:13 +00:00
|
|
|
-$(DELREC) temp
|
|
|
|
|
$(MKDIR) temp
|
|
|
|
|
$(MKDIR) temp$Sortools_examples
|
|
|
|
|
$(MKDIR) temp$Sortools_examples$Sexamples
|
2016-04-13 13:51:05 +02:00
|
|
|
$(MKDIR) temp$Sortools_examples$Sexamples$Spython
|
2017-11-24 10:45:16 +01:00
|
|
|
$(MKDIR) temp$Sortools_examples$Sexamples$Snotebook
|
2016-04-12 18:04:18 +02:00
|
|
|
$(MKDIR) temp$Sortools_examples$Sexamples$Sdata
|
2016-04-13 13:51:05 +02:00
|
|
|
$(COPY) examples$Spython$S*.py temp$Sortools_examples$Sexamples$Spython
|
2017-11-24 10:45:16 +01:00
|
|
|
$(COPY) examples$Snotebook$S*.ipynb temp$Sortools_examples$Sexamples$Snotebook
|
|
|
|
|
$(COPY) examples$Snotebook$S*.md temp$Sortools_examples$Sexamples$Snotebook
|
2014-01-04 09:38:46 +00:00
|
|
|
$(COPY) tools$SREADME.examples.python temp$Sortools_examples$SREADME.txt
|
2014-01-04 09:30:13 +00:00
|
|
|
$(COPY) LICENSE-2.0.txt temp$Sortools_examples
|
|
|
|
|
ifeq ($(SYSTEM),win)
|
2018-03-06 10:10:58 +01:00
|
|
|
cd temp\ortools_examples && ..\..\tools\tar.exe -C ..\.. -c -v --exclude *svn* --exclude *roadef* --exclude *vector_packing* examples\data | ..\..\tools\tar.exe xvm
|
2016-09-20 15:54:58 +02:00
|
|
|
cd temp && ..\tools\zip.exe -r ..\or-tools_python_examples_v$(OR_TOOLS_VERSION).zip ortools_examples
|
2014-01-04 09:30:13 +00:00
|
|
|
else
|
2018-03-06 10:10:58 +01:00
|
|
|
cd temp/ortools_examples && tar -C ../.. -c -v --exclude *svn* --exclude *roadef* --exclude *vector_packing* examples/data | tar xvm
|
2017-07-14 14:09:02 -07:00
|
|
|
cd temp && tar -c -v -z --no-same-owner -f ../or-tools_python_examples$(PYPI_OS)_v$(OR_TOOLS_VERSION).tar.gz ortools_examples
|
2014-01-04 09:30:13 +00:00
|
|
|
endif
|
|
|
|
|
|
2017-01-24 19:33:22 +01:00
|
|
|
PYPI_ARCHIVE_TEMP_DIR = temp-python$(PYTHON_VERSION)
|
|
|
|
|
|
2017-01-25 20:10:19 +01:00
|
|
|
OR_TOOLS_PYTHON_GEN_SCRIPTS = $(wildcard src/gen/ortools/*/*.py) $(wildcard src/gen/ortools/*/*.cc)
|
2017-01-24 19:33:22 +01:00
|
|
|
|
2017-09-03 18:15:23 +02:00
|
|
|
# Stages all the files needed to build the python package.
|
|
|
|
|
pypi_archive_dir: python $(PYPI_ARCHIVE_TEMP_DIR)
|
2017-01-24 19:33:22 +01:00
|
|
|
|
2017-09-03 18:15:23 +02:00
|
|
|
# Patches the archive files to be able to build a pypi package.
|
|
|
|
|
# Graft libortools if needed and set RPATHs.
|
|
|
|
|
pypi_archive: pypi_archive_dir $(PATCHELF)
|
2017-09-11 16:37:03 +00:00
|
|
|
ifneq ($(SYSTEM),win)
|
2017-09-03 18:15:23 +02:00
|
|
|
cp lib/libortools.$(LIB_SUFFIX) $(PYPI_ARCHIVE_TEMP_DIR)/ortools/ortools
|
|
|
|
|
ifeq ($(PLATFORM),MACOSX)
|
|
|
|
|
tools/fix_python_libraries_on_mac.sh $(PYPI_ARCHIVE_TEMP_DIR)
|
|
|
|
|
endif
|
|
|
|
|
ifeq ($(PLATFORM),LINUX)
|
|
|
|
|
tools/fix_python_libraries_on_linux.sh $(PYPI_ARCHIVE_TEMP_DIR)
|
|
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
$(PYPI_ARCHIVE_TEMP_DIR) : $(OR_TOOLS_PYTHON_GEN_SCRIPTS)
|
2017-01-24 19:33:22 +01:00
|
|
|
-$(DELREC) $(PYPI_ARCHIVE_TEMP_DIR)
|
|
|
|
|
$(MKDIR) $(PYPI_ARCHIVE_TEMP_DIR)
|
|
|
|
|
$(MKDIR) $(PYPI_ARCHIVE_TEMP_DIR)$Sortools
|
|
|
|
|
$(MKDIR) $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools
|
|
|
|
|
$(MKDIR) $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Sconstraint_solver
|
|
|
|
|
$(MKDIR) $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Slinear_solver
|
2017-09-29 16:33:02 +02:00
|
|
|
$(MKDIR) $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Ssat
|
2017-11-16 23:27:58 +01:00
|
|
|
$(MKDIR) $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Ssat$Spython
|
2017-01-24 19:33:22 +01:00
|
|
|
$(MKDIR) $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Sgraph
|
|
|
|
|
$(MKDIR) $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Salgorithms
|
2017-11-14 14:28:23 +01:00
|
|
|
$(MKDIR) $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Sdata
|
2018-01-16 14:35:25 +01:00
|
|
|
$(MKDIR) $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Sutil
|
2017-05-11 15:01:35 +02:00
|
|
|
$(COPY) ortools$Sgen$Sortools$Sconstraint_solver$S*.py $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Sconstraint_solver
|
|
|
|
|
$(COPY) ortools$Slinear_solver$S*.py $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Slinear_solver
|
|
|
|
|
$(COPY) ortools$Sgen$Sortools$Slinear_solver$S*.py $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Slinear_solver
|
2017-09-29 16:33:02 +02:00
|
|
|
$(COPY) ortools$Ssat$S*.py $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Ssat
|
2017-11-16 23:27:58 +01:00
|
|
|
$(COPY) ortools$Ssat$Spython$S*.py $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Ssat$Spython
|
2017-09-29 16:33:02 +02:00
|
|
|
$(COPY) ortools$Sgen$Sortools$Ssat$S*.py $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Ssat
|
2017-05-11 15:01:35 +02:00
|
|
|
$(COPY) ortools$Sgen$Sortools$Sgraph$Spywrapgraph.py $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Sgraph
|
|
|
|
|
$(COPY) ortools$Sgen$Sortools$Salgorithms$Spywrapknapsack_solver.py $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Salgorithms
|
2017-11-14 14:28:23 +01:00
|
|
|
$(COPY) ortools$Sgen$Sortools$Sdata$S*.py $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Sdata
|
2018-01-16 14:35:25 +01:00
|
|
|
$(COPY) ortools$Sgen$Sortools$Sutil$S*.py $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Sutil
|
2017-01-24 19:33:22 +01:00
|
|
|
$(COPY) $(GEN_DIR)$Sortools$S__init__.py $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$S__init__.py
|
2017-07-24 11:41:21 -07:00
|
|
|
ifeq ($(SYSTEM),win)
|
2017-09-21 07:53:30 +02:00
|
|
|
echo __version__ = "$(OR_TOOLS_VERSION)" >> $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$S__init__.py
|
2017-07-24 11:41:21 -07:00
|
|
|
else
|
2017-05-24 23:52:13 +02:00
|
|
|
echo "__version__ = \"$(OR_TOOLS_VERSION)\"" >> $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$S__init__.py
|
2017-07-24 11:41:21 -07:00
|
|
|
endif
|
2017-01-24 19:33:22 +01:00
|
|
|
$(SED) -i -e 's/VVVV/$(OR_TOOLS_VERSION)/' $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$S__init__.py
|
|
|
|
|
$(TOUCH) $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Sconstraint_solver$S__init__.py
|
|
|
|
|
$(TOUCH) $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Slinear_solver$S__init__.py
|
2017-09-29 16:33:02 +02:00
|
|
|
$(TOUCH) $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Ssat$S__init__.py
|
2017-01-24 19:33:22 +01:00
|
|
|
$(TOUCH) $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Sgraph$S__init__.py
|
|
|
|
|
$(TOUCH) $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Salgorithms$S__init__.py
|
2017-11-14 14:28:23 +01:00
|
|
|
$(TOUCH) $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Sdata$S__init__.py
|
2018-01-16 14:35:25 +01:00
|
|
|
$(TOUCH) $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Sutil$S__init__.py
|
2017-01-24 19:33:22 +01:00
|
|
|
$(COPY) tools$SREADME.pypi $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$SREADME.txt
|
|
|
|
|
$(COPY) LICENSE-2.0.txt $(PYPI_ARCHIVE_TEMP_DIR)$Sortools
|
|
|
|
|
$(COPY) tools$Ssetup.py $(PYPI_ARCHIVE_TEMP_DIR)$Sortools
|
2017-07-14 13:57:25 -07:00
|
|
|
$(SED) -i -e 's/ORTOOLS_PYTHON_VERSION/ortools$(PYPI_OS)/' $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Ssetup.py
|
2017-01-24 19:33:22 +01:00
|
|
|
$(SED) -i -e 's/VVVV/$(OR_TOOLS_VERSION)/' $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Ssetup.py
|
|
|
|
|
$(SED) -i -e 's/PROTOBUF_TAG/$(PROTOBUF_TAG)/' $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Ssetup.py
|
2012-09-02 15:20:21 +00:00
|
|
|
ifeq ($(SYSTEM),win)
|
2017-05-11 15:01:35 +02:00
|
|
|
copy ortools\gen\ortools\constraint_solver\_pywrapcp.pyd $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Sconstraint_solver
|
|
|
|
|
copy ortools\gen\ortools\linear_solver\_pywraplp.pyd $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Slinear_solver
|
2017-09-29 16:33:02 +02:00
|
|
|
copy ortools\gen\ortools\sat\_pywrapsat.pyd $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Ssat
|
2017-05-11 15:01:35 +02:00
|
|
|
copy ortools\gen\ortools\graph\_pywrapgraph.pyd $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Sgraph
|
|
|
|
|
copy ortools\gen\ortools\algorithms\_pywrapknapsack_solver.pyd $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Salgorithms
|
2017-11-14 14:28:23 +01:00
|
|
|
copy ortools\gen\ortools\data\_pywraprcpsp.pyd $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Sortools$Sdata
|
2017-01-24 19:33:22 +01:00
|
|
|
$(SED) -i -e 's/\.dll/\.pyd/' $(PYPI_ARCHIVE_TEMP_DIR)/ortools/setup.py
|
|
|
|
|
$(SED) -i -e '/DELETEWIN/d' $(PYPI_ARCHIVE_TEMP_DIR)/ortools/setup.py
|
|
|
|
|
$(SED) -i -e 's/DELETEUNIX/ /g' $(PYPI_ARCHIVE_TEMP_DIR)/ortools/setup.py
|
|
|
|
|
-del $(PYPI_ARCHIVE_TEMP_DIR)\ortools\setup.py-e
|
2012-01-08 18:57:31 +00:00
|
|
|
else
|
2017-01-24 19:33:22 +01:00
|
|
|
cp lib/_pywrapcp.$(SWIG_LIB_SUFFIX) $(PYPI_ARCHIVE_TEMP_DIR)/ortools/ortools/constraint_solver
|
|
|
|
|
cp lib/_pywraplp.$(SWIG_LIB_SUFFIX) $(PYPI_ARCHIVE_TEMP_DIR)/ortools/ortools/linear_solver
|
2017-09-29 16:33:02 +02:00
|
|
|
cp lib/_pywrapsat.$(SWIG_LIB_SUFFIX) $(PYPI_ARCHIVE_TEMP_DIR)/ortools/ortools/sat
|
2017-01-24 19:33:22 +01:00
|
|
|
cp lib/_pywrapgraph.$(SWIG_LIB_SUFFIX) $(PYPI_ARCHIVE_TEMP_DIR)/ortools/ortools/graph
|
|
|
|
|
cp lib/_pywrapknapsack_solver.$(SWIG_LIB_SUFFIX) $(PYPI_ARCHIVE_TEMP_DIR)/ortools/ortools/algorithms
|
2017-11-07 15:45:52 +01:00
|
|
|
cp lib/_pywraprcpsp.$(SWIG_LIB_SUFFIX) $(PYPI_ARCHIVE_TEMP_DIR)/ortools/ortools/data
|
2017-01-24 19:33:22 +01:00
|
|
|
$(SED) -i -e 's/\.dll/\.so/' $(PYPI_ARCHIVE_TEMP_DIR)/ortools/setup.py
|
|
|
|
|
$(SED) -i -e 's/DELETEWIN //g' $(PYPI_ARCHIVE_TEMP_DIR)/ortools/setup.py
|
|
|
|
|
$(SED) -i -e '/DELETEUNIX/d' $(PYPI_ARCHIVE_TEMP_DIR)/ortools/setup.py
|
|
|
|
|
$(SED) -i -e 's/DLL/$(LIB_SUFFIX)/g' $(PYPI_ARCHIVE_TEMP_DIR)/ortools/setup.py
|
2012-01-08 18:57:31 +00:00
|
|
|
endif
|
2013-12-27 12:22:30 +00:00
|
|
|
|
2017-07-12 14:56:59 -07:00
|
|
|
pypi_upload: pypi_archive
|
2018-02-27 17:44:44 +01:00
|
|
|
@echo Uploading Pypi module for "$(PYTHON_EXECUTABLE)".
|
2013-12-27 12:22:30 +00:00
|
|
|
ifeq ($(SYSTEM),win)
|
2018-02-27 17:44:44 +01:00
|
|
|
cd $(PYPI_ARCHIVE_TEMP_DIR)\ortools && "$(PYTHON_EXECUTABLE)" setup.py bdist_wheel bdist_wininst
|
2013-12-27 12:22:30 +00:00
|
|
|
else
|
2016-06-28 16:35:33 +02:00
|
|
|
ifeq ($(PLATFORM),MACOSX)
|
2018-02-27 17:44:44 +01:00
|
|
|
cd $(PYPI_ARCHIVE_TEMP_DIR)/ortools && "$(PYTHON_EXECUTABLE)" setup.py bdist_wheel
|
2016-06-28 16:35:33 +02:00
|
|
|
else
|
2018-02-27 17:44:44 +01:00
|
|
|
cd $(PYPI_ARCHIVE_TEMP_DIR)/ortools && "$(PYTHON_EXECUTABLE)" setup.py bdist_egg
|
2016-06-28 16:35:33 +02:00
|
|
|
endif
|
2013-12-27 12:22:30 +00:00
|
|
|
endif
|
2017-01-25 18:11:15 +01:00
|
|
|
cd $(PYPI_ARCHIVE_TEMP_DIR)/ortools && twine upload dist/*
|
2015-12-11 15:29:11 +01:00
|
|
|
|
2018-02-22 16:26:26 +01:00
|
|
|
.PHONY: detect_python # Show variables used to build Python OR-Tools.
|
2016-04-13 04:39:22 -07:00
|
|
|
detect_python:
|
2018-03-06 14:34:17 +01:00
|
|
|
@echo Relevant info for the Python build:
|
2018-02-22 16:26:26 +01:00
|
|
|
ifeq ($(SYSTEM),win)
|
2018-02-27 17:44:44 +01:00
|
|
|
@echo WINDOWS_PATH_TO_PYTHON = "$(WINDOWS_PATH_TO_PYTHON)"
|
2018-03-01 11:48:55 +01:00
|
|
|
else
|
|
|
|
|
@echo UNIX_PYTHON_VER = "$(UNIX_PYTHON_VER)"
|
2018-02-22 16:26:26 +01:00
|
|
|
endif
|
|
|
|
|
@echo PYTHON_COMPILER = $(PYTHON_COMPILER)
|
2018-02-27 17:44:44 +01:00
|
|
|
@echo PYTHON_EXECUTABLE = "$(PYTHON_EXECUTABLE)"
|
2017-11-24 09:47:12 +01:00
|
|
|
@echo PYTHON_VERSION = $(PYTHON_VERSION)
|
2017-12-01 15:30:47 +01:00
|
|
|
@echo PYTHON3 = $(PYTHON3)
|
2018-02-22 16:26:26 +01:00
|
|
|
@echo SET_PYTHONPATH = "$(SET_PYTHONPATH)"
|
2018-03-01 11:48:55 +01:00
|
|
|
@echo PYTHON_INC = $(PYTHON_INC)
|
|
|
|
|
@echo PYTHON_LNK = $(PYTHON_LNK)
|
2017-04-26 17:30:25 +02:00
|
|
|
@echo SWIG_PYTHON3_FLAG = $(SWIG_PYTHON3_FLAG)
|
2018-03-06 14:34:17 +01:00
|
|
|
ifeq ($(SYSTEM),win)
|
|
|
|
|
@echo.
|
|
|
|
|
else
|
|
|
|
|
@echo
|
|
|
|
|
endif
|