使用nmake编译Gdal源代码(Win10, VS2022)

为了编译Gdal-master的源码,需要PROJ的支持,而PROJ又需要SQLite的支持。

SQLite、PROJ、Gdal-master的源码及编译可参见网页:

Gdal-master、PROJ 8.2.1源码下载及编译(Win10+VS2022)_Alexabc3000的专栏-CSDN博客

也可使用nmake在命令行创建(参考网页 BuildingOnWindows – GDAL )

使用命令行,进入VS2022开发者命令行窗口

cd D:\Programs\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build

D:

vcvars64.bat



cd D:\SourceCodes\gdal-master

set BINDIR=d:\programs\gdal\gdal-bin

set DATADIR=d:\programs\gdal\gdal-data

set INCDIR=d:\programs\gdal\gdal-include

set LIBDIR=d:\programs\gdal\gdal-lib

修改文件“nmake.opt”的内容:

(1)将

#PROJ_INCLUDE = -Id:\install-proj\local\include

改为

PROJ_INCLUDE = -ID:\My3rdParty\include

(2)将

#PROJ_LIBRARY = d:\install-proj\local\lib\proj_6_0.lib shell32.lib ole32.lib

改为

PROJ_LIBRARY = D:\My3rdParty\lib\proj.lib shell32.lib ole32.lib

依次使用下列命令, 创建x64的Release版本

nmake -f makefile.vc MSVC_VER=1930 WIN64=1 
nmake /f makefile.vc install MSVC_VER=1930  WIN64=yes 
nmake /f makefile.vc devinstall MSVC_VER=1930 WIN64=yes

执行完毕后,目录“d:\programs\gdal”中的内容如下(使用命令 “tree /f d:\programs\gdal” 列出)

D:\PROGRAMS\GDAL
├─gdal-bin
│  │  gdal303.dll
│  │  gdaladdo.exe
│  │  gdalbuildvrt.exe
│  │  gdaldem.exe
│  │  gdalenhance.exe
│  │  gdalinfo.exe
│  │  gdallocationinfo.exe
│  │  gdalmanage.exe
│  │  gdalmdiminfo.exe
│  │  gdalmdimtranslate.exe
│  │  gdalsrsinfo.exe
│  │  gdaltindex.exe
│  │  gdaltransform.exe
│  │  gdalwarp.exe
│  │  gdal_contour.exe
│  │  gdal_create.exe
│  │  gdal_grid.exe
│  │  gdal_rasterize.exe
│  │  gdal_translate.exe
│  │  gdal_viewshed.exe
│  │  gnmanalyse.exe
│  │  gnmmanage.exe
│  │  nearblack.exe
│  │  ogr2ogr.exe
│  │  ogrinfo.exe
│  │  ogrlineref.exe
│  │  ogrtindex.exe
│  │
│  └─gdalplugins
│          drivers.ini

