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

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用nmake编译Gdal源代码(Win10+VS2022)相关的知识,希望对你有一定的参考价值。

参考技术A

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

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

https://www.toutiao.com/a7063703225425199623/?log_from=fe233e3892be3_1644664643652

也可使用nmake在命令行创建(参考网页 https://trac.osgeo.org/gdal/wiki/BuildingOnWindows

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

cd D:ProgramsMicrosoft Visual Studio2022CommunityVCAuxiliaryBuild

D:

vcvars64.bat


cd D:SourceCodesgdal-master

set BINDIR=d:programsgdalgdal-bin

set DATADIR=d:programsgdalgdal-data

set INCDIR=d:programsgdalgdal-include

set LIBDIR=d:programsgdalgdal-lib

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

(1)将

#PROJ_INCLUDE = -Id:install-projlocalinclude

改为

PROJ_INCLUDE = -ID:My3rdPartyinclude

(2)将

#PROJ_LIBRARY = d:install-projlocallibproj_6_0.lib shell32.lib ole32.lib

改为

PROJ_LIBRARY = D:My3rdPartylibproj.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:programsgdal”中的内容如下(使用命令 “tree /f d:programsgdal” 列出)

D:PROGRAMSGDAL

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

以上是关于使用nmake编译Gdal源代码(Win10+VS2022)的主要内容,如果未能解决你的问题,请参考以下文章

Win10下vs2015编译OSGEarth2.10

win32汇编中nmake用法

链接器错误构建GDAL VS2017

Nmake构建失败

Win64下编译OSG详细过程(Win10+VS2015+OSG3.6.3)

fluent中的UDF能用vs2010编译吗?