File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -88,13 +88,32 @@ def cythonize_wrapper(modules, **kwargs):
88
88
with redirect_stdout (cython_filter ):
89
89
if src_modules :
90
90
cythonize (src_modules , ** kwargs )
91
+ windows_include_python_debug_build_wrapper (src_modules , bin_dir )
91
92
92
93
if bin_modules :
93
94
os .chdir (bin_dir )
94
95
cythonize (bin_modules , ** kwargs )
96
+ windows_include_python_debug_build_wrapper (bin_modules , bin_dir )
95
97
os .chdir (src_dir )
96
98
97
99
100
+ def windows_include_python_debug_build_wrapper (modules , path ):
101
+ for module in modules :
102
+ module = str (module )
103
+ if (path ):
104
+ module = path + "\\ " + module
105
+ module = module .removesuffix (".py" ).removesuffix (".pyx" )
106
+ module = module + ".cpp"
107
+ with open (module , "r" ) as file :
108
+ text = file .read ()
109
+ text = text .replace ("#include \" Python.h\" " ,
110
+ "#ifdef _DEBUG\n #define _DEBUG_WAS_DEFINED\n #undef _DEBUG\n #endif\n \
111
+ #include \" Python.h\" \n #ifdef _DEBUG_WAS_DEFINED\n #define _DEBUG\n \
112
+ #undef _DEBUG_WAS_DEFINED\n #endif" , 1 )
113
+ with open (module , "w" ) as file :
114
+ file .write (text )
115
+
116
+
98
117
def main ():
99
118
""" CLI entry point """
100
119
cli = argparse .ArgumentParser ()
Original file line number Diff line number Diff line change @@ -128,8 +128,7 @@ function(add_cython_modules)
128
128
if (MINGW )
129
129
set_target_properties ("${TARGETNAME} " PROPERTIES LINK_FLAGS "-municode" )
130
130
endif ()
131
-
132
- target_link_libraries ("${TARGETNAME} " PRIVATE ${PYEXT_LIBRARY} )
131
+ target_link_libraries ("${TARGETNAME} " PRIVATE C:/vcpkg/installed/x64-windows/lib/python311.lib )
133
132
else ()
134
133
set_property (GLOBAL APPEND PROPERTY SFT_CYTHON_MODULES "${source} " )
135
134
add_library ("${TARGETNAME} " MODULE "${CPPNAME} " )
@@ -140,7 +139,7 @@ function(add_cython_modules)
140
139
)
141
140
142
141
if (WIN32 )
143
- target_link_libraries ("${TARGETNAME} " PRIVATE ${PYEXT_LIBRARY} )
142
+ target_link_libraries ("${TARGETNAME} " PRIVATE C:/vcpkg/installed/x64-windows/lib/python311.lib )
144
143
endif ()
145
144
endif ()
146
145
@@ -514,6 +513,7 @@ function(python_finalize)
514
513
${INPLACEMODULES_LISTFILE}
515
514
"$<CONFIG>"
516
515
)
516
+ message (hello jeremiah, ${INPLACEMODULES_LISTFILE} )
517
517
set (INPLACEMODULES_TIMEFILE "${CMAKE_BINARY_DIR} /py/inplacemodules_timefile" )
518
518
add_custom_command (OUTPUT "${INPLACEMODULES_TIMEFILE} "
519
519
COMMAND ${INPLACEMODULES_INVOCATION}
You can’t perform that action at this time.
0 commit comments