[MacOSX] KICAD_BUILD_DYNAMIC stabilized and almost working

This commit is contained in:
Marco Serantoni 2014-01-27 23:24:04 +01:00
parent 6181e9e46e
commit 786bb81c4d
9 changed files with 102 additions and 10 deletions

View File

@ -182,6 +182,9 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__ASSERTMACROS__ -mmacosx-version-min=10.5" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__ASSERTMACROS__ -mmacosx-version-min=10.5" )
# Allows .dylib relocation in the future
set( CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} -headerpad_max_install_names")
if( NOT CMAKE_CXX_COMPILER )
EXEC_PROGRAM( wx-config ARGS --cc OUTPUT_VARIABLE CMAKE_C_COMPILER )
endif( NOT CMAKE_CXX_COMPILER )
@ -332,6 +335,11 @@ if ( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC )
set( CAIRO_INCLUDE_DIR "${CAIRO_ROOT}/include/cairo")
set( CAIRO_LIBRARY "${CAIRO_ROOT}/lib/libcairo.a")
if( KICAD_BUILD_DYNAMIC AND APPLE )
add_custom_target( osx_fix_bundles ALL DEPENDS cvpcb eeschema gerbview kicad pcbnew bitmap2component pcb_calculator pl_editor)
add_custom_command(TARGET osx_fix_bundles POST_BUILD COMMAND scripts/osx_fixbundle.sh COMMENT "Migrating dylibs to bundles")
endif()
endif( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC)
@ -525,8 +533,13 @@ add_dependencies( pcad2kicadpcb lib-dependencies )
add_dependencies( polygon lib-dependencies )
add_dependencies( pl_editor lib-dependencies )
add_dependencies( pnsrouter lib-dependencies )
if ( BUILD_GITHUB_PLUGIN )
add_dependencies( github_plugin lib-dependencies )
endif()
endif()
if ( KICAD_BUILD_DYNAMIC )
endif()
#############
# Resources #

View File

