我需要从swig生成的.cxx文件创建.pyd。当谈到VS2017和命令行时,我有点小气,我希望有一点帮助。swig和建设项目与视觉工作室2017年命令行
这是我迄今所做的:
呷设置为Windows
1)。下载anaconda(使用python 3.6 x64版本)
2)。下载VS社区版
- installed all the c++ extensions
3)。下载的FGDB API(视窗2017):
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.
谢谢
确定,它说VS2017 – JabberJabber
我的意思是,你的确切版本,例如在旧的14.1 MSVC版本中,你不能让你的程序可移植,在这种情况下,这些库与编译器不兼容 – MinCarve
有没有办法找出我需要什么来编译这个东西? – JabberJabber