[MacOSX] Automating building for OSX with KICAD_SCRIPTING, see Documentation/compiling/mac-osx.txt

This commit is contained in:
Marco Serantoni 2014-02-07 19:53:54 +01:00
parent 34f6ca1b20
commit eb34364d89
8 changed files with 443 additions and 149 deletions

View File

@ -58,9 +58,16 @@ option( KICAD_SCRIPTING_WXPYTHON
)
option( KICAD_BUILD_STATIC
"Builds Kicad and all libraries static (except wx-widgets)"
"Builds Kicad and all libraries static"
)
option( KICAD_BUILD_DYNAMIC
"Builds Kicad and all libraries dynamic (required for wxPython)"
)
# WARNING: KiCad developers strongly advise you to build Boost with supplied patches,
# as it is known to work with KiCad. Other versions may contain bugs that may result
# WARNING: KiCad developers strongly advise you to build Boost with supplied patches,
# as it is known to work with KiCad. Other versions may contain bugs that may result
# in KiCad errors.
@ -334,6 +341,14 @@ add_definitions(-DWX_COMPATIBILITY)
find_package( OpenGL QUIET )
check_find_package_result( OPENGL_FOUND "OpenGL" )
add_custom_target( lib-wxpython )
include( download_pcre )
include( download_swig )
include( download_wxpython )
add_dependencies( lib-wxpython pcre )
add_dependencies( lib-wxpython swig )
add_dependencies( lib-wxpython libwxpython )
if( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC )
#set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so;.dylib;.dll")
@ -348,7 +363,6 @@ if( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC )
if( KICAD_BUILD_DYNAMIC )
message(STATUS "KICAD_BUILD_DYNAMIC set")
# TODO - Library packaging/relocation
endif()
add_custom_target( lib-dependencies
@ -357,8 +371,28 @@ if( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC )
include( download_libpng )
if( KICAD_SCRIPTING_WXPYTHON )
message( FATAL_ERROR "KICAD_BUILD_* and SCRIPTING Not Implemented Yet!" )
if( KICAD_SCRIPTING OR KICAD_SCRIPTING_WXPYTHON OR KICAD_SCRIPTING_MODULES )
set( SWIG_EXECUTABLE ${SWIG_ROOT}/bin/swig )
set( SWIG_INCLUDE ${SWIG_ROOT}/include )
set( PYTHON_DEST ${LIBWXPYTHON_ROOT}/wxPython/lib/python2.6/site-packages )
if( NOT EXISTS ${SWIG_EXECUTABLE} )
set(KICAD_SCRIPTING CACHE OFF FORCE "Disabling KICAD_SCRIPTING")
message( STATUS "KICAD_SCRIPTING Enabled but SWIG not found, please disable and before reenabling execute: make lib-wxpython")
message( FATAL_ERROR "Missing SWIG!")
endif()
message(STATUS "SWIG_EXECUTABLE: ${SWIG_EXECUTABLE}")
set( PYTHON_EXECUTABLE /usr/bin/python2.6 )
set( PYTHON_DEST ${LIBWXPYTHON_ROOT}/wxPython/lib/python2.6/site-packages )
set(wxWidgets_BIN_DIR ${LIBWXPYTHON_ROOT}/bin/wxrc )
set(wxWidgets_CONFIG_EXECUTABLE ${LIBWXPYTHON_ROOT}/bin/wx-config )
set(wxWidgets_INCLUDE_DIRS ${LIBWXPYTHON_ROOT}/include/wx-3.0 )
set(wxWidgets_LIBRARY_DIRS ${LIBWXPYTHON_ROOT}/lib )
add_dependencies( lib-dependencies libwxpython )
else()
include( download_wxwidgets )
add_dependencies( lib-dependencies libwx )
@ -421,7 +455,7 @@ endif()
# On Apple only wxwidgets 2.9 or higher doesn't need to find aui part of base
# Seems no more needed on wx-3
if( APPLE AND NOT (KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC) )
if( APPLE AND ( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES OR KICAD_SCRIPTING_WXPYTHON) )
find_package( wxWidgets COMPONENTS gl adv html core net base xml QUIET )
else()
find_package( wxWidgets COMPONENTS gl aui adv html core net base xml QUIET )

View File

@ -0,0 +1,73 @@
# This program source code file is part of KICAD, a free EDA CAD application.
#
# Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
# Copyright (C) 2013 Kicad Developers, see AUTHORS.txt for contributors.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, you may find one here:
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# or you may search the http://www.gnu.org website for the version 2 license,
# or you may write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
# Downloads and builds PCRE
#-----<configure>----------------------------------------------------------------
set( PCRE_RELEASE 8.34 )
set( PCRE_MD5 eb34b2c9c727fd64940d6fd9a00995eb ) # re-calc this on every RELEASE change
# The boost headers [and static libs if built] go here, at the top of KiCad
# source tree in boost_root.
set( PCRE_ROOT "${PROJECT_SOURCE_DIR}/pcre_root" )
#-----</configure>---------------------------------------------------------------
find_package( BZip2 REQUIRED )
set( PREFIX ${DOWNLOAD_DIR}/pcre )
if (APPLE)
if( CMAKE_OSX_ARCHITECTURES )
set( PCRE_CFLAGS "CFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.5" )
set( PCRE_CXXFLAGS "CXXFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.5" )
set( PCRE_LDFLAGS "LDFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.5" )
endif( CMAKE_OSX_ARCHITECTURES )
endif(APPLE)
# There is a Bazaar 'boost scratch repo' in <SOURCE_DIR>/boost and after committing pristine
# download, the patch is applied. This lets you regenerate a new patch at any time
# easily, simply by editing the working tree in <SOURCE_DIR> and doing "bzr diff" in there.
ExternalProject_Add( pcre
PREFIX "${PREFIX}"
DOWNLOAD_DIR "${DOWNLOAD_DIR}"
URL http://sourceforge.net/projects/pcre/files/pcre/${PCRE_RELEASE}/pcre-${PCRE_RELEASE}.tar.gz
URL_MD5 ${PCRE_MD5}
STAMP_DIR "${PREFIX}"
#SOURCE_DIR "${PREFIX}"
BUILD_IN_SOURCE 1
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${PCRE_ROOT}"
#PATCH_COMMAND "true"
CONFIGURE_COMMAND ./configure --prefix=${PCRE_ROOT} ${PCRE_CFLAGS} ${PCRE_CXXFLAGS} ${PCRE_LDFLAGS} --disable-dependency-tracking
#BINARY_DIR "${PREFIX}"
BUILD_COMMAND $(MAKE)
INSTALL_DIR "${PCRE_ROOT}"
INSTALL_COMMAND $(MAKE) install
)

View File

@ -0,0 +1,77 @@
# This program source code file is part of KICAD, a free EDA CAD application.
#
# Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
# Copyright (C) 2013 Kicad Developers, see AUTHORS.txt for contributors.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, you may find one here:
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# or you may search the http://www.gnu.org website for the version 2 license,
# or you may write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
# Downloads and builds SWIG
#-----<configure>----------------------------------------------------------------
set( SWIG_RELEASE 2.0.11 )
set( SWIG_MD5 291ba57c0acd218da0b0916c280dcbae ) # re-calc this on every RELEASE change
# The boost headers [and static libs if built] go here, at the top of KiCad
# source tree in boost_root.
set( SWIG_ROOT "${PROJECT_SOURCE_DIR}/swig_root" )
#-----</configure>---------------------------------------------------------------
find_package( BZip2 REQUIRED )
set( PREFIX ${DOWNLOAD_DIR}/swig )
if (APPLE)
if( CMAKE_OSX_ARCHITECTURES )
set( SWIG_CFLAGS "CFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.5" )
set( SWIG_CXXFLAGS "CXXFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.5" )
set( SWIG_LDFLAGS "LDFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.5" )
set( SWIG_PYTHON "--with-python=/usr/bin/python2.6" )
endif( CMAKE_OSX_ARCHITECTURES )
endif(APPLE)
# <SOURCE_DIR> = ${PREFIX}/src/glew
# There is a Bazaar 'boost scratch repo' in <SOURCE_DIR>/boost and after committing pristine
# download, the patch is applied. This lets you regenerate a new patch at any time
# easily, simply by editing the working tree in <SOURCE_DIR> and doing "bzr diff" in there.
ExternalProject_Add( swig
PREFIX "${PREFIX}"
DOWNLOAD_DIR "${DOWNLOAD_DIR}"
URL http://sourceforge.net/projects/swig/files/swig/swig-${SWIG_RELEASE}/swig-${SWIG_RELEASE}.tar.gz
URL_MD5 ${SWIG_MD5}
STAMP_DIR "${PREFIX}"
DEPENDS pcre
#SOURCE_DIR "${PREFIX}"
BUILD_IN_SOURCE 1
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${SWIG_ROOT}"
#PATCH_COMMAND "true"
CONFIGURE_COMMAND ./configure --prefix=${SWIG_ROOT} --with-pcre-prefix=${PCRE_ROOT} ${SWIG_CFLAGS} ${SWIG_LDFLAGS} ${SWIG_CXXFLAGS} ${SWIG_PYTHON}
#BINARY_DIR "${PREFIX}"
BUILD_COMMAND $(MAKE)
INSTALL_DIR "${SWIG_ROOT}"
INSTALL_COMMAND $(MAKE) install
)

View File

@ -0,0 +1,117 @@
# This program source code file is part of KICAD, a free EDA CAD application.
#
# Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
# Copyright (C) 2013 Kicad Developers, see AUTHORS.txt for contributors.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, you may find one here:
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# or you may search the http://www.gnu.org website for the version 2 license,
# or you may write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
# Downloads and builds LIBWXPYTHON
#-----<configure>----------------------------------------------------------------
set( LIBWXPYTHON_RELEASE 3.0.0.0 )
set( LIBWXPYTHON_MD5 f5e32c7d85dc261ba777e113c3b7e365 ) # re-calc this on every RELEASE change
set( LIBWXPYTHON_ROOT "${PROJECT_SOURCE_DIR}/libwxpython_root" )
#-----</configure>---------------------------------------------------------------
find_package( BZip2 REQUIRED )
set( PREFIX ${DOWNLOAD_DIR}/libwxpython )
set( LIBWXPYTHON_EXEC python )
set( LIBWXPYTHON_OPTS --wxpy_installdir=${LIBWXPYTHON_ROOT}/wxPython )
if (APPLE)
SET( LIBWXPYTHON_EXEC python2.6 )
SET( LIBWXPYTHON_OPTS ${LIBWXPYTHON_OPTS} --osx_cocoa )
#SET( LIBWXPYTHON_OPTS ${LIBWXPYTHON_OPTS} --mac_framework --mac_framework_prefix=${LIBWXPYTHON_ROOT}/wxPython )
if( CMAKE_OSX_ARCHITECTURES )
STRING(REGEX REPLACE " -arch " "," LIBWXPYTHON_ARCHITECTURES ${CMAKE_OSX_ARCHITECTURES})
SET( LIBWXPYTHON_OPTS ${LIBWXPYTHON_OPTS} --mac_arch=${LIBWXPYTHON_ARCHITECTURES})
endif( CMAKE_OSX_ARCHITECTURES )
endif(APPLE)
if ( KICAD_BUILD_STATIC )
#message fail
set( LIBWXPYTHON_BUILDTYPE "--disable-shared" )
endif( KICAD_BUILD_STATIC )
# <SOURCE_DIR> = ${PREFIX}/src/libwx
# There is a Bazaar 'boost scratch repo' in <SOURCE_DIR>/boost and after committing pristine
# download, the patch is applied. This lets you regenerate a new patch at any time
# easily, simply by editing the working tree in <SOURCE_DIR> and doing "bzr diff" in there.
ExternalProject_Add( libwxpython
PREFIX "${PREFIX}"
DOWNLOAD_DIR "${DOWNLOAD_DIR}"
URL http://sourceforge.net/projects/wxpython/files/wxPython/${LIBWXPYTHON_RELEASE}/wxPython-src-${LIBWXPYTHON_RELEASE}.tar.bz2
URL_MD5 ${LIBWXPYTHON_MD5}
STAMP_DIR "${PREFIX}"
BUILD_IN_SOURCE 1
PATCH_COMMAND bzr revert
COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/wxpython-3.0.0_macosx.patch"
#COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/wxwidgets-3.0.0_macosx_bug_15908.patch"
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${LIBWXPYTHON_ROOT}"
COMMAND ${LIBWXPYTHON_EXEC} wxPython/build-wxpython.py --clean
CONFIGURE_COMMAND ${LIBWXPYTHON_EXEC} wxPython/build-wxpython.py --prefix=/Users/marco/Development/product/libwxpython_root --unicode --install ${LIBWXPYTHON_OPTS}
#BINARY_DIR "${PREFIX}"
BUILD_COMMAND true
INSTALL_DIR "${LIBWXPYTHON_ROOT}"
INSTALL_COMMAND true
)
ExternalProject_Add_Step( libwxpython bzr_commit_libwxpython
COMMAND bzr ci -q -m pristine <SOURCE_DIR>
COMMENT "committing pristine libwxpython files to 'libwxpython scratch repo'"
DEPENDERS patch
)
ExternalProject_Add_Step( libwxpython bzr_add_libwxpython
COMMAND bzr add -q ${PREFIX}/src/libwxpython
COMMENT "adding pristine libwxpython files to 'libwxpython scratch repo'"
DEPENDERS bzr_commit_libwxpython
)
ExternalProject_Add_Step( libwxpython bzr_init_libwxpython
COMMAND bzr init -q <SOURCE_DIR>
COMMENT "creating 'libwxpython scratch repo' specifically for libwx to track libwx patches"
DEPENDERS bzr_add_libwxpython
DEPENDEES download
)
######
# Now is time to search what we have built
######
ExternalProject_Add_Step( libwxpython libwxpython_recursive_message
COMMAND cmake .
COMMENT "*** RERUN CMAKE - wxWidgets built, now reissue a cmake to build Kicad"
DEPENDEES install
)

View File

@ -1,8 +1,10 @@
Compiling KiCad on Apple Mac OS X
=================================
First written: 2010-01-31
Last edited by: Jerry Jacobs <xor.gate.engineering[at]gmail[dot]com>
by: Jerry Jacobs <xor.gate.engineering[at]gmail[dot]com>
Modified at: 2014-02-07
by: Marco Serantoni <marco.serantoni[at]gmail[dot]com>
Snow Leopard
------------
@ -11,158 +13,48 @@ Requirements
* XCode Tools (http://developer.apple.com/tools/xcode)
* bzr (bazaar)
* CMake (http://www.cmake.org)
* wxWidgets 2.9 (http://www.wxwidgets.org/downloads)
* Doxygen (http://www.doxygen.nl)
* ccache (http://www.macports.org)
The build of Kicad for OSX is now easier than before.
The building system will download and compile the needed libraries for you
patching them accordly to the needs.
Building wxWidgets 2.9 Universal
Building Kicad with no support for Scripting
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To check if your tools and libraries are installed check with file for architectures.
user@macosx$ file /Developer/SDKs/MacOSX10.5.sdk/usr/lib/libSystem.dylib
The building needs to know if you want a static binary or a dynamic one
Just set ONE of those two options KICAD_BUILD_STATIC or KICAD_BUILD_DYNAMIC
If you set KICAD_BUILD_DYNAMIC the building system will build all and include
the needed libraries for each executable in its bundle
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libSystem.dylib: Mach-O universal binary with 4 architectures
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libSystem.dylib (for architecture ppc7400): Mach-O dynamically linked shared library stub ppc
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libSystem.dylib (for architecture ppc64)Mach-O 64-bit dynamically linked shared library stub ppc64
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libSystem.dylib (for architecture i386):Mach-O dynamically linked shared library stub i386
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libSystem.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library stub x86_64
Building Kicad with support for Scripting
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Due some problems with some dependencies the build of this kind of binary is a bit
more complex, you should initially set KICAD_BUILD_DYNAMIC
then issue for example
You need the architectures what you are compiling for !
cmake -DKICAD_BUILD_DYNAMIC=ON
make lib-wxpython
If you have problems that the 64bits library is not build you should add in
the configure file:
After successfully building you can set your KICAD_SCRIPTING* options (for example):
At time of writing (2009-01-16) this is on line 18381
changing this: OSX_UNIV_OPTS="-arch ppc -arch i386"
into this: OSX_UNIV_OPTS="-arch ppc -arch i386 -arch x86_64"
cmake -DKICAD_SCRIPTING=ON -DKICAD_SCRIPTING_WXPYTHON=ON
make
Building a universal monolib wxWidgets 2.9 with the following parameters:
./configure --enable-unicode=yes --enable-shared=no --enable-monolithic --with-opengl --with-expat=builtin --enable-universal_binary --enable-aui --enable-debug --with-osx_cocoa --with-macosx-sdk=/Developer/SDKs/MacOSX10.5.sdk/ --prefix=/opt/wxwidgets/<rev>
The system will build all accordling your choices and package all in the bundle
I know bundles will be huge, but those will be autosufficient.
<rev> Should be subsituded with the revision from SVN
Building Kicad for other processors or Universal binaries
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Then you should a message like this:
I wish remember you should set the processor like
Configured wxWidgets 2.9.2 for `i686-apple-darwin10.4.0'
cmake -DCMAKE_OSX_ARCHITECTURES="x86_64"
Which GUI toolkit should wxWidgets use? osx_cocoa
Should wxWidgets be compiled into single library? yes
Should wxWidgets be linked as a shared library? no
Should wxWidgets support Unicode? yes (using UTF-8)
What level of wxWidgets compatibility should be enabled?
wxWidgets 2.6 no
wxWidgets 2.8 yes
Which libraries should wxWidgets use?
STL no
jpeg builtin
png builtin
regex builtin
tiff builtin
zlib sys
expat builtin
libmspack no
sdl no
for other platforms
cmake -DCMAKE_OSX_ARCHITECTURES="x86_64 -arch i386"
cmake -DCMAKE_OSX_ARCHITECTURES="x86_64 -arch i386 -arch ppc"
If you don't need the debugging symbols then you can remove the --enable-debug parameter.
Compiling and installing:
make
sudo make install
Move the old Mac OS X wxconfig and symlink it to the new compiled 2.9
sudo mv /usr/bin/wx-config /usr/bin/wx-config.osx
sudo ln -s /opt/wxwidgets-svn/bin/wx-config /usr
Building KiCad
~~~~~~~~~~~~~~
Extract the sources or get them from subversion.
user@mac-osx$ cmake .
Regarding Kicad the only things i've changed are the Variables
in the generated CMakeCache.txt
It depends on which CMake version you use:
//Flags used by the compiler during all build types.
//This fixes also BOOST macro errors
CMAKE_CXX_FLAGS:STRING=-D__ASSERTMACROS__
//Build architectures for OSX
CMAKE_OSX_ARCHITECTURES:STRING=x86_64 -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.5.sdk/ -mmacosx-version-min=10.5
//The product will be built against the headers and libraries located
// inside the indicated SDK.
CMAKE_OSX_SYSROOT:PATH=/Developer/SDKs/MacOSX10.5.sdk
//Minimum OS X version to target for deployment (at runtime); newer
// APIs weak linked. Set to empty string for default value.
CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.5
Or:
CMAKE_OSX_ARCHITECTURE = x86_64 -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.5.sdk/ -mmacosx-version-min=10.5
CMAKE_OSX_SYSROOT = /Developer/SDKs/MacOSX10.5.sdk
CMAKE_CXX_FLAGS = -D__ASSERTMACROS__
Then we invoke make:
user@mac-osx$ make
It is also possible to give all the options on the commandline and not to edit the CMakeCache.txt. This is a oneliner for Leopard and up:
cmake ~/Repositories/testing -DCMAKE_OSX_ARCHITECTURES="i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6" -DCMAKE_CXX_FLAGS="-D__ASSERTMACROS__" -DCMAKE_OSX_SYSROOT="/Developer/SDKs/MacOSX10.6.sdk"
Optional compiler cache
~~~~~~~~~~~~~~~~~~~~~~~
If you (re)compile often, you would love to use cache. The best is to install it using macports and set the libexec symlink
directory of ccache in your PATH variable.
Then start with a clean directory and invoke cmake, make sure that the C++ compiler points to /opt/local/libexec/ccache/g++
Further reading at http://trac.macports.org/wiki/howto/ccache
Known Problems
~~~~~~~~~~~~~~
In file included from
/temp/kicad-sources/boost_1_38_0/boost/ptr_container/detail/reversible_ptr_container.hpp:22In
file included from
/temp/kicad-sources/boost_1_38_0/boost/ptr_container/detail/reversible_ptr_container.hpp:22,
from
/temp/kicad-sources/boost_1_38_0/boost/ptr_container/ptr_sequence_adapter.hpp:20,
from
/temp/kicad-sources/boost_1_38_0/boost/ptr_container/ptr_vector.hpp:20,
from
/temp/kicad-sources/kicad/include/board_item_struct.h:9,
from /temp/kicad-sources/kicad/include/pcbstruct.h:10,
from /temp/kicad-sources/kicad/3d-viewer/3d_viewer.h:29,
from /temp/kicad-sources/kicad/3d-viewer/3d_aux.cpp:23:
/temp/kicad-sources/boost_1_38_0/boost/ptr_container/detail/static_move_ptr.hpp:154:50:
error: macro "check" passed 2 arguments, but takes just 1
CMAKE_CXX_FLAGS = -D__ASSERTMACROS__ fixes this :-)
configure:18585: gcc -isysroot /Developer/SDKs/MacOSX10.5.sdk/ -mmacosx-version-min=10.5 -o conftest -arch i386 -arch x86_64 -arch ppc -arch i386 -arch x86_64 -arch ppc conftest.c >&5
ld: warning: in /Developer/SDKs/MacOSX10.5.sdk//usr/lib/libSystem.dylib, missing required architecture ppc in file
Installing rosetta and xcode with all architectures fixes this "problem"
ld: warning: in /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks//QuickTime.framework/QuickTime, missing required architecture x86_64 in file
You get this error because the QuickTime 10.6 framework is not build with 64bit support. This not a real issue for KiCad because we don't use it anyway.
Undefined symbols:
"TestForIntersectionOfStraightLineSegments(int, int, int, int, int, int, int, int, int*, int*, double*)", referenced from:
clipLine(EDA_Rect*, int&, int&, int&, int&)in libcommon.a(gr_basic.cpp.o)
Make sure you marked the build type Release:
//Choose the type of build, options are: None(CMAKE_CXX_FLAGS or
// CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.
CMAKE_BUILD_TYPE:STRING=Release
I know some you should prefer use ; as separator, this will be accomplished soon
keeping support for both the syntaxes

View File

@ -593,6 +593,23 @@ if( KICAD_SCRIPTING )
)
install( FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py DESTINATION ${PYTHON_DEST} )
if( APPLE )
# copies all into PYTHON_DEST then all into the bundle !
add_custom_target( _pcbnew_py_copy ALL
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py "${PYTHON_DEST}"
DEPENDS FixSwigImportsModuleScripting
COMMENT "Copying pcbnew.py into PYTHON_DEST"
)
add_custom_target( pcbnew_copy_wxpython_scripting ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBWXPYTHON_ROOT}/wxPython ${CMAKE_SOURCE_DIR}/pcbnew/pcbnew.app/Contents/Frameworks/wxPython
DEPENDS FixSwigImportsScripting _pcbnew_py_copy
COMMENT "Copying wxPython into pcbnew.app Framework"
)
# fix bundle after copying wxpython, fixing and copying
add_dependencies( osx_fix_bundles pcbnew_copy_wxpython_scripting )
endif()
endif()
if( KICAD_SCRIPTING_MODULES )
@ -609,6 +626,24 @@ if( KICAD_SCRIPTING_MODULES )
else()
install( FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.so DESTINATION ${PYTHON_DEST} )
endif()
if( APPLE )
# copies needed files into PYTHON_DEST then copy all into the bundle !
add_custom_target( _pcbnew_so_copy ALL
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.so "${PYTHON_DEST}"
DEPENDS _pcbnew FixSwigImportsModuleScripting
COMMENT "Copying _pcbnew.so into PYTHON_DEST"
)
add_custom_target( pcbnew_copy_wxpython_module ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBWXPYTHON_ROOT}/wxPython ${CMAKE_SOURCE_DIR}/pcbnew/pcbnew.app/Contents/Frameworks/wxPython
DEPENDS FixSwigImportsModuleScripting _pcbnew_so_copy
COMMENT "Copying wxPython into pcbnew.app Frameworks"
)
# 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()

View File

@ -42,6 +42,7 @@
#include <pcbcommon.h>
#include <colors_selection.h>
#include <gr_basic.h>
#include <wx/stdpaths.h>
#include <wx/file.h>
#include <wx/snglinst.h>
@ -153,6 +154,22 @@ bool EDA_APP::OnInit()
#else
// Add this default search path:
msg = wxT("/usr/local/kicad/bin/scripting/plugins");
// OSX
// System Library first
// User Library then
// (TODO) Bundle package ? where to place ? Shared Support ?
msg = wxT("/Library/Application Support/kicad/scripting");
msg = 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" );
#endif
// On linux and osx, 2 others paths are
// [HOME]/.kicad_plugins/

View File

@ -12,7 +12,6 @@ fi
EXECUTABLES="`find . -name '*.app'`"
#
# Copies libraries under <bzr_root> in the bundle and relocates them in the binary
#
@ -27,12 +26,62 @@ function fixbundle() {
for library in $LIBRARIES; do
mkdir -p ${execpath}${exec}.app/Contents/Frameworks
if [[ "$library" =~ "$2" ]]; then
if [[ "$library" =~ "$bzroot" ]]; then
echo "${exec}: Migrating `basename $library` in the bundle"
cp -f $library ${execpath}${exec}.app/Contents/Frameworks
if [ ! -f ${exec}.app/Contents/Frameworks/`basename $library` ]; then
cp -f $library ${execpath}${exec}.app/Contents/Frameworks
fi
install_name_tool -change $library @executable_path/../Frameworks/`basename $library` ${execpath}${exec}.app/Contents/MacOS/${exec}
fi
done
# Resolve issue in python modules (.so)
cd ${execpath}
MODULES="`find ${exec}.app -name '*.so'`"
for module in $MODULES; do
LIBRARIES="`otool -L $module | cut -d' ' -f1`"
mkdir -p ${exec}.app/Contents/Frameworks
for library in $LIBRARIES; do
if [[ "$library" =~ "$bzroot" ]]; then
if [ ! -f ${exec}.app/Contents/Frameworks/`basename $library` ]; then
cp -f $library ${exec}.app/Contents/Frameworks
fi
install_name_tool -change $library @executable_path/../Frameworks/`basename $library` $module
fi
done
echo "${exec}: elaborated module `basename ${module}`"
done
# Resolve issue between DYNLIBS
dynlib_migrate="1";
dynlib_cycle="0";
while [ $dynlib_migrate -gt 0 ]; do
dynlib_migrate="0";
(( dynlib_cycle += 1 ))
DYNLIBS="`find ${exec}.app -name '*.dylib'`"
for dynlib in $DYNLIBS; do
LIBRARIES="`otool -L $dynlib | cut -d' ' -f1`"
mkdir -p ${exec}.app/Contents/Frameworks
for library in $LIBRARIES; do
if [[ "$library" =~ "$bzroot" ]]; then
if [ ! -f ${exec}.app/Contents/Frameworks/`basename $library` ]; then
cp -f $library ${exec}.app/Contents/Frameworks
echo "copied `basename $library` into bundle"
(( dynlib_migrate += 1))
fi
install_name_tool -change $library @executable_path/../Frameworks/`basename $library` $dynlib
fi
done
done
echo "${exec}: bundle dynlib dependencies migration Pass $dynlib_cycle: Migrated $dynlib_migrate libraries in bundle"
done
cd - >/dev/null
}