huge makefile cleanup; remove Makefile.local; detect all languages
This commit is contained in:
6
Makefile
6
Makefile
@@ -53,9 +53,6 @@ include $(OR_ROOT)Version.txt
|
||||
include $(OR_ROOT)makefiles/Makefile.port.mk
|
||||
OR_ROOT_FULL=$(OR_TOOLS_TOP)
|
||||
|
||||
# Load local variables
|
||||
include $(OR_ROOT)Makefile.local
|
||||
|
||||
# Change the file extensions to increase diff tool friendliness.
|
||||
# Then include specific system commands and definitions
|
||||
include $(OR_ROOT)makefiles/Makefile.$(SYSTEM).mk
|
||||
@@ -127,11 +124,10 @@ test_all: test_cc test_python test_java test_dotnet
|
||||
@echo Or-tools have been built and tested for $(BUILT_LANGUAGES)
|
||||
|
||||
.PHONY: clean_all
|
||||
clean_all: clean_cc clean_python clean_java clean_dotnet clean_compat clean_archive
|
||||
clean_all: clean_cc clean_python clean_java clean_dotnet clean_archive clean_third_party
|
||||
-$(DELREC) $(BIN_DIR)
|
||||
-$(DELREC) $(LIB_DIR)
|
||||
-$(DELREC) $(OBJ_DIR)
|
||||
-$(DELREC) $(GEN_PATH)
|
||||
@echo Or-tools have been cleaned for $(BUILT_LANGUAGES)
|
||||
|
||||
.PHONY: detect_all
|
||||
|
||||
@@ -29,6 +29,8 @@ OR_TOOLS_LIBS = $(LIB_DIR)/$(LIB_PREFIX)ortools.$L.$(OR_TOOLS_MAJOR)
|
||||
endif
|
||||
endif
|
||||
|
||||
BUILT_LANGUAGES = C++
|
||||
|
||||
# Main target
|
||||
.PHONY: cc # Build C++ OR-Tools library.
|
||||
.PHONY: test_cc # Run all C++ OR-Tools test targets.
|
||||
@@ -567,14 +569,6 @@ clean_cc:
|
||||
-$(DELREC) $(TEMP_PACKAGE_CC_DIR)
|
||||
-$(DELREC) $(TEMP_CC_DIR)
|
||||
|
||||
.PHONY: clean_compat
|
||||
clean_compat:
|
||||
-$(DELREC) $(OR_ROOT)constraint_solver
|
||||
-$(DELREC) $(OR_ROOT)linear_solver
|
||||
-$(DELREC) $(OR_ROOT)algorithms
|
||||
-$(DELREC) $(OR_ROOT)graph
|
||||
-$(DELREC) $(OR_ROOT)gen
|
||||
|
||||
#############
|
||||
## DEBUG ##
|
||||
#############
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
# ---------- dotnet support using SWIG ----------
|
||||
ifeq ($(BUILD_DOTNET),OFF)
|
||||
dotnet:
|
||||
$(warning Either .NET support was turned of, of the dotnet binary was not found.)
|
||||
|
||||
test_dotnet: dotnet
|
||||
package_dotnet: dotnet
|
||||
else
|
||||
|
||||
.PHONY: help_dotnet # Generate list of dotnet targets with descriptions.
|
||||
help_dotnet:
|
||||
@echo Use one of the following dotnet targets:
|
||||
@@ -11,12 +18,12 @@ else
|
||||
endif
|
||||
|
||||
# Check for required build tools
|
||||
DOTNET = dotnet
|
||||
ifeq ($(SYSTEM),win)
|
||||
DOTNET_BIN := $(shell $(WHICH) $(DOTNET) 2> NUL)
|
||||
DOTNET_BIN := $(shell $(WHICH) dotnet 2> NUL)
|
||||
else # UNIX
|
||||
DOTNET_BIN := $(shell command -v $(DOTNET) 2> /dev/null)
|
||||
DOTNET_BIN := $(shell $(WHICH) dotnet 2> /dev/null)
|
||||
endif
|
||||
|
||||
# All libraries and dependencies
|
||||
TEMP_DOTNET_DIR = temp_dotnet
|
||||
DOTNET_PACKAGE_DIR = temp_dotnet/packages
|
||||
@@ -24,6 +31,7 @@ DOTNET_PACKAGE_PATH = $(subst /,$S,$(DOTNET_PACKAGE_DIR))
|
||||
DOTNET_ORTOOLS_ASSEMBLY_NAME := Google.OrTools
|
||||
|
||||
dotnet: $(OR_TOOLS_LIBS)
|
||||
BUILT_LANGUAGES +=, .Net (6.0)
|
||||
|
||||
###################
|
||||
## .NET SOURCE ##
|
||||
@@ -663,6 +671,8 @@ nuget_upload: nuget_archive
|
||||
@echo Uploading Nuget package for "net6.0".
|
||||
$(warning Not Implemented)
|
||||
|
||||
endif # BUILD_DOTNET=ON
|
||||
|
||||
################
|
||||
## Cleaning ##
|
||||
################
|
||||
@@ -670,7 +680,7 @@ nuget_upload: nuget_archive
|
||||
clean_dotnet:
|
||||
-$(DELREC) ortools$Sdotnet$SCreateSigningKey$Sbin
|
||||
-$(DELREC) ortools$Sdotnet$SCreateSigningKey$Sobj
|
||||
-$(DEL) $(DOTNET_ORTOOLS_SNK_PATH)
|
||||
# -$(DEL) $(DOTNET_ORTOOLS_SNK_PATH)
|
||||
-$(DELREC) $(TEMP_DOTNET_DIR)
|
||||
-$(DEL) $(GEN_PATH)$Sortools$Salgorithms$S*.cs
|
||||
-$(DEL) $(GEN_PATH)$Sortools$Salgorithms$S*csharp_wrap*
|
||||
@@ -687,9 +697,9 @@ clean_dotnet:
|
||||
-$(DEL) $(GEN_PATH)$Sortools$Sinit$S*.cs
|
||||
-$(DEL) $(GEN_PATH)$Sortools$Sinit$S*csharp_wrap*
|
||||
-$(DEL) $(OBJ_DIR)$Sswig$S*_csharp_wrap.$O
|
||||
-$(DEL) $(LIB_DIR)$S$(DOTNET_ORTOOLS_NATIVE).*
|
||||
-$(DEL) $(BIN_DIR)$S$(DOTNET_ORTOOLS_ASSEMBLY_NAME).*
|
||||
-$(DEL) $(BIN_DIR)$S$(FSHARP_ORTOOLS_ASSEMBLY_NAME).*
|
||||
# -$(DEL) $(LIB_DIR)$S$(DOTNET_ORTOOLS_NATIVE).*
|
||||
# -$(DEL) $(BIN_DIR)$S$(DOTNET_ORTOOLS_ASSEMBLY_NAME).*
|
||||
# -$(DEL) $(BIN_DIR)$S$(FSHARP_ORTOOLS_ASSEMBLY_NAME).*
|
||||
-$(DELREC) $(DOTNET_EX_PATH)$Sbin
|
||||
-$(DELREC) $(DOTNET_EX_PATH)$Sobj
|
||||
-$(DELREC) $(CONTRIB_EX_PATH)$Sbin
|
||||
@@ -721,9 +731,6 @@ detect_dotnet:
|
||||
@echo PROTOC = $(PROTOC)
|
||||
@echo DOTNET_SNK = $(DOTNET_SNK)
|
||||
@echo DOTNET_ORTOOLS_SNK = $(DOTNET_ORTOOLS_SNK)
|
||||
@echo SWIG_BINARY = $(SWIG_BINARY)
|
||||
@echo SWIG_INC = $(SWIG_INC)
|
||||
@echo SWIG_DOTNET_LIB_SUFFIX = $(SWIG_DOTNET_LIB_SUFFIX)
|
||||
@echo DOTNET_ORTOOLS_NATIVE = $(DOTNET_ORTOOLS_NATIVE)
|
||||
@echo DOTNET_ORTOOLS_RUNTIME_ASSEMBLY_NAME =$(DOTNET_ORTOOLS_RUNTIME_ASSEMBLY_NAME)
|
||||
@echo DOTNET_ORTOOLS_RUNTIME_NUPKG = $(DOTNET_ORTOOLS_RUNTIME_NUPKG)
|
||||
@@ -737,3 +744,4 @@ ifeq ($(SYSTEM),win)
|
||||
else
|
||||
@echo
|
||||
endif
|
||||
|
||||
|
||||
@@ -1,4 +1,21 @@
|
||||
# ---------- Java support using SWIG ----------
|
||||
ifeq ($(BUILD_JAVA),OFF)
|
||||
java_runtime: java
|
||||
java:
|
||||
@echo JAVA_HOME = $(JAVA_HOME)
|
||||
@echo JAVAC_BIN = $(JAVAC_BIN)
|
||||
@echo JAR_BIN = $(JAR_BIN)
|
||||
@echo JAVA_BIN = $(JAVA_BIN)
|
||||
@echo MVN_BIN = $(MVN_BIN)
|
||||
$(warning Either JAVA support was turned off, or the the makefile cannot\
|
||||
find 'java' or 'maven' command which is needed for build. \
|
||||
Please make sure it is installed and in system path. \
|
||||
Or turn java support ON.)
|
||||
check_java: java
|
||||
test_java: java
|
||||
package_java: java
|
||||
|
||||
else # BUILD_JAVA=ON
|
||||
|
||||
.PHONY: help_java # Generate list of Java targets with descriptions.
|
||||
help_java:
|
||||
@echo Use one of the following Java targets:
|
||||
@@ -10,51 +27,16 @@ else
|
||||
@echo
|
||||
endif
|
||||
|
||||
# Check for required build tools
|
||||
HAS_JAVA = true
|
||||
ifndef JAVAC_BIN
|
||||
HAS_JAVA =
|
||||
endif
|
||||
ifndef JAR_BIN
|
||||
HAS_JAVA =
|
||||
endif
|
||||
ifndef JAVA_BIN
|
||||
HAS_JAVA =
|
||||
endif
|
||||
ifndef MVN_BIN
|
||||
HAS_JAVA =
|
||||
endif
|
||||
|
||||
TEMP_JAVA_DIR = temp_java
|
||||
JAVA_ORTOOLS_PACKAGE := com.google.ortools
|
||||
JAVA_ORTOOLS_JAR := $(LIB_DIR)/$(JAVA_ORTOOLS_PACKAGE)$J
|
||||
JAVA_ORTOOLS_NATIVE_LIBS := $(LIB_DIR)/$(LIB_PREFIX)jniortools.$(JNI_LIB_EXT)
|
||||
JAVAFLAGS := -Djava.library.path=$(LIB_DIR)
|
||||
|
||||
# Main target
|
||||
.PHONY: java_runtime # Build Java OR-Tools runtime.
|
||||
.PHONY: java # Build Java OR-Tools.
|
||||
.PHONY: test_java # Test Java OR-Tools using various examples.
|
||||
ifndef HAS_JAVA
|
||||
java_runtime: java
|
||||
java:
|
||||
@echo JAVA_HOME = $(JAVA_HOME)
|
||||
@echo JAVAC_BIN = $(JAVAC_BIN)
|
||||
@echo JAR_BIN = $(JAR_BIN)
|
||||
@echo JAVA_BIN = $(JAVA_BIN)
|
||||
@echo MVN_BIN = $(MVN_BIN)
|
||||
$(warning Cannot find 'java' or 'maven' command which is needed for build. \
|
||||
Please make sure it is installed and in system path. \
|
||||
Check Makefile.local for more information.)
|
||||
check_java: java
|
||||
test_java: java
|
||||
else
|
||||
java_runtime: java_runtime_pimpl
|
||||
java: $(OR_TOOLS_LIBS)
|
||||
check_java: check_java_pimpl
|
||||
test_java: test_java_pimpl
|
||||
BUILT_LANGUAGES +=, Java
|
||||
endif
|
||||
|
||||
# Detect RuntimeIDentifier
|
||||
ifeq ($(OS),Windows)
|
||||
JAVA_NATIVE_IDENTIFIER=win32-x86-64
|
||||
@@ -310,8 +292,8 @@ test_java_sat_samples: \
|
||||
rjava_StepFunctionSampleSat \
|
||||
rjava_StopAfterNSolutionsSampleSat
|
||||
|
||||
.PHONY: check_java_pimpl
|
||||
check_java_pimpl: \
|
||||
.PHONY: check_java
|
||||
check_java: \
|
||||
test_java_algorithms_samples \
|
||||
test_java_constraint_solver_samples \
|
||||
test_java_graph_samples \
|
||||
@@ -388,19 +370,19 @@ test_java_java: \
|
||||
rjava_RabbitsPheasants \
|
||||
rjava_RandomTsp
|
||||
|
||||
.PHONY: test_java_pimpl
|
||||
test_java_pimpl: \
|
||||
check_java_pimpl \
|
||||
.PHONY: test_java
|
||||
test_java: \
|
||||
check_java \
|
||||
test_java_tests \
|
||||
test_java_contrib \
|
||||
test_java_java
|
||||
|
||||
.PHONY: publish_java_runtime_pimpl
|
||||
publish_java_runtime_pimpl: java_runtime
|
||||
.PHONY: publish_java_runtime
|
||||
publish_java_runtime: java_runtime
|
||||
cd $(TEMP_JAVA_DIR)$S$(JAVA_ORTOOLS_NATIVE_PROJECT) && "$(MVN_BIN)" deploy
|
||||
|
||||
.PHONY: publish_java_pimpl
|
||||
publish_java_pimpl: java
|
||||
.PHONY: publish_java
|
||||
publish_java: java
|
||||
cd $(TEMP_JAVA_DIR)$S$(JAVA_ORTOOLS_PROJECT) && "$(MVN_BIN)" deploy
|
||||
|
||||
#######################
|
||||
@@ -475,6 +457,8 @@ else
|
||||
endif
|
||||
-$(DELREC) $(TEMP_JAVA_DIR)$Sortools_examples
|
||||
|
||||
endif # BUILD_JAVA=ON
|
||||
|
||||
################
|
||||
## Cleaning ##
|
||||
################
|
||||
@@ -503,17 +487,11 @@ clean_java:
|
||||
.PHONY: detect_java # Show variables used to build Java OR-Tools.
|
||||
detect_java:
|
||||
@echo Relevant info for the Java build:
|
||||
@echo JAVA_INC = $(JAVA_INC)
|
||||
@echo JNIFLAGS = $(JNIFLAGS)
|
||||
@echo JAVA_HOME = $(JAVA_HOME)
|
||||
@echo JAVAC_BIN = $(JAVAC_BIN)
|
||||
@echo CLASS_DIR = $(CLASS_DIR)
|
||||
@echo JAR_BIN = $(JAR_BIN)
|
||||
@echo JAVA_BIN = $(JAVA_BIN)
|
||||
@echo JAVAFLAGS = $(JAVAFLAGS)
|
||||
@echo JAVA_ORTOOLS_JAR = $(JAVA_ORTOOLS_JAR)
|
||||
@echo SWIG_BINARY = $(SWIG_BINARY)
|
||||
@echo SWIG_INC = $(SWIG_INC)
|
||||
@echo MVN_BIN = $(MVN_BIN)
|
||||
@echo JAVA_ORTOOLS_PACKAGE = $(JAVA_ORTOOLS_PACKAGE)
|
||||
@echo JAVA_ORTOOLS_NATIVE_PROJECT = $(JAVA_ORTOOLS_NATIVE_PROJECT)
|
||||
|
||||
@@ -17,15 +17,7 @@ endif
|
||||
ifeq ($(SYSTEM),unix)
|
||||
OR_TOOLS_TOP ?= $(shell pwd)
|
||||
OS = $(shell uname -s)
|
||||
ifeq ($(UNIX_PYTHON_VER),)
|
||||
ifeq ($(shell which python3),)
|
||||
DETECTED_PYTHON_VERSION := $(shell python -c "from sys import version_info as v; print (str(v[0]) + '.' + str(v[1]))")
|
||||
else
|
||||
DETECTED_PYTHON_VERSION := $(shell python3 -c "from sys import version_info as v; print (str(v[0]) + '.' + str(v[1]))")
|
||||
endif
|
||||
else
|
||||
DETECTED_PYTHON_VERSION := $(UNIX_PYTHON_VER)
|
||||
endif
|
||||
PYTHON_VERSION ?= $(shell python3 -c "from sys import version_info as v; print (str(v[0]) + '.' + str(v[1]))")
|
||||
|
||||
ifeq ($(OS),Linux)
|
||||
PLATFORM = LINUX
|
||||
@@ -174,21 +166,7 @@ ifeq ("$(SYSTEM)","win")
|
||||
CBC_PLATFORM = $(CBC_PLATFORM_PREFIX)-$(VS_RELEASE)-Release
|
||||
|
||||
# Detect Python
|
||||
ifeq ($(WINDOWS_PATH_TO_PYTHON),)
|
||||
DETECTED_PATH_TO_PYTHON = $(shell python -c "from sys import executable; from os.path import sep; print(sep.join(executable.split(sep)[:-1]).rstrip())")
|
||||
CANONIC_DETECTED_PATH_TO_PYTHON = $(subst $(SPACE),$(BACKSLASH_SPACE),$(subst \,/,$(subst \\,/,$(DETECTED_PATH_TO_PYTHON))))
|
||||
ifeq ($(wildcard $(CANONIC_DETECTED_PATH_TO_PYTHON)),)
|
||||
SELECTED_PATH_TO_PYTHON = WINDOWS_PATH_TO_PYTHON =\# python was not found. Set this variable to the path to python to build the python files. Don\'t include the name of the executable in the path! (ex: WINDOWS_PATH_TO_PYTHON = c:\\python37-64)
|
||||
else
|
||||
SELECTED_PATH_TO_PYTHON = WINDOWS_PATH_TO_PYTHON = $(DETECTED_PATH_TO_PYTHON)
|
||||
WINDOWS_PATH_TO_PYTHON = $(DETECTED_PATH_TO_PYTHON)
|
||||
endif
|
||||
else
|
||||
SELECTED_PATH_TO_PYTHON = WINDOWS_PATH_TO_PYTHON = $(WINDOWS_PATH_TO_PYTHON)
|
||||
endif
|
||||
ifneq ($(WINDOWS_PATH_TO_PYTHON),)
|
||||
WINDOWS_PYTHON_VERSION = $(shell "$(WINDOWS_PATH_TO_PYTHON)\python" -c "from sys import version_info as v; print (str(v[0]) + str(v[1]))")
|
||||
endif
|
||||
PYTHON_VERSION ?= $(shell -c "from sys import version_info as v; print (str(v[0]) + str(v[1]))")
|
||||
endif # ($(SYSTEM),win)
|
||||
|
||||
# Get github revision level
|
||||
@@ -233,8 +211,6 @@ detect_port:
|
||||
ifeq ($(SYSTEM),win)
|
||||
@echo CMAKE_PLATFORM = $(CMAKE_PLATFORM)
|
||||
endif
|
||||
@echo SWIG_BINARY = $(SWIG_BINARY)
|
||||
@echo SWIG_INC = $(SWIG_INC)
|
||||
ifeq ($(SYSTEM),win)
|
||||
@echo off & echo(
|
||||
else
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
# ---------- Python support using SWIG ----------
|
||||
ifeq ($(BUILD_PYTHON),OFF)
|
||||
python:
|
||||
$(warning Either Python support was turned off, or the python3 binary was not found.)
|
||||
|
||||
test_python: python
|
||||
package_python: python
|
||||
|
||||
else # BUILD_PYTHON=ON
|
||||
|
||||
.PHONY: help_python # Generate list of Python targets with descriptions.
|
||||
help_python:
|
||||
@echo Use one of the following Python targets:
|
||||
@@ -14,6 +22,8 @@ PYTHON_EXECUTABLE := dependencies$Spython$Svenv$Sbin$Spython
|
||||
|
||||
python: $(OR_TOOLS_LIBS)
|
||||
|
||||
BUILT_LANGUAGES += , Python$(PYTHON_VERSION)
|
||||
|
||||
#######################
|
||||
## Python SOURCE ##
|
||||
#######################
|
||||
@@ -612,6 +622,8 @@ else
|
||||
endif
|
||||
-$(DELREC) $(TEMP_PYTHON_DIR)$Sortools_examples
|
||||
|
||||
endif # BUILD_PYTHON=ON
|
||||
|
||||
################
|
||||
## Cleaning ##
|
||||
################
|
||||
@@ -680,7 +692,6 @@ clean_python:
|
||||
-$(DELREC) ortools$Sutil$S__pycache__
|
||||
-$(DEL) $(GEN_PATH)$Sortools$Sutil$S*_python_wrap.*
|
||||
-$(DEL) $(GEN_PATH)$Sortools$Sutil$S_*
|
||||
-$(DEL) $(LIB_DIR)$S_*.$(SWIG_PYTHON_LIB_SUFFIX)
|
||||
-$(DEL) $(OBJ_DIR)$Sswig$S*python_wrap.$O
|
||||
-$(DEL) *.whl
|
||||
-$(DELREC) temp_python*
|
||||
@@ -691,24 +702,8 @@ clean_python:
|
||||
.PHONY: detect_python # Show variables used to build Python OR-Tools.
|
||||
detect_python:
|
||||
@echo Relevant info for the Python build:
|
||||
ifeq ($(SYSTEM),win)
|
||||
@echo WINDOWS_PATH_TO_PYTHON = "$(WINDOWS_PATH_TO_PYTHON)"
|
||||
else
|
||||
@echo UNIX_PYTHON_VER = "$(UNIX_PYTHON_VER)"
|
||||
endif
|
||||
@echo PYTHON_COMPILER = $(PYTHON_COMPILER)
|
||||
@echo PYTHON_EXECUTABLE = "$(PYTHON_EXECUTABLE)"
|
||||
@echo PYTHON_VERSION = $(PYTHON_VERSION)
|
||||
@echo PYTHON3 = $(PYTHON3)
|
||||
@echo PYTHON_INC = $(PYTHON_INC)
|
||||
@echo PYTHON_LNK = $(PYTHON_LNK)
|
||||
@echo PYTHON_LDFLAGS = $(PYTHON_LDFLAGS)
|
||||
@echo SWIG_BINARY = $(SWIG_BINARY)
|
||||
@echo SWIG_INC = $(SWIG_INC)
|
||||
@echo SWIG_PYTHON3_FLAG = $(SWIG_PYTHON3_FLAG)
|
||||
@echo SWIG_PYTHON_LIB_SUFFIX = $(SWIG_PYTHON_LIB_SUFFIX)
|
||||
@echo SET_PYTHONPATH = "$(SET_PYTHONPATH)"
|
||||
@echo MYPY_OUT = "$(MYPY_OUT)"
|
||||
ifeq ($(SYSTEM),win)
|
||||
@echo off & echo(
|
||||
else
|
||||
|
||||
@@ -10,55 +10,12 @@ USE_SCIP ?= ON
|
||||
USE_GLPK ?= OFF
|
||||
PROTOC ?= $(OR_TOOLS_TOP)/bin/protoc
|
||||
|
||||
# language targets
|
||||
BUILD_PYTHON ?= OFF
|
||||
BUILD_JAVA ?= OFF
|
||||
BUILD_DOTNET ?= OFF
|
||||
|
||||
# Swig is only needed when building .Net, Java or Python wrapper
|
||||
UNIX_SWIG_BINARY ?= swig
|
||||
SWIG_BINARY = $(shell $(WHICH) $(UNIX_SWIG_BINARY))
|
||||
SWIG_DOXYGEN = -doxygen
|
||||
|
||||
|
||||
# Main target.
|
||||
.PHONY: third_party # Build OR-Tools Prerequisite
|
||||
third_party: Makefile.local dependencies/Makefile
|
||||
third_party: dependencies/Makefile
|
||||
|
||||
THIRD_PARTY_TARGET = dependencies/Makefile
|
||||
|
||||
######################
|
||||
## Makefile.local ##
|
||||
######################
|
||||
# Make sure that local file lands correctly across platforms
|
||||
Makefile.local: makefiles/Makefile.third_party.$(SYSTEM).mk
|
||||
-$(DEL) Makefile.local
|
||||
@echo Generating Makefile.local
|
||||
@echo "# Define UNIX_SWIG_BINARY to use a custom version." >> Makefile.local
|
||||
@echo "# e.g. UNIX_SWIG_BINARY = /opt/swig-x.y.z/bin/swig" >> Makefile.local
|
||||
@echo JAVA_HOME = $(JAVA_HOME)>> Makefile.local
|
||||
@echo UNIX_PYTHON_VER = $(DETECTED_PYTHON_VERSION)>> Makefile.local
|
||||
@echo >> Makefile.local
|
||||
@echo "## OPTIONAL DEPENDENCIES ##" >> Makefile.local
|
||||
@echo "# Define UNIX_CPLEX_DIR to use CPLEX" >> Makefile.local
|
||||
@echo "# e.g. UNIX_CPLEX_DIR = /opt/CPLEX_Studio-X.Y" >> Makefile.local
|
||||
@echo >> Makefile.local
|
||||
@echo "# Define UNIX_XPRESS_DIR to use XPRESS MP" >> Makefile.local
|
||||
@echo "# e.g. on Mac OS X: UNIX_XPRESS_DIR = /Applications/FICO\ Xpress/xpressmp" >> Makefile.local
|
||||
@echo "# e.g. on linux: UNIX_XPRESS_DIR = /opt/xpressmp" >> Makefile.local
|
||||
@echo >> Makefile.local
|
||||
@echo "# SCIP is enabled and built-in by default. To disable SCIP support" >> Makefile.local
|
||||
@echo "# completely, uncomment the following line:">> Makefile.local
|
||||
@echo "# USE_SCIP = OFF" >> Makefile.local
|
||||
@echo >> Makefile.local
|
||||
@echo "# Define UNIX_GLPK_DIR to point to a compiled version of GLPK to use it" >> Makefile.local
|
||||
@echo "# e.g. UNIX_GLPK_DIR = /opt/glpk-x.y.z" >> Makefile.local
|
||||
@echo >> Makefile.local
|
||||
@echo "# Coin OR solvers (CLP, CBC) are enabled and built-in by default." >> Makefile.local
|
||||
@echo "# To disable Coin OR support completely, uncomment the following line:">> Makefile.local
|
||||
@echo "# USE_COINOR = OFF" >> Makefile.local
|
||||
@echo >> Makefile.local
|
||||
|
||||
dependencies:
|
||||
mkdir dependencies
|
||||
|
||||
@@ -105,5 +62,4 @@ ifdef UNIX_XPRESS_DIR
|
||||
@echo XPRESS_INC = $(XPRESS_INC)
|
||||
@echo XPRESS_LNK = $(XPRESS_LNK)
|
||||
endif
|
||||
@echo SWIG_VERSION = $(SWIG_VERSION)
|
||||
@echo
|
||||
|
||||
@@ -9,7 +9,6 @@ USE_COINOR ?= ON
|
||||
USE_SCIP ?= ON
|
||||
USE_GLPK ?= OFF
|
||||
PROTOC = "$(OR_TOOLS_TOP)\\bin\\protoc.exe"
|
||||
SWIG_BINARY = swig.exe
|
||||
|
||||
# language targets
|
||||
BUILD_PYTHON ?= OFF
|
||||
@@ -21,41 +20,10 @@ dependencies:
|
||||
mkdir dependencies
|
||||
|
||||
.PHONY: third_party # Build OR-Tools Prerequisite
|
||||
third_party: \
|
||||
Makefile.local \
|
||||
dependencies/ortools.sln | dependencies
|
||||
third_party: dependencies/ortools.sln | dependencies
|
||||
|
||||
THIRD_PARTY_TARGET = dependencies/ortools.sln
|
||||
|
||||
######################
|
||||
## Makefile.local ##
|
||||
######################
|
||||
# Make sure that local file lands correctly across platforms
|
||||
Makefile.local: makefiles/Makefile.third_party.$(SYSTEM).mk
|
||||
-$(DEL) Makefile.local
|
||||
@echo $(SELECTED_PATH_TO_PYTHON)>> Makefile.local
|
||||
@echo # >> Makefile.local
|
||||
@echo ## OPTIONAL DEPENDENCIES ## >> Makefile.local
|
||||
@echo # Define WINDOWS_CPLEX_DIR to point to a installation directory of the CPLEX Studio >> Makefile.local
|
||||
@echo # e.g.: WINDOWS_CPLEX_DIR = C:\Progra~1\CPLEX_STUDIO2010\IBM\ILOG\CPLEX_STUDIO2010 >> Makefile.local
|
||||
@echo # >> Makefile.local
|
||||
@echo # Define WINDOWS_CPLEX_VERSION to specify the suffix of the library >> Makefile.local
|
||||
@echo # e.g.: WINDOWS_CPLEX_VERSION = 2010 >> Makefile.local
|
||||
@echo # >> Makefile.local
|
||||
@echo # Define WINDOWS_XPRESS_DIR to point to a installation directory of the XPRESS-MP >> Makefile.local
|
||||
@echo # e.g.: WINDOWS_XPRESS_DIR = C:\xpressmp>> Makefile.local
|
||||
@echo # >> Makefile.local
|
||||
@echo # SCIP is enabled and built-in by default. >> Makefile.local
|
||||
@echo # To disable support, uncomment the following line: >> Makefile.local
|
||||
@echo # USE_SCIP = OFF >> Makefile.local
|
||||
@echo # >> Makefile.local
|
||||
@echo # Coin OR solvers (CLP, CBC) are enabled and built-in by default. >> Makefile.local
|
||||
@echo # To disable support, uncomment the following line: >> Makefile.local
|
||||
@echo # USE_COINOR = OFF >> Makefile.local
|
||||
@echo # >> Makefile.local
|
||||
@echo # Define absolute paths without trailing "\". E.g. "C:\Foo\Bar" >> Makefile.local
|
||||
@echo # Paths must be without spaces, try to use 'dir "directory*" /x' to get the shortname without space of each directory >> Makefile.local
|
||||
@echo # e.g. dir "%ProgramFiles%*" /x >> Makefile.local
|
||||
|
||||
dependencies/ortools.sln: | dependencies
|
||||
cmake -S . -B dependencies -DBUILD_DEPS=ON \
|
||||
|
||||
@@ -74,37 +74,14 @@ CMAKE := $(shell $(WHICH) cmake)
|
||||
ifeq ($(CMAKE),)
|
||||
$(error Please add "cmake" to your PATH)
|
||||
endif
|
||||
MVN_BIN := $(shell $(WHICH) mvn)
|
||||
|
||||
# This is needed to find python.h
|
||||
PYTHON_VERSION = $(UNIX_PYTHON_VER)
|
||||
MAJOR_PYTHON_VERSION = $(shell python$(UNIX_PYTHON_VER) -c "from sys import version_info as v; print (str(v[0]))")
|
||||
MINOR_PYTHON_VERSION = $(shell python$(UNIX_PYTHON_VER) -c "from sys import version_info as v; print (str(v[1]))")
|
||||
|
||||
PATH_TO_PYTHON_LIB = $(shell python$(UNIX_PYTHON_VER) -c 'import sysconfig; print (sysconfig.get_paths()["stdlib"])')
|
||||
PATH_TO_PYTHON_INCLUDE = $(shell python$(UNIX_PYTHON_VER) -c 'import sysconfig; print (sysconfig.get_paths()["platinclude"])')
|
||||
PYTHON_INC = -I$(PATH_TO_PYTHON_INCLUDE) -I$(PATH_TO_PYTHON_LIB) $(ADD_PYTHON_INC)
|
||||
|
||||
PYTHON_INC += $(shell pkg-config --cflags python$(MAJOR_PYTHON_VERSION) 2> /dev/null)
|
||||
|
||||
ifdef UNIX_CPLEX_DIR
|
||||
CPLEX_INC = -I$(UNIX_CPLEX_DIR)/cplex/include -DUSE_CPLEX
|
||||
CPLEX_SWIG = $(CPLEX_INC)
|
||||
endif
|
||||
ifdef UNIX_XPRESS_DIR
|
||||
XPRESS_INC = -I$(UNIX_XPRESS_DIR)/include -DUSE_XPRESS -DXPRESS_PATH="$(UNIX_XPRESS_DIR)"
|
||||
XPRESS_SWIG = $(XPRESS_INC)
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),LINUX)
|
||||
SWIG_INC = -DSWIGWORDSIZE64
|
||||
else
|
||||
SWIG_INC =
|
||||
endif
|
||||
SWIG_INC += \
|
||||
-DUSE_GLOP -DUSE_BOP -DABSL_MUST_USE_RESULT \
|
||||
$(GLPK_SWIG) $(CPLEX_SWIG) $(XPRESS_INC)
|
||||
|
||||
# Compilation flags
|
||||
DEBUG = -O4 -DNDEBUG
|
||||
JNIDEBUG = -O1 -DNDEBUG
|
||||
@@ -129,14 +106,8 @@ ifeq ($(PLATFORM),LINUX)
|
||||
endif
|
||||
|
||||
SYS_LNK = -lrt -lpthread -Wl,--no-as-needed -ldl
|
||||
JAVA_INC = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
|
||||
JAVAC_BIN = $(shell $(WHICH) $(JAVA_HOME)/bin/javac)
|
||||
JAVA_BIN = $(shell $(WHICH) $(JAVA_HOME)/bin/java)
|
||||
JAR_BIN = $(shell $(WHICH) $(JAVA_HOME)/bin/jar)
|
||||
JNI_LIB_EXT = so
|
||||
|
||||
SWIG_PYTHON_LIB_SUFFIX = so
|
||||
SWIG_DOTNET_LIB_SUFFIX = so
|
||||
LINK_CMD = $(DYNAMIC_LD)
|
||||
PRE_LIB = -L$(OR_ROOT_FULL)/lib -l
|
||||
POST_LIB =
|
||||
@@ -144,12 +115,6 @@ ifeq ($(PLATFORM),LINUX)
|
||||
-Wl,-rpath,'$$ORIGIN' \
|
||||
-Wl,-rpath,'$$ORIGIN/../lib'
|
||||
|
||||
PYTHON_LDFLAGS = \
|
||||
-Wl,-rpath,'$$ORIGIN' \
|
||||
-Wl,-rpath,'$$ORIGIN/../../ortools' \
|
||||
-Wl,-rpath,'$$ORIGIN/../../ortools/.libs' \
|
||||
-Wl,-rpath,'$$ORIGIN/../../../../lib'
|
||||
|
||||
endif # ifeq ($(PLATFORM),LINUX)
|
||||
ifeq ($(PLATFORM),MACOSX)
|
||||
MAC_VERSION = -mmacosx-version-min=$(MAC_MIN_VERSION)
|
||||
@@ -177,14 +142,8 @@ ifeq ($(PLATFORM),MACOSX)
|
||||
SYS_LNK =
|
||||
SET_COMPILER = CXX="$(CCC)"
|
||||
SET_COIN_OPT = OPT_CXXFLAGS="-O1 -DNDEBUG" OPT_CFLAGS="-O1 -DNDEBUG"
|
||||
JAVA_INC = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin
|
||||
JAVAC_BIN = $(shell $(WHICH) $(JAVA_HOME)/bin/javac)
|
||||
JAVA_BIN = $(shell $(WHICH) $(JAVA_HOME)/bin/java)
|
||||
JAR_BIN = $(shell $(WHICH) $(JAVA_HOME)/bin/jar)
|
||||
JNI_LIB_EXT = dylib
|
||||
|
||||
SWIG_PYTHON_LIB_SUFFIX = so# To overcome a bug in Mac OS X loader.
|
||||
SWIG_DOTNET_LIB_SUFFIX = dylib
|
||||
LINK_CMD = clang++ -dynamiclib $(MAC_VERSION) \
|
||||
-Wl,-search_paths_first \
|
||||
-Wl,-headerpad_max_install_names \
|
||||
@@ -198,12 +157,6 @@ ifeq ($(PLATFORM),MACOSX)
|
||||
-Wl,-rpath,@loader_path/../lib \
|
||||
-Wl,-rpath,@loader_path/../dependencies/install/lib
|
||||
LDFLAGS = -install_name @rpath/$(LIB_PREFIX)ortools.$L #
|
||||
PYTHON_LDFLAGS = \
|
||||
-Wl,-rpath,@loader_path \
|
||||
-Wl,-rpath,@loader_path/../../ortools \
|
||||
-Wl,-rpath,@loader_path/../../ortools/.libs \
|
||||
-Wl,-rpath,@loader_path/../../../../lib \
|
||||
-Wl,-rpath,@loader_path/../../../../dependencies/install/lib
|
||||
endif # ifeq ($(PLATFORM),MACOSX)
|
||||
|
||||
DEPENDENCIES_INC = -I$(INC_DIR) -I$(SRC_DIR) -I$(GEN_DIR) \
|
||||
@@ -217,3 +170,40 @@ DEPENDENCIES_LNK = $(GLPK_LNK) $(CPLEX_LNK) $(XPRESS_LNK)
|
||||
|
||||
OR_TOOLS_LNK = $(PRE_LIB)ortools$(POST_LIB)
|
||||
OR_TOOLS_LDFLAGS = $(ZLIB_LNK) $(SYS_LNK) $(LINK_FLAGS)
|
||||
|
||||
# language targets
|
||||
|
||||
BUILD_PYTHON ?= ON
|
||||
ifeq ($(PYTHON_VERSION),)
|
||||
BUILD_PYTHON = OFF
|
||||
endif
|
||||
|
||||
BUILD_JAVA ?= ON
|
||||
JAVAC_BIN = $(shell $(WHICH) $(JAVA_HOME)/bin/javac)
|
||||
JAVA_BIN = $(shell $(WHICH) $(JAVA_HOME)/bin/java)
|
||||
JAR_BIN = $(shell $(WHICH) $(JAVA_HOME)/bin/jar)
|
||||
MVN_BIN := $(shell $(WHICH) mvn)
|
||||
ifndef JAVAC_BIN
|
||||
BUILD_JAVA = OFF
|
||||
endif
|
||||
ifndef JAR_BIN
|
||||
BUILD_JAVA = OFF
|
||||
endif
|
||||
ifndef JAVA_BIN
|
||||
BUILD_JAVA = OFF
|
||||
endif
|
||||
ifndef MVN_BIN
|
||||
BUILD_JAVA = OFF
|
||||
endif
|
||||
|
||||
BUILD_DOTNET ?= ON
|
||||
DOTNET := $(shell which dotnet)
|
||||
ifeq ($(DOTNET),)
|
||||
BUILD_DOTNET=OFF
|
||||
endif
|
||||
|
||||
.PHONY detect_languages:
|
||||
detect_languages:
|
||||
@echo BUILD_PYTHON = $(BUILD_PYTHON)
|
||||
@echo BUILD_JAVA = $(BUILD_JAVA)
|
||||
@echo BUILD_DOTNET = $(BUILD_DOTNET)
|
||||
|
||||
@@ -7,8 +7,6 @@ LIB_PREFIX =
|
||||
PRE_LIB = $(OR_ROOT)lib\\
|
||||
POST_LIB = .lib
|
||||
LIB_SUFFIX = lib
|
||||
SWIG_PYTHON_LIB_SUFFIX = dll
|
||||
SWIG_DOTNET_LIB_SUFFIX = dll
|
||||
JNI_LIB_EXT = dll
|
||||
STATIC_PRE_LIB = $(OR_ROOT)lib\\
|
||||
STATIC_POST_LIB = .lib
|
||||
@@ -93,7 +91,7 @@ CMAKE := $(shell $(WHICH) cmake)
|
||||
ifeq ($(CMAKE),)
|
||||
$(error Please add "cmake" to your PATH)
|
||||
endif
|
||||
MVN_BIN := $(shell $(WHICH) mvn.cmd)
|
||||
|
||||
|
||||
# Add some additional macros
|
||||
ATTRIB = attrib
|
||||
@@ -104,42 +102,26 @@ DEBUG=/O2 -DNDEBUG
|
||||
CCC=cl /std:c++20 /EHsc /MD /nologo -nologo $(SYSCFLAGS) /D__WIN32__ /DPSAPI_VERSION=1 \
|
||||
/DNOMINMAX /DWIN32_LEAN_AND_MEAN=1 /D_CRT_SECURE_NO_WARNINGS
|
||||
|
||||
PYTHON_VERSION = $(WINDOWS_PYTHON_VERSION)
|
||||
PYTHON_INC=/I"$(WINDOWS_PATH_TO_PYTHON)\\include"
|
||||
PYTHON_LNK="$(WINDOWS_PATH_TO_PYTHON)\\libs\\python$(PYTHON_VERSION).lib"
|
||||
|
||||
# This is needed to find GLPK include files and libraries.
|
||||
ifdef WINDOWS_GLPK_DIR
|
||||
GLPK_INC = /I"$(WINDOWS_GLPK_DIR)\\include" /DUSE_GLPK
|
||||
GLPK_SWIG = -I"$(WINDOWS_GLPK_DIR)/include" -DUSE_GLPK
|
||||
DYNAMIC_GLPK_LNK = "$(WINDOWS_GLPK_DIR)\\lib\\glpk.lib"
|
||||
STATIC_GLPK_LNK = "$(WINDOWS_GLPK_DIR)\\lib\\glpk.lib"
|
||||
endif
|
||||
# This is needed to find CPLEX include files and libraries.
|
||||
ifdef WINDOWS_CPLEX_DIR
|
||||
CPLEX_INC = /I"$(WINDOWS_CPLEX_DIR)\\cplex\\include" /DUSE_CPLEX
|
||||
CPLEX_SWIG = -I"$(WINDOWS_CPLEX_DIR)/cplex/include" -DUSE_CPLEX
|
||||
STATIC_CPLEX_LNK = "$(WINDOWS_CPLEX_DIR)\\cplex\\lib\\x64_windows_msvc14\\stat_mda\\cplex$(WINDOWS_CPLEX_VERSION).lib"
|
||||
DYNAMIC_CPLEX_LNK = $(STATIC_CPLEX_LNK)
|
||||
endif
|
||||
ifdef WINDOWS_XPRESS_DIR
|
||||
XPRESS_INC = /I"$(WINDOWS_XPRESS_DIR)\\include" /DUSE_XPRESS /DXPRESS_PATH=\"$(WINDOWS_XPRESS_DIR)\"
|
||||
XPRESS_SWIG = -I"$(WINDOWS_XPRESS_DIR)/include" -DUSE_XPRESS
|
||||
STATIC_XPRESS_LNK = "$(WINDOWS_XPRESS_DIR)\\lib\\xprs.lib"
|
||||
DYNAMIC_XPRESS_LNK = $(STATIC_XPRESS_LNK)
|
||||
endif
|
||||
|
||||
SWIG_INC = \
|
||||
-DUSE_GLOP -DUSE_BOP -DABSL_MUST_USE_RESULT \
|
||||
$(GLPK_SWIG) $(GUROBI_SWIG) $(CPLEX_SWIG) $(XPRESS_SWIG)
|
||||
|
||||
SYS_LNK = psapi.lib ws2_32.lib shlwapi.lib
|
||||
|
||||
JAVA_INC=/I"$(JAVA_HOME)\\include" /I"$(JAVA_HOME)\\include\\win32"
|
||||
JAVAC_BIN=$(shell $(WHICH) "$(JAVA_HOME)\bin\javac")
|
||||
JAVA_BIN=$(shell $(WHICH) "$(JAVA_HOME)\bin\java")
|
||||
JAR_BIN=$(shell $(WHICH) "$(JAVA_HOME)\bin\jar")
|
||||
|
||||
DEPENDENCIES_INC = /I$(INC_DIR) /I$(SRC_DIR) /I$(GEN_DIR) \
|
||||
/DUSE_GLOP /DUSE_BOP \
|
||||
$(GLPK_INC) $(GUROBI_INC) $(CPLEX_INC) $(XPRESS_INC)
|
||||
@@ -235,3 +217,41 @@ ABSL_LNK = \
|
||||
|
||||
OR_TOOLS_LNK = $(PRE_LIB)ortools$(POST_LIB) $(DEPENDENCIES_LNK)
|
||||
OR_TOOLS_LDFLAGS =
|
||||
|
||||
# language targets
|
||||
|
||||
BUILD_PYTHON ?= ON
|
||||
ifeq ($(PYTHON_VERSION),)
|
||||
BUILD_PYTHON = OFF
|
||||
endif
|
||||
|
||||
BUILD_JAVA ?= ON
|
||||
JAVAC_BIN=$(shell $(WHICH) "$(JAVA_HOME)\bin\javac")
|
||||
JAVA_BIN=$(shell $(WHICH) "$(JAVA_HOME)\bin\java")
|
||||
JAR_BIN=$(shell $(WHICH) "$(JAVA_HOME)\bin\jar")
|
||||
MVN_BIN := $(shell $(WHICH) mvn.cmd)
|
||||
ifndef JAVAC_BIN
|
||||
BUILD_JAVA = OFF
|
||||
endif
|
||||
ifndef JAR_BIN
|
||||
BUILD_JAVA = OFF
|
||||
endif
|
||||
ifndef JAVA_BIN
|
||||
BUILD_JAVA = OFF
|
||||
endif
|
||||
ifndef MVN_BIN
|
||||
BUILD_JAVA = OFF
|
||||
endif
|
||||
|
||||
BUILD_DOTNET ?= ON
|
||||
DOTNET := $(shell $(WHICH) dotnet)
|
||||
ifeq ($(DOTNET),)
|
||||
BUILD_DOTNET=OFF
|
||||
endif
|
||||
|
||||
.PHONY detect_languages:
|
||||
detect_languages:
|
||||
@echo BUILD_PYTHON = $(BUILD_PYTHON)
|
||||
@echo BUILD_JAVA = $(BUILD_JAVA)
|
||||
@echo BUILD_DOTNET = $(BUILD_DOTNET)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user