pydext
This commit is contained in:
parent
21eed02866
commit
a96ab06e31
30 changed files with 528 additions and 69 deletions
63
.gitattributes
vendored
Normal file
63
.gitattributes
vendored
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
###############################################################################
|
||||||
|
# Set default behavior to automatically normalize line endings.
|
||||||
|
###############################################################################
|
||||||
|
* text=auto
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Set default behavior for command prompt diff.
|
||||||
|
#
|
||||||
|
# This is need for earlier builds of msysgit that does not have it on by
|
||||||
|
# default for csharp files.
|
||||||
|
# Note: This is only used by command line
|
||||||
|
###############################################################################
|
||||||
|
#*.cs diff=csharp
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Set the merge driver for project and solution files
|
||||||
|
#
|
||||||
|
# Merging from the command prompt will add diff markers to the files if there
|
||||||
|
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
||||||
|
# the diff markers are never inserted). Diff markers may cause the following
|
||||||
|
# file extensions to fail to load in VS. An alternative would be to treat
|
||||||
|
# these files as binary and thus will always conflict and require user
|
||||||
|
# intervention with every merge. To do so, just uncomment the entries below
|
||||||
|
###############################################################################
|
||||||
|
#*.sln merge=binary
|
||||||
|
#*.csproj merge=binary
|
||||||
|
#*.vbproj merge=binary
|
||||||
|
#*.vcxproj merge=binary
|
||||||
|
#*.vcproj merge=binary
|
||||||
|
#*.dbproj merge=binary
|
||||||
|
#*.fsproj merge=binary
|
||||||
|
#*.lsproj merge=binary
|
||||||
|
#*.wixproj merge=binary
|
||||||
|
#*.modelproj merge=binary
|
||||||
|
#*.sqlproj merge=binary
|
||||||
|
#*.wwaproj merge=binary
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# behavior for image files
|
||||||
|
#
|
||||||
|
# image files are treated as binary by default.
|
||||||
|
###############################################################################
|
||||||
|
#*.jpg binary
|
||||||
|
#*.png binary
|
||||||
|
#*.gif binary
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# diff behavior for common document formats
|
||||||
|
#
|
||||||
|
# Convert binary document formats to text before diffing them. This feature
|
||||||
|
# is only available from the command line. Turn it on by uncommenting the
|
||||||
|
# entries below.
|
||||||
|
###############################################################################
|
||||||
|
#*.doc diff=astextplain
|
||||||
|
#*.DOC diff=astextplain
|
||||||
|
#*.docx diff=astextplain
|
||||||
|
#*.DOCX diff=astextplain
|
||||||
|
#*.dot diff=astextplain
|
||||||
|
#*.DOT diff=astextplain
|
||||||
|
#*.pdf diff=astextplain
|
||||||
|
#*.PDF diff=astextplain
|
||||||
|
#*.rtf diff=astextplain
|
||||||
|
#*.RTF diff=astextplain
|
BIN
C和C++扩展/pydext/.vs/pydext/v15/.suo
Normal file
BIN
C和C++扩展/pydext/.vs/pydext/v15/.suo
Normal file
Binary file not shown.
BIN
C和C++扩展/pydext/.vs/pydext/v15/Browse.VC.db
Normal file
BIN
C和C++扩展/pydext/.vs/pydext/v15/Browse.VC.db
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
C和C++扩展/pydext/Release/pydext.exp
Normal file
BIN
C和C++扩展/pydext/Release/pydext.exp
Normal file
Binary file not shown.
BIN
C和C++扩展/pydext/Release/pydext.iobj
Normal file
BIN
C和C++扩展/pydext/Release/pydext.iobj
Normal file
Binary file not shown.
BIN
C和C++扩展/pydext/Release/pydext.ipdb
Normal file
BIN
C和C++扩展/pydext/Release/pydext.ipdb
Normal file
Binary file not shown.
BIN
C和C++扩展/pydext/Release/pydext.lib
Normal file
BIN
C和C++扩展/pydext/Release/pydext.lib
Normal file
Binary file not shown.
BIN
C和C++扩展/pydext/Release/pydext.pdb
Normal file
BIN
C和C++扩展/pydext/Release/pydext.pdb
Normal file
Binary file not shown.
BIN
C和C++扩展/pydext/Release/pydext.pyd
Normal file
BIN
C和C++扩展/pydext/Release/pydext.pyd
Normal file
Binary file not shown.
31
C和C++扩展/pydext/pydext.sln
Normal file
31
C和C++扩展/pydext/pydext.sln
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio 15
|
||||||
|
VisualStudioVersion = 15.0.27428.2037
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pydext", "pydext\pydext.vcxproj", "{023C9F4B-FECC-430A-81D2-7044FAFF15D0}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
Release|x86 = Release|x86
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{023C9F4B-FECC-430A-81D2-7044FAFF15D0}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{023C9F4B-FECC-430A-81D2-7044FAFF15D0}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{023C9F4B-FECC-430A-81D2-7044FAFF15D0}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{023C9F4B-FECC-430A-81D2-7044FAFF15D0}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{023C9F4B-FECC-430A-81D2-7044FAFF15D0}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{023C9F4B-FECC-430A-81D2-7044FAFF15D0}.Release|x64.Build.0 = Release|x64
|
||||||
|
{023C9F4B-FECC-430A-81D2-7044FAFF15D0}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{023C9F4B-FECC-430A-81D2-7044FAFF15D0}.Release|x86.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {FB11C75A-F832-45BC-BEB7-40ED2F7A3A3B}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
15
C和C++扩展/pydext/pydext/Release/pydext.Build.CppClean.log
Normal file
15
C和C++扩展/pydext/pydext/Release/pydext.Build.CppClean.log
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
f:\python\github\pyqt\c和c++扩展\pydext\pydext\release\vc141.pdb
|
||||||
|
f:\python\github\pyqt\c和c++扩展\pydext\pydext\release\pydext.obj
|
||||||
|
f:\python\github\pyqt\c和c++扩展\pydext\release\pydext.pyd
|
||||||
|
f:\python\github\pyqt\c和c++扩展\pydext\release\pydext.pdb
|
||||||
|
f:\python\github\pyqt\c和c++扩展\pydext\release\pydext.lib
|
||||||
|
f:\python\github\pyqt\c和c++扩展\pydext\release\pydext.exp
|
||||||
|
f:\python\github\pyqt\c和c++扩展\pydext\release\pydext.ipdb
|
||||||
|
f:\python\github\pyqt\c和c++扩展\pydext\release\pydext.iobj
|
||||||
|
f:\python\github\pyqt\c和c++扩展\pydext\pydext\release\pydext.tlog\cl.command.1.tlog
|
||||||
|
f:\python\github\pyqt\c和c++扩展\pydext\pydext\release\pydext.tlog\cl.read.1.tlog
|
||||||
|
f:\python\github\pyqt\c和c++扩展\pydext\pydext\release\pydext.tlog\cl.write.1.tlog
|
||||||
|
f:\python\github\pyqt\c和c++扩展\pydext\pydext\release\pydext.tlog\link.command.1.tlog
|
||||||
|
f:\python\github\pyqt\c和c++扩展\pydext\pydext\release\pydext.tlog\link.read.1.tlog
|
||||||
|
f:\python\github\pyqt\c和c++扩展\pydext\pydext\release\pydext.tlog\link.write.1.tlog
|
||||||
|
f:\python\github\pyqt\c和c++扩展\pydext\pydext\release\pydext.tlog\pydext.write.1u.tlog
|
7
C和C++扩展/pydext/pydext/Release/pydext.log
Normal file
7
C和C++扩展/pydext/pydext/Release/pydext.log
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
F:\Python\Github\PyQt\C和C++扩展\pydext\pydext\pydext.vcxproj(201,5): warning : Python debug symbols are not installed. Installing the symbols through the Python installer is strongly recommended.
|
||||||
|
pydext.c
|
||||||
|
正在创建库 F:\Python\Github\PyQt\C和C++扩展\pydext\Release\pydext.lib 和对象 F:\Python\Github\PyQt\C和C++扩展\pydext\Release\pydext.exp
|
||||||
|
正在生成代码
|
||||||
|
All 5 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
|
||||||
|
已完成代码的生成
|
||||||
|
pydext.vcxproj -> F:\Python\Github\PyQt\C和C++扩展\pydext\Release\pydext.pyd
|
BIN
C和C++扩展/pydext/pydext/Release/pydext.obj
Normal file
BIN
C和C++扩展/pydext/pydext/Release/pydext.obj
Normal file
Binary file not shown.
BIN
C和C++扩展/pydext/pydext/Release/pydext.tlog/CL.command.1.tlog
Normal file
BIN
C和C++扩展/pydext/pydext/Release/pydext.tlog/CL.command.1.tlog
Normal file
Binary file not shown.
BIN
C和C++扩展/pydext/pydext/Release/pydext.tlog/CL.read.1.tlog
Normal file
BIN
C和C++扩展/pydext/pydext/Release/pydext.tlog/CL.read.1.tlog
Normal file
Binary file not shown.
BIN
C和C++扩展/pydext/pydext/Release/pydext.tlog/CL.write.1.tlog
Normal file
BIN
C和C++扩展/pydext/pydext/Release/pydext.tlog/CL.write.1.tlog
Normal file
Binary file not shown.
BIN
C和C++扩展/pydext/pydext/Release/pydext.tlog/link.command.1.tlog
Normal file
BIN
C和C++扩展/pydext/pydext/Release/pydext.tlog/link.command.1.tlog
Normal file
Binary file not shown.
BIN
C和C++扩展/pydext/pydext/Release/pydext.tlog/link.read.1.tlog
Normal file
BIN
C和C++扩展/pydext/pydext/Release/pydext.tlog/link.read.1.tlog
Normal file
Binary file not shown.
BIN
C和C++扩展/pydext/pydext/Release/pydext.tlog/link.write.1.tlog
Normal file
BIN
C和C++扩展/pydext/pydext/Release/pydext.tlog/link.write.1.tlog
Normal file
Binary file not shown.
|
@ -0,0 +1,2 @@
|
||||||
|
#TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0.16299.0
|
||||||
|
Release|Win32|F:\Python\Github\PyQt\C和C++扩展\pydext\|
|
BIN
C和C++扩展/pydext/pydext/Release/pydext.tlog/pydext.write.1u.tlog
Normal file
BIN
C和C++扩展/pydext/pydext/Release/pydext.tlog/pydext.write.1u.tlog
Normal file
Binary file not shown.
BIN
C和C++扩展/pydext/pydext/Release/vc141.pdb
Normal file
BIN
C和C++扩展/pydext/pydext/Release/vc141.pdb
Normal file
Binary file not shown.
92
C和C++扩展/pydext/pydext/pydext.c
Normal file
92
C和C++扩展/pydext/pydext/pydext.c
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
#include <Python.h>
|
||||||
|
|
||||||
|
// 无参数
|
||||||
|
PyObject *pydext_hello(PyObject *self) {
|
||||||
|
return Py_BuildValue("s", "this is hello function");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 可以解析普通参数
|
||||||
|
// 这里就解析一个好了
|
||||||
|
PyObject *pydext_hello2(PyObject *self, PyObject *args) {
|
||||||
|
char *name = "";
|
||||||
|
|
||||||
|
if (!PyArg_ParseTuple(args, "s", &name)) {
|
||||||
|
PyErr_SetString(PyExc_ValueError, "parameter must be str");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return Py_BuildValue("s", name);
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(pydext_sum_doc, "sum(x, y, minus=False)\
|
||||||
|
\
|
||||||
|
sum function, if minus=True then return -(x+y)");
|
||||||
|
// 可以解析普通参数和指定参数
|
||||||
|
PyObject *pydext_sum(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
|
/* Shared references that do not need Py_DECREF before returning. */
|
||||||
|
int x = 0;
|
||||||
|
int y = 0;
|
||||||
|
int minus = 0;
|
||||||
|
|
||||||
|
/* Parse positional and keyword arguments */
|
||||||
|
static char* keywords[] = { "x", "y", "minus", NULL };
|
||||||
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii|$p", keywords, &x, &y, &minus)) {
|
||||||
|
PyErr_SetString(PyExc_ValueError, "x and y must be int, and minus must be True or False");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Function implementation starts here */
|
||||||
|
if (minus == 1)
|
||||||
|
return Py_BuildValue("i", -(x + y));
|
||||||
|
return Py_BuildValue("i", x + y);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* List of functions to add to pydext in exec_pydext().
|
||||||
|
*/
|
||||||
|
static PyMethodDef pydext_functions[] = {
|
||||||
|
{ "hello", (PyCFunction)pydext_hello, METH_NOARGS, NULL },
|
||||||
|
{ "hello2", (PyCFunction)pydext_hello2, METH_VARARGS, NULL },
|
||||||
|
{ "sum", (PyCFunction)pydext_sum, METH_VARARGS | METH_KEYWORDS, pydext_sum_doc },
|
||||||
|
{ NULL, NULL, 0, NULL } /* marks end of array */
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize pydext. May be called multiple times, so avoid
|
||||||
|
* using static state.
|
||||||
|
*/
|
||||||
|
int exec_pydext(PyObject *module) {
|
||||||
|
PyModule_AddFunctions(module, pydext_functions);
|
||||||
|
|
||||||
|
PyModule_AddStringConstant(module, "__author__", "Irony");
|
||||||
|
PyModule_AddStringConstant(module, "__mail__", "892768447@qq.com");
|
||||||
|
PyModule_AddStringConstant(module, "__version__", "1.0.0");
|
||||||
|
|
||||||
|
return 0; /* success */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Documentation for pydext.
|
||||||
|
*/
|
||||||
|
PyDoc_STRVAR(pydext_doc, "The pydext module");
|
||||||
|
|
||||||
|
|
||||||
|
static PyModuleDef_Slot pydext_slots[] = {
|
||||||
|
{ Py_mod_exec, exec_pydext },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
|
static PyModuleDef pydext_def = {
|
||||||
|
PyModuleDef_HEAD_INIT,
|
||||||
|
"pydext",
|
||||||
|
pydext_doc,
|
||||||
|
0, /* m_size */
|
||||||
|
NULL, /* m_methods */
|
||||||
|
pydext_slots,
|
||||||
|
NULL, /* m_traverse */
|
||||||
|
NULL, /* m_clear */
|
||||||
|
NULL, /* m_free */
|
||||||
|
};
|
||||||
|
|
||||||
|
PyMODINIT_FUNC PyInit_pydext() {
|
||||||
|
return PyModuleDef_Init(&pydext_def);
|
||||||
|
}
|
203
C和C++扩展/pydext/pydext/pydext.vcxproj
Normal file
203
C和C++扩展/pydext/pydext/pydext.vcxproj
Normal file
|
@ -0,0 +1,203 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{023C9F4B-FECC-430A-81D2-7044FAFF15D0}</ProjectGuid>
|
||||||
|
<RootNamespace>pydext</RootNamespace>
|
||||||
|
<PythonVersion>3.5</PythonVersion>
|
||||||
|
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Label="PythonConfiguration">
|
||||||
|
<RegistryView>RegistryView.Registry32</RegistryView>
|
||||||
|
<RegistryView Condition="$(Platform) == 'x64'">RegistryView.Registry64</RegistryView>
|
||||||
|
<PythonTag>$(PythonVersion)-32</PythonTag>
|
||||||
|
<PythonTag Condition="$(Platform) == 'x64'">$(PythonVersion)</PythonTag>
|
||||||
|
<PythonHome Condition="$(PythonHome) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\$(PythonTag)\InstallPath', null, null, $(RegistryView)))</PythonHome>
|
||||||
|
<PythonHome Condition="$(PythonHome) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\$(PythonTag)\InstallPath', null, null, $(RegistryView)))</PythonHome>
|
||||||
|
<PythonExe Condition="$(PythonExe) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\$(PythonTag)\InstallPath', 'ExecutablePath', null, $(RegistryView)))</PythonExe>
|
||||||
|
<PythonExe Condition="$(PythonExe) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\$(PythonTag)\InstallPath', 'ExecutablePath', null, $(RegistryView)))</PythonExe>
|
||||||
|
<PythonExe Condition="$(PythonExe) == '' and $(PythonHome) != ''">$(PythonHome)python.exe</PythonExe>
|
||||||
|
<PythonDevVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'dev', null, $(RegistryView)))</PythonDevVersion>
|
||||||
|
<PythonDevVersion Condition="$(PythonDevVersion) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'dev', null, $(RegistryView)))</PythonDevVersion>
|
||||||
|
<PythonCorePDBVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'core_pdb', null, $(RegistryView)))</PythonCorePDBVersion>
|
||||||
|
<PythonCorePDBVersion Condition="$(PythonCorePDBVersion) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'core_pdb', null, $(RegistryView)))</PythonCorePDBVersion>
|
||||||
|
<PythonCoreDVersion>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'core_d', null, $(RegistryView)))</PythonCoreDVersion>
|
||||||
|
<PythonCoreDVersion Condition="$(PythonCoreDVersion) == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\$(PythonTag)\InstalledFeatures', 'core_d', null, $(RegistryView)))</PythonCoreDVersion>
|
||||||
|
<PythonDebugSuffix Condition="$(PythonCoreDVersion) != ''">_d</PythonDebugSuffix>
|
||||||
|
<PythonDExe Condition="$(PythonExe) != '' and $(PythonDExe) == ''">$([System.IO.Path]::GetDirectoryName($(PythonExe)))\python$(PythonDebugSuffix).exe</PythonDExe>
|
||||||
|
<PythonDExe Condition="!Exists($(PythonDExe))">$(PythonExe)</PythonDExe>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<DefaultDebuggerFlavor>WindowsLocalDebugger</DefaultDebuggerFlavor>
|
||||||
|
<DefaultDebuggerFlavor Condition="$(HasPythonDebugLaunchProvider) == 'true'">PythonDebugLaunchProvider</DefaultDebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<TargetName>pydext$(PythonDebugSuffix)</TargetName>
|
||||||
|
<TargetExt>.pyd</TargetExt>
|
||||||
|
<LocalDebuggerCommand>$(PythonDExe)</LocalDebuggerCommand>
|
||||||
|
<LocalDebuggerCommandArguments>-i -c "print('>>> import pydext'); import pydext"</LocalDebuggerCommandArguments>
|
||||||
|
<LocalDebuggerEnvironment>PYTHONPATH=$(OutDir)</LocalDebuggerEnvironment>
|
||||||
|
<DebuggerFlavor>$(DefaultDebuggerFlavor)</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<TargetName>pydext</TargetName>
|
||||||
|
<TargetExt>.pyd</TargetExt>
|
||||||
|
<LocalDebuggerCommand>$(PythonExe)</LocalDebuggerCommand>
|
||||||
|
<LocalDebuggerCommandArguments>-i -c "print('>>> import pydext'); import pydext"</LocalDebuggerCommandArguments>
|
||||||
|
<LocalDebuggerEnvironment>PYTHONPATH=$(OutDir)</LocalDebuggerEnvironment>
|
||||||
|
<DebuggerFlavor>$(DefaultDebuggerFlavor)</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<TargetName>pydext$(PythonDebugSuffix)</TargetName>
|
||||||
|
<TargetExt>.pyd</TargetExt>
|
||||||
|
<LocalDebuggerCommand>$(PythonDExe)</LocalDebuggerCommand>
|
||||||
|
<LocalDebuggerCommandArguments>-i -c "print('>>> import pydext'); import pydext"</LocalDebuggerCommandArguments>
|
||||||
|
<LocalDebuggerEnvironment>PYTHONPATH=$(OutDir)</LocalDebuggerEnvironment>
|
||||||
|
<DebuggerFlavor>$(DefaultDebuggerFlavor)</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<TargetName>pydext</TargetName>
|
||||||
|
<TargetExt>.pyd</TargetExt>
|
||||||
|
<LocalDebuggerCommand>$(PythonExe)</LocalDebuggerCommand>
|
||||||
|
<LocalDebuggerCommandArguments>-i -c "print('>>> import pydext'); import pydext"</LocalDebuggerCommandArguments>
|
||||||
|
<LocalDebuggerEnvironment>PYTHONPATH=$(OutDir)</LocalDebuggerEnvironment>
|
||||||
|
<DebuggerFlavor>$(DefaultDebuggerFlavor)</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<RuntimeLibrary Condition="$(PythonCoreDVersion) == ''">MultithreadedDLL</RuntimeLibrary>
|
||||||
|
<AdditionalIncludeDirectories>D:\soft\Python35\include;$(PythonHome)Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>$(PythonHome)libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<RuntimeLibrary Condition="$(PythonCoreDVersion) == ''">MultithreadedDLL</RuntimeLibrary>
|
||||||
|
<AdditionalIncludeDirectories>$(PythonHome)Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>$(PythonHome)libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<RuntimeLibrary>Multithreaded</RuntimeLibrary>
|
||||||
|
<AdditionalIncludeDirectories>D:\soft\Python35\include;$(PythonHome)Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<IgnoreSpecificDefaultLibraries>libucrt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||||
|
<AdditionalDependencies>ucrt.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>$(PythonHome)libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<RuntimeLibrary>Multithreaded</RuntimeLibrary>
|
||||||
|
<AdditionalIncludeDirectories>$(PythonHome)Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<IgnoreSpecificDefaultLibraries>libucrt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||||
|
<AdditionalDependencies>ucrt.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>$(PythonHome)libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="pydext.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
<Target Name="_ValidatePythonInstall" BeforeTargets="PrepareForBuild">
|
||||||
|
<Error Condition="$(PythonHome) == ''" Text="Python $(PythonTag) is not installed. Please install Python $(PythonTag) and try again." />
|
||||||
|
<Error Condition="$(PythonDevVersion) == ''" Text="Python development files are not installed. Please add the development files, or repair your existing installation." />
|
||||||
|
<Warning Condition="$(PythonCorePDBVersion) == ''" Text="Python debug symbols are not installed. Installing the symbols through the Python installer is strongly recommended." />
|
||||||
|
</Target>
|
||||||
|
</Project>
|
22
C和C++扩展/pydext/pydext/pydext.vcxproj.filters
Normal file
22
C和C++扩展/pydext/pydext/pydext.vcxproj.filters
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Resource Files">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="pydext.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
4
C和C++扩展/pydext/pydext/pydext.vcxproj.user
Normal file
4
C和C++扩展/pydext/pydext/pydext.vcxproj.user
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup />
|
||||||
|
</Project>
|
19
C和C++扩展/pydext/test.py
Normal file
19
C和C++扩展/pydext/test.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
import sys
|
||||||
|
sys.path.insert(0, './Release')
|
||||||
|
|
||||||
|
import pydext
|
||||||
|
|
||||||
|
print(pydext)
|
||||||
|
print(dir(pydext))
|
||||||
|
|
||||||
|
print(pydext.__author__)
|
||||||
|
print(pydext.__mail__)
|
||||||
|
|
||||||
|
print(pydext.hello())
|
||||||
|
|
||||||
|
print(pydext.hello2('Irony'))
|
||||||
|
|
||||||
|
print(pydext.sum(1, 5))
|
||||||
|
|
||||||
|
# 结果变负数
|
||||||
|
print(pydext.sum(1, 5, minus=True))
|
|
@ -38,6 +38,7 @@
|
||||||
- [1.28 C和C++扩展](C和C++扩展/)
|
- [1.28 C和C++扩展](C和C++扩展/)
|
||||||
- [1.28.1 pyx和c++](C和C++扩展/pyx和c++/)
|
- [1.28.1 pyx和c++](C和C++扩展/pyx和c++/)
|
||||||
- [1.28.2 py转pyd](C和C++扩展/py转pyd/)
|
- [1.28.2 py转pyd](C和C++扩展/py转pyd/)
|
||||||
|
- [1.28.3 pydext](C和C++扩展/pydext/)
|
||||||
|
|
||||||
|
|
||||||
### [2.QGraphicsView练习](QGraphicsView练习/)
|
### [2.QGraphicsView练习](QGraphicsView练习/)
|
||||||
|
|
Loading…
Reference in a new issue