Commit 32e962e8 authored by Maciej Suminski's avatar Maciej Suminski
Browse files

Merged upstream and Mac OS X build fixes.

parents a7e963bd 379f04af
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
include/boost
boost_root
.downloads-by-cmake
common/netlist_keywords.*
common/netlist_lexer.h
+0 −1
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@ add_definitions(-DPCBNEW)

include_directories(BEFORE ${INC_BEFORE})
include_directories(
    ${Boost_INCLUDE_DIR}
    ../pcbnew
    ../polygon
    ${INC_AFTER}
+208 −206
Original line number Diff line number Diff line
@@ -14,9 +14,6 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
# reports.
#

option(USE_PCBNEW_NANOMETRES
    "Use nanometers for Pcbnew internal units instead of deci-mils (default ON)." ON)

# Russian GOST patch
option( wxUSE_UNICODE "enable/disable building unicode ( default OFF)" )
option( KICAD_GOST "enable/disable building using GOST notation for multiple gates per package ( default OFF)" )
@@ -35,10 +32,6 @@ option(KICAD_STABLE_VERSION
    "set this option to ON to build the stable version of KICAD. mainly used to set version ID (default OFF)"
    )

option(KICAD_TESTING_VERSION
    "set this option to ON to build the testing version of KICAD. mainly used to set version ID (default OFF)"
    )

option( KICAD_SCRIPTING
    "set this option ON to build the scripting support inside kicad binaries"
    )
@@ -60,18 +53,14 @@ option(KICAD_SCRIPTING_WXPYTHON

option( USE_FP_LIB_TABLE "Use the new footprint library table implementation. ( default OFF)" )

#option( BUILD_GITHUB_PLUGIN "Build the GITHUB_PLUGIN for pcbnew." OFF )


#Set version option (stable or testing)

if(KICAD_STABLE_VERSION AND KICAD_TESTING_VERSION )
    message(FATAL_ERROR "Only one KiCad build version option KICAD_TESTING_VERSION or KICAD_STABLE_VERSION can be set to ON")
elseif(NOT KICAD_STABLE_VERSION AND NOT KICAD_TESTING_VERSION)
    message(FATAL_ERROR "Either KiCad build version option KICAD_TESTING_VERSION or KICAD_STABLE_VERSION must be set to ON")
elseif(KICAD_STABLE_VERSION)
if( KICAD_STABLE_VERSION)
    add_definitions( -DKICAD_STABLE_VERSION )
    message( "Build stable version of KiCad")
else()
    add_definitions(-DKICAD_TESTING_VERSION)
    message("Build testing (unstable) version of KiCad")
    message( STATUS "Building stable version of KiCad" )
endif()

# All CMake downloads go here.  Suggested is up in the source tree, not in the build dir where they
@@ -277,9 +266,8 @@ check_find_package_result(GLEW_FOUND "GLEW")
find_package(Cairo 1.8.1 QUIET)
check_find_package_result(CAIRO_FOUND "Cairo")

##########################
# Download Boost library #
##########################
# Download boost and possibly build parts of it
#################################################
include( download_boost )


@@ -315,6 +303,27 @@ if(MINGW AND USE_WX_GRAPHICS_CONTEXT)
    check_find_package_result( GDI_PLUS_FOUND "GDI+" )
endif()

# Assist with header file searching optimization:
# INC_BEFORE and INC_AFTER are two lists which go at the front and back of the
# header file search lists, respectively.
# INC_BEFORE is for use with "include_directories( BEFORE ...)", which _reverses_
# the order during insertion.  (So put first wanted last, which is
# ${CMAKE_SOURCE_DIR/include.)  Use '.' for current source dir since
# we don't want expansion here and now, which would happen if using ${CMAKE_CURRENT_SOURCE_DIR}.
# Instead we use '.' which is applicable to any source directory below here as a result of
# this lack of expansion.
set( INC_BEFORE
    .
    ${CMAKE_SOURCE_DIR}/include
    )

set( INC_AFTER
    ${Boost_INCLUDE_DIR}
    #include <config.h>
    ${CMAKE_BINARY_DIR}
    )


# Find Python and other scripting resources
if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
    set( PythonInterp_FIND_VERSION )
@@ -337,11 +346,19 @@ if(KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
    set( PYTHON_DEST "${PYTHON_SITE_PACKAGE_PATH}" CACHE PATH "Python module install path." )
    mark_as_advanced( PYTHON_DEST )
    message( STATUS "Python module install path: ${PYTHON_DEST}" )

    find_package( PythonLibs )
    include_directories(${PYTHON_INCLUDE_DIRS}
                        ./scripting)
endif(KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)

    #message( STATUS "PYTHON_INCLUDE_DIRS:${PYTHON_INCLUDE_DIRS}" )

    # Infrequently needed headers go at end of search paths, append to INC_AFTER which
    # although is used for all components, should be a harmless hit for something like eeschema
    # so long as unused search paths are at the end like this.
    set( INC_AFTER ${INC_AFTER} ${PYTHON_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/scripting )

    #message( STATUS "/ INC_AFTER:${INC_AFTER}" )

endif()


# Automagically create version header file.
@@ -356,20 +373,6 @@ if(EXISTS ${CMAKE_SOURCE_DIR}/include/config.h)
    add_definitions( -DHAVE_SVN_REVISION )
endif()

# For include_directories(BEFORE ...), which _reverses_
# the order during insertion, so put first wanted last, which is
# ${CMAKE_SOURCE_DIR/include.  Use '.' for current source dir since
# we don't want expansion here and now, and don't need expansion of
# ${CMAKE_CURRENT_SOURCE_DIR}, '.' will work for any source directory.
set(INC_BEFORE
    .
    ${CMAKE_SOURCE_DIR}/include
    )

set(INC_AFTER
    #include <config.h>
    ${CMAKE_BINARY_DIR}
    )

#================================================
# Let CMake look in these directories for nested
@@ -388,7 +391,6 @@ add_subdirectory(eeschema)
add_subdirectory( gerbview )
add_subdirectory( kicad )
add_subdirectory( pcbnew )
add_subdirectory(pcbnew/pcad2kicadpcb_plugin)
add_subdirectory( polygon )
add_subdirectory( pagelayout_editor )
add_subdirectory( potrace )
@@ -399,7 +401,7 @@ add_subdirectory(tools)


# Make all libs and executables depend on ExternalProject_Add( boost ),
# except perhaps bitmap lib
# except perhaps bitmap lib.  This allows a multi-threaded build to succeed.
add_dependencies( pcbnew boost )
add_dependencies( eeschema boost )
add_dependencies( cvpcb boost )
+5 −8
Original line number Diff line number Diff line
@@ -75,17 +75,14 @@

#cmakedefine USE_IMAGES_IN_MENUS 1

/// Definitions to enable the s-expression file formats and nanometer units.
#cmakedefine USE_PCBNEW_NANOMETRES

/// The legacy file format revision of the *.brd file created by this build
#if defined(USE_PCBNEW_NANOMETRES)
#define LEGACY_BOARD_FILE_VERSION 2
#else
#define LEGACY_BOARD_FILE_VERSION          1
#endif

/// Definition to compile with Pcbnew footprint library table implementation.
#cmakedefine USE_FP_LIB_TABLE

/// When defined, build the GITHUB_PLUGIN for pcbnew.
#cmakedefine BUILD_GITHUB_PLUGIN


#endif  // CONFIG_H_
+129 −21
Original line number Diff line number Diff line
@@ -22,11 +22,43 @@



# Download and patch boost headers to a particular version.
# Assumes include( ExternalProject ) was done inline previous to this file.
# Download a particular boost version, and patch it [and build it if BUILD_GITHUB_PLUGIN].
# Assumes include( ExternalProject ) was done inline previous to this file
# and that set( DOWNLOAD_DIR ... ) was set in a higher context.


#-----<configure>----------------------------------------------------------------

if( false )
    set( BOOST_RELEASE 1.53.0 )
    set( BOOST_MD5 a00d22605d5dbcfb4c9936a9b35bc4c2 )   # re-calc this on every RELEASE change
else()
    set( BOOST_RELEASE 1.54.0 )
    set( BOOST_MD5 15cb8c0803064faef0c4ddf5bc5ca279 )   # re-calc this on every RELEASE change
endif()

# The boost headers [and static libs if built] go here, at the top of KiCad
# source tree in boost_root.
set( BOOST_ROOT "${PROJECT_SOURCE_DIR}/boost_root" )


if( BUILD_GITHUB_PLUGIN )
    # Space separated list which indicates the subset of boost libraries to compile.
    set( BOOST_LIBS_BUILT
        #filesystem
        system
        #regex
        #program_options
        #date_time
        #thread
        #exception
        unit_test_framework
        )
endif()

#-----</configure>---------------------------------------------------------------



string( REGEX REPLACE "\\." "_" BOOST_VERS "${BOOST_RELEASE}" )
set( PREFIX ${DOWNLOAD_DIR}/boost_${BOOST_VERS} )
@@ -36,27 +68,102 @@ set( PREFIX ${DOWNLOAD_DIR}/boost_${BOOST_VERS} )
# 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.

# include only the headers in the repo.
# repo = "${headers}/../.bzr" = "<SOURCE_DIR>/.bzr"
set( headers ${PREFIX}/src/boost/boost )
# path to the boost headers in the repo.
# repo = "${headers_src}/../.bzr" = "<SOURCE_DIR>/.bzr"
set( headers_src "${PREFIX}/src/boost/boost" )


# don't look at this:
function( set_boost_lib_names libs output )
    foreach( lib ${libs} )
        set( fullpath_lib, "${BOOST_ROOT}/lib/libboost_${lib}.a" )
        message( STATUS "fullpath_lib:${fullpath_lib}" )
        set( output ${output} ${fullpath_lib} )
    endforeach()
endfunction()


if( BUILD_GITHUB_PLUGIN )

    # (BTW "test" yields "unit_test_framework" when passed to bootstrap.{sh,bat} ).
    message( STATUS "BOOST_LIBS_BUILT:${BOOST_LIBS_BUILT}" )
    string( REPLACE "unit_test_framework" "test" libs_csv "${BOOST_LIBS_BUILT}" )
    message( STATUS "REPLACE libs_csv:${libs_csv}" )

    string( REGEX REPLACE "\\;" "," libs_csv "${libs_csv}" )
    message( STATUS "libs_csv:${libs_csv}" )

    if( MINGW )
        set( bootstrap "bootstart.bat mingw" )
    else()
        set( bootstrap bootstrap.sh )
    endif()

    ExternalProject_Add( boost
        PREFIX          "${PREFIX}"
        DOWNLOAD_DIR    "${DOWNLOAD_DIR}"
        URL             http://downloads.sourceforge.net/project/boost/boost/${BOOST_RELEASE}/boost_${BOOST_VERS}.tar.bz2
        URL_MD5         ${BOOST_MD5}

        # The patch command executes with the working directory set to <SOURCE_DIR>
        PATCH_COMMAND   bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost.patch"

        # [Mis-]use this step to erase all the boost headers and libraries before
        # replacing them below.
        UPDATE_COMMAND  ${CMAKE_COMMAND} -E remove_directory "${BOOST_ROOT}"

        BINARY_DIR      "${PREFIX}/src/boost/"
        CONFIGURE_COMMAND ${bootstrap}
                        --with-libraries=${libs_csv}

        BUILD_COMMAND   b2
                        variant=release
                        threading=multi
                        toolset=gcc
                        link=static
                        --prefix=${BOOST_ROOT}
                        install

        INSTALL_COMMAND ""
        )

    file( GLOB boost_libs "${BOOST_ROOT}/lib/*" )
    #message( STATUS BOOST_ROOT:${BOOST_ROOT}  boost_libs:${boost_libs} )
    set( Boost_LIBRARIES    ${boost_libs}           CACHE FILEPATH "Boost libraries directory" )
    set( Boost_INCLUDE_DIR  "${BOOST_ROOT}/include" CACHE FILEPATH "Boost include directory" )


else( BUILD_GITHUB_PLUGIN )


    ExternalProject_Add( boost
    PREFIX          ${PREFIX}
    DOWNLOAD_DIR    ${DOWNLOAD_DIR}
        PREFIX          "${PREFIX}"
        DOWNLOAD_DIR    "${DOWNLOAD_DIR}"
        URL             http://downloads.sourceforge.net/project/boost/boost/${BOOST_RELEASE}/boost_${BOOST_VERS}.tar.bz2
        URL_MD5         ${BOOST_MD5}

        # The patch command executes with the working directory set to <SOURCE_DIR>
    PATCH_COMMAND   bzr patch -p0 ${PROJECT_SOURCE_DIR}/patches/boost.patch
        PATCH_COMMAND   bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost.patch"

        # Dick 18-Aug-2013:
        # [mis-]use this UPDATE_COMMAND opportunity to remove the old place of boost headers.
        # Can eventually remove this step after headers are moved from <kicad_src>/include/boost
        # to <kicad_src>/boost_root/include/boost over the next several months.
        UPDATE_COMMAND  ${CMAKE_COMMAND} -E remove_directory "${PROJECT_SOURCE_DIR}/include/boost"

        CONFIGURE_COMMAND ""

        # remove then re-copy into the include/boost directory during next two steps:
    BUILD_COMMAND   ${CMAKE_COMMAND} -E remove_directory ${PROJECT_SOURCE_DIR}/include/boost
    INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ${headers} ${PROJECT_SOURCE_DIR}/include/boost
        BUILD_COMMAND   ${CMAKE_COMMAND} -E remove_directory ${BOOST_ROOT}
        INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory "${headers_src}" "${BOOST_ROOT}/include/boost"
        )

    # Until my find_package() support is done for my boost.
    set( Boost_INCLUDE_DIR  "${BOOST_ROOT}/include" CACHE FILEPATH "Boost include directory" )


endif( BUILD_GITHUB_PLUGIN )


ExternalProject_Add_Step( boost bzr_commit_boost
    COMMAND bzr ci -q -m pristine <SOURCE_DIR>
@@ -66,8 +173,8 @@ ExternalProject_Add_Step( boost bzr_commit_boost


ExternalProject_Add_Step( boost bzr_add_boost
    # add only the headers to the scratch repo, repo = "../.bzr" from ${headers}
    COMMAND bzr add -q ${headers}
    # add only the headers to the scratch repo, repo = "../.bzr" from ${headers_src}
    COMMAND bzr add -q ${headers_src}
    COMMENT "adding pristine boost files to 'boost scratch repo'"
    DEPENDERS bzr_commit_boost
    )
@@ -79,3 +186,4 @@ ExternalProject_Add_Step( boost bzr_init_boost
    DEPENDERS bzr_add_boost
    DEPENDEES download
    )
Loading