OSX build fixes and improvements.
* Fix creation of single app bundle with respect to scripting support. * Cleanup scripting search paths for OSX. * Fix some small CMake bugs from previous OSX build change. * Optimize bundle file structure to be consistent with Apple specs. * Add helper script for compiling wxWidgets and wxPython * Update OSX build instructions.
This commit is contained in:
parent
0b2cadbcca
commit
b8d1789a22
|
@ -340,35 +340,43 @@ set( KICAD_TEMPLATE ${KICAD_DATA}/template
|
||||||
CACHE PATH "Location of KiCad template files." )
|
CACHE PATH "Location of KiCad template files." )
|
||||||
|
|
||||||
if( APPLE )
|
if( APPLE )
|
||||||
# Everything without leading / is relative to CMAKE_INSTALL_PREFIX.
|
# everything without leading / is relative to CMAKE_INSTALL_PREFIX.
|
||||||
# CMAKE_INSTALL_PREFIX is root of .dmg image
|
# CMAKE_INSTALL_PREFIX is root of .dmg image
|
||||||
set( KICAD_BIN ${CMAKE_INSTALL_PREFIX}
|
set( KICAD_BIN ${CMAKE_INSTALL_PREFIX}
|
||||||
CACHE PATH "Location of KiCad binaries." FORCE )
|
CACHE PATH "Location of KiCad binaries." FORCE )
|
||||||
|
|
||||||
|
# some paths to single app bundle
|
||||||
|
set( OSX_BUNDLE_MAIN "kicad.app" )
|
||||||
|
set( OSX_BUNDLE_BIN_DIR "Contents/MacOS" )
|
||||||
|
set( OSX_BUNDLE_LIB_DIR "Contents/Frameworks" )
|
||||||
|
set( OSX_BUNDLE_KIFACE_DIR "Contents/Plugins" )
|
||||||
|
set( OSX_BUNDLE_SUP_DIR "Contents/SharedSupport" )
|
||||||
|
set( OSX_BUNDLE_BUILD_DIR "${CMAKE_BINARY_DIR}/kicad/${OSX_BUNDLE_MAIN}" )
|
||||||
|
set( OSX_BUNDLE_BUILD_BIN_DIR "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_BIN_DIR}" )
|
||||||
|
set( OSX_BUNDLE_BUILD_LIB_DIR "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_LIB_DIR}" )
|
||||||
|
set( OSX_BUNDLE_BUILD_KIFACE_DIR "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_KIFACE_DIR}" )
|
||||||
|
set( OSX_BUNDLE_INSTALL_DIR "${KICAD_BIN}/${OSX_BUNDLE_MAIN}" )
|
||||||
|
set( OSX_BUNDLE_INSTALL_BIN_DIR "${OSX_BUNDLE_INSTALL_DIR}/${OSX_BUNDLE_BIN_DIR}" )
|
||||||
|
set( OSX_BUNDLE_INSTALL_LIB_DIR "${OSX_BUNDLE_INSTALL_DIR}/${OSX_BUNDLE_LIB_DIR}" )
|
||||||
|
set( OSX_BUNDLE_INSTALL_KIFACE_DIR "${OSX_BUNDLE_INSTALL_DIR}/${OSX_BUNDLE_KIFACE_DIR}" )
|
||||||
|
|
||||||
# everything provided with the application bundle goes into
|
# everything provided with the application bundle goes into
|
||||||
# kicad.app/Contents/SharedSupport => accessible via GetDataDir()
|
# kicad.app/Contents/SharedSupport => accessible via GetDataDir()
|
||||||
# everything else to the .dmg image
|
# everything else to the .dmg image
|
||||||
set( KICAD_DATA ${CMAKE_INSTALL_PREFIX}/kicad.app/Contents/SharedSupport
|
set( KICAD_DATA ${OSX_BUNDLE_INSTALL_DIR}/${OSX_BUNDLE_SUP_DIR}
|
||||||
CACHE PATH "Location of KiCad data files." FORCE )
|
CACHE PATH "Location of KiCad data files." FORCE )
|
||||||
|
set( KICAD_TEMPLATE ${KICAD_DATA}/template
|
||||||
|
CACHE PATH "Location of KiCad template files." FORCE )
|
||||||
set( KICAD_PLUGINS ${KICAD_DATA}/plugins
|
set( KICAD_PLUGINS ${KICAD_DATA}/plugins
|
||||||
CACHE PATH "Location of KiCad plugins." FORCE )
|
CACHE PATH "Location of KiCad plugins." FORCE )
|
||||||
set( KICAD_DOCS doc
|
set( KICAD_DOCS doc
|
||||||
CACHE PATH "Location of KiCad documentation files." FORCE )
|
CACHE PATH "Location of KiCad documentation files." FORCE )
|
||||||
set( KICAD_TEMPLATE ${KICAD_DATA}/template
|
|
||||||
CACHE PATH "Location of KiCad template files." FORCE )
|
|
||||||
set( KICAD_DEMOS demos
|
set( KICAD_DEMOS demos
|
||||||
CACHE PATH "Location of KiCad demo files." FORCE )
|
CACHE PATH "Location of KiCad demo files." FORCE )
|
||||||
|
|
||||||
# used to set DEFAULT_FP_LIB_PATH in config.h.cmake, but then never used
|
# used to set DEFAULT_FP_LIB_PATH in config.h.cmake, but then never used
|
||||||
# set it to correct value just in case (see common.cpp)
|
# set it to correct value just in case (see common.cpp)
|
||||||
set( KICAD_FP_LIB_INSTALL_PATH "~/Library/Preferences/kicad" )
|
set( KICAD_FP_LIB_INSTALL_PATH "~/Library/Preferences/kicad" )
|
||||||
|
|
||||||
# path to binaries in single app bundle
|
|
||||||
set( OSX_BUNDLE_BUILD_BIN_DIR "${CMAKE_BINARY_DIR}/kicad/kicad.app/Contents/MacOS" )
|
|
||||||
set( OSX_BUNDLE_INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/kicad.app/Contents/MacOS" )
|
|
||||||
|
|
||||||
# plugins/libs to additionally relocate during fixup_bundle (e.g., *.kiface added in subfolders)
|
|
||||||
set( OSX_BUNDLE_PLUGINS "" )
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
mark_as_advanced( KICAD_BIN
|
mark_as_advanced( KICAD_BIN
|
||||||
|
@ -400,13 +408,7 @@ add_definitions( -DWX_COMPATIBILITY )
|
||||||
# See line 41 of CMakeModules/FindwxWidgets.cmake
|
# See line 41 of CMakeModules/FindwxWidgets.cmake
|
||||||
set( wxWidgets_CONFIG_OPTIONS --static=no )
|
set( wxWidgets_CONFIG_OPTIONS --static=no )
|
||||||
|
|
||||||
# On Apple only wxwidgets 2.9 or higher doesn't need to find aui part of base
|
find_package( wxWidgets 3.0.0 COMPONENTS gl aui adv html core net base xml REQUIRED )
|
||||||
# Seems no longer needed on wx-3
|
|
||||||
if( APPLE AND ( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES OR KICAD_SCRIPTING_WXPYTHON) )
|
|
||||||
find_package( wxWidgets 3.0.0 COMPONENTS gl adv html core net base xml REQUIRED )
|
|
||||||
else()
|
|
||||||
find_package( wxWidgets 3.0.0 COMPONENTS gl aui adv html core net base xml REQUIRED )
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Include wxWidgets macros.
|
# Include wxWidgets macros.
|
||||||
include( ${wxWidgets_USE_FILE} )
|
include( ${wxWidgets_USE_FILE} )
|
||||||
|
@ -606,7 +608,18 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set( PYTHON_DEST "${PYTHON_SITE_PACKAGE_PATH}" CACHE PATH "Python module install path." )
|
if( NOT APPLE )
|
||||||
|
set( PYTHON_DEST "${PYTHON_SITE_PACKAGE_PATH}"
|
||||||
|
CACHE PATH "Python module install path."
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
# relative path for python in bundle
|
||||||
|
set( PYTHON_LIB_DIR "python" )
|
||||||
|
# install into bundle Frameworks folder
|
||||||
|
set( PYTHON_DEST "${OSX_BUNDLE_BUILD_LIB_DIR}/${PYTHON_LIB_DIR}"
|
||||||
|
CACHE PATH "Python module install path."
|
||||||
|
)
|
||||||
|
endif()
|
||||||
mark_as_advanced( PYTHON_DEST )
|
mark_as_advanced( PYTHON_DEST )
|
||||||
message( STATUS "Python module install path: ${PYTHON_DEST}" )
|
message( STATUS "Python module install path: ${PYTHON_DEST}" )
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
Compiling KiCad on Apple Mac OS X
|
Compiling KiCad on Apple Mac OS X
|
||||||
=================================
|
=================================
|
||||||
|
|
||||||
Building on OSX is very similar to building on Linux. This document will provide a
|
Building on OSX is very similar to building on Linux. This document will provide
|
||||||
complete walk-through on what to do but it will focus on OSX specific things.
|
a complete walk-through on what to do but it will focus on OSX specific things.
|
||||||
See general documentation on non-OSX specific KiCad build switches, etc.
|
See general documentation on non-OSX specific KiCad build switches, etc.
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,25 +21,34 @@ Mandatory library dependencies needed to compile KiCad:
|
||||||
* GLEW - The OpenGL Extension Wrangler Library
|
* GLEW - The OpenGL Extension Wrangler Library
|
||||||
* cairo - 2D graphics library
|
* cairo - 2D graphics library
|
||||||
* wxWidgets - Cross-Platform GUI Library
|
* wxWidgets - Cross-Platform GUI Library
|
||||||
|
OR
|
||||||
|
wxPython - A blending of the wxWidgets C++ class library with the Python
|
||||||
|
programming language
|
||||||
|
|
||||||
Optional library dependencies, depends on used KiCad features
|
Optional library dependencies, depends on used KiCad features
|
||||||
* OpenSSL - The Open Source toolkit for SSL/TLS
|
* OpenSSL - The Open Source toolkit for SSL/TLS
|
||||||
=> Needed for github plugin
|
=> Needed for github plugin
|
||||||
|
|
||||||
All tools (except XCode, of course) and all dependencies except wxWidgets can be compiled
|
All tools (except XCode, of course) and all dependencies except wxWidgets/wxPython
|
||||||
manually, but it is advised to install them using your favorite package manager for OSX
|
can be compiled manually, but it is advised to install them using your favorite
|
||||||
like MacPorts or Homebrew.
|
package manager for OSX like MacPorts or Homebrew.
|
||||||
Depending on the package manager the development packages of the library dependencies
|
Depending on the package manager the development packages of the library
|
||||||
may have to be installed (usually something like <pkg>-dev or <pkg>-devel).
|
dependencies may have to be installed (usually something like <pkg>-dev or
|
||||||
Further, depending on the configuration of your package manager packages might have to
|
<pkg>-devel).
|
||||||
be compiled with special flags/variants to support the correct architecture. E.g., some
|
Further, depending on the configuration of your package manager packages might
|
||||||
packages of MacPorts need to have the "+universal" variant set to also include the
|
have to be compiled with special flags/variants to support the correct
|
||||||
x86_64 variant that might be chosen automatically by KiCad build process.
|
architecture. E.g., some packages of MacPorts need to have the "+universal"
|
||||||
|
variant set to also include the x86_64 variant that might be chosen
|
||||||
|
automatically by KiCad build process.
|
||||||
|
|
||||||
IMPORTANT:
|
IMPORTANT:
|
||||||
At the moment you *must not* use a wxWidgets version installed by any package manager.
|
At the moment you *must not* use a wxWidgets/wxPython version installed by any
|
||||||
KiCad on OSX needs overlay support and some other fixes, which are not yet contained in
|
package manager.
|
||||||
mainline wxWidgets sources and builds.
|
KiCad on OSX needs overlay support and some other fixes, which are not yet
|
||||||
|
contained in mainline wxWidgets/wxPython sources and builds.
|
||||||
|
If you don't use a patched wxWidgets you will get graphical artifacts (something
|
||||||
|
like a magnifying glass effect in the upper left corner of KiCad windows) or
|
||||||
|
KiCad will just crash on start (due to duplicate libraries).
|
||||||
|
|
||||||
Install now the tools and library dependencies as mentioned above.
|
Install now the tools and library dependencies as mentioned above.
|
||||||
|
|
||||||
|
@ -47,15 +56,15 @@ Install now the tools and library dependencies as mentioned above.
|
||||||
Folder Structure
|
Folder Structure
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
This documentation will use the following folder structure as an example, but it is not
|
This documentation will use the following folder structure as an example, but it
|
||||||
mandatory to do it like that:
|
is not mandatory to do it like that:
|
||||||
KiCad/
|
KiCad/
|
||||||
+-- kicad/ KiCad source folder
|
+-- kicad/ KiCad source folder
|
||||||
+-- build/ KiCad build folder
|
+-- build/ KiCad build folder
|
||||||
+-- bin/ KiCad binaries folder
|
+-- bin/ KiCad binaries folder
|
||||||
+-- wx-src/ wxWidgets source folder
|
+-- wx-src/ wxWidgets/wxPython source folder
|
||||||
+-- wx-build/ wxWidgets build folder
|
+-- wx-build/ wxWidgets/wxPython build folder
|
||||||
+-- wx-bin/ wxWidgets binaries folder
|
+-- wx-bin/ wxWidgets/wxPython binaries folder
|
||||||
|
|
||||||
|
|
||||||
Get KiCad sources
|
Get KiCad sources
|
||||||
|
@ -67,24 +76,46 @@ Create your work root "KiCad" wherever you like and sync KiCad sources to it:
|
||||||
# bzr branch lp:kicad
|
# bzr branch lp:kicad
|
||||||
|
|
||||||
|
|
||||||
Compiling wxWidgets
|
Compiling wxWidgets / wxPython
|
||||||
-------------------
|
------------------------------
|
||||||
|
|
||||||
|
If you don't intend to build KiCad with scripting support then you only need
|
||||||
|
wxWidgets, otherwise you need wxPython (which also contains wxWidgets).
|
||||||
|
|
||||||
Get wxWidgets sources from
|
Get wxWidgets sources from
|
||||||
http://www.wxwidgets.org/downloads/
|
http://www.wxwidgets.org/downloads/
|
||||||
and unpack them to the wx-src folder.
|
or wxPython sources from
|
||||||
It's recommended to use the latest stable (at the time of this writing 3.0.1) version.
|
http://www.wxpython.org/download.php#source
|
||||||
|
and unpack it to the wx-src folder.
|
||||||
|
It is recommended to use the latest stable version. As of this writing this is
|
||||||
|
3.0.2 for wxWidgets or 3.0.1.1 for wxPython.
|
||||||
|
|
||||||
Apply the patches needed for KiCad:
|
There is a little helper script osx_build_wx.sh in kicad/scripts that does all
|
||||||
# cd wx-src
|
the patching/configuring/compiling of wxWidgets or wxPython for you.
|
||||||
|
Go to your working root "KiCad" and run:
|
||||||
|
# kicad/scripts/osx_build_wx.sh wx-src wx-bin kicad "-j4"
|
||||||
|
|
||||||
|
First parameter is the source folder of wxWidgets/wxPython, second parameter the
|
||||||
|
target folder for compiled binaries, third parameter is the kicad folder, and
|
||||||
|
the last optional parameter are make options used during the build (in this
|
||||||
|
case for building with 4 jobs in parallel).
|
||||||
|
The script will automatically detect if you are compiling wxWidgets or wxPython.
|
||||||
|
CAUTION: The script will erase existing wx-build and target folders (wx-bin)
|
||||||
|
without any confirmation!
|
||||||
|
|
||||||
|
If everything went fine during compilation you will now have a working
|
||||||
|
wxWidgets/wxPython installation in the wx-bin folder.
|
||||||
|
For building KiCad it is sufficient to keep the wx-bin folder.
|
||||||
|
|
||||||
|
The script doesn't have to be used, the usual "configure/make/make install" will
|
||||||
|
also work. If you do so, be sure to apply the patches needed for KiCad:
|
||||||
# patch -p0 < ../kicad/patches/wxwidgets-3.0.0_macosx.patch
|
# patch -p0 < ../kicad/patches/wxwidgets-3.0.0_macosx.patch
|
||||||
# patch -p0 < ../kicad/patches/wxwidgets-3.0.0_macosx_bug_15908.patch
|
# patch -p0 < ../kicad/patches/wxwidgets-3.0.0_macosx_bug_15908.patch
|
||||||
# patch -p0 < ../kicad/patches/wxwidgets-3.0.0_macosx_soname.patch
|
# patch -p0 < ../kicad/patches/wxwidgets-3.0.0_macosx_soname.patch
|
||||||
|
The same patches apply both for wxWidgets and for wxPython.
|
||||||
|
|
||||||
Configure:
|
The script uses the following configure command/options for wxWidgets known to
|
||||||
# cd ..
|
work:
|
||||||
# mkdir wx-build
|
|
||||||
# cd wx-build
|
|
||||||
# ../wx-src/configure \
|
# ../wx-src/configure \
|
||||||
--prefix=`pwd`/../wx-bin \
|
--prefix=`pwd`/../wx-bin \
|
||||||
--with-opengl \
|
--with-opengl \
|
||||||
|
@ -100,31 +131,22 @@ Configure:
|
||||||
--with-expat=builtin \
|
--with-expat=builtin \
|
||||||
--without-liblzma \
|
--without-liblzma \
|
||||||
--with-macosx-version-min=10.5 \
|
--with-macosx-version-min=10.5 \
|
||||||
|
--enable-universal-binary=i386,x86_64 \
|
||||||
CPPFLAGS="-stdlib=libstdc++" \
|
CPPFLAGS="-stdlib=libstdc++" \
|
||||||
LDFLAGS="-stdlib=libstdc++" \
|
LDFLAGS="-stdlib=libstdc++" \
|
||||||
CC=clang \
|
CC=clang \
|
||||||
CXX=clang++
|
CXX=clang++
|
||||||
|
If you know what you are doing, you can of course use different settings.
|
||||||
Build & Install:
|
|
||||||
# make
|
|
||||||
... will take some time ...
|
|
||||||
# make install
|
|
||||||
|
|
||||||
If everything went fine you will now have a working wxWidgets installation in the wx-bin
|
|
||||||
folder.
|
|
||||||
For building KiCad it is sufficient to keep the wx-bin folder.
|
|
||||||
The above configuration of wxWidgets is known to work, if you know what you are doing
|
|
||||||
you of course can use different settings.
|
|
||||||
|
|
||||||
|
|
||||||
Compiling KiCad (without scripting support)
|
Compiling KiCad
|
||||||
-------------------------------------------
|
---------------
|
||||||
|
|
||||||
Change to your working root "KiCad" and create the build folder there:
|
Change to your working root "KiCad" and create the build folder there:
|
||||||
# mkdir build
|
# mkdir build
|
||||||
|
|
||||||
Configure KiCad:
|
|
||||||
# cd build
|
# cd build
|
||||||
|
|
||||||
|
Now, configure KiCad without scripting support:
|
||||||
# cmake ../kicad \
|
# cmake ../kicad \
|
||||||
-DCMAKE_C_COMPILER=clang \
|
-DCMAKE_C_COMPILER=clang \
|
||||||
-DCMAKE_CXX_COMPILER=clang++ \
|
-DCMAKE_CXX_COMPILER=clang++ \
|
||||||
|
@ -135,16 +157,42 @@ Configure KiCad:
|
||||||
-DCMAKE_INSTALL_PREFIX=../bin \
|
-DCMAKE_INSTALL_PREFIX=../bin \
|
||||||
-DCMAKE_BUILD_TYPE=Release
|
-DCMAKE_BUILD_TYPE=Release
|
||||||
|
|
||||||
Now KiCad is configured using default features/build-switches without scripting support.
|
or, configure KiCad with scripting support:
|
||||||
See Documentation/compiling/build-config.txt for a list of all CMake options available
|
# cmake ../kicad \
|
||||||
when compiling KiCad.
|
-DCMAKE_C_COMPILER=clang \
|
||||||
|
-DCMAKE_CXX_COMPILER=clang++ \
|
||||||
|
-DwxWidgets_CONFIG_EXECUTABLE=../wx-bin/bin/wx-config \
|
||||||
|
-DPYTHON_EXECUTABLE=`which python` \
|
||||||
|
-DPYTHON_SITE_PACKAGE_PATH=`pwd`/../wx-bin/lib/python2.7/site-packages \
|
||||||
|
-DKICAD_SCRIPTING=ON \
|
||||||
|
-DKICAD_SCRIPTING_MODULES=ON \
|
||||||
|
-DKICAD_SCRIPTING_WXPYTHON=ON \
|
||||||
|
-DCMAKE_INSTALL_PREFIX=../bin \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release
|
||||||
|
Note, that depending on your python version the "python2.7" part of the
|
||||||
|
"-DPYTHON_SITE_PACKAGE_PATH" variable might have to be adjusted to what has
|
||||||
|
been generated when compiling/installing wxPython. If you want to use a specific
|
||||||
|
python, you can also specify it via "-DPYTHON_EXECUTABLE" instead of using
|
||||||
|
`which python` (this one will just detect/use you default python).
|
||||||
|
|
||||||
|
Now KiCad is configured using default features/build-switches.
|
||||||
|
See Documentation/compiling/build-config.txt for a list of all CMake options
|
||||||
|
available when compiling KiCad.
|
||||||
|
|
||||||
Build & Install:
|
Build & Install:
|
||||||
# make
|
# make
|
||||||
... will take some time ...
|
... will take some time ...
|
||||||
# make install
|
# make install
|
||||||
|
|
||||||
Again, if everything went fine you will now have KiCad binaries in the "bin" folder.
|
Again, if everything went fine you will now have KiCad binaries in the "bin"
|
||||||
KiCad application can be directly run from there to test.
|
folder. KiCad application can be directly run from there to test.
|
||||||
If everything is OK, you can create a .dmg image of your "bin" folder or just copy/install
|
If everything is OK, you can create a .dmg image of your "bin" folder or just
|
||||||
the KiCad binaries and/or support files (like demos or documentation) wherever you want.
|
copy/install the KiCad binaries and/or support files (like demos or
|
||||||
|
documentation) wherever you want.
|
||||||
|
|
||||||
|
If you resync to newer versions of KiCad you don't have to rebuild wxWidgets or
|
||||||
|
other dependencies.
|
||||||
|
CMake should pick up the changes automatically and build correctly. However, it
|
||||||
|
is advised that you make a clean build to be sure (just delete the build folder
|
||||||
|
and go again through the configure/build steps).
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,11 @@ const wxString KIWAY::dso_full_path( FACE_T aFaceId )
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFileName fn = wxStandardPaths::Get().GetExecutablePath();
|
wxFileName fn = wxStandardPaths::Get().GetExecutablePath();
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
// we have the dso's in @executable_path/../Plugins in OSX bundle
|
||||||
|
fn.RemoveLastDir();
|
||||||
|
fn.AppendDir( wxT( "Plugins" ) );
|
||||||
|
#endif
|
||||||
|
|
||||||
fn.SetName( name );
|
fn.SetName( name );
|
||||||
|
|
||||||
|
|
|
@ -146,10 +146,7 @@ if( USE_KIWAY_DLLS )
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR}
|
RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR}
|
||||||
)
|
)
|
||||||
set_target_properties( cvpcb_kiface PROPERTIES
|
set_target_properties( cvpcb_kiface PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR}
|
LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR}
|
||||||
)
|
|
||||||
set( OSX_BUNDLE_PLUGINS ${OSX_BUNDLE_PLUGINS} "${OSX_BUNDLE_INSTALL_BIN_DIR}/_cvpcb.kiface"
|
|
||||||
PARENT_SCOPE
|
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
install( TARGETS cvpcb
|
install( TARGETS cvpcb
|
||||||
|
|
|
@ -297,10 +297,7 @@ if( USE_KIWAY_DLLS )
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR}
|
RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR}
|
||||||
)
|
)
|
||||||
set_target_properties( eeschema_kiface PROPERTIES
|
set_target_properties( eeschema_kiface PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR}
|
LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR}
|
||||||
)
|
|
||||||
set( OSX_BUNDLE_PLUGINS ${OSX_BUNDLE_PLUGINS} "${OSX_BUNDLE_INSTALL_BIN_DIR}/_eeschema.kiface"
|
|
||||||
PARENT_SCOPE
|
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
install( TARGETS eeschema
|
install( TARGETS eeschema
|
||||||
|
|
|
@ -140,10 +140,7 @@ if( USE_KIWAY_DLLS )
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR}
|
RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR}
|
||||||
)
|
)
|
||||||
set_target_properties( gerbview_kiface PROPERTIES
|
set_target_properties( gerbview_kiface PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR}
|
LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR}
|
||||||
)
|
|
||||||
set( OSX_BUNDLE_PLUGINS ${OSX_BUNDLE_PLUGINS} "${OSX_BUNDLE_INSTALL_BIN_DIR}/_gerbview.kiface"
|
|
||||||
PARENT_SCOPE
|
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
install( TARGETS gerbview
|
install( TARGETS gerbview
|
||||||
|
|
|
@ -81,10 +81,44 @@ install( TARGETS kicad
|
||||||
COMPONENT binary
|
COMPONENT binary
|
||||||
)
|
)
|
||||||
if( APPLE )
|
if( APPLE )
|
||||||
|
# "install( CODE ... )" will launch its own CMake, so no variables from
|
||||||
|
# this CMake instance are accessible... use helper to transfer
|
||||||
|
if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
|
||||||
|
set( SCRIPTING_HELPER "1" )
|
||||||
|
else()
|
||||||
|
set( SCRIPTING_HELPER "0" )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# make bundle relocatable
|
||||||
install( CODE "
|
install( CODE "
|
||||||
include(BundleUtilities)
|
# find all libs and modules
|
||||||
fixup_bundle(\"${OSX_BUNDLE_INSTALL_BIN_DIR}/kicad\"
|
file( GLOB BUNDLE_FIX_LIBS ${OSX_BUNDLE_INSTALL_KIFACE_DIR}/*.kiface )
|
||||||
\"${OSX_BUNDLE_PLUGINS}\"
|
if( ${SCRIPTING_HELPER} )
|
||||||
|
file( GLOB PYTHON_SCRIPTING_SO ${OSX_BUNDLE_INSTALL_LIB_DIR}/${PYTHON_LIB_DIR}/*.so )
|
||||||
|
set( BUNDLE_FIX_LIBS \${BUNDLE_FIX_LIBS} \${PYTHON_SCRIPTING_SO} )
|
||||||
|
file( GLOB PYTHON_SCRIPTING_SO ${OSX_BUNDLE_INSTALL_LIB_DIR}/${PYTHON_LIB_DIR}/wx/*.so )
|
||||||
|
set( BUNDLE_FIX_LIBS \${BUNDLE_FIX_LIBS} \${PYTHON_SCRIPTING_SO} )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# override default embedded path settings
|
||||||
|
function( gp_item_default_embedded_path_override item default_embedded_path_var )
|
||||||
|
# by default, embed things right next to the main bundle executable:
|
||||||
|
set( path \"@executable_path/../../Contents/MacOS\" )
|
||||||
|
set( overridden 0 )
|
||||||
|
|
||||||
|
# embed .dylibs right next to the main bundle executable:
|
||||||
|
if( item MATCHES \"\\\\.dylib$\" )
|
||||||
|
set( path \"@executable_path/../Frameworks\" )
|
||||||
|
set( overridden 1 )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set( \${default_embedded_path_var} \"\${path}\" PARENT_SCOPE )
|
||||||
|
endfunction(gp_item_default_embedded_path_override)
|
||||||
|
|
||||||
|
# do all the work
|
||||||
|
include( BundleUtilities )
|
||||||
|
fixup_bundle( ${OSX_BUNDLE_INSTALL_BIN_DIR}/kicad
|
||||||
|
\"\${BUNDLE_FIX_LIBS}\"
|
||||||
\"\"
|
\"\"
|
||||||
)
|
)
|
||||||
" COMPONENT Runtime
|
" COMPONENT Runtime
|
||||||
|
|
|
@ -115,10 +115,7 @@ if( USE_KIWAY_DLLS )
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR}
|
RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR}
|
||||||
)
|
)
|
||||||
set_target_properties( pl_editor_kiface PROPERTIES
|
set_target_properties( pl_editor_kiface PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR}
|
LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR}
|
||||||
)
|
|
||||||
set( OSX_BUNDLE_PLUGINS ${OSX_BUNDLE_PLUGINS} "${OSX_BUNDLE_INSTALL_BIN_DIR}/_pl_editor.kiface"
|
|
||||||
PARENT_SCOPE
|
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
install( TARGETS pl_editor
|
install( TARGETS pl_editor
|
||||||
|
|
|
@ -113,10 +113,7 @@ if( USE_KIWAY_DLLS )
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR}
|
RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR}
|
||||||
)
|
)
|
||||||
set_target_properties( pcb_calculator_kiface PROPERTIES
|
set_target_properties( pcb_calculator_kiface PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR}
|
LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR}
|
||||||
)
|
|
||||||
set( OSX_BUNDLE_PLUGINS ${OSX_BUNDLE_PLUGINS} "${OSX_BUNDLE_INSTALL_BIN_DIR}/_pcb_calculator.kiface"
|
|
||||||
PARENT_SCOPE
|
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
install( TARGETS pcb_calculator
|
install( TARGETS pcb_calculator
|
||||||
|
|
|
@ -417,7 +417,8 @@ if( KICAD_SCRIPTING_MODULES )
|
||||||
|
|
||||||
if( ${OPENMP_FOUND} )
|
if( ${OPENMP_FOUND} )
|
||||||
set_property( TARGET _pcbnew APPEND_STRING
|
set_property( TARGET _pcbnew APPEND_STRING
|
||||||
PROPERTY LINK_FLAGS " ${OpenMP_CXX_FLAGS}" )
|
PROPERTY LINK_FLAGS " ${OpenMP_CXX_FLAGS}"
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -597,10 +598,7 @@ if( USE_KIWAY_DLLS )
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR}
|
RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR}
|
||||||
)
|
)
|
||||||
set_target_properties( pcbnew_kiface PROPERTIES
|
set_target_properties( pcbnew_kiface PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR}
|
LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR}
|
||||||
)
|
|
||||||
set( OSX_BUNDLE_PLUGINS ${OSX_BUNDLE_PLUGINS} "${OSX_BUNDLE_INSTALL_BIN_DIR}/_pcbnew.kiface"
|
|
||||||
PARENT_SCOPE
|
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
install( TARGETS pcbnew
|
install( TARGETS pcbnew
|
||||||
|
@ -686,43 +684,20 @@ add_dependencies( pcbnew lib-dependencies )
|
||||||
|
|
||||||
|
|
||||||
if( KICAD_SCRIPTING )
|
if( KICAD_SCRIPTING )
|
||||||
add_custom_target( FixSwigImportsScripting ALL
|
if( NOT APPLE )
|
||||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripting/build_tools/fix_swig_imports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py
|
|
||||||
DEPENDS pcbnew
|
|
||||||
COMMENT "Fixing swig_import_helper in Kicad scripting"
|
|
||||||
)
|
|
||||||
|
|
||||||
install( FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py DESTINATION ${PYTHON_DEST} )
|
install( FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py DESTINATION ${PYTHON_DEST} )
|
||||||
|
else()
|
||||||
if( APPLE )
|
# put into bundle at build time, it is relocated at install
|
||||||
# copies all into PYTHON_DEST then all into the bundle !
|
add_custom_target( ScriptingPcbnewPyCopy ALL
|
||||||
add_custom_target( _pcbnew_py_copy ALL
|
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py" "${PYTHON_DEST}"
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py "${PYTHON_DEST}/wx-3.0-osx_cocoa/"
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py
|
||||||
DEPENDS FixSwigImportsScripting
|
COMMENT "Copying pcbnew.py into ${PYTHON_DEST}"
|
||||||
COMMENT "Copying pcbnew.py into PYTHON_DEST/wx-3.0-osx_cocoa/"
|
|
||||||
)
|
)
|
||||||
|
# scripting plugins
|
||||||
add_custom_target( pcbnew_copy_wxpython_scripting ALL
|
install( DIRECTORY ${PROJECT_SOURCE_DIR}/pcbnew/scripting/plugins/
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBWXPYTHON_ROOT}/wxPython/ ${CMAKE_SOURCE_DIR}/pcbnew/pcbnew.app/Contents/Frameworks/wxPython/
|
DESTINATION ${KICAD_DATA}/scripting/plugins
|
||||||
DEPENDS FixSwigImportsScripting _pcbnew_py_copy
|
COMPONENT binary
|
||||||
COMMENT "Copying wxPython into pcbnew.app Framework"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target( pcbnew_copy_plugins ALL
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/pcbnew/scripting/plugins ${PROJECT_SOURCE_DIR}/pcbnew/pcbnew.app/Contents/PlugIns/scripting/plugins
|
|
||||||
DEPENDS pcbnew_copy_wxpython_scripting
|
|
||||||
COMMENT "Copying plugins into bundle"
|
|
||||||
)
|
|
||||||
|
|
||||||
# fix bundle after copying wxpython, fixing and copying
|
|
||||||
add_dependencies( osx_fix_bundles pcbnew_copy_wxpython_scripting )
|
|
||||||
|
|
||||||
if ( KICAD_SCRIPTING_MODULES )
|
|
||||||
#they do more or less the same job, avoid race between them
|
|
||||||
#Cmake copy goes in error otherwise
|
|
||||||
add_dependencies( pcbnew_copy_wxpython_scripting pcbnew_copy_wxpython_module )
|
|
||||||
endif()
|
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -733,33 +708,43 @@ if( KICAD_SCRIPTING_MODULES )
|
||||||
COMMENT "Fixing swig_import_helper in Kicad scripting modules"
|
COMMENT "Fixing swig_import_helper in Kicad scripting modules"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if( NOT APPLE )
|
||||||
install( FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py DESTINATION ${PYTHON_DEST} )
|
install( FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py DESTINATION ${PYTHON_DEST} )
|
||||||
|
else()
|
||||||
|
# put everything into bundle at build time, it is relocated at install
|
||||||
|
add_custom_target( ScriptingModulesPcbnewPyCopy ALL
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py" "${PYTHON_DEST}"
|
||||||
|
DEPENDS FixSwigImportsModuleScripting
|
||||||
|
COMMENT "Copying pcbnew.py into ${PYTHON_DEST}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
if( MINGW )
|
if( MINGW )
|
||||||
install( FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.pyd DESTINATION ${PYTHON_DEST} )
|
install( FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.pyd DESTINATION ${PYTHON_DEST} )
|
||||||
|
elseif( APPLE )
|
||||||
|
# put everything into bundle at build time, it is relocated at install
|
||||||
|
add_custom_target( ScriptingModulesPcbnewSoCopy ALL
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.so" "${PYTHON_DEST}"
|
||||||
|
DEPENDS _pcbnew
|
||||||
|
COMMENT "Copying _pcbnew.so into ${PYTHON_DEST}"
|
||||||
|
)
|
||||||
else()
|
else()
|
||||||
install( FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.so DESTINATION ${PYTHON_DEST} )
|
install( FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.so DESTINATION ${PYTHON_DEST} )
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if( APPLE )
|
if( APPLE )
|
||||||
# copies needed files into PYTHON_DEST then copy all into the bundle !
|
if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
|
||||||
add_custom_target( _pcbnew_so_copy ALL
|
# find wx-X.Y-osx_cocoa path below PYTHON_SITE_PACKAGE_PATH
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.so "${PYTHON_DEST}"
|
file( GLOB WXPYTHON_PATH ${PYTHON_SITE_PACKAGE_PATH}/wx-?.?-osx_cocoa )
|
||||||
DEPENDS _pcbnew FixSwigImportsModuleScripting
|
if( NOT WXPYTHON_PATH )
|
||||||
COMMENT "Copying _pcbnew.so into PYTHON_DEST"
|
message( FATAL_ERROR "Could not find 'wx-?.?-osx_cocoa' in '${PYTHON_SITE_PACKAGE_PATH}'" )
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_target( pcbnew_copy_wxpython_module ALL
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBWXPYTHON_ROOT}/wxPython/ ${PROJECT_SOURCE_DIR}/pcbnew/pcbnew.app/Contents/Frameworks/wxPython/
|
|
||||||
DEPENDS FixSwigImportsModuleScripting _pcbnew_so_copy
|
|
||||||
COMMENT "Copying wxPython into pcbnew.app Frameworks"
|
|
||||||
)
|
|
||||||
|
|
||||||
if( KICAD_BUILD_DYNAMIC )
|
|
||||||
# Tell that we have to run osx_fix_bundles fix after building _pcbnew and migrating wxPython
|
|
||||||
add_dependencies( osx_fix_bundles pcbnew_copy_wxpython_module )
|
|
||||||
add_dependencies( osx_fix_bundles _pcbnew )
|
|
||||||
endif()
|
endif()
|
||||||
|
# copy contents
|
||||||
|
add_custom_target( ScriptingWxpythonCopy ALL
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_directory "${WXPYTHON_PATH}" "${PYTHON_DEST}"
|
||||||
|
COMMENT "Copying wxPython into ${PYTHON_DEST}"
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,7 @@ static bool scriptingSetup()
|
||||||
{
|
{
|
||||||
wxString path_frag;
|
wxString path_frag;
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
// force python environment under Windows:
|
// force python environment under Windows:
|
||||||
const wxString python_us( "python27_us" );
|
const wxString python_us( "python27_us" );
|
||||||
|
|
||||||
|
@ -261,32 +261,36 @@ static bool scriptingSetup()
|
||||||
// [KICAD_PATH]/scripting/plugins
|
// [KICAD_PATH]/scripting/plugins
|
||||||
// Add this default search path:
|
// Add this default search path:
|
||||||
path_frag = Pgm().GetExecutablePath() + wxT( "scripting/plugins" );
|
path_frag = Pgm().GetExecutablePath() + wxT( "scripting/plugins" );
|
||||||
#else
|
#elif defined __WXMAC__
|
||||||
|
// User plugin folder is ~/Library/Application Support/kicad/scripting/plugins
|
||||||
|
path_frag = wxStandardPaths::Get().GetUserDataDir() + wxT( "/scripting/plugins" );
|
||||||
|
|
||||||
|
// Add default paths to PYTHONPATH
|
||||||
|
wxString pypath;
|
||||||
|
// User scripting folder (~/Library/Application Support/kicad/scripting/plugins)
|
||||||
|
pypath = wxStandardPaths::Get().GetUserDataDir() + wxT( "/scripting/plugins" );
|
||||||
|
// Machine scripting folder (/Library/Application Support/kicad/scripting/plugins)
|
||||||
|
pypath += wxT( ":/Library/Application Support/kicad/scripting/plugins" );
|
||||||
|
// Bundle scripting folder (<kicad.app>/Contents/SharedSupport/scripting/plugins)
|
||||||
|
pypath += wxT( ":" ) + wxStandardPaths::Get().GetDataDir() + wxT( "/scripting/plugins" );
|
||||||
|
// Bundle wxPython folder (<kicad.app>/Contents/Frameworks/python)
|
||||||
|
wxFileName fn = wxFileName( wxStandardPaths::Get().GetExecutablePath() );
|
||||||
|
fn.RemoveLastDir();
|
||||||
|
fn.AppendDir( wxT( "Frameworks" ) );
|
||||||
|
fn.AppendDir( wxT( "python" ) );
|
||||||
|
pypath += wxT( ":" ) + fn.GetPath();
|
||||||
|
// Original content of PYTHONPATH
|
||||||
|
if( wxGetenv("PYTHONPATH") != NULL )
|
||||||
|
{
|
||||||
|
pypath += wxT( ":" ) + wxString( wxGetenv("PYTHONPATH") );
|
||||||
|
}
|
||||||
|
|
||||||
|
// set $PYTHONPATH
|
||||||
|
wxSetEnv( "PYTHONPATH", pypath );
|
||||||
|
#else
|
||||||
// Add this default search path:
|
// Add this default search path:
|
||||||
path_frag = wxT( "/usr/local/kicad/bin/scripting/plugins" );
|
path_frag = wxT( "/usr/local/kicad/bin/scripting/plugins" );
|
||||||
|
#endif
|
||||||
#ifdef __WXMAC__
|
|
||||||
// OSX
|
|
||||||
// System Library first
|
|
||||||
// User Library then
|
|
||||||
// (TODO) Bundle package ? where to place ? Shared Support ?
|
|
||||||
path_frag = wxT( "/Library/Application Support/kicad/scripting" );
|
|
||||||
path_frag = wxString( wxGetenv("HOME") ) + wxT( "/Library/Application Support/kicad/scripting" );
|
|
||||||
|
|
||||||
// Get pcbnew.app/Contents directory
|
|
||||||
wxFileName bundledir( wxStandardPaths::Get().GetExecutablePath() ) ;
|
|
||||||
bundledir.RemoveLastDir();
|
|
||||||
|
|
||||||
// Prepend in PYTHONPATH the content of the bundle libraries !
|
|
||||||
wxSetEnv( "PYTHONPATH", ((wxGetenv("PYTHONPATH") != NULL ) ? (wxString(wxGetenv("PYTHONPATH")) + ":") : wxString("")) +
|
|
||||||
bundledir.GetPath() +
|
|
||||||
"/Frameworks/wxPython/lib/python2.6/site-packages/wx-3.0-osx_cocoa" + ":" +
|
|
||||||
"/Library/Application Support/kicad/" + ":" +
|
|
||||||
bundledir.GetPath() + "/PlugIns" + ":" +
|
|
||||||
wxString( wxGetenv("HOME") ) + "/Library/Application Support/kicad/"
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// On linux and osx, 2 others paths are
|
// On linux and osx, 2 others paths are
|
||||||
// [HOME]/.kicad_plugins/
|
// [HOME]/.kicad_plugins/
|
||||||
|
|
|
@ -0,0 +1,162 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Small helper script for patching/compiling wxWidgets/wxPython on OSX
|
||||||
|
#
|
||||||
|
# Params
|
||||||
|
# $1 wxWidgets/wxPython source folder (relative to current dir)
|
||||||
|
# $2 Target bin folder
|
||||||
|
# $3 KiCad source folder (relative to current dir)
|
||||||
|
# $4 Make options (e.g., "-j4")
|
||||||
|
|
||||||
|
createPaths() {
|
||||||
|
echo "*** Creating/wiping build and bin folder..."
|
||||||
|
|
||||||
|
rm -rf wx-build
|
||||||
|
rm -rf $1
|
||||||
|
mkdir wx-build
|
||||||
|
mkdir $1
|
||||||
|
}
|
||||||
|
|
||||||
|
doPatch() {
|
||||||
|
cwd=$(pwd)
|
||||||
|
cd $1
|
||||||
|
|
||||||
|
patchcmd="patch -p0 -RN --dry-run < $cwd/$2"
|
||||||
|
eval $patchcmd &> /dev/null
|
||||||
|
if [ $? -eq 0 ];
|
||||||
|
then
|
||||||
|
echo "*** Patch '$2' already applied, skipping..."
|
||||||
|
else
|
||||||
|
echo "*** Applying patch '$2'..."
|
||||||
|
|
||||||
|
patch -p0 < $cwd/$2
|
||||||
|
if [ $? -ne 0 ];
|
||||||
|
then
|
||||||
|
cd $cwd
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd $cwd
|
||||||
|
}
|
||||||
|
|
||||||
|
wxWidgets_configure() {
|
||||||
|
echo "*** Configuring wxWidgets..."
|
||||||
|
cwd=$(pwd)
|
||||||
|
cd wx-build
|
||||||
|
|
||||||
|
../$1/configure \
|
||||||
|
--prefix=$cwd/$2 \
|
||||||
|
--with-opengl \
|
||||||
|
--enable-aui \
|
||||||
|
--enable-utf8 \
|
||||||
|
--enable-html \
|
||||||
|
--enable-stl \
|
||||||
|
--with-libjpeg=builtin \
|
||||||
|
--with-libpng=builtin \
|
||||||
|
--with-regex=builtin \
|
||||||
|
--with-libtiff=builtin \
|
||||||
|
--with-zlib=builtin \
|
||||||
|
--with-expat=builtin \
|
||||||
|
--without-liblzma \
|
||||||
|
--with-macosx-version-min=10.5 \
|
||||||
|
--enable-universal-binary=i386,x86_64 \
|
||||||
|
CPPFLAGS="-stdlib=libstdc++" \
|
||||||
|
LDFLAGS="-stdlib=libstdc++" \
|
||||||
|
CC=clang \
|
||||||
|
CXX=clang++
|
||||||
|
if [ $? -ne 0 ];
|
||||||
|
then
|
||||||
|
cd ..
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
}
|
||||||
|
|
||||||
|
wxWidgets_buildInst() {
|
||||||
|
echo "*** Building wxWidgets..."
|
||||||
|
cd wx-build
|
||||||
|
|
||||||
|
make $1 install
|
||||||
|
if [ $? -ne 0 ];
|
||||||
|
then
|
||||||
|
cd ..
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
}
|
||||||
|
|
||||||
|
wxPython_buildInst() {
|
||||||
|
cwd=$(pwd)
|
||||||
|
cd $1/wxPython
|
||||||
|
|
||||||
|
# build params
|
||||||
|
WXPYTHON_BUILD_OPTS="WX_CONFIG=$cwd/$2/bin/wx-config \
|
||||||
|
BUILD_BASE=$cwd/wx-build \
|
||||||
|
UNICODE=1 \
|
||||||
|
WXPORT=osx_cocoa"
|
||||||
|
|
||||||
|
# build
|
||||||
|
python setup.py build_ext $WXPYTHON_BUILD_OPTS
|
||||||
|
if [ $? -ne 0 ];
|
||||||
|
then
|
||||||
|
cd $cwd
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# install
|
||||||
|
python setup.py install --prefix=$cwd/$2 $WXPYTHON_BUILD_OPTS
|
||||||
|
if [ $? -ne 0 ];
|
||||||
|
then
|
||||||
|
cd $cwd
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd $cwd
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# check parameters
|
||||||
|
if [ "$#" -lt 3 ];
|
||||||
|
then
|
||||||
|
echo "OSX wxWidgets/wxPython build script"
|
||||||
|
echo
|
||||||
|
echo "Usage:"
|
||||||
|
echo " osx_build_wx.sh <src> <bin> <kicad> <makeopts>"
|
||||||
|
echo " <src> wxWidgets/wxPython source folder"
|
||||||
|
echo " <bin> Destination folder"
|
||||||
|
echo " <kicad> KiCad folder"
|
||||||
|
echo " <makeopts> Optional: make options for building wxWidgets (e.g., -j4)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# create build paths
|
||||||
|
createPaths "$2"
|
||||||
|
|
||||||
|
# patch wxWidgets sources
|
||||||
|
echo "*** Patching wxWidgets..."
|
||||||
|
doPatch "$1" "$3/patches/wxwidgets-3.0.0_macosx.patch"
|
||||||
|
doPatch "$1" "$3/patches/wxwidgets-3.0.0_macosx_bug_15908.patch"
|
||||||
|
doPatch "$1" "$3/patches/wxwidgets-3.0.0_macosx_soname.patch"
|
||||||
|
|
||||||
|
# configure and build wxWidgets
|
||||||
|
wxWidgets_configure "$1" "$2"
|
||||||
|
wxWidgets_buildInst "$4"
|
||||||
|
|
||||||
|
# check if source is wxPython
|
||||||
|
if [ -d $1/wxPython ];
|
||||||
|
then
|
||||||
|
echo "*** Source is wxPython, now building wxPython stuff..."
|
||||||
|
wxPython_buildInst "$1" "$2"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# remove build dir
|
||||||
|
echo "*** Removing build folder"
|
||||||
|
rm -rf wx-build
|
||||||
|
|
||||||
|
# done
|
||||||
|
echo "*** Finished building!"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue