diff --git a/maxrev.gdal.core.libshared/proj.db b/maxrev.gdal.core.libshared/proj.db index 4e29853ca..a25f01991 100644 Binary files a/maxrev.gdal.core.libshared/proj.db and b/maxrev.gdal.core.libshared/proj.db differ diff --git a/test/GdalCoreTest/Program.cs b/test/GdalCoreTest/Program.cs index 968c808f0..704d2421b 100644 --- a/test/GdalCoreTest/Program.cs +++ b/test/GdalCoreTest/Program.cs @@ -2,7 +2,9 @@ using OSGeo.GDAL; using OSGeo.OSR; using System; +using System.Collections.Generic; using System.IO; +using System.Linq; namespace GdalCoreTest { @@ -22,7 +24,7 @@ static void Main(string[] args) "GDAL Version: " + Gdal.VersionInfo("RELEASE_NAME"), "GDAL INFO: " + Gdal.VersionInfo(""))); var spatialReference = new SpatialReference(null); - spatialReference.SetWellKnownGeogCS("wgs84"); + spatialReference.SetWellKnownGeogCS("wgs84"); // list of common drivers var drivers = new[] diff --git a/unix/GNUmakefile b/unix/GNUmakefile index 4c873a64c..8a447b85a 100644 --- a/unix/GNUmakefile +++ b/unix/GNUmakefile @@ -1,9 +1,8 @@ -include GdalCore.opt +RUNTIME_RID=unix +include ../shared/GdalCore.opt include $(BASE_GDAL_)/GDALmake.opt include $(GDAL_ROOT)/swig/csharp/csharp.opt -SRC_=$(PWD) - ifeq ($(LIBGDAL_CURRENT),) LIBGDAL_CURRENT := 27 endif @@ -37,15 +36,15 @@ endif OUTPUT = $(ROOTDIR_)/runtimes/$(RID)/native CSHARP_MODULES = libgdalcsharp.$(SO_EXT) libogrcsharp.$(SO_EXT) libgdalconstcsharp.$(SO_EXT) libosrcsharp.$(SO_EXT) -CSHARP_OBJECTS = $(SRC_)/const/gdalconst_wrap.$(OBJ_EXT) $(SRC_)/gdal/gdal_wrap.$(OBJ_EXT) $(SRC_)/osr/osr_wrap.$(OBJ_EXT) $(SRC_)/ogr/ogr_wrap.$(OBJ_EXT) +CSHARP_OBJECTS = $(BASE)/const/gdalconst_wrap.$(OBJ_EXT) $(BASE)/gdal/gdal_wrap.$(OBJ_EXT) $(BASE)/osr/osr_wrap.$(OBJ_EXT) $(BASE)/ogr/ogr_wrap.$(OBJ_EXT) echo: echo $(CXX) clean: - (cd $(SRC_) && rm -f ${CSHARP_MODULES} *.$(OBJ_EXT) *.config *.dll *.mdb *.exe) + (cd $(BASE) && rm -f ${CSHARP_MODULES} *.$(OBJ_EXT) *.config *.dll *.mdb *.exe) (cd $(PWD) && rm -f ${CSHARP_MODULES} *.$(OBJ_EXT) *.config *.dll *.mdb *.exe) veryclean: clean - (cd $(SRC_) && rm -f -R const/*.cs const/*.c gdal/*.cs gdal/*.cpp osr/*.cs osr/*.cpp ogr/*.cs ogr/*.cpp Data) + (cd $(BASE) && rm -f -R const/*.cs const/*.c gdal/*.cs gdal/*.cpp osr/*.cs osr/*.cpp ogr/*.cs ogr/*.cpp Data) (cd $(PWD) && rm -f -R *.so *.o ./*.cs gdal/*.cs gdal/*.cpp osr/*.cs osr/*.cpp ogr/*.cs *.c *.cpp .libs/ const/ ogr/ osr/ gdal/ obj/ runtimes/ bin/) cleangdal: @@ -65,7 +64,7 @@ prebuild: interface build: ${CSHARP_OBJECTS} ${CSHARP_MODULES} gdal_csharp sign: - (cd $(SRC_) && sn -k gdal.snk) + (cd $(BASE) && sn -k gdal.snk) install: @echo "No installation to be done" diff --git a/unix/GdalCore.opt b/unix/GdalCore.opt deleted file mode 100644 index 7083aa0c6..000000000 --- a/unix/GdalCore.opt +++ /dev/null @@ -1,40 +0,0 @@ -### repo root -ROOTDIR_=$(PWD)/.. -### build (drivers) root -BUILD_ROOT=$(PWD)/../build-unix - -GDAL_ROOT=$(BUILD_ROOT)/gdal-source -GDAL_REPO=https://github.com/OSGeo/gdal.git -GDAL_COMMIT_VER=2a0f3ead5cdb46d6bf8b53462a07793e4d7b91d0 - -PROJ6_ROOT=$(BUILD_ROOT)/proj6-source -PROJ6_REPO=https://github.com/OSGeo/PROJ.git -PROJ6_COMMIT_VER=2228592582910d866b8c1b5187bc2ef50955b281 - -GEOS_ROOT=$(BUILD_ROOT)/geos-source -GEOS_REPO=https://github.com/libgeos/geos.git -GEOS_COMMIT_VER=ff05d9755d189771147acb3105bd9c9cfff730ff - -SQLITE3_ROOT=$(BUILD_ROOT)/sqlite3-source -SQLITE3_REPO=https://github.com/sqlite/sqlite.git -SQLITE3_COMMIT_VER=562fd18b9dc27216191c0a6477bba9b175f7f0d2 - - -# ---------------------- CONFIG --------------------- -##### GDAL source location -$(eval BASE_GDAL_=$(GDAL_ROOT)/gdal) - -##### SWIG executable and interface -BASE_SWIG_=$(BASE_GDAL_)/swig -BASE_CSHARP_=$(BASE_SWIG_)/csharp -SWIG_INCLUDE_=$(BASE_SWIG_)/include - -##### GDAL build location -GDAL_BUILD_=$(BUILD_ROOT)/gdal-build - -##### PROJ6 libraries path required by gdal -BASE_PROG_=$(BUILD_ROOT)/proj6-build - -##### NUGET output folder -NUGET_=$(ROOTDIR_)/nuget -# --------------------- !CONFIG! -------------------- \ No newline at end of file diff --git a/unix/GdalMakefile b/unix/GdalMakefile deleted file mode 100644 index cffbe647b..000000000 --- a/unix/GdalMakefile +++ /dev/null @@ -1,47 +0,0 @@ -include GdalCore.opt -TARGETS = sqlite3 proj6 geos gdal -all: $(TARGETS) - -UP = $(shell echo '$*' | tr a-z A-Z) -LW = $(shell echo '$*' | tr A-Z a-z) - -% : -ifeq ($(findstring $(LW),$(TARGETS)),$(LW)) #TODO: how to fix this? - $(MAKE) -f GdalMakefile init_$(LW) - $(MAKE) -f GdalMakefile configure_$(LW) - $(MAKE) -f GdalMakefile build_$(LW) -endif - exit 0 - -init_%: - if [ ! -d "$($(UP)_ROOT)" ]; then \ - git clone $($(UP)_REPO) $($(UP)_ROOT); \ - fi; - cd $($(UP)_ROOT) && git checkout -q $($(UP)_COMMIT_VER) - - -configure_gdal: - ./configuregdal.sh - -configure_sqlite3: - if [ ! -d "$(BUILD_ROOT)/sqlite3-build" ]; then \ - mkdir $(BUILD_ROOT)/sqlite3-build; \ - fi; - cd $(BUILD_ROOT)/sqlite3-build && $(SQLITE3_ROOT)/configure --prefix=$(BUILD_ROOT)/sqlite3-build - -build_sqlite3: - cd $(BUILD_ROOT)/sqlite3-build && make - -configure_%: - cd $($(UP)_ROOT) && chmod +x ./autogen.sh && ./autogen.sh && ./configure --prefix=$(BUILD_ROOT)/$(LW)-build - -build_%: - cd $($(UP)_ROOT) && make && make install - -build_gdal: - cd $(GDAL_ROOT)/gdal && make && make install -reset_SQLITE3: - cd $(BUILD_ROOT)/sqlite3-build && rm -f -R *.so *.o -reset: reset_PROJ6 reset_GDAL reset_GEOS -reset_%: - cd $($(UP)_ROOT) && git checkout -q $($(UP)_COMMIT_VER) && git reset --hard && git clean -fqdx; diff --git a/unix/README.md b/unix/README.md index 4d82f6cd4..a82e42b10 100644 --- a/unix/README.md +++ b/unix/README.md @@ -4,7 +4,7 @@ * [Easy way compiling](#easy-way-compiling) * [Alternate way](#alternate-way) - + [1. Compile SQLite3 (optional)](#1-compile-sqlite3-optional) + + [1. Install prerequisite packages](#1-install-prerequisite-packages) + [2. Compile PROJ6](#2-compile-proj6) + [3. Clone and Compile GDAL](#3-clone-and-compile-gdal) + [4. Build a wrapper](#4-build-a-wrapper) @@ -18,10 +18,6 @@ First of all I wish you to be patient & bring your snacks. Compilation from scra 1. `yum install tcl tcl-devel -y` - for building sqlite3 2. `yum install patchelf -y` - dynamic linking -If you have installed **libsqlite3-dev** and **proj6** - go forward to step **#3** - -If you have **libsqlite3-dev** installed you may skip the first step. - Set a root variable for convenience ``export gc_root=`pwd` `` @@ -32,40 +28,23 @@ Set a root variable for convenience Assuming you have `tclsh` for compiling `sqlite3` ```shell -make -f GdalMakefile +make -f gdal-makefile ``` this will compile `sqlite3, proj6, geos` and `gdal` from scratch ## Alternate way -### 1. Compile SQLite3 (optional) - -1. [Download SQLite3 Autoconf](https://www.sqlite.org/download.html) & unpack (GdalMakefile uses git for this) - - ```shell - mkdir $gc_root/build-unix - curl -o sqlite.tar.gz "https://www.sqlite.org/2019/sqlite-autoconf-3290000.tar.gz" - tar xfv sqlite.tar.gz && mv sqlite-autoconf-3290000 sqlite3-source && cd sqlite3-source - ``` - -2. Configure sqlite3 - - ```shell - ./configure --prefix=$gc_root/sqlite3-build - ``` - -3. Compile and install - - ```shell - make && make install && cd $gc_root - ``` +### 1. Install prerequisite packages +```shell + `yum install xz-devel hdf hdf5-devel libtiff sqlite-devel expat curl-devel -y` - LZMA, HDF4, HDF5 +``` ### 2. Compile PROJ6 -1. [Download proj](https://proj.org/download.html) & unpack (GdalMakefile uses git for this) +1. [Download proj](https://proj.org/download.html) & unpack (gdal-makefile uses git for this) ```shell mkdir $gc_root/build-unix @@ -85,10 +64,10 @@ this will compile `sqlite3, proj6, geos` and `gdal` from scratch ### 3. Clone and Compile GDAL -You can build gdal using **GdalMakefile**, but before you must setup paths in **GdalCore.opt** file. +You can build gdal using **gdal-makefile**, but before you must setup paths in **GdalCore.opt** file. Also you must change **configuregdal.sh** script to setup necessary drivers. -Then you may just call `make -f GdalMakefile gdal` - this will sync gdal repository, configure it and finaly build. +Then you may just call `make -f gdal-makefile gdal` - this will sync gdal repository, configure it and finaly build. *Or alternatively...* (assuming you are in the root of this repo) @@ -97,11 +76,11 @@ Then you may just call `make -f GdalMakefile gdal` - this will sync gdal reposit ``` 2. ```shell - cd $gc_root && make -f GdalMakefile configure_gdal #calls ./configuregdal.sh + cd $gc_root && make -f gdal-makefile configure_gdal #calls ./configuregdal.sh ``` 3. ```shell - make -f GdalMakefile build_gdal + make -f gdal-makefile build_gdal ``` After you have gdal installed, you can proceed to netcore bindings build. diff --git a/unix/configuregdal.sh b/unix/configuregdal.sh index e04bed83a..e630126a1 100644 --- a/unix/configuregdal.sh +++ b/unix/configuregdal.sh @@ -1,25 +1,35 @@ #!/bin/sh source=`pwd`/../build-unix cd ${source}/gdal-source/gdal +vcdir=${source}/vcpkg/installed/x64-linux chmod +x ./configure -./configure --prefix=${source}/gdal-build CFLAGS="-fPIC" \ +export PKG_CONFIG_PATH="${vcdir}/lib/pkgconfig" + +# hdf5 path - only this works. +# tried with vcpkg static and other HDF5_LIBS + +./configure --prefix=${source}/gdal-build \ +CFLAGS="-fPIC" \ --with-geos=${source}/geos-build/bin/geos-config \ - --with-proj=${source}/proj6-build \ + --with-proj=${source}/proj-build \ + --with-liblzma \ --with-libtool \ --with-geotiff=internal \ --with-hide-internal-symbols \ - --with-libtiff=internal \ - --with-libz=internal \ - --with-jpeg=internal \ --with-threads \ - --with-hdf4 \ - --with-hdf5 \ - --with-sqlite3 \ --with-curl \ + --with-png \ + --with-sqlite3 \ + --with-hdf4 \ + --with-hdf5="/usr/lib64" \ + --with-libz=${vcdir} \ + --with-jpeg=${vcdir} \ + --with-expat=${vcdir} \ + --with-libtiff=${vcdir} \ + --with-xerces=${vcdir} \ --without-cfitsio \ --without-cryptopp \ --without-ecw \ - --without-expat \ --without-fme \ --without-freexl \ --without-gif \ @@ -47,7 +57,6 @@ chmod +x ./configure --without-qhull \ --without-sde \ --without-webp \ - --without-xerces \ --without-xml2 \ --without-poppler \ --without-crypto \ No newline at end of file diff --git a/unix/gdal-makefile b/unix/gdal-makefile new file mode 100644 index 000000000..aedeb6488 --- /dev/null +++ b/unix/gdal-makefile @@ -0,0 +1,86 @@ +# +# gdal.netcore package automation +# + +BASE=$(PWD) +BASE_RUNTIME_RID=unix +VCPKG_RID=x64-linux + +include ../shared/GdalCore.opt + +# default targets on linux +TARGETS = proj geos gdal +all: $(TARGETS) + +# lower and uppercase funcs +UP = $(shell echo '$*' | tr a-z A-Z) +LW = $(shell echo '$*' | tr A-Z a-z) + +# add support for [-force] param +REP = $(shell echo '$(LW)' | sed "s/-force//g") + +# accepts any user params +% : +ifneq ($(filter $(REP),$(TARGETS)),'') + @if [ ! -d "$(BUILD_ROOT)/$(REP)-build" ] || [[ "$(LW)" == *"-force"* ]] ; then \ + $(MAKE) -f gdal-makefile init_$(REP); \ + $(MAKE) -f gdal-makefile configure_$(REP); \ + $(MAKE) -f gdal-makefile build_$(REP); \ + else \ + echo "Build folder exists $(BUILD_ROOT)/$(REP)-build"; \ + echo "To rebuild add {key}-force"; \ + fi; +else + @echo "Can not make $(REP)" +endif + +init_%: + @if [ ! -d "$($(UP)_ROOT)" ]; then \ + git clone $($(UP)_REPO) $($(UP)_ROOT); \ + fi; + @echo "Restoring $(LW) sources version to $($(UP)_COMMIT_VER)" + @cd $($(UP)_ROOT) && git fetch + @cd $($(UP)_ROOT) && git checkout -q $($(UP)_COMMIT_VER) --force + @cd $($(UP)_ROOT) && git reset --hard + @cd $($(UP)_ROOT) && $(GIT_CLEAN) + @echo "Sources restore complete for $(LW)" + +configure_gdal: + ./configuregdal.sh + +configure_%: + @cd $(PROJ_ROOT) && chmod +x ./autogen.sh + cd $(PROJ_ROOT) && ./autogen.sh + cd $(PROJ_ROOT) && ./configure --prefix=$(BUILD_ROOT)/$(LW)-build + +configure_proj: + @cd $(PROJ_ROOT) && chmod +x ./autogen.sh + cd $(PROJ_ROOT) && ./autogen.sh + +# 1. --with-curl=[path] does not work because curl-config not found +# 2. vcpkg's tiff_x64-linux default location in pkg-config also not found + + cd $(PROJ_ROOT) && ./configure --prefix=$(BUILD_ROOT)/proj-build \ + LIBS="-L$(VCPKG_INSTALLED)/lib -lsqlite3 -L$(VCPKG_INSTALLED)/lib -ltiff -L$(VCPKG_INSTALLED)/lib -llzma -L$(VCPKG_INSTALLED)/lib -ljpeg" \ + TIFF_INCLUDE_DIR=-I$(VCPKG_INSTALLED)/include \ + TIFF_CFLAGS=-L$(VCPKG_INSTALLED)/lib \ + SQLITE3_CFLAGS=-I$(VCPKG_INSTALLED)/include \ + SQLITE3_LIBS=-L$(VCPKG_INSTALLED)/lib \ + TIFF_LIBRARY_RELEASE=$(VCPKG_INSTALLED)/lib/libtiff.a + +build_%: + cd $($(UP)_ROOT) && $(MAKE) && $(MAKE) install + + +build_gdal: + cd $(GDAL_ROOT) && $(MAKE) + cd $(GDAL_ROOT) && $(MAKE) install + +reset: reset_proj reset_gdal reset_geos +reset_%: + cd $($(UP)_ROOT) && git checkout -q $($(UP)_COMMIT_VER) && git reset --hard && git clean -fqdx; + + +.EXPORT_ALL_VARIABLES: + +PKG_CONFIG_PATH=$(VCPKG_INSTALLED)/lib/pkgconfig diff --git a/unix/vcpkg-makefile b/unix/vcpkg-makefile new file mode 100644 index 000000000..69c7055e5 --- /dev/null +++ b/unix/vcpkg-makefile @@ -0,0 +1,68 @@ +# +# gdal.netcore package automation +# + +BASE=$(PWD) +BASE_RUNTIME_RID=unix +VCPKG_RID=x64-linux + +include ../shared/GdalCore.opt + +VCPKG=$(VCPKG_ROOT)/vcpkg + +# lowercase func +LW = $(shell echo '$*' | tr A-Z a-z) + +# add support for [-force] param +REP = $(shell echo '$*' | sed "s/-force//g") + +all: install_vcpkg install_requirements + +# accepts any user params +% : +ifneq ($(filter $(REP),$(VCPKG_REQUIRE_UNIX)),'') + @if [[ "$(LW)" == *"-force"* ]] ; then \ + $(MAKE) -f vcpkg-makefile upgrade; \ + $(VCPKG) remove $(REP):$(VCPKG_RID) --recurse; \ + $(VCPKG) install $(REP):$(VCPKG_RID) --recurse --clean-after-build; \ + else \ + echo "To rebuild add {key}-force"; \ + $(VCPKG) list; \ + fi; +else + @echo "Can not make $(REP)" +endif + +install_vcpkg: + @if [ ! -d "$(VCPKG_ROOT)" ]; then \ + git clone https://github.com/microsoft/vcpkg $(VCPKG_ROOT); \ + fi; + @if [ ! -f "$(VCPKG)" ]; then \ + $(MAKE) pull_vcpkg; \ + (cd $(VCPKG_ROOT) && ./bootstrap-vcpkg.sh); \ + fi; + +install_requirements: install_vcpkg install_packages + +pull_vcpkg: + cd $(VCPKG_ROOT) && git pull origin master +upgrade: pull_vcpkg + $(VCPKG) upgrade +update: pull_vcpkg + $(VCPKG) update + +$(VCPKG_CLEANUP): + @if [ -d "$(VCPKG_ROOT)/$@/" ]; then \ + rm -rf "$(VCPKG_ROOT)/$@"; \ + fi; + +build_cleanup: $(VCPKG_CLEANUP) +clean_ALL: build_cleanup + + +install_packages: + @$(foreach pack,$(VCPKG_REQUIRE_UNIX),$(VCPKG) install $(pack):$(VCPKG_RID) --recurse --clean-after-build;) + +remove_packages: + @$(foreach pack,$(VCPKG_REQUIRE_UNIX), $(VCPKG) remove $(pack):$(VCPKG_RID) --recurse;) + \ No newline at end of file diff --git a/win/CONFIGVARS.bat b/win/CONFIGVARS.bat index b90b62e96..e735cb029 100644 --- a/win/CONFIGVARS.bat +++ b/win/CONFIGVARS.bat @@ -5,14 +5,16 @@ set _buildroot_=%~dp0..\build-win set GDAL_REPO=https://github.com/OSGeo/gdal.git set GDAL_COMMIT_VER=a3f8b8b84d38c65717e1d9f08f8be85782cf7094 -set PROJ6_REPO=https://github.com/OSGeo/PROJ.git -set PROJ6_COMMIT_VER=2228592582910d866b8c1b5187bc2ef50955b281 +set PROJ_REPO=https://github.com/OSGeo/PROJ.git +set PROJ_COMMIT_VER=dd91c93ca44cbe3cf4f6f7c94a8f225aefa4b408 set GEOS_REPO=https://github.com/libgeos/geos.git set GEOS_COMMIT_VER=ff05d9755d189771147acb3105bd9c9cfff730ff +set LIBRARIES=%_buildroot_%/vcpkg/installed/x64-windows + rem Which components to install -set features=curl sqlite3 libz libjpeg libpng geos proj6 hdf4 hdf5 +set features=hdf4 geos proj rem Remove sources after build? (init for true) set _rmsource_= @@ -21,6 +23,7 @@ rem Path to vcvars bat configurators set _vcvars_="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64 set _libshared_=libshared +set NUGET_LIBSHARED=maxrev.gdal.core.libshared rem Bat helpers scripts root set tclsh="%~dp0tcl\tclsh.exe" set __=%~dp0misc diff --git a/win/final-copydrivers.bat b/win/final-copydrivers.bat index 41963fa75..8547063a4 100644 --- a/win/final-copydrivers.bat +++ b/win/final-copydrivers.bat @@ -11,7 +11,7 @@ xcopy /Y /F /R "%~dp0..\build-win\gdal-build\bin\gdalplugins" "%_out_%\gdalplugi rem Copy VC runtime. Currently I had copied them manually from rem C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\14.24.28127\x64\Microsoft.VC142.CRT rem ISSUE: https://developercommunity.visualstudio.com/content/problem/852548/vcruntime140-1dll-is-missing.html# -xcopy /Y /F /R "%_pre_%\vc-runtime" "%_out_%\" +xcopy /Y /F /R "%VCToolsRedistDir%x64\Microsoft.VC142.CRT\*.dll" "%_out_%\" cd %back% \ No newline at end of file diff --git a/win/gdal-fetch.bat b/win/gdal-fetch.bat index d45b93491..ded5ff91f 100644 --- a/win/gdal-fetch.bat +++ b/win/gdal-fetch.bat @@ -5,9 +5,7 @@ set _rx_=%_buildroot_%\%key%-source set back=%cd% if not exist "%_rx_%/gdal" git clone %GDAL_REPO% %_rx_% cd "%_rx_%" -git fetch -git checkout -q %GDAL_COMMIT_VER% -git clean -fdx +nmake -f gdal-makefile.vc fetch-gdal echo Populating gdal source with nmake.opt options.. copy /y "%_pre_%\gdal-nmake.opt" gdal\nmake.opt echo Populating gdal source with makefile.vc.. diff --git a/win/gdal-makefile.vc b/win/gdal-makefile.vc new file mode 100644 index 000000000..9ff7c7c72 --- /dev/null +++ b/win/gdal-makefile.vc @@ -0,0 +1,78 @@ +# +# gdal.netcore package automation +# + +TARGETS = proj geos gdal +all: $(TARGETS) + +BASE=$(MAKEDIR) +BASE_RUNTIME_RID=win +VCPKG_RID=x64-windows + +!INCLUDE ..\shared\GdalCore.opt + +OUTPUT = ..\runtimes\win-x86\native +!IFDEF WIN64 +OUTPUT = ..\runtimes\win-x64\native +!ENDIF + +$(TARGETS): build-$@ + +fetch-gdal: + +build-proj: + call getproj.bat + +build-geos: + call getgeos.bat + +fetch-gdal: +!IF !EXISTS($(GDAL_ROOT)) + git clone $(GDAL_REPO) $(GDAL_ROOT) +!ENDIF + cd $(GDAL_ROOT) + git fetch + git checkout -q $(GDAL_COMMIT_VER) --force + git reset --hard + $(GIT_CLEAN) + cd $(BASE) + +fetch-geos: +!IF !EXISTS($(GEOS_ROOT)) + git clone $(GEOS_REPO) $(GEOS_ROOT) +!ENDIF + cd $(GEOS_ROOT) + git fetch + git checkout -q $(GEOS_COMMIT_VER) --force + git reset --hard + $(GIT_CLEAN) + cd $(BASE) + +fetch-proj: +!IF !EXISTS($(PROJ_ROOT)) + git clone $(PROJ_REPO) $(PROJ_ROOT) +!ENDIF + cd $(PROJ_ROOT) + git fetch + git checkout -q $(PROJ_COMMIT_VER) --force + git reset --hard + $(GIT_CLEAN) + cd $(BASE) + +configure-gdal: fetch-gdal +# -echo Populating gdal source with nmake.opt options.. +# -copy /y "$(BASE)\gdal-nmake.opt" "$(GDAL_ROOT)\nmake.opt" + -echo Populating gdal source with makefile.vc.. + -copy /y "$(BASE)\presource\gdal-makefile.vc" "$(GDAL_ROOT)\makefile.vc" + +build-gdal: configure-gdal + cd $(GDAL_ROOT) && $(MAKE) /f makefile.vc MSVC_VER=1920 WIN64=1 EXT_NMAKE_OPT="$(BASE)\gdal-nmake.opt" + cd $(GDAL_ROOT) && $(MAKE) /f makefile.vc install WIN64=1 EXT_NMAKE_OPT="$(BASE)\gdal-nmake.opt" + + +hostfix31: + set MSBUILDSINGLELOADCONTEXT=1 +pack: hostfix31 + dotnet pack -c Release -o $(_outdir_)/nuget $(_outdir_)/gdalcore.windowsruntime.csproj +packdev: hostfix31 + dotnet pack -c Debug -o $(_outdir_)/nuget $(_outdir_)/gdalcore.windowsruntime.csproj \ No newline at end of file diff --git a/win/presource/gdal-nmake.opt b/win/gdal-nmake.opt similarity index 95% rename from win/presource/gdal-nmake.opt rename to win/gdal-nmake.opt index 8bae674b2..838029d65 100644 --- a/win/presource/gdal-nmake.opt +++ b/win/gdal-nmake.opt @@ -20,7 +20,8 @@ # For convenience, user may put custom settings in a local settings file # named nmake.local, or a name defined by the EXT_NMAKE_OPT option. -BUILD_ROOT=$(GDAL_ROOT)\..\..\ +BUILD_ROOT=$(GDAL_ROOT)\..\.. +BUILD_ROOT_VCPKG=$(BUILD_ROOT)\vcpkg\installed\x64-windows !IF EXIST("$(GDAL_ROOT)\nmake.local") !INCLUDE $(GDAL_ROOT)\nmake.local @@ -249,13 +250,13 @@ INCLUDE_GNM_FRMTS = YES # To be enabled defined to point to wsetargv.obj from the Visual C++ directory, # when you want the utility programs to be able to expand wildcards. -#SETARGV = "D:\Software\VStudio\VC98\lib\wsetargv.obj" +SETARGV = $(GDAL_SETARGV) # PROJ stuff (required dependency: PROJ >= 6) # Note: shell32.lib is needed starting with PROJ 7.0 in some circumstances # See https://github.com/OSGeo/gdal/issues/2488 -PROJ_INCLUDE = -I$(BUILD_ROOT)\proj6-build\include -PROJ_LIBRARY = $(BUILD_ROOT)\proj6-build\lib\proj_6_1.lib +PROJ_INCLUDE = -I$(BUILD_ROOT)\proj-build\include +PROJ_LIBRARY = $(BUILD_ROOT)\proj-build\lib\proj.lib shell32.lib ole32.lib # Uncomment to build with libiconv library to support extended character # recoding capabilities. GDAL's internal stub implementation supports @@ -264,10 +265,10 @@ PROJ_LIBRARY = $(BUILD_ROOT)\proj6-build\lib\proj_6_1.lib # const or leave it empty. Take a look on your iconv() declaration in iconv.h. # If the second parameter declared as const char** then you need to define # ICONV_CONST=const otherwise leave it empty. -#LIBICONV_DIR = "C:\Program Files\GnuWin32" -#LIBICONV_INCLUDE = -I$(LIBICONV_DIR)\include -#LIBICONV_LIBRARY = $(LIBICONV_DIR)\lib\libiconv.lib -#LIBICONV_CFLAGS = -DICONV_CONST=const +LIBICONV_DIR = $(BUILD_ROOT_VCPKG) +LIBICONV_INCLUDE = -I$(LIBICONV_DIR)\include +LIBICONV_LIBRARY = $(LIBICONV_DIR)\lib\libiconv.lib +LIBICONV_CFLAGS = -DICONV_CONST= # Comment out the following to disable BSB support. !IFNDEF BSB_SUPPORTED @@ -305,17 +306,17 @@ JPEG12_SUPPORTED = 1 #if using an external jpeg library uncomment the following lines JPEG_EXTERNAL_LIB = 1 -JPEGDIR = $(BUILD_ROOT)\libjpeg-build\include -JPEG_LIB = $(BUILD_ROOT)\libjpeg-build\lib\jpeg.lib +JPEGDIR = $(BUILD_ROOT_VCPKG)\include +JPEG_LIB = $(BUILD_ROOT_VCPKG)\lib\jpeg.lib #if using an external png library uncomment the following lines -PNG_EXTERNAL_LIB = 1 -PNGDIR = $(BUILD_ROOT)\libpng-build\include -PNG_LIB = $(BUILD_ROOT)\libpng-build\lib\libpng16.lib +PNG_EXTERNAL_LIB = 1 +PNGDIR = $(BUILD_ROOT_VCPKG)\include +PNG_LIB = $(BUILD_ROOT_VCPKG)\lib\libpng16.lib # if using an external libtiff library. Must be libtiff >= 4.0 -#TIFF_INC = -Ic:/warmerda/libtiff/libtiff -#TIFF_LIB = c:/warmerda/libtiff/libtiff/libtiff_i.lib +TIFF_INC = -I$(BUILD_ROOT_VCPKG)\include +TIFF_LIB = $(BUILD_ROOT_VCPKG)\lib\tiff.lib # if using an external libgeotiff library #GEOTIFF_INC = -Ic:/warmerda/libgeotiff -Ic:/warmerda/libgeotiff/libxtiff @@ -527,14 +528,14 @@ TD_LIBS = $(TD_LIBS) \ # $(OGDIDIR)\lib\$(TARGET)\zlib_ogdi$(OGDIVER).lib # Uncomment for Expat support (required for KML, GPX and GeoRSS read support). -#EXPAT_DIR = "C:\Program Files\Expat 2.0.1" -#EXPAT_INCLUDE = -I$(EXPAT_DIR)/source/lib -#EXPAT_LIB = $(EXPAT_DIR)/bin/libexpat.lib +EXPAT_DIR = $(BUILD_ROOT_VCPKG) +EXPAT_INCLUDE = -I$(EXPAT_DIR)\include +EXPAT_LIB = $(EXPAT_DIR)\lib\expat.lib # Uncomment for Xerces based GML and ILI support. -#XERCES_DIR = c:\warmerda\supportlibs\xerces-c_3_1_3 -#XERCES_INCLUDE = -I$(XERCES_DIR)/include -I$(XERCES_DIR)/include/xercesc -#XERCES_LIB = $(XERCES_DIR)/lib/xerces-c_3.lib +XERCES_DIR = $(BUILD_ROOT_VCPKG) +XERCES_INCLUDE = -I$(XERCES_DIR)\include -I$(XERCES_DIR)\include\xercesc +XERCES_LIB =$(XERCES_DIR)/lib/xerces-c_3.lib # Uncomment the following for Interlis support. Note that a Xercex 3.x # is also required (see above). Also, Interlis support only works with @@ -574,19 +575,19 @@ KAKADU_7_5_OR_LATER = YES HDF4_PLUGIN = YES HDF4_DIR = $(BUILD_ROOT)\hdf4-build -HDF4_LIB = $(HDF4_DIR)\lib\libhdf.lib $(HDF4_DIR)\lib\libmfhdf.lib $(HDF4_DIR)\lib\libxdr.lib $(BUILD_ROOT)\libz-build\lib\zlib.lib $(BUILD_ROOT)\libjpeg-build\lib\jpeg.lib Ws2_32.lib -HDF4_INCLUDE = $(HDF4_DIR)\include -I$(BUILD_ROOT)\libz-build\include -I$(BUILD_ROOT)\libjpeg-build\include +HDF4_LIB = $(HDF4_DIR)\lib\libhdf.lib $(HDF4_DIR)\lib\libmfhdf.lib $(HDF4_DIR)\lib\libxdr.lib $(BUILD_ROOT_VCPKG)\lib\jpeg.lib $(BUILD_ROOT_VCPKG)\lib\zlib.lib Ws2_32.lib +HDF4_INCLUDE = $(HDF4_DIR)\include -I$(BUILD_ROOT_VCPKG)\include # Uncomment following if your library is newer than 4.2.5. HDF4_HAS_MAXOPENFILES = YES # Uncomment the following and update to enable NCSA HDF Release 5 support. HDF5_PLUGIN = YES -HDF5_DIR = $(BUILD_ROOT)\hdf5-build -HDF5_LIB = $(HDF5_DIR)\lib\libhdf5.lib $(HDF5_DIR)\lib\hdf5.lib +HDF5_DIR = $(BUILD_ROOT_VCPKG) +HDF5_LIB = $(HDF5_DIR)\lib\hdf5.lib $(HDF5_DIR)\lib\hdf5_hl.lib $(HDF5_DIR)\lib\zlib.lib $(HDF5_DIR)\lib\szip.lib # Needed to define H5_BUILT_AS_DYNAMIC_LIB for windows compilation # scenarios where it is not exported on the target (non-CMake builds) -HDF5_H5_IS_DLL = NO +HDF5_H5_IS_DLL = YES # Uncomment the following and update to enable KEA support. #KEA_PLUGIN = NO @@ -638,8 +639,8 @@ INGRES_LIB = "$(INGRES_HOME)\lib\iilibapi.lib" \ # SQLite Libraries -SQLITE_INC=-I$(BUILD_ROOT)\sqlite3-build\include -SQLITE_LIB=$(BUILD_ROOT)\sqlite3-build\lib\sqlite3.lib +SQLITE_INC=-I$(BUILD_ROOT_VCPKG)\include +SQLITE_LIB=$(BUILD_ROOT_VCPKG)\lib\sqlite3.lib # For spatialite support, try this instead (assuming you grab the libspatialite-amalgamation-2.3.1 and installed it in osgeo4w): # The -DSPATIALITE_AMALGAMATION, which cause "spatialite/sqlite3.h" to be included instead of "sqlite3.h" might not be necessary # depending on the layout of the include directories. In case of compilation errors, remove it. @@ -732,8 +733,8 @@ OCI_INCLUDE = -I$(ORACLE_HOME)\oci\include # Uncomment to use libcurl (DLL by default) # The cURL library is used for WCS, WMS, GeoJSON, SRS call importFromUrl(), WFS, CouchDB, /vsicurl/ etc. -CURL_DIR=$(BUILD_ROOT)\curl-build\lib -CURL_INC = -I$(BUILD_ROOT)\curl-build\include +CURL_DIR=$(BUILD_ROOT_VCPKG)\lib +CURL_INC = -I$(BUILD_ROOT_VCPKG)\include -I$(BUILD_ROOT_VCPKG)\include\curl # Uncomment following line to use libcurl as dynamic library #CURL_LIB = $(CURL_DIR)/libcurl_imp.lib wsock32.lib wldap32.lib winmm.lib # Uncomment following two lines to use libcurl as static library @@ -766,8 +767,8 @@ GEOS_LIB = $(GEOS_DIR)\lib\libgeos_c.dll.a #if using an external zlib uncomment the following lines ZLIB_EXTERNAL_LIB = 1 -ZLIB_INC = -I$(BUILD_ROOT)\libz-build\include -ZLIB_LIB = $(BUILD_ROOT)\libz-build\lib\zlib.lib +ZLIB_INC = -I$(BUILD_ROOT_VCPKG)\include +ZLIB_LIB = $(BUILD_ROOT_VCPKG)\lib\zlib.lib # Uncomment for PDF support, and update version numbers (poppler 0.23 or later required) #POPPLER_ENABLED = YES @@ -799,8 +800,8 @@ ZLIB_LIB = $(BUILD_ROOT)\libz-build\lib\zlib.lib #PDF_PLUGIN = NO # Uncomment for LZMA TIFF support -#LZMA_CFLAGS = -IC:/gdal_trunk/xz-5.0.0-windows/include -#LZMA_LIBS = C:/gdal_trunk/xz-5.0.0-windows/bin_i486/liblzma.lib +LZMA_CFLAGS = -I$(BUILD_ROOT_VCPKG)/include -I$(BUILD_ROOT_VCPKG)/include/lzma +LZMA_LIBS = $(BUILD_ROOT_VCPKG)/lib/lzma.lib # Uncomment for ZSTD TIFF support #ZSTD_CFLAGS = -IC:/install-zstd/include diff --git a/win/getgeos.bat b/win/getgeos.bat index 2db978764..a397881e3 100644 --- a/win/getgeos.bat +++ b/win/getgeos.bat @@ -6,10 +6,7 @@ call %~dp0configvars set key=geos if not exist "%_buildroot_%/%key%-source" git clone %GEOS_REPO% "%_buildroot_%/%key%-source" cd %_buildroot_%/%key%-source -git fetch -git checkout -q %GEOS_COMMIT_VER% -git reset --hard -git clean -fdx +nmake -f gdal-makefile.vc fetch-geos set bindir=%_buildroot_%/%key%-build if exist "%bindir%" rd /s /q "%bindir%" @@ -18,7 +15,11 @@ cd build rem MinGW64 must be installed and available in path rem tested with x86_x64_posix_seh -cmake -S .. -G "Unix Makefiles" -DCMAKE_MAKE_PROGRAM=mingw32-make -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%bindir% -DDISABLE_GEOS_INLINE=ON -DCMAKE_CXX_FLAGS="-static-libgcc -static-libstdc++ -Wl,-allow-multiple-definition -Wno-maybe-uninitialized -Wno-unused-but-set-variable" +cmake -S .. -G "Unix Makefiles" -DCMAKE_MAKE_PROGRAM=mingw32-make^ + -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++^ + -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%bindir%^ + -DDISABLE_GEOS_INLINE=ON^ + -DCMAKE_CXX_FLAGS="-static-libgcc -static-libstdc++ -Wl,-allow-multiple-definition -Wno-maybe-uninitialized -Wno-unused-but-set-variable" rem --- THIS IS NOT WORKING more than 16 errors with xmemory & xutility rem cmake -S .. -B . -G "Visual Studio 16 2019" -A x64 -DCMAKE_GENERATOR_TOOLSET=host=x64 diff --git a/win/gethdf4.bat b/win/gethdf4.bat index 71282261e..adc442762 100644 --- a/win/gethdf4.bat +++ b/win/gethdf4.bat @@ -17,7 +17,14 @@ if exist "%bindir%" rd /s /q "%bindir%" if not exist build mkdir build cd build -cmake -S .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DHDF_CFG_NAME=Release -DCMAKE_INSTALL_PREFIX=%cd%/%key%-build -DJPEG_LIBRARY=%_buildroot_%/libjpeg-build/lib/jpeg.lib -DJPEG_DIR=%_buildroot_%/libjpeg-build -DJPEG_INCLUDE_DIR=%_buildroot_%/libjpeg-build/include -DZLIB_LIBRARY=%_buildroot_%/libz-build/lib/zlib.lib -DZLIB_INCLUDE_DIR=%_buildroot_%/libz-build/include -DHDF4_BUILD_FORTRAN=OFF +cmake -S .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON^ + -DHDF_CFG_NAME=Release^ + -DJPEG_LIBRARY=%LIBRARIES%/lib/jpeg.lib^ + -DJPEG_DIR=%LIBRARIES%^ + -DJPEG_INCLUDE_DIR=%LIBRARIES%/include^ + -DZLIB_LIBRARY=%LIBRARIES%/lib/zlib.lib^ + -DZLIB_INCLUDE_DIR=%LIBRARIES%/include^ + -DHDF4_BUILD_FORTRAN=OFF cmake --build . --config Release cmake --install . --prefix %key%-build move /Y %key%-build %bindir%/.. diff --git a/win/getproj.bat b/win/getproj.bat new file mode 100644 index 000000000..d7c8a0e4f --- /dev/null +++ b/win/getproj.bat @@ -0,0 +1,32 @@ +@echo off +set back=%cd% +call %~dp0configvars +set key=proj +set bindir=%_buildroot_%/%key%-build + +if not exist "%_buildroot_%/%key%-source" git clone %PROJ_REPO% "%_buildroot_%/%key%-source" + +nmake -f gdal-makefile.vc fetch-proj +cd "%_buildroot_%/%key%-source" +mkdir build +cd build +cmake -DSQLITE3_INCLUDE_DIR="%LIBRARIES%/include"^ + -DTIFF_INCLUDE_DIR="%LIBRARIES%/include"^ + -DCURL_INCLUDE_DIR="%LIBRARIES%/include"^ + -DTIFF_LIBRARY="%LIBRARIES%/lib/tiff.lib"^ + -DCURL_LIBRARY="%LIBRARIES%/lib/libcurl.lib"^ + -DSQLITE3_LIBRARY="%LIBRARIES%/lib/sqlite3.lib"^ + -DEXE_SQLITE3="%LIBRARIES%/tools/sqlite3.exe"^ + -DBUILD_TESTING=OFF .. +cmake --build . --target ALL_BUILD --config Release +set bindir=%_buildroot_%/%key%-build +if exist "%bindir%" rd /s /q "%bindir%" +cmake --install . --prefix %bindir% --config Release + +call %__%\copyrecursive %bindir% +rem copy proj.db to maxrev.gdal.core.libshared +xcopy /Y /R /F "%bindir%/share/proj/proj.db" "%BUILD_ENGINE_ROOT%\%NUGET_LIBSHARED%\" + +cd %back% +if defined _rmsource_ rd /s /q "%_buildroot_%/%key%-source" +echo %key% installation complete! diff --git a/win/getproj6.bat b/win/getproj6.bat deleted file mode 100644 index 73aa9d2a2..000000000 --- a/win/getproj6.bat +++ /dev/null @@ -1,27 +0,0 @@ -@echo off -set back=%cd% -call %~dp0configvars -set key=proj6 - -if not exist "%_buildroot_%/%key%-source" git clone %PROJ6_REPO% "%_buildroot_%/%key%-source" -cd "%_buildroot_%/%key%-source" -git fetch -git checkout -q %PROJ6_COMMIT_VER% -git reset --hard -git clean -fdx -mkdir build -cd build -cmake -DSQLITE3_INCLUDE_DIR="%_buildroot_%/sqlite3-build/include" -DSQLITE3_LIBRARY="%_buildroot_%/sqlite3-build/lib/sqlite3.lib" -DEXE_SQLITE3="%_buildroot_%/sqlite3-build/bin/sqlite3.exe" .. -cmake --build . --target ALL_BUILD --config Release -set bindir=%_buildroot_%/%key%-build -if exist "%bindir%" rd /s /q "%bindir%" -cmake --install . --prefix %bindir% --config Release - -call %__%\copyrecursive %bindir% - -rem copy proj.db to maxrev.gdal.core.libshared -xcopy /Y "%bindir%/share/proj/proj.db" "%BUILD_ENGINE_ROOT%\maxrev.gdal.core.libshared\" - -cd %back% -if defined _rmsource_ rd /s /q "%_buildroot_%/%key%-source" -echo %key% installation complete! diff --git a/win/init.bat b/win/init.bat new file mode 100644 index 000000000..b933c8ead --- /dev/null +++ b/win/init.bat @@ -0,0 +1,6 @@ +@echo off +echo "gdal.netcore > Initializing build environment..." +set __error="gdal.netcore > Failed to initialize build evironment" +set __success="gdal.netcore > Build environment is ready!" +call %~dp0/misc/trysetvcenv.bat && (echo %__success%) || (echo %__error%) + \ No newline at end of file diff --git a/win/makefile.vc b/win/makefile.vc deleted file mode 100644 index 81e7bd703..000000000 --- a/win/makefile.vc +++ /dev/null @@ -1,134 +0,0 @@ -# -# makefile.vc - MSVC++ makefile for the C#/GDAL extension -# -# This VC++ makefile will build the GDAL C# interface assemblies -# -# To use the makefile: -# - Open a DOS prompt window -# - Run the VCVARS32.BAT script to initialize the VC++ environment variables -# - Start the build with: nmake /f makefile.vc -# -# $Id$ -# - -back = $(MAKEDIR) -GDAL_ROOT = $(back)\..\build-win\gdal-source\gdal -_swig_root = $(GDAL_ROOT)\swig -source_root = $(_swig_root) -source = $(source_root)\csharp -_outdir_=$(MAKEDIR)\.. -!INCLUDE $(GDAL_ROOT)\nmake.opt - -!INCLUDE $(GDAL_ROOT)\swig\csharp\csharp.opt - -OUTPUT = ..\runtimes\win-x86\native -!IFDEF WIN64 -OUTPUT = ..\runtimes\win-x64\native -!ENDIF - -!IFDEF CSHARP_STATIC_LINKAGE -GDALLIB = $(GDAL_ROOT)\gdal.lib -!ELSE -GDALLIB = $(GDAL_ROOT)\gdal_i.lib -!ENDIF - -OBJ = gdal_wrap.obj gdalconst_wrap.obj ogr_wrap.obj osr_wrap.obj - -gdal_swig_include = ..\..\include - -all: ogr_dir gdal_dir osr_dir const_dir gdal_csharp - -gdal_csharp: - xcopy /Y /R /F $(GDAL_ROOT)\gdal*.dll "$(OUTPUT)\" - link /dll $(OGR_INCLUDE) $(BASE_INCLUDE) $(source)\ogr_wrap.obj \ - $(EXTERNAL_LIBS) $(GDALLIB)\ - /out:ogr_wrap.dll $(LINKER_FLAGS) - if exist ogr_wrap.dll.manifest mt -manifest ogr_wrap.dll.manifest -outputresource:ogr_wrap.dll;2 - - link /dll $(OGR_INCLUDE) $(BASE_INCLUDE) $(source)\gdal_wrap.obj \ - $(EXTERNAL_LIBS) $(GDALLIB)\ - /out:gdal_wrap.dll $(LINKER_FLAGS) - if exist gdal_wrap.dll.manifest mt -manifest gdal_wrap.dll.manifest -outputresource:gdal_wrap.dll;2 - - link /dll $(OGR_INCLUDE) $(BASE_INCLUDE) $(source)\gdalconst_wrap.obj \ - $(EXTERNAL_LIBS) $(GDALLIB)\ - /out:gdalconst_wrap.dll $(LINKER_FLAGS) - if exist gdalconst_wrap.dll.manifest mt -manifest gdalconst_wrap.dll.manifest -outputresource:gdalconst_wrap.dll;2 - - link /dll $(OGR_INCLUDE) $(BASE_INCLUDE) $(source)\osr_wrap.obj \ - $(EXTERNAL_LIBS) $(GDALLIB)\ - /out:osr_wrap.dll $(LINKER_FLAGS) - if exist osr_wrap.dll.manifest mt -manifest osr_wrap.dll.manifest -outputresource:osr_wrap.dll;2 - -md $(OUTPUT) - move *.dll $(OUTPUT) - -ogr_dir: - cd $(source)\ogr - $(MAKE) /f makefile.vc - cd $(back) - -gdal_dir: - cd $(source)\gdal - $(MAKE) /f makefile.vc - cd $(back) - -const_dir: - cd $(source)\const - $(MAKE) /f makefile.vc - cd $(back) - -osr_dir: - cd $(source)\osr - $(MAKE) /f makefile.vc - cd $(back) - -interface: - cd $(source)\const - $(SWIG) -csharp -namespace OSGeo.GDAL -dllimport gdalconst_wrap -o gdalconst_wrap.c $(gdal_swig_include)\gdalconst.i - cd $(source)\gdal - $(SWIG) -c++ -csharp -namespace OSGeo.GDAL -dllimport gdal_wrap -I$(gdal_swig_include)\csharp -o gdal_wrap.cpp $(gdal_swig_include)\gdal.i - cd $(source)\osr - $(SWIG) -c++ -csharp -namespace OSGeo.OSR -dllimport osr_wrap -I$(gdal_swig_include)\csharp -o osr_wrap.cpp $(gdal_swig_include)\osr.i - cd $(source)\ogr - $(SWIG) -c++ -csharp -namespace OSGeo.OGR -dllimport ogr_wrap -I$(gdal_swig_include)\csharp -o ogr_wrap.cpp $(gdal_swig_include)\ogr.i - cd $(back) - -cleanlocal: - -del gdal.lib - -del *_wrap.dll - -del *_csharp.dll - -del *.obj - -del *.exp - -del *.ilk - -del *.pdb - -del *.tlb - -del *.lib - -del *.mdb - -del *.exe - -del *.manifest -clean: - cd $(source)\gdal - $(MAKE) /f makefile.vc clean - cd $(source)\ogr - $(MAKE) /f makefile.vc clean - cd $(source)\const - $(MAKE) /f makefile.vc clean - cd $(source)\osr - $(MAKE) /f makefile.vc clean - cd $(source) - $(MAKE) /f makefile.vc clean - -del /q /s Data - -del $(OUTPUT)\*.dll - cd $(back) - $(MAKE) /f makefile.vc cleanlocal - rd /s /q ..\runtimes\ - -install: - xcopy /Y /R /F *_wrap.dll $(OUTPUT) - -hostfix31: - set MSBUILDSINGLELOADCONTEXT=1 -pack: hostfix31 - dotnet pack -c Release -o $(_outdir_)/nuget $(_outdir_)/gdalcore.windowsruntime.csproj -packdev: hostfix31 - dotnet pack -c Debug -o $(_outdir_)/nuget $(_outdir_)/gdalcore.windowsruntime.csproj diff --git a/win/misc/trysetvcenv.bat b/win/misc/trysetvcenv.bat index 574d8303d..6c8cb0fcf 100644 --- a/win/misc/trysetvcenv.bat +++ b/win/misc/trysetvcenv.bat @@ -1,3 +1,4 @@ @echo off call %~dp0..\configvars.bat -if not defined WindowsSdkDir (call %_vcvars_%) \ No newline at end of file +if not defined WindowsSdkDir (call %_vcvars_%) +exit /b 0 \ No newline at end of file diff --git a/win/getcurl.bat b/win/old/getcurl.bat similarity index 100% rename from win/getcurl.bat rename to win/old/getcurl.bat diff --git a/win/gethdf5.bat b/win/old/gethdf5.bat similarity index 100% rename from win/gethdf5.bat rename to win/old/gethdf5.bat diff --git a/win/getlerc.bat b/win/old/getlerc.bat similarity index 100% rename from win/getlerc.bat rename to win/old/getlerc.bat diff --git a/win/getlibgeotiff.bat b/win/old/getlibgeotiff.bat similarity index 100% rename from win/getlibgeotiff.bat rename to win/old/getlibgeotiff.bat diff --git a/win/getlibjpeg.bat b/win/old/getlibjpeg.bat similarity index 100% rename from win/getlibjpeg.bat rename to win/old/getlibjpeg.bat diff --git a/win/getlibpng.bat b/win/old/getlibpng.bat similarity index 100% rename from win/getlibpng.bat rename to win/old/getlibpng.bat diff --git a/win/getlibtiff.bat b/win/old/getlibtiff.bat similarity index 100% rename from win/getlibtiff.bat rename to win/old/getlibtiff.bat diff --git a/win/getlibz.bat b/win/old/getlibz.bat similarity index 100% rename from win/getlibz.bat rename to win/old/getlibz.bat diff --git a/win/getsqlite3.bat b/win/old/getsqlite3.bat similarity index 100% rename from win/getsqlite3.bat rename to win/old/getsqlite3.bat diff --git a/win/presource/vc-runtime/concrt140.dll b/win/presource/vc-runtime/concrt140.dll deleted file mode 100644 index bca13b015..000000000 Binary files a/win/presource/vc-runtime/concrt140.dll and /dev/null differ diff --git a/win/presource/vc-runtime/msvcp140.dll b/win/presource/vc-runtime/msvcp140.dll deleted file mode 100644 index d7d19bf20..000000000 Binary files a/win/presource/vc-runtime/msvcp140.dll and /dev/null differ diff --git a/win/presource/vc-runtime/msvcp140_1.dll b/win/presource/vc-runtime/msvcp140_1.dll deleted file mode 100644 index ae442dc7c..000000000 Binary files a/win/presource/vc-runtime/msvcp140_1.dll and /dev/null differ diff --git a/win/presource/vc-runtime/msvcp140_2.dll b/win/presource/vc-runtime/msvcp140_2.dll deleted file mode 100644 index e73c12a77..000000000 Binary files a/win/presource/vc-runtime/msvcp140_2.dll and /dev/null differ diff --git a/win/presource/vc-runtime/msvcp140_codecvt_ids.dll b/win/presource/vc-runtime/msvcp140_codecvt_ids.dll deleted file mode 100644 index 5aa556cf3..000000000 Binary files a/win/presource/vc-runtime/msvcp140_codecvt_ids.dll and /dev/null differ diff --git a/win/presource/vc-runtime/vccorlib140.dll b/win/presource/vc-runtime/vccorlib140.dll deleted file mode 100644 index 966cceae8..000000000 Binary files a/win/presource/vc-runtime/vccorlib140.dll and /dev/null differ diff --git a/win/presource/vc-runtime/vcruntime140.dll b/win/presource/vc-runtime/vcruntime140.dll deleted file mode 100644 index afb990081..000000000 Binary files a/win/presource/vc-runtime/vcruntime140.dll and /dev/null differ diff --git a/win/presource/vc-runtime/vcruntime140_1.dll b/win/presource/vc-runtime/vcruntime140_1.dll deleted file mode 100644 index 25baeeba5..000000000 Binary files a/win/presource/vc-runtime/vcruntime140_1.dll and /dev/null differ diff --git a/win/vcpkg-makefile.vc b/win/vcpkg-makefile.vc new file mode 100644 index 000000000..5bb928ef1 --- /dev/null +++ b/win/vcpkg-makefile.vc @@ -0,0 +1,49 @@ +# +# gdal-makefile.vc - gdal.netcore package automation +# + +all: install_vcpkg install_requirements + +BASE = $(MAKEDIR) +BASE_RUNTIME_RID = win +VCPKG_RID=x64-windows + +VCPKG_CLEANUP=buildtrees downloads packages installed + +!INCLUDE ..\shared\GdalCore.opt +VCPKG_ROOT = $(BASE)\..\build-$(BASE_RUNTIME_RID)\vcpkg +VCPKG = $(VCPKG_ROOT)\vcpkg.exe + +install_vcpkg: +!IF !EXISTS($(VCPKG_ROOT)) + git clone https://github.com/microsoft/vcpkg $(VCPKG_ROOT) +!ENDIF +!IF !EXISTS($(VCPKG)) + cd $(VCPKG_ROOT) && git pull origin master + $(VCPKG_ROOT)\bootstrap-vcpkg.bat +!ENDIF + +install_requirements: install_vcpkg install_packages + + +pull_vcpkg: + cd $(VCPKG_ROOT) && git pull origin master +upgrade: pull_vcpkg + $(VCPKG) upgrade +update: pull_vcpkg + $(VCPKG) update + +$(VCPKG_CLEANUP): + @cmd /c if exist "$(VCPKG_ROOT)\$@\" rmdir /S /Q "$(VCPKG_ROOT)\$@" + + +build_cleanup: $(VCPKG_CLEANUP) +clean_ALL: build_cleanup + +install_packages: + -for %p in ( $(VCPKG_REQUIRE_WIN) ) \ + do $(VCPKG) install %p:$(VCPKG_RID) --recurse --clean-after-build +remove_packages: + -for %p in ( $(VCPKG_REQUIRE_WIN) ) \ + do $(VCPKG) remove %p:$(VCPKG_RID) --recurse +