Commit 2fc69884 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.
parent 96f8f606
Loading
Loading
Loading
Loading
+17 −11
Original line number Original line Diff line number Diff line
project(kicad)
project(kicad)


# The minimum CMake version requirement could be different under unix, OSX,  or Windows
cmake_minimum_required(VERSION 2.8.4 FATAL_ERROR)
if(WIN32)
# because of http://public.kitware.com/Bug/view.php?id=10395
    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()


# Path to local CMake modules.
# Path to local CMake modules.
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
@@ -359,9 +353,9 @@ set(INC_AFTER
# 'CMakeLists.txt' files to process
# 'CMakeLists.txt' files to process
#================================================
#================================================


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


add_subdirectory(bitmaps_png)
add_subdirectory(bitmaps_png)
add_subdirectory(common)
add_subdirectory(common)
@@ -380,6 +374,18 @@ add_subdirectory(tools)
#add_subdirectory(new)
#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 #
# Resources #
#############
#############
+13 −1
Original line number Original line Diff line number Diff line
@@ -23,7 +23,10 @@




# Function make_lexer
# 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 )
function( make_lexer inputFile outHeaderFile outCppFile enum )
    add_custom_command(
    add_custom_command(
        OUTPUT  ${outHeaderFile}
        OUTPUT  ${outHeaderFile}
@@ -41,5 +44,14 @@ function( make_lexer inputFile outHeaderFile outCppFile enum )
           ${outCppFile} from
           ${outCppFile} from
           ${inputFile}"
           ${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()
endfunction()
+12 −16
Original line number Original line Diff line number Diff line
@@ -3,23 +3,20 @@
# Assumes include( ExternalProject ) was done inline previous to this file.
# Assumes include( ExternalProject ) was done inline previous to this file.


set( BOOST_RELEASE 1.53.0 )
set( BOOST_RELEASE 1.53.0 )
string( REGEX REPLACE "\\." "_" BOOST_VERS "${BOOST_RELEASE}" )

set( BOOST_MD5 a00d22605d5dbcfb4c9936a9b35bc4c2 ) # re-calc this on every RELEASE change
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} )
set( PREFIX ${DOWNLOAD_DIR}/boost_${BOOST_VERS} )




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


    #UPDATE_COMMAND

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


    CONFIGURE_COMMAND ""
    CONFIGURE_COMMAND ""


@@ -29,23 +26,23 @@ ExternalProject_Add(
    )
    )




# <SOURCE_DIR> = ${PREFIX}/src/
# <SOURCE_DIR> = ${PREFIX}/src/boost
# Add extra steps, so that we can easily regenerate any boost patch needed for the above.
# 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
# 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
# download, the patch is applied.  This lets you regenerate a new patch at any time
# easily, simply by editing the copy in <SOURCE_DIR> and doing "bzr diff" in there.
# easily, simply by editing the working tree in <SOURCE_DIR> and doing "bzr diff" in there.




ExternalProject_Add_Step( boost bzr_commit_boost
ExternalProject_Add_Step( boost bzr_commit_boost
    COMMAND bzr ci -q -m pristine <SOURCE_DIR>
    COMMAND bzr ci -q -m pristine <SOURCE_DIR>
    COMMENT "committing boost files to 'boost scratch repo'"
    COMMENT "committing pristine boost files to 'boost scratch repo'"
    DEPENDERS patch
    DEPENDERS patch
    )
    )




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


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


#add_library( bitmaps SHARED ${CPP_LIST} )
#add_library( bitmaps SHARED ${CPP_LIST} )
add_library( bitmaps STATIC ${CPP_LIST} )
add_library( bitmaps STATIC ${CPP_LIST} )
+21 −11
Original line number Original line Diff line number Diff line
@@ -150,13 +150,15 @@ set_source_files_properties( ${PCB_COMMON_SRCS} PROPERTIES


add_library(pcbcommon STATIC ${PCB_COMMON_SRCS})
add_library(pcbcommon STATIC ${PCB_COMMON_SRCS})



# auto-generate netlist_lexer.h and netlist_keywords.cpp
# auto-generate netlist_lexer.h and netlist_keywords.cpp
make_lexer(
make_lexer(
    ${CMAKE_CURRENT_SOURCE_DIR}/netlist.keywords
    ${CMAKE_CURRENT_SOURCE_DIR}/netlist.keywords
    ${PROJECT_SOURCE_DIR}/include/netlist_lexer.h
    ${PROJECT_SOURCE_DIR}/include/netlist_lexer.h
    ${CMAKE_CURRENT_SOURCE_DIR}/netlist_keywords.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/netlist_keywords.cpp
    NL_T
    NL_T

    # Pass header file with dependency on *_lexer.h as extra_arg
    ${CMAKE_PROJECT_SOURCE_DIR}/pcbnew/netlist_reader.h
    )
    )


# auto-generate pcb_plot_params_lexer.h and pcb_plot_params_keywords.cpp
# auto-generate pcb_plot_params_lexer.h and pcb_plot_params_keywords.cpp
@@ -165,17 +167,25 @@ make_lexer(
    ${PROJECT_SOURCE_DIR}/include/pcb_plot_params_lexer.h
    ${PROJECT_SOURCE_DIR}/include/pcb_plot_params_lexer.h
    ${CMAKE_CURRENT_SOURCE_DIR}/pcb_plot_params_keywords.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/pcb_plot_params_keywords.cpp
    PCBPLOTPARAMS_T
    PCBPLOTPARAMS_T

    # Pass header file with dependency on *_lexer.h as extra_arg
    ${PROJECT_SOURCE_DIR}/pcbnew/pcb_plot_params.h
    )
    )


# auto-generate pcbnew_sexpr.h and pcbnew_sexpr.cpp
# auto-generate pcbnew_sexpr.h and pcbnew_sexpr.cpp
make_lexer( ${CMAKE_CURRENT_SOURCE_DIR}/pcb.keywords
make_lexer(
    ${CMAKE_CURRENT_SOURCE_DIR}/pcb.keywords
    ${PROJECT_SOURCE_DIR}/include/pcb_lexer.h
    ${PROJECT_SOURCE_DIR}/include/pcb_lexer.h
    ${CMAKE_CURRENT_SOURCE_DIR}/pcb_keywords.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/pcb_keywords.cpp
    PCB_KEYS_T
    PCB_KEYS_T

    # Pass header file with dependency on *_lexer.h as extra_arg
    ${PROJECT_SOURCE_DIR}/pcbnew/pcb_parser.h
    )
    )


# auto-generate pcbnew s-expression footprint library table code.
# auto-generate pcbnew s-expression footprint library table code.
make_lexer( ${CMAKE_CURRENT_SOURCE_DIR}/fp_lib_table.keywords
make_lexer(
    ${CMAKE_CURRENT_SOURCE_DIR}/fp_lib_table.keywords
    ${PROJECT_SOURCE_DIR}/include/fp_lib_table_lexer.h
    ${PROJECT_SOURCE_DIR}/include/fp_lib_table_lexer.h
    ${CMAKE_CURRENT_SOURCE_DIR}/fp_lib_table_keywords.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/fp_lib_table_keywords.cpp
    FP_LIB_TABLE_T
    FP_LIB_TABLE_T
Loading