*) Refinements to ExternalProject_Add( boost )

*) Enhancements to make_lexer().
*) Support multi-threaded build.
*) Switch to "bzr patch" from patch.exe for Windows users.
This commit is contained in:
Dick Hollenbeck 2013-05-31 16:22:34 -05:00
parent 96f8f6066d
commit 2fc698846b
9 changed files with 76 additions and 87 deletions

View File

@ -1,13 +1,7 @@
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)
@ -359,9 +353,9 @@ set(INC_AFTER
# 'CMakeLists.txt' files to process
#================================================
############
# Binaries #
############
############################
# Binaries (CMake targets) #
############################
add_subdirectory(bitmaps_png)
add_subdirectory(common)
@ -380,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 #
#############

View File

@ -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()

View File

@ -3,49 +3,46 @@
# Assumes include( ExternalProject ) was done inline previous to this file.
set( BOOST_RELEASE 1.53.0 )
string( REGEX REPLACE "\\." "_" BOOST_VERS "${BOOST_RELEASE}" )
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
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}
#UPDATE_COMMAND
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 patch -p0 < ${PROJECT_SOURCE_DIR}/patches/boost.patch
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
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/
# <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 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
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
)
ExternalProject_Add_Step( boost bzr_add_boost
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
)
@ -53,7 +50,6 @@ ExternalProject_Add_Step( boost bzr_add_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_commit_boost
DEPENDERS bzr_add_boost
DEPENDEES download
)

View File

@ -752,4 +752,3 @@ endforeach()
#add_library( bitmaps SHARED ${CPP_LIST} )
add_library( bitmaps STATIC ${CPP_LIST} )

View File

@ -150,13 +150,15 @@ set_source_files_properties( ${PCB_COMMON_SRCS} PROPERTIES
add_library(pcbcommon STATIC ${PCB_COMMON_SRCS})
# auto-generate netlist_lexer.h and netlist_keywords.cpp
make_lexer(
${CMAKE_CURRENT_SOURCE_DIR}/netlist.keywords
${PROJECT_SOURCE_DIR}/include/netlist_lexer.h
${CMAKE_CURRENT_SOURCE_DIR}/netlist_keywords.cpp
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
@ -165,21 +167,29 @@ make_lexer(
${PROJECT_SOURCE_DIR}/include/pcb_plot_params_lexer.h
${CMAKE_CURRENT_SOURCE_DIR}/pcb_plot_params_keywords.cpp
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
make_lexer( ${CMAKE_CURRENT_SOURCE_DIR}/pcb.keywords
${PROJECT_SOURCE_DIR}/include/pcb_lexer.h
${CMAKE_CURRENT_SOURCE_DIR}/pcb_keywords.cpp
PCB_KEYS_T
)
make_lexer(
${CMAKE_CURRENT_SOURCE_DIR}/pcb.keywords
${PROJECT_SOURCE_DIR}/include/pcb_lexer.h
${CMAKE_CURRENT_SOURCE_DIR}/pcb_keywords.cpp
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.
make_lexer( ${CMAKE_CURRENT_SOURCE_DIR}/fp_lib_table.keywords
${PROJECT_SOURCE_DIR}/include/fp_lib_table_lexer.h
${CMAKE_CURRENT_SOURCE_DIR}/fp_lib_table_keywords.cpp
FP_LIB_TABLE_T
)
make_lexer(
${CMAKE_CURRENT_SOURCE_DIR}/fp_lib_table.keywords
${PROJECT_SOURCE_DIR}/include/fp_lib_table_lexer.h
${CMAKE_CURRENT_SOURCE_DIR}/fp_lib_table_keywords.cpp
FP_LIB_TABLE_T
)
# The dsntest may not build properly using MS Visual Studio.
if(NOT MSVC)

View File

@ -198,6 +198,9 @@ make_lexer(
${CMAKE_CURRENT_SOURCE_DIR}/template_fieldnames_lexer.h
${CMAKE_CURRENT_SOURCE_DIR}/template_fieldnames_keywords.cpp
TFIELD_T
# Pass header file with dependency on *_lexer.h as extra_arg
template_fieldnames.h
)
add_executable(eeschema WIN32 MACOSX_BUNDLE

View File

@ -1,43 +0,0 @@
/**
* @file kicad_msvc.h
* @brief Code used to compile KiCad with Microsoft Visual C++
*/
// __MSVC__ must be defined
//
// there are several issues
// 1 - the EXCHG macro uses the typeof keyword, this is unsupported in MSVC
// 2 - there is no round function in the msvc math library
// see ReadMe-MSVC. txt to view list of all changes to sources
//
#ifndef __KICAD_MSVC_ INC__
#define __KICAD_MSVC_ INC__
#ifdef __MSVC__
// the boost libs have a workaround for the typeof problem
#ifdef _MSC_VER
#if ( _MSC_VER <= 1310 ) // 6.5 7.0 and 7.1 use the msvc bug
#include <boost/typeof/msvc/typeof_impl.hpp>
#else // 8.0 or greater
#include <boost/typeof/typeof.hpp>
// we have to register the types used with the typeof keyword with boost
BOOST_TYPEOF_REGISTER_TYPE(wxPoint) ;
BOOST_TYPEOF_REGISTER_TYPE(wxSize) ;
BOOST_TYPEOF_REGISTER_TYPE(wxString) ;
class DrawSheetLabelStruct;
BOOST_TYPEOF_REGISTER_TYPE(DrawSheetLabelStruct *);
class EDA_ITEM;
BOOST_TYPEOF_REGISTER_TYPE(EDA_ITEM *);
class D_PAD;
BOOST_TYPEOF_REGISTER_TYPE(D_PAD *);
BOOST_TYPEOF_REGISTER_TYPE(const D_PAD *);
class BOARD_ITEM;
BOOST_TYPEOF_REGISTER_TYPE(BOARD_ITEM *);
#endif // _MSC_VER <= 1310
#define typeof(expr) BOOST_TYPEOF(expr)
#endif // def _MSC_VER
#endif // def __MSVC__
#endif // ndef __KICAD_MSVC_ INC__

View File

@ -60,10 +60,13 @@ endif(APPLE)
# auto-generate pcb_calculator_datafile.h and pcb_calculator_datafile_keywords.cpp
# for the storage data file format.
make_lexer(
${CMAKE_CURRENT_SOURCE_DIR}/pcb_calculator_datafile.keywords
${CMAKE_CURRENT_SOURCE_DIR}/pcb_calculator_datafile_lexer.h
${CMAKE_CURRENT_SOURCE_DIR}/pcb_calculator_datafile_keywords.cpp
PCBCALC_DATA_T
${CMAKE_CURRENT_SOURCE_DIR}/pcb_calculator_datafile.keywords
${CMAKE_CURRENT_SOURCE_DIR}/pcb_calculator_datafile_lexer.h
${CMAKE_CURRENT_SOURCE_DIR}/pcb_calculator_datafile_keywords.cpp
PCBCALC_DATA_T
# Pass header file with dependency on *_lexer.h as extra_arg
datafile_read_write.h
)

View File

@ -385,6 +385,9 @@ make_lexer(
${CMAKE_CURRENT_SOURCE_DIR}/specctra_lexer.h
${CMAKE_CURRENT_SOURCE_DIR}/specctra_keywords.cpp
DSN
# Pass header file with dependency on *_lexer.h as extra_arg
specctra.h
)