diff --git a/CMakeModules/download_boost.cmake b/CMakeModules/download_boost.cmake index 7745ded765..9c6041ecef 100644 --- a/CMakeModules/download_boost.cmake +++ b/CMakeModules/download_boost.cmake @@ -97,6 +97,13 @@ string( REPLACE "unit_test_framework" "test" boost_libs_list "${BOOST_LIBS_BUILT # Default Toolset set( BOOST_TOOLSET "toolset=gcc" ) +if( KICAD_BUILD_STATIC ) + set(BOOST_LINKTYPE "link=static") +else() + set( BOOST_LINKTYPE "#link=static") +endif() + + if( MINGW ) if( MSYS ) # The Boost system does not build properly on MSYS using bootstrap.sh. Running @@ -122,14 +129,18 @@ else() unset( b2_libs ) endif() - if( APPLE ) # I set this to being compatible with wxWidgets # wxWidgets still using libstdc++ (gcc), meanwhile OSX # has switched to libc++ (llvm) by default - set(BOOST_CXXFLAGS "cxxflags=-mmacosx-version-min=10.5 -fno-common -fno-lto" ) - set(BOOST_LINKFLAGS "linkflags=-mmacosx-version-min=10.5 -fno-common -fno-lto" ) + set(BOOST_CXXFLAGS "cxxflags=-mmacosx-version-min=10.5 -fno-common" ) + set(BOOST_LINKFLAGS "linkflags=-mmacosx-version-min=10.5 -fno-common" ) set(BOOST_TOOLSET "toolset=darwin" ) + + if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) + set(BOOST_CXXFLAGS "${BOOST_CXXFLAGS} -fno-lto" ) + set(BOOST_LINKFLAGS "${BOOST_LINKFLAGS} -fno-lto" ) + endif() if( CMAKE_OSX_ARCHITECTURES ) @@ -142,9 +153,17 @@ if( APPLE ) if( (CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR CMAKE_OSX_ARCHITECTURES MATCHES "386") AND (CMAKE_OSX_ARCHITECTURES MATCHES "ppc")) - message("-- BOOST found ppc/intel Architecture") + message("-- BOOST found ppc/x86 Architecture") set(BOOST_ARCHITECTURE "architecture=combined") + elseif( (CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR CMAKE_OSX_ARCHITECTURES MATCHES "386") ) + message("-- BOOST found x86 Architecture") + + set(BOOST_ARCHITECTURE "architecture=x86") + elseif( (CMAKE_OSX_ARCHITECTURES MATCHES "ppc64" OR CMAKE_OSX_ARCHITECTURES MATCHES "ppc") ) + message("-- BOOST found ppc Architecture") + + set(BOOST_ARCHITECTURE "architecture=ppc") endif() set(BOOST_CFLAGS "${BOOST_CFLAGS} -arch ${CMAKE_OSX_ARCHITECTURES}" ) @@ -188,7 +207,7 @@ ExternalProject_Add( boost ${BOOST_ADDRESSMODEL} ${BOOST_ARCHITECTURE} ${b2_libs} - #link=static + ${BOOST_LINKTYPE} --prefix= install diff --git a/CMakeModules/download_cairo.cmake b/CMakeModules/download_cairo.cmake index 7720428d2d..82e9b86b4d 100644 --- a/CMakeModules/download_cairo.cmake +++ b/CMakeModules/download_cairo.cmake @@ -39,13 +39,18 @@ set( PREFIX ${DOWNLOAD_DIR}/cairo ) if (APPLE) if( CMAKE_OSX_ARCHITECTURES ) - set( CAIRO_CFLAGS "CFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES} -fno-lto" ) - set( CAIRO_LDFLAGS "LDFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES} -framework CoreGraphics -framework CoreServices" ) + set( CAIRO_CFLAGS "CFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES}" ) + set( CAIRO_LDFLAGS "LDFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES} -framework CoreServices -framework Cocoa" ) set( CAIRO_OPTS "--enable-quartz-image" ) endif( CMAKE_OSX_ARCHITECTURES ) + if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) + set(CAIRO_CFLAGS "${CAIRO_CFLAGS} -fno-lto" ) + endif() + if( CMAKE_OSX_SYSROOT ) - set( CAIRO_CFLAGS "${CAIRO_CFLAGS} -isysroot ${CMAKE_OSX_SYSROOT}") + #set( CAIRO_CFLAGS "${CAIRO_CFLAGS} -isysroot ${CMAKE_OSX_SYSROOT}") + set( CAIRO_LDFLAGS "${CAIRO_LDFLAGS} -isysroot ${CMAKE_OSX_SYSROOT}") endif( CMAKE_OSX_SYSROOT) endif(APPLE) @@ -72,10 +77,9 @@ ExternalProject_Add( cairo PKG_CONFIG=${PROJECT_SOURCE_DIR}/pkgconfig_root/bin/pkg-config PKG_CONFIG_PATH=${PROJECT_SOURCE_DIR}/pixman_root/lib/pkgconfig:${PROJECT_SOURCE_DIR}/libpng_root/lib/pkgconfig --enable-png=yes --enable-svg=yes - --disable-silent-rules + --disable-silent-rules --disable-dependency-tracking ${CAIRO_CFLAGS} ${CAIRO_LDFLAGS} - CC=${CMAKE_C_COMPILER} #BINARY_DIR "${PREFIX}" diff --git a/CMakeModules/download_libpng.cmake b/CMakeModules/download_libpng.cmake index 93074f6848..043d1d259d 100644 --- a/CMakeModules/download_libpng.cmake +++ b/CMakeModules/download_libpng.cmake @@ -59,7 +59,7 @@ ExternalProject_Add( libpng BUILD_IN_SOURCE 1 #PATCH_COMMAND "true" - CONFIGURE_COMMAND ./configure --prefix=${LIBPNG_ROOT} --enable-static --disable-shared ${LIBPNG_CFLAGS} + CONFIGURE_COMMAND ./configure --prefix=${LIBPNG_ROOT} --enable-static --disable-shared ${LIBPNG_CFLAGS} --disable-dependency-tracking #BINARY_DIR "${PREFIX}" BUILD_COMMAND make diff --git a/CMakeModules/download_pixman.cmake b/CMakeModules/download_pixman.cmake index 34981d44d9..74716c8cfa 100644 --- a/CMakeModules/download_pixman.cmake +++ b/CMakeModules/download_pixman.cmake @@ -59,7 +59,7 @@ ExternalProject_Add( pixman BUILD_IN_SOURCE 1 #PATCH_COMMAND "true" - CONFIGURE_COMMAND ./configure --prefix=${PIXMAN_ROOT} --enable-static=yes --enable-shared=no ${PIXMAN_CPPFLAGS} CC=${CMAKE_C_COMPILER} + CONFIGURE_COMMAND ./configure --prefix=${PIXMAN_ROOT} --enable-static=yes --enable-shared=no ${PIXMAN_CPPFLAGS} --disable-dependency-tracking #BINARY_DIR "${PREFIX}" BUILD_COMMAND make