make: Fix .Net archive

This commit is contained in:
Mizux Seiha
2021-12-09 11:34:01 +01:00
parent f6212dcbba
commit 0bf387c3bc
3 changed files with 55 additions and 30 deletions

View File

@@ -139,29 +139,54 @@ archive_java: java \
$(TEMP_ARCHIVE_DIR)/$(INSTALL_DIR)/examples/dotnet: | $(TEMP_ARCHIVE_DIR)/$(INSTALL_DIR)/examples
$(MKDIR) $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sdotnet
define dotnet-sample-archive =
$$(TEMP_ARCHIVE_DIR)/$$(INSTALL_DIR)/examples/dotnet/%/plop: \
$$(TEMP_DOTNET_DIR)/$1/%/%.csproj \
ortools/$1/samples/%.cs \
| $$(TEMP_ARCHIVE_DIR)/$$(INSTALL_DIR)/examples/dotnet
-$$(MKDIR_P) $$(TEMP_ARCHIVE_DIR)$$S$$(INSTALL_DIR)$$Sexamples$$Sdotnet$$S$$*
$$(COPY) $$(SRC_DIR)$$Sortools$$S$1$$Ssamples$$S$$*.cs \
$$(TEMP_ARCHIVE_DIR)$$S$$(INSTALL_DIR)$$Sexamples$$Sdotnet$$S$$*
$$(COPY) $$(TEMP_DOTNET_DIR)$$S$1$$S$$*$$S$$*.csproj \
$$(TEMP_ARCHIVE_DIR)$$S$$(INSTALL_DIR)$$Sexamples$$Sdotnet$$S$$*
endef
$(foreach sample,$(DOTNET_SAMPLES),$(eval $(call dotnet-sample-archive,$(sample))))
define dotnet-example-archive =
$$(TEMP_ARCHIVE_DIR)/$$(INSTALL_DIR)/examples/dotnet/%/plop: \
$$(TEMP_DOTNET_DIR)/$1/%/%.csproj \
examples/$1/%.cs \
| $$(TEMP_ARCHIVE_DIR)/$$(INSTALL_DIR)/examples/dotnet
-$$(MKDIR_P) $$(TEMP_ARCHIVE_DIR)$$S$$(INSTALL_DIR)$$Sexamples$$Sdotnet$$S$$*
$$(COPY) $$(SRC_DIR)$$Sexamples$$S$1$$S$$*.cs \
$$(TEMP_ARCHIVE_DIR)$$S$$(INSTALL_DIR)$$Sexamples$$Sdotnet$$S$$*
$$(COPY) $$(TEMP_DOTNET_DIR)$$S$1$$S$$*$$S$$*.csproj \
$$(TEMP_ARCHIVE_DIR)$$S$$(INSTALL_DIR)$$Sexamples$$Sdotnet$$S$$*
endef
$(foreach example,$(DOTNET_EXAMPLES),$(eval $(call dotnet-example-archive,$(example))))
SAMPLE_DOTNET_FILES = \
$(addsuffix /plop,$(addprefix $(TEMP_ARCHIVE_DIR)/$(INSTALL_DIR)/examples/dotnet/,$(basename $(notdir $(wildcard ortools/*/samples/*.cs)))))
EXAMPLE_DOTNET_FILES = \
$(addsuffix /plop,$(addprefix $(TEMP_ARCHIVE_DIR)/$(INSTALL_DIR)/examples/dotnet/,$(basename $(notdir $(wildcard examples/contrib/*.cs))))) \
$(addsuffix /plop,$(addprefix $(TEMP_ARCHIVE_DIR)/$(INSTALL_DIR)/examples/dotnet/,$(basename $(notdir $(wildcard examples/dotnet/*.cs)))))
.PHONY: archive_dotnet # Add .Net OR-Tools to archive.
archive_dotnet: dotnet | $(TEMP_ARCHIVE_DIR)/$(INSTALL_DIR)/examples/dotnet
archive_dotnet: dotnet \
$(SAMPLE_DOTNET_FILES) \
$(EXAMPLE_DOTNET_FILES) \
| $(TEMP_ARCHIVE_DIR)/$(INSTALL_DIR)/examples/dotnet
-$(MKDIR_P) $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Spackages
$(COPY) $(TEMP_DOTNET_DIR)$Spackages$S*.nupkg $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Spackages
-$(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$Sconstraint_solver$Ssamples$S*.cs* $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sdotnet
-$(COPY) ortools$Sconstraint_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
-$(SED) -i -e 's/\/temp_dotnet//' $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sdotnet$S*.*proj
-$(SED) -i -e 's/..\/..\/..\/packages/..\/..\/packages/' $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sdotnet$S*.*proj
-$(SED) -i -e 's/..\/..\/packages/..\/..\/..\/packages/' $(TEMP_ARCHIVE_DIR)$S$(INSTALL_DIR)$Sexamples$Sdotnet$S*$S*.*proj
################
## FLATZINC ##
################
$(FZ_INSTALL_DIR)$(ARCHIVE_EXT): fz | $(TEMP_FZ_DIR)
-$(DELREC) $(TEMP_FZ_DIR)$S*

View File

@@ -650,7 +650,7 @@ build: $(SOURCE) $(SOURCE)proj
.PHONY: run # Run a .Net C# program.
run: build
"$(DOTNET_BIN)" run --no-build --project $(SOURCE_PATH)proj -- $(ARGS)
"$(DOTNET_BIN)" run --no-build --framework net6.0 --project $(SOURCE_PATH)proj -- $(ARGS)
endif # ifeq ($(SOURCE_SUFFIX),.cs)
# .Net F#
@@ -665,7 +665,7 @@ build: $(SOURCE) $(SOURCE)proj
.PHONY: run # Run a .Net F# program.
run: build
"$(DOTNET_BIN)" run --no-build --project $(SOURCE_PATH)proj -- $(ARGS)
"$(DOTNET_BIN)" run --no-build --framework net6.0 --project $(SOURCE_PATH)proj -- $(ARGS)
endif # ifeq ($(SOURCE_SUFFIX),.fs)
endif # ifndef DOTNET_BIN

View File

@@ -6,9 +6,9 @@ OR-Tools is located at https://developers.google.com/optimization
These modules have been tested under:
- Ubuntu 14.04, 16.04, 17.10 and 18.04 (64-bit).
- macOS 10.13 High Sierra with Xcode 9.4 (64 bit).
- Microsoft Windows with Visual Studio 2015 and 2017 (64-bit)
- Ubuntu 16.04, 18.04 and 20.04 (64-bit).
- macOS 12 Monterey (64 bit).
- Microsoft Windows with Visual Studio Community 2019 (64-bit)
Upon decompressing the archive, you will get the following structure:
@@ -83,22 +83,22 @@ dotnet/cli tools accessible from the command line.
Use Makefile:
```shell
make run SOURCE=examples/dotnet/csflow.cs
make run SOURCE=examples/dotnet/Vrp/Vrp.cs
```
**OR** this is equivalent to compiling and running
`examples/dotnet/csflow.cs`.
`examples/dotnet/Vrp/Vrp.cs`.
- on Unix:
```shell
dotnet build examples/dotnet/csflow.csproj
dotnet run --no-build --project examples/dotnet/csflow.csproj
dotnet build examples/dotnet/Vrp/Vrp.csproj
dotnet run --no-build --framework net6.0 --project examples/dotnet/Vrp/Vrp.csproj
```
- on Windows:
```shell
dotnet build examples\dotnet\csflow.csproj
dotnet run --no-build --project examples\dotnet\csflow.csproj
dotnet build examples\dotnet\Vrp\Vrp.csproj
dotnet run --no-build --framework net6.0 --project examples\dotnet\Vrp\Vrp.csproj
```