Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion etg/webview.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ def run():
# customizing the generated code and docstrings.

module.addHeaderCode("""\
#if wxUSE_WEBVIEW
#include <wx/webview.h>
#if wxUSE_WEBVIEW_IE && defined(__WXMSW__)
#include <wx/msw/webview_ie.h>
#include <wx/msw/webview_edge.h>
#endif
#endif
""")
module.addHeaderCode('#include <wx/filesys.h>')

Expand Down Expand Up @@ -213,7 +215,7 @@ def run():
# these methods with a new implementation that does the RightThing using
# sys.executable.
c.addCppCode(r"""
#if wxUSE_WEBVIEW_IE && defined(__WXMSW__)
#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_IE && defined(__WXMSW__)
#include <wx/msw/webview_ie.h>
#include <wx/msw/registry.h>

Expand Down
11 changes: 11 additions & 0 deletions etgtools/sip_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,9 @@ def generateClass(self, klass, stream, indent=''):
if klass.ignored:
return

# For any header filename starting with these prefixes, protect the #include with an #if wxUSE_ guard
optional_wx_modules = [ "webview" ]

# Propagate preMethodCode setting to the ctors
if klass.preMethodCode:
for item in klass.allItems():
Expand All @@ -466,7 +469,15 @@ def generateClass(self, klass, stream, indent=''):
if klass.includes:
stream.write('%s%%TypeHeaderCode\n' % indent2)
for inc in klass.includes:
header_basename = inc.split('/')[-1].split('.')[0]
need_endif = False
for module_name in optional_wx_modules:
if header_basename.startswith(module_name):
stream.write('%s #if wxUSE_%s\n' % (indent2, module_name.upper()))
need_endif = True
stream.write('%s #include <%s>\n' % (indent2, inc))
if need_endif:
stream.write('%s #endif\n' % indent2)
stream.write('%s%%End\n\n' % indent2)

# C++ code to be written to the Type's header
Expand Down
Loading