← Back to team overview

kicad-developers team mailing list archive

[PATCH] Verify wxPython.h exists.

 

I created a patch to fix bug report 1785663.  It works on linux and
windows msys2 builds.  On these platforms wxPython.h is located in the
same path as the wx headers so it's straight forward fix.  I'm not sure
where wxPython.h is installed on other build platforms.  I would like
our macos and msvc devs to test it to make sure it doesn't break those
platform builds.

Thanks,

Wayne

[1]: https://bugs.launchpad.net/kicad/+bug/1785663
From 540654e2147677311078a152daae747787bf2efa Mon Sep 17 00:00:00 2001
From: Wayne Stambaugh <stambaughw@xxxxxxxxx>
Date: Sat, 20 Oct 2018 09:21:12 -0400
Subject: [PATCH] Check for wxPython.h when wxPython scripting is enabled.

Fixes lp:1785663

https://bugs.launchpad.net/kicad/+bug/1785663
---
 CMakeLists.txt | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index cf55d49e7..33bb3c4c6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -794,6 +794,9 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
             OUTPUT_STRIP_TRAILING_WHITESPACE
         )
 
+        message( STATUS "wxWidgets_TOOLKIT_FOUND=${wxWidgets_TOOLKIT_FOUND}" )
+        message( STATUS "WXPYTHON_TOOLKIT_FOUND=${WXPYTHON_TOOLKIT_FOUND}" )
+
         # Check if wxWidgets toolkits match, it is a Linux-only issue
         if( UNIX AND NOT APPLE AND NOT wxWidgets_TOOLKIT_FOUND STREQUAL WXPYTHON_TOOLKIT_FOUND )
             message( FATAL_ERROR "\nwxWidgets and wxPython use different toolkits "
@@ -802,6 +805,24 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
                 "${wxWidgets_TOOLKIT_FOUND} or add '-DKICAD_SCRIPTING_WXPYTHON=OFF' to cmake "
                 "parameters to disable wxPython support." )
         endif()
+
+        message( STATUS "wxWidgets_INCLUDE_DIRS=${wxWidgets_INCLUDE_DIRS}" )
+
+        # wxPython appears to be installed and valid so make sure the headers are available.
+        foreach( path ${wxWidgets_INCLUDE_DIRS} )
+            message( STATUS "Searching for wx/wxPython/wxPython.h in ${path}" )
+
+            find_path( wxPYTHON_INCLUDE_DIRS wx/wxPython/wxPython.h
+                PATHS "${path}" )
+
+            if( wxPYTHON_INCLUDE_DIRS )
+                break()
+            endif()
+        endforeach()
+
+        if( NOT wxPYTHON_INCLUDE_DIRS )
+            message( FATAL_ERROR "Cannot find wxPython.h." )
+        endif()
     endif()
 
     #message( STATUS "PYTHON_INCLUDE_DIRS:${PYTHON_INCLUDE_DIRS}" )
-- 
2.19.1


Follow ups