From 97fd0095a7a770dcab69059f01294226c2fedbc3 Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Mon, 19 Nov 2018 09:40:09 +0100 Subject: [PATCH] Makefile: Update archive targets recipe --- makefiles/Makefile.archive.mk | 54 ++++++++++++++++++++++++----------- makefiles/Makefile.python.mk | 13 ++++++--- tools/README.examples.python | 50 +++++++++++++++++++------------- 3 files changed, 76 insertions(+), 41 deletions(-) diff --git a/makefiles/Makefile.archive.mk b/makefiles/Makefile.archive.mk index a7bc08aaab..8d29079a5b 100644 --- a/makefiles/Makefile.archive.mk +++ b/makefiles/Makefile.archive.mk @@ -59,32 +59,52 @@ archive_cc: cc $(CVRPTW_LIBS) $(DIMACS_LIBS) $(FAP_LIBS) | $(TEMP_ARCHIVE_DIR) $(COPY) $(DIMACS_PATH) $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Slib $(COPY) $(FAP_PATH) $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Slib -$(MKDIR_P) $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Scpp - $(COPY) examples$Scpp$S*.cc $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Scpp - $(COPY) examples$Scpp$S*.h $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Scpp + -$(COPY) $(CC_EX_PATH)$S*.h $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Scpp + -$(COPY) $(CC_EX_PATH)$S*.cc $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Scpp + -$(COPY) $(CC_EX_PATH)$SREADME.md $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Scpp + -$(COPY) $(CONTRIB_EX_PATH)$S*.h $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Scpp + -$(COPY) $(CONTRIB_EX_PATH)$S*.cc $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Scpp + -$(COPY) ortools$Salgorithms$Ssamples$S*.cc $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Scpp + -$(COPY) ortools$Sgraph$Ssamples$S*.cc $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Scpp + -$(COPY) ortools$Slinear_solver$Ssamples$S*.cc $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Scpp + -$(COPY) ortools$Srouting$Ssamples$S*.cc $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Scpp + -$(COPY) ortools$Ssat$Ssamples$S*.cc $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Scpp .PHONY: archive_java # Add Java OR-Tools to archive. archive_java: java | $(TEMP_ARCHIVE_DIR) $(COPY) $(LIB_DIR)$Scom.google.ortools.jar $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Slib $(COPY) $(LIB_DIR)$Sprotobuf.jar $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Slib $(COPY) $(LIB_DIR)$S$(LIB_PREFIX)jniortools.$(JNI_LIB_EXT) $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Slib - -$(MKDIR_P) $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples -ifeq ($(SYSTEM),win) - -$(MKDIR) $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sjava - $(COPYREC) $(JAVA_EX_PATH) "$(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sjava" /E -else - $(COPYREC) $(JAVA_EX_PATH) $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples -endif + -$(MKDIR_P) $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sjava + -$(COPY) $(JAVA_EX_PATH)$S*.java $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sjava + -$(COPY) $(JAVA_EX_PATH)$SREADME.md $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sjava + -$(COPY) $(CONTRIB_EX_PATH)$S*.java $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sjava + -$(COPY) ortools$Salgorithms$Ssamples$S*.java $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sjava + -$(COPY) ortools$Sgraph$Ssamples$S*.java $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sjava + -$(COPY) ortools$Slinear_solver$Ssamples$S*.java $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sjava + -$(COPY) ortools$Srouting$Ssamples$S*.java $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sjava + -$(COPY) ortools$Ssat$Ssamples$S*.java $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sjava .PHONY: archive_dotnet # Add .Net OR-Tools to archive. archive_dotnet: dotnet | $(TEMP_ARCHIVE_DIR) -$(MKDIR_P) $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Spackages $(COPY) packages$S*.nupkg $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Spackages -$(MKDIR_P) $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sdotnet - $(COPY) examples$Sdotnet$S*.cs $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sdotnet - $(COPY) examples$Sdotnet$S*.csproj $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sdotnet - $(COPY) examples$Sdotnet$S*.fs $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sdotnet - $(COPY) examples$Sdotnet$S*.fsproj $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sdotnet - $(COPY) examples$Sdotnet$SREADME.md $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sdotnet + -$(COPY) $(DOTNET_EX_PATH)$S*.cs* $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sdotnet + -$(COPY) $(DOTNET_EX_PATH)$S*.fs* $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sdotnet + -$(COPY) $(DOTNET_EX_PATH)$SREADME.md $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sdotnet + -$(COPY) $(CONTRIB_EX_PATH)$S*.cs* $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sdotnet + -$(COPY) $(CONTRIB_EX_PATH)$S*.fs* $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sdotnet + -$(COPY) ortools$Salgorithms$Ssamples$S*.cs* $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sdotnet + -$(COPY) ortools$Salgorithms$Ssamples$S*.fs* $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sdotnet + -$(COPY) ortools$Sgraph$Ssamples$S*.cs* $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sdotnet + -$(COPY) ortools$Sgraph$Ssamples$S*.fs* $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sdotnet + -$(COPY) ortools$Slinear_solver$Ssamples$S*.cs* $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sdotnet + -$(COPY) ortools$Slinear_solver$Ssamples$S*.fs* $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sdotnet + -$(COPY) ortools$Srouting$Ssamples$S*.cs* $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sdotnet + -$(COPY) ortools$Srouting$Ssamples$S*.fs* $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sdotnet + -$(COPY) ortools$Ssat$Ssamples$S*.cs* $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sdotnet + -$(COPY) ortools$Ssat$Ssamples$S*.fs* $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sdotnet $(FZ_INSTALL_DIR)$(ARCHIVE_EXT): fz | $(TEMP_FZ_DIR) -$(DELREC) $(TEMP_FZ_DIR)$S* @@ -94,11 +114,11 @@ $(FZ_INSTALL_DIR)$(ARCHIVE_EXT): fz | $(TEMP_FZ_DIR) $(COPY) $(BIN_DIR)$Sparser_main$E $(TEMP_FZ_DIR)$S$(FZ_INSTALL_DIR)$Sbin$Sparser-or-tools$E -$(MKDIR_P) $(TEMP_FZ_DIR)$S$(FZ_INSTALL_DIR)$Sshare -$(MKDIR) $(TEMP_FZ_DIR)$S$(FZ_INSTALL_DIR)$Sshare$Sminizinc_cp - $(COPY) ortools$Sflatzinc$Smznlib_cp$S* $(TEMP_FZ_DIR)$S$(FZ_INSTALL_DIR)$Sshare$Sminizinc_cp + $(COPY) $(FZ_EX_PATH)$Smznlib_cp$S* $(TEMP_FZ_DIR)$S$(FZ_INSTALL_DIR)$Sshare$Sminizinc_cp -$(MKDIR) $(TEMP_FZ_DIR)$S$(FZ_INSTALL_DIR)$Sshare$Sminizinc_sat - $(COPY) ortools$Sflatzinc$Smznlib_sat$S* $(TEMP_FZ_DIR)$S$(FZ_INSTALL_DIR)$Sshare$Sminizinc_sat + $(COPY) $(FZ_EX_PATH)$Smznlib_sat$S* $(TEMP_FZ_DIR)$S$(FZ_INSTALL_DIR)$Sshare$Sminizinc_sat -$(MKDIR_P) $(TEMP_FZ_DIR)$S$(FZ_INSTALL_DIR)$Sexamples - $(COPY) examples$Sflatzinc$S* $(TEMP_FZ_DIR)$S$(FZ_INSTALL_DIR)$Sexamples + $(COPY) $(FZ_EX_PATH)$S* $(TEMP_FZ_DIR)$S$(FZ_INSTALL_DIR)$Sexamples ifeq ($(SYSTEM),win) cd $(TEMP_FZ_DIR) && ..$S$(ZIP) -r ..$S$(FZ_INSTALL_DIR)$(ARCHIVE_EXT) $(FZ_INSTALL_DIR) else diff --git a/makefiles/Makefile.python.mk b/makefiles/Makefile.python.mk index 3c156fb4a4..48ddcfa2c9 100755 --- a/makefiles/Makefile.python.mk +++ b/makefiles/Makefile.python.mk @@ -1042,10 +1042,15 @@ python_examples_archive: -$(MKDIR) $(TEMP_PYTHON_DIR)$Sortools_examples$Sexamples$Spython -$(MKDIR) $(TEMP_PYTHON_DIR)$Sortools_examples$Sexamples$Snotebook -$(MKDIR) $(TEMP_PYTHON_DIR)$Sortools_examples$Sexamples$Sdata - $(COPY) $(PYTHON_EX_PATH)$S*.py $(TEMP_PYTHON_DIR)$Sortools_examples$Sexamples$Spython - $(COPY) examples$Snotebook$S*.ipynb $(TEMP_PYTHON_DIR)$Sortools_examples$Sexamples$Snotebook - $(COPY) examples$Snotebook$S*.md $(TEMP_PYTHON_DIR)$Sortools_examples$Sexamples$Snotebook - $(COPY) tools$SREADME.examples.python $(TEMP_PYTHON_DIR)$Sortools_examples$SREADME.txt + -$(COPY) $(PYTHON_EX_PATH)$S*.py $(TEMP_PYTHON_DIR)$Sortools_examples$Sexamples$Spython + -$(COPY) ortools$Salgorithms$Ssamples$S*.py $(TEMP_PYTHON_DIR)$Sortools_examples$Sexamples$Spython + -$(COPY) ortools$Sgraph$Ssamples$S*.py $(TEMP_PYTHON_DIR)$Sortools_examples$Sexamples$Spython + -$(COPY) ortools$Slinear_solver$Ssamples$S*.py $(TEMP_PYTHON_DIR)$Sortools_examples$Sexamples$Spython + -$(COPY) ortools$Srouting$Ssamples$S*.py $(TEMP_PYTHON_DIR)$Sortools_examples$Sexamples$Spython + -$(COPY) ortools$Ssat$Ssamples$S*.py $(TEMP_PYTHON_DIR)$Sortools_examples$Sexamples$Spython + -$(COPY) examples$Snotebook$S*.ipynb $(TEMP_PYTHON_DIR)$Sortools_examples$Sexamples$Snotebook + -$(COPY) examples$Snotebook$S*.md $(TEMP_PYTHON_DIR)$Sortools_examples$Sexamples$Snotebook + -$(COPY) tools$SREADME.examples.python $(TEMP_PYTHON_DIR)$Sortools_examples$SREADME.md $(COPY) LICENSE-2.0.txt $(TEMP_PYTHON_DIR)$Sortools_examples ifeq ($(SYSTEM),win) cd $(TEMP_PYTHON_DIR)\ortools_examples \ diff --git a/tools/README.examples.python b/tools/README.examples.python index 99b7d960b3..b3c7c76eae 100644 --- a/tools/README.examples.python +++ b/tools/README.examples.python @@ -1,9 +1,11 @@ +# Introduction This file describes how to use OR-Tools in python with the binary archives. -OR-Tools is located at https://developers.google.com/optimization +OR-Tools online documetation is +[here](https://developers.google.com/optimization) -Full installation instructions are located at: - https://developers.google.com/optimization/introduction/installing/binary +Full installation instructions are located +[here](https://developers.google.com/optimization/install/python/) These modules have been tested under: - Ubuntu 14.04 and up, CentOS 7, Debian 9. @@ -11,25 +13,33 @@ These modules have been tested under: - Microsoft Windows with Visual Studio 2015 and 2017 (64-bit) Upon decompressing the archive, you will get the following structure: - +``` or-tools/ - LICENSE-2.0.txt <- Apache License - README <- This file - data/ <- Data for the examples - examples/ - examples/python <- Python examples - examples/notebook <- Jupyter/IPython notebooks + [LICENSE-2.0.txt](LICENSE-2.0.txt) <- Apache License + [README.md](README.md) <- This file + [examples/data/](examples/data) <- Data for the examples + [examples/python](examples/python) <- Python examples + [examples/notebook](examples/notebook) <- Jupyter/IPython notebooks +``` -To install the package : - 1/Make sure python and pip are installed +# Installation +To install the package: +1. Make sure python and pip are installed - 2/Make sure pip is up to date: - pip -V should return 9.0.1 - otherwise, run: pip install --upgrade pip +2. Make sure pip is up to date: +```shell +python -m pip -V +``` +should return 9.0.1 otherwise, run: `python -m pip install --upgrade --user pip` - 3/Fetch ortools from Pypi: - pip install --upgrade ortools - It should pull the latest version of or-tools. +3. Fetch `ortools` from Pypi: +```shell +python -m pip install --upgrade --user ortools +``` +It should pull the latest version of OR-Tools. - 4/Run a first example: - python examples/python/hidato_table.py +# Run Examples +To run a first example: +```shell +python examples/python/hidato_table.py +```