├─gdal-data
│      bag_template.xml
│      cubewerx_extra.wkt
│      default.rsc
│      ecw_cs.wkt
│      eedaconf.json
│      epsg.wkt
│      esri_StatePlane_extra.wkt
│      gdalicon.png
│      GDALLogoBW.svg
│      GDALLogoColor.svg
│      GDALLogoGS.svg
│      gdalmdiminfo_output.schema.json
│      gdalvrt.xsd
│      gmlasconf.xml
│      gmlasconf.xsd
│      gml_registry.xml
│      grib2_center.csv
│      grib2_process.csv
│      grib2_subcenter.csv
│      grib2_table_4_2_0_0.csv
│      grib2_table_4_2_0_1.csv
│      grib2_table_4_2_0_13.csv
│      grib2_table_4_2_0_14.csv
│      grib2_table_4_2_0_15.csv
│      grib2_table_4_2_0_16.csv
│      grib2_table_4_2_0_17.csv
│      grib2_table_4_2_0_18.csv
│      grib2_table_4_2_0_19.csv
│      grib2_table_4_2_0_190.csv
│      grib2_table_4_2_0_191.csv
│      grib2_table_4_2_0_2.csv
│      grib2_table_4_2_0_20.csv
│      grib2_table_4_2_0_3.csv
│      grib2_table_4_2_0_4.csv
│      grib2_table_4_2_0_5.csv
│      grib2_table_4_2_0_6.csv
│      grib2_table_4_2_0_7.csv
│      grib2_table_4_2_10_0.csv
│      grib2_table_4_2_10_1.csv
│      grib2_table_4_2_10_191.csv
│      grib2_table_4_2_10_2.csv
│      grib2_table_4_2_10_3.csv
│      grib2_table_4_2_10_4.csv
│      grib2_table_4_2_1_0.csv
│      grib2_table_4_2_1_1.csv
│      grib2_table_4_2_1_2.csv
│      grib2_table_4_2_20_0.csv
│      grib2_table_4_2_20_1.csv
│      grib2_table_4_2_20_2.csv
│      grib2_table_4_2_2_0.csv
│      grib2_table_4_2_2_3.csv
│      grib2_table_4_2_2_4.csv
│      grib2_table_4_2_2_5.csv
│      grib2_table_4_2_3_0.csv
│      grib2_table_4_2_3_1.csv
│      grib2_table_4_2_3_2.csv
│      grib2_table_4_2_3_3.csv
│      grib2_table_4_2_3_4.csv
│      grib2_table_4_2_3_5.csv
│      grib2_table_4_2_3_6.csv
│      grib2_table_4_2_4_0.csv
│      grib2_table_4_2_4_1.csv
│      grib2_table_4_2_4_10.csv
│      grib2_table_4_2_4_2.csv
│      grib2_table_4_2_4_3.csv
│      grib2_table_4_2_4_4.csv
│      grib2_table_4_2_4_5.csv
│      grib2_table_4_2_4_6.csv
│      grib2_table_4_2_4_7.csv
│      grib2_table_4_2_4_8.csv
│      grib2_table_4_2_4_9.csv
│      grib2_table_4_2_local_Canada.csv
│      grib2_table_4_2_local_HPC.csv
│      grib2_table_4_2_local_index.csv
│      grib2_table_4_2_local_MRMS.csv
│      grib2_table_4_2_local_NCEP.csv
│      grib2_table_4_2_local_NDFD.csv
│      grib2_table_4_5.csv
│      grib2_table_versions.csv
│      gt_datum.csv
│      gt_ellips.csv
│      header.dxf
│      inspire_cp_BasicPropertyUnit.gfs
│      inspire_cp_CadastralBoundary.gfs
│      inspire_cp_CadastralParcel.gfs
│      inspire_cp_CadastralZoning.gfs
│      jpfgdgml_AdmArea.gfs
│      jpfgdgml_AdmBdry.gfs
│      jpfgdgml_AdmPt.gfs
│      jpfgdgml_BldA.gfs
│      jpfgdgml_BldL.gfs
│      jpfgdgml_Cntr.gfs
│      jpfgdgml_CommBdry.gfs
│      jpfgdgml_CommPt.gfs
│      jpfgdgml_Cstline.gfs
│      jpfgdgml_ElevPt.gfs
│      jpfgdgml_GCP.gfs
│      jpfgdgml_LeveeEdge.gfs
│      jpfgdgml_RailCL.gfs
│      jpfgdgml_RdArea.gfs
│      jpfgdgml_RdASL.gfs
│      jpfgdgml_RdCompt.gfs
│      jpfgdgml_RdEdg.gfs
│      jpfgdgml_RdMgtBdry.gfs
│      jpfgdgml_RdSgmtA.gfs
│      jpfgdgml_RvrMgtBdry.gfs
│      jpfgdgml_SBAPt.gfs
│      jpfgdgml_SBArea.gfs
│      jpfgdgml_SBBdry.gfs
│      jpfgdgml_WA.gfs
│      jpfgdgml_WL.gfs
│      jpfgdgml_WStrA.gfs
│      jpfgdgml_WStrL.gfs
│      LICENSE.TXT
│      netcdf_config.xsd
│      nitf_spec.xml
│      nitf_spec.xsd
│      ogrvrt.xsd
│      osmconf.ini
│      ozi_datum.csv
│      ozi_ellips.csv
│      pci_datum.txt
│      pci_ellips.txt
│      pdfcomposition.xsd
│      pds4_template.xml
│      plscenesconf.json
│      ruian_vf_ob_v1.gfs
│      ruian_vf_st_uvoh_v1.gfs
│      ruian_vf_st_v1.gfs
│      ruian_vf_v1.gfs
│      s57agencies.csv
│      s57attributes.csv
│      s57expectedinput.csv
│      s57objectclasses.csv
│      seed_2d.dgn
│      seed_3d.dgn
│      stateplane.csv
│      template_tiles.mapml
│      tms_LINZAntarticaMapTileGrid.json
│      tms_MapML_APSTILE.json
│      tms_MapML_CBMTILE.json
│      tms_NZTM2000.json
│      trailer.dxf
│      vdv452.xml
│      vdv452.xsd
│      vicar.json

