2017-08-29 77 views
0

我需要從swig生成的.cxx文件創建.pyd。當談到VS2017和命令行時,我有點小氣,我希望有一點幫助。swig和建設項目與視覺工作室2017年命令行

這是我迄今所做的:

呷設置爲Windows

1)。下載anaconda(使用python 3.6 x64版本)

2)。下載VS社區版

- installed all the c++ extensions 

3)。下載的FGDB API(視窗2017):

https://github.com/Esri/file-geodatabase-api/blob/master/FileGDB_API_1.5.1/FileGDB_API_1_5_1-VS2017.zip

4)。設置Python環境變量:

PYTHON_INCLUDE: C:\ProgramData\Anaconda3\include 

PYTHON_LIB: C:\ProgramData\Anaconda3\libs\python36.lib 

5)。下載並解壓Swig

6)。將swig路徑添加到PATH環境變量

7)。從google hosting或github下載文件-geodatabase-api文件。 https://storage.googleapis.com/google-code-archive-source/v2/code.google.com/file-geodatabase-api-python-wrapper/source-archive.zip

8)。創建文件夾:C:\ fgdb_code

  • 應該有一個。我,和的.py文件夾

9)在make文件。將來自步驟#7的文件放置在該文件夾中

10)。從步驟#8

c:\fgdb_code\FGDB 

生成.CXX文件

11)解壓縮來自步驟#3在文件夾中的文件。以管理員身份打開命令行窗口(可能不需要管理員)

12)。導航到c:\ fgdb_code文件夾

13)。執行命令痛飲-python -IFGDB /包括-C++ filegdbapi.i

This generates a .cxx file 

``` 輸出消息:

FGDB\include\Util.h(819) : Warning 312: Nested union not currently supported (ignored). 
FGDB\include\Util.h(838) : Warning 312: Nested union not currently supported (ignored). 
FGDB\include\Util.h(843) : Warning 312: Nested union not currently supported (ignored). 
FGDB\include\Util.h(849) : Warning 312: Nested union not currently supported (ignored). 
FGDB\include\Geodatabase.h(307) : Warning 503: Can't wrap 'FileGDBAPI::CreateGeodatabase' unless renamed to a valid identifier. 
FGDB\include\Geodatabase.h(308) : Warning 503: Can't wrap 'FileGDBAPI::OpenGeodatabase' unless renamed to a valid identifier. 
FGDB\include\Geodatabase.h(309) : Warning 503: Can't wrap 'FileGDBAPI::CloseGeodatabase' unless renamed to a valid identifier. 
FGDB\include\Geodatabase.h(310) : Warning 503: Can't wrap 'FileGDBAPI::DeleteGeodatabase' unless renamed to a valid identifier. 

```

從VS 2017生成.pyd文件

這是我卡住的地方。
我試着創建一個新的VS項目來生成一個DLL,但我似乎無法得到接口工作(我發現VS工作室接口有點令人生畏)。有沒有辦法通過命令行來做到這一點,而無需創建一個項目?如果是這樣,有人可以提供一些指導我如何做到這一點?
我應該只需要.i和.cxx文件來編譯代碼。

UPDATE 生成從VS 2017

14 .pyd文件)。 Open Visual Studios

15)。選擇File - > From Existing Code

16)。選擇C++

17)。輸入以下內容:

- Project file location: folder from step #8 

- project name: filegdbapi 

- Check add files (should be checked by default) 

- Click Next 

18)。對於項目類型:動態鏈接庫(DLL)項目

19)。 Press Finish

20)。構建項目

與失敗:

1>------ Build started: Project: filegdbapi, Configuration: Release x64 ------ 
1>XSD : error : The CodeDom provider type "Microsoft.VisualC.CppCodeProvider, CppCodeProvider, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" could not be located. 
1> 
1>If you would like more help, please type "xsd /?". 
1>Done building project "filegdbapi.vcxproj" -- FAILED. 

謝謝

回答

0

的庫與您的Visual Studio版本不兼容

+0

確定,它說VS2017 – JabberJabber

+0

我的意思是,你的確切版本,例如在舊的14.1 MSVC版本中,你不能讓你的程序可移植,在這種情況下,這些庫與編譯器不兼容 – MinCarve

+0

有沒有辦法找出我需要什麼來編譯這個東西? – JabberJabber