@ -81,6 +81,7 @@ ExternalProject_Add( cairo
BUILD_IN_SOURCE 1
#SOURCE_DIR "${PREFIX}"
#PATCH_COMMAND ""
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${CAIRO_ROOT}"
CONFIGURE_COMMAND ./configure --prefix=${CAIRO_ROOT} --enable-static ${CAIRO_BUILDTYPE}
PKG_CONFIG=${PROJECT_SOURCE_DIR}/pkgconfig_root/bin/pkg-config

View File

@ -60,6 +60,8 @@ ExternalProject_Add( glew
#SOURCE_DIR "${PREFIX}"
BUILD_IN_SOURCE 1
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${GLEW_ROOT}"
#PATCH_COMMAND "true"
CONFIGURE_COMMAND ""
@ -68,5 +70,18 @@ ExternalProject_Add( glew
BUILD_COMMAND $(MAKE) ${GLEW_CFLAGS} ${GLEW_LDFLAGS} ${GLEW_STRIP}
INSTALL_DIR "${GLEW_ROOT}"
INSTALL_COMMAND $(MAKE) GLEW_DEST="${GLEW_ROOT}" install && ranlib "${GLEW_ROOT}/lib/libGLEW.a"
INSTALL_COMMAND $(MAKE) GLEW_DEST="${GLEW_ROOT}" install
)
#
# Optional Steps
#
if( APPLE )
# On OSX is needed to run ranlib to make .a indexes for all platforms
ExternalProject_Add_Step( glew glew_osx_ranlib
COMMAND ranlib "${GLEW_ROOT}/lib/libGLEW.a"
COMMENT "ranlib ${GLEW_ROOT}/lib/libGLEW.a - Needed on OSX only"
DEPENDEES install
)
endif()

View File

@ -67,6 +67,7 @@ ExternalProject_Add( libpng
#PATCH_COMMAND "true"
CONFIGURE_COMMAND ./configure --prefix=${LIBPNG_ROOT} ${LIBPNG_OPTS} ${LIBPNG_CFLAGS} --disable-dependency-tracking
#BINARY_DIR "${PREFIX}"
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${LIBPNG_ROOT}"
BUILD_COMMAND $(MAKE)

View File

@ -68,6 +68,8 @@ ExternalProject_Add( pixman
#SOURCE_DIR "${PREFIX}"
BUILD_IN_SOURCE 1
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${PIXMAN_ROOT}"
#PATCH_COMMAND "true"
CONFIGURE_COMMAND ./configure --prefix=${PIXMAN_ROOT} ${PIXMAN_OPTS} ${PIXMAN_CPPFLAGS} --disable-dependency-tracking
#BINARY_DIR "${PREFIX}"

View File

@ -62,19 +62,17 @@ ExternalProject_Add( pkgconfig
CONFIGURE_COMMAND ./configure --prefix=${PKGCONFIG_ROOT} --with-internal-glib ${PKGCONFIG_BUILDTYPE} --disable-silent-rules
#BINARY_DIR "${PREFIX}"
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${PKGCONFIG_ROOT}"
BUILD_COMMAND $(MAKE)
INSTALL_DIR "${PKGCONFIG_ROOT}"
INSTALL_COMMAND $(MAKE) install
)
#
# At second execution make install will fail ..
#
ExternalProject_Add_Step( pkgconfig pkgconfig_erase_dir
COMMAND rm -fr ${PKGCONFIG_ROOT}
COMMENT "*** Erasing pkgconfig directory"
ExternalProject_Add_Step( pkgconfig pkgconfig_cleanup
COMMAND ${CMAKE_COMMAND} -E remove_directory "${PKGCONFIG_ROOT}"
COMMENT "pkgconfig - cleanup destination before proceeding in install"
DEPENDEES build
)

View File

@ -62,9 +62,11 @@ ExternalProject_Add( libwx
BUILD_IN_SOURCE 1
# wxOverlay PATCH for OSX - http://trac.wxwidgets.org/ticket/12894
PATCH_COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/wxwidgets-3.0.0_macosx.patch"
PATCH_COMMAND bzr revert
COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/wxwidgets-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 "${LIBWX_ROOT}"
CONFIGURE_COMMAND ./configure --prefix=${LIBWX_ROOT} -with-opengl --enable-aui --enable-debug_info -with-expat=builtin --with-regex=builtin --enable-utf8 ${LIBWX_ARCHITECTURES} ${LIBWX_BUILDTYPE}
#BINARY_DIR "${PREFIX}"

View File

@ -0,0 +1,14 @@
=== modified file 'src/common/translation.cpp'
--- src/common/translation.cpp 2014-01-26 13:59:40 +0000
+++ src/common/translation.cpp 2014-01-26 15:18:47 +0000
@@ -1611,6 +1611,9 @@
/* static */
const wxString& wxTranslations::GetUntranslatedString(const wxString& str)
{
+ // Marco Serantoni - Dirty Patch
+ // Awaiting for http://trac.wxwidgets.org/ticket/15908
+ if( gs_translationsOwned == false) return str;
wxLocaleUntranslatedStrings& strings = wxThreadInfo.untranslatedStrings;
wxLocaleUntranslatedStrings::iterator i = strings.find(str);

46
scripts/osx_fixbundle.sh Executable file
View File

@ -0,0 +1,46 @@
#!/bin/bash
# usage osx_fixbundle.sh <bundle-name> <bzr_root>
if [[ ! -f version.h ]]; then
echo "**"
echo "** ERROR: $0 doesn't seems to be launched from the kicad's bzr root !!!"
echo "** Go in the bzr root directory and launch: scripts/osx_fixbundle.sh"
echo "**"
exit 1
fi
EXECUTABLES="`find . -name '*.app'`"
#
# Copies libraries under <bzr_root> in the bundle and relocates them in the binary
#
function fixbundle() {
exec="$1"
bzroot="$2"
execpath="$3"
LIBRARIES="`otool -L ${execpath}${exec}.app/Contents/MacOS/${exec} | cut -d' ' -f1`"
for library in $LIBRARIES; do
mkdir -p ${execpath}${exec}.app/Contents/Frameworks
if [[ "$library" =~ "$2" ]]; then
echo "${exec}: Migrating `basename $library` in the bundle"
cp -f $library ${execpath}${exec}.app/Contents/Frameworks
install_name_tool -change $library @executable_path/../Frameworks/`basename $library` ${execpath}${exec}.app/Contents/MacOS/${exec}
fi
done
}
#fixbundle $1 $2 $3
for executable in $EXECUTABLES;
do
myexecpath="`dirname ${executable}`/"
myexec="`basename ${executable}|sed -e 's/\.app//'`"
fixbundle "${myexec}" "`pwd`" "${myexecpath}"
done