├─gdal-include
│      armadillo_headers.h
│      cplkeywordparser.h
│      cpl_alibaba_oss.h
│      cpl_atomic_ops.h
│      cpl_auto_close.h
│      cpl_aws.h
│      cpl_azure.h
│      cpl_compressor.h
│      cpl_config.h
│      cpl_config_extras.h
│      cpl_conv.h
│      cpl_cpu_features.h
│      cpl_csv.h
│      cpl_curl_priv.h
│      cpl_error.h
│      cpl_error_internal.h
│      cpl_float.h
│      cpl_google_cloud.h
│      cpl_hash_set.h
│      cpl_http.h
│      cpl_json.h
│      cpl_json_header.h
│      cpl_json_streaming_parser.h
│      cpl_json_streaming_writer.h
│      cpl_list.h
│      cpl_md5.h
│      cpl_mem_cache.h
│      cpl_minixml.h
│      cpl_minizip_ioapi.h
│      cpl_minizip_unzip.h
│      cpl_minizip_zip.h
│      cpl_multiproc.h
│      cpl_odbc.h
│      cpl_port.h
│      cpl_progress.h
│      cpl_quad_tree.h
│      cpl_sha1.h
│      cpl_sha256.h
│      cpl_spawn.h
│      cpl_string.h
│      cpl_swift.h
│      cpl_time.h
│      cpl_userfaultfd.h
│      cpl_vax.h
│      cpl_virtualmem.h
│      cpl_vsi.h
│      cpl_vsil_curl_class.h
│      cpl_vsil_curl_priv.h
│      cpl_vsil_plugin.h
│      cpl_vsi_error.h
│      cpl_vsi_virtual.h
│      cpl_worker_thread_pool.h
│      cpl_zlib_header.h
│      gdal.h
│      gdalexif.h
│      gdalgeorefpamdataset.h
│      gdalgrid.h
│      gdalgrid_priv.h
│      gdaljp2abstractdataset.h
│      gdaljp2metadata.h
│      gdaljp2metadatagenerator.h
│      gdallinearsystem.h
│      gdalpansharpen.h
│      gdalpython.h
│      gdalsse_priv.h
│      gdalwarper.h
│      gdalwarpkernel_opencl.h
│      gdal_alg.h
│      gdal_alg_priv.h
│      gdal_csv.h
│      gdal_frmts.h
│      gdal_mdreader.h
│      gdal_pam.h
│      gdal_priv.h
│      gdal_proxy.h
│      gdal_rat.h
│      gdal_simplesurf.h
│      gdal_thread_pool.h
│      gdal_utils.h
│      gdal_version.h
│      gdal_vrt.h
│      gnm.h
│      gnmgraph.h
│      gnm_api.h
│      gvgcpfit.h
│      internal_qhull_headers.h
│      memdataset.h
│      nasakeywordhandler.h
│      ograpispy.h
│      ogrgeomediageometry.h
│      ogrpgeogeometry.h
│      ogrsf_frmts.h
│      ogr_api.h
│      ogr_attrind.h
│      ogr_core.h
│      ogr_expat.h
│      ogr_feature.h
│      ogr_featurestyle.h
│      ogr_geocoding.h
│      ogr_geometry.h
│      ogr_geos.h
│      ogr_geo_utils.h
│      ogr_libs.h
│      ogr_p.h
│      ogr_proj_p.h
│      ogr_sfcgal.h
│      ogr_spatialref.h
│      ogr_srs_api.h
│      ogr_srs_esri_names.h
│      ogr_swq.h
│      ogr_xerces.h
│      ogr_xerces_headers.h
│      rawdataset.h
│      thinplatespline.h
│      vrtdataset.h

└─gdal-lib
        gdal_i.lib

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Alexabc3000

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值