Commit 387d0c4e authored by Dick Hollenbeck's avatar Dick Hollenbeck
Browse files

*) Refinements to ExternalProject_Add( boost )

*) Enhancements to make_lexer().
*) Support multi-threaded build.
*) Switch to "bzr patch" from patch.exe for Windows users.
parents a23dcccc 70b8e6b6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
include/boost
downloads-by-cmake
common/netlist_keywords.*
common/netlist_lexer.h
common/pcb_plot_params_lexer.h
@@ -12,7 +14,6 @@ pcbnew/dialogs/dialog_freeroute_exchange_help_html.h
pcbnew/pcb_plot_params_keywords.cpp
pcbnew/pcb_plot_params_lexer.h
Makefile
CMakeFiles
CMakeCache.txt
auto_renamed_to_cpp
Testing
@@ -20,7 +21,6 @@ version.h
config.h
install_manifest.txt
Documentation/doxygen
*.cmake
*.bak
common/pcb_plot_params_keywords.cpp
include/pcb_plot_params_lexer.h
+28 −19
Original line number Diff line number Diff line
project(kicad)

# The minimum CMake version requirement could be different under unix, OSX,  or Windows
if(WIN32)
    cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR)   # win32 and win64
elseif(APPLE)
    cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR)   # OSX
else()
    cmake_minimum_required(VERSION 2.6.4 FATAL_ERROR)   # Linux, Unix, and everything else.
endif()
cmake_minimum_required(VERSION 2.8.4 FATAL_ERROR)
# because of http://public.kitware.com/Bug/view.php?id=10395

# Path to local CMake modules.
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
@@ -243,6 +237,12 @@ mark_as_advanced(KICAD_BIN

include(Functions)

include( ExternalProject )

# All CMake downloads go here, up in the source tree, not in the build dir where they
# would have to be downloaded over and over again.
set( DOWNLOAD_DIR ${PROJECT_SOURCE_DIR}/downloads-by-cmake )

#================================================
# Find libraries that are needed to build KiCad.
#================================================
@@ -254,14 +254,11 @@ include(CheckFindPackageResult)
find_package(OpenGL QUIET)
check_find_package_result(OPENGL_FOUND "OpenGL")

######################
# Find Boost library #
######################
# kicad now includes needed boost files.
# the two next lines can be uncommented to use the native boost lib.
# but this is not a good idea
#find_package(Boost 1.36 QUIET)
#check_find_package_result(Boost_FOUND "Boost")
##########################
# Download Boost library #
##########################
include( download_boost )


##########################
# Find wxWidgets library #
@@ -356,9 +353,9 @@ set(INC_AFTER
# 'CMakeLists.txt' files to process
#================================================

############
# Binaries #
############
############################
# Binaries (CMake targets) #
############################

add_subdirectory(bitmaps_png)
add_subdirectory(common)
@@ -377,6 +374,18 @@ add_subdirectory(tools)
#add_subdirectory(new)


# Make all libs and executables depend on ExternalProject_Add( boost ),
# except perhaps bitmap lib
add_dependencies( pcbnew boost )
add_dependencies( eeschema boost )
add_dependencies( cvpcb boost )
add_dependencies( common boost )
add_dependencies( pcbcommon boost )
add_dependencies( 3d-viewer boost )
add_dependencies( pcad2kicadpcb boost )
add_dependencies( polygon boost )


#############
# Resources #
#############
+13 −1
Original line number Diff line number Diff line
@@ -23,7 +23,10 @@


# Function make_lexer
# is a standard way to invoke TokenList2DsnLexer.cmake
# is a standard way to invoke TokenList2DsnLexer.cmake.
# Extra arguments are treated as source files which depend on the generated
# outHeaderFile

function( make_lexer inputFile outHeaderFile outCppFile enum )
    add_custom_command(
        OUTPUT  ${outHeaderFile}
@@ -41,5 +44,14 @@ function( make_lexer inputFile outHeaderFile outCppFile enum )
           ${outCppFile} from
           ${inputFile}"
        )

    # extra_args, if any, are treated as source files (typically headers) which
    # are known to depend on the generated outHeader.
    foreach( extra_arg ${ARGN} )
        set_source_files_properties( ${extra_arg}
            PROPERTIES OBJECT_DEPENDS ${outHeaderFile}
            )
    endforeach()

endfunction()
+78 −0
Original line number Diff line number Diff line
#  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



# Download and patch boost headers to a particular version.
# Assumes include( ExternalProject ) was done inline previous to this file.

set( BOOST_RELEASE 1.53.0 )
set( BOOST_MD5 a00d22605d5dbcfb4c9936a9b35bc4c2 ) # re-calc this on every RELEASE change

string( REGEX REPLACE "\\." "_" BOOST_VERS "${BOOST_RELEASE}" )
set( PREFIX ${DOWNLOAD_DIR}/boost_${BOOST_VERS} )


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

    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 <SOURCE_DIR>/boost ${PROJECT_SOURCE_DIR}/include/boost
    )


# <SOURCE_DIR> = ${PREFIX}/src/boost
# Add extra steps, so that we can easily regenerate any boost patch needed for the above.
# There is a Bazaar 'boost scratch repo' in <SOURCE_DIR> 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_Step( boost bzr_commit_boost
    COMMAND bzr ci -q -m pristine <SOURCE_DIR>
    COMMENT "committing pristine boost files to 'boost scratch repo'"
    DEPENDERS patch
    )


ExternalProject_Add_Step( boost bzr_add_boost
    COMMAND bzr add -q <SOURCE_DIR>
    COMMENT "adding pristine boost files to 'boost scratch repo'"
    DEPENDERS bzr_commit_boost
    )


ExternalProject_Add_Step( boost bzr_init_boost
    COMMAND bzr init -q <SOURCE_DIR>
    COMMENT "creating 'boost scratch repo' specifically for boost to track boost patches"
    DEPENDERS bzr_add_boost
    DEPENDEES download
    )
+0 −1
Original line number Diff line number Diff line
@@ -753,4 +753,3 @@ endforeach()

#add_library( bitmaps SHARED ${CPP_LIST} )
add_library( bitmaps STATIC ${CPP_LIST} )
Loading