Lay basis for a more full featured usage of boost, including compiled libraries such as unit_test_framework, system, etc. Move headers now into boost_root/include/boost/.

This commit is contained in:
Dick Hollenbeck 2013-08-20 13:03:21 -05:00
parent e04860d61b
commit 0be3992913
13 changed files with 520 additions and 349 deletions

View File

@ -1,4 +1,4 @@
include/boost
boost_root
.downloads-by-cmake
common/netlist_keywords.*
common/netlist_lexer.h

View File

@ -2,7 +2,6 @@ add_definitions(-DPCBNEW)
include_directories(BEFORE ${INC_BEFORE})
include_directories(
${Boost_INCLUDE_DIR}
../pcbnew
../polygon
${INC_AFTER}

View File

@ -53,11 +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)
add_definitions( -DKICAD_STABLE_VERSION )
message( "Building stable 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
@ -248,9 +251,8 @@ include(CheckFindPackageResult)
find_package( OpenGL QUIET )
check_find_package_result( OPENGL_FOUND "OpenGL" )
##########################
# Download Boost library #
##########################
# Download boost and possibly build parts of it
#################################################
include( download_boost )
@ -286,6 +288,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 )
@ -308,11 +331,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)
find_package( PythonLibs )
#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.
@ -327,20 +358,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
@ -359,7 +376,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 )
@ -370,7 +386,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 )

View File

@ -81,4 +81,8 @@
/// 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_

View File

@ -22,12 +22,39 @@
# 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>----------------------------------------------------------------
set( BOOST_RELEASE 1.53.0 )
set( BOOST_MD5 a00d22605d5dbcfb4c9936a9b35bc4c2 ) # re-calc this on every RELEASE change
# 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 +63,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 )
foreach( lib IN LISTS ${libs} )
string( TOUPPER ${lib} LIB )
message( STATUS "LIB:${LIB} lib:${lib}" )
set( Boost_${LIB}_LIBRARY, "${BOOST_ROOT}/lib/libboost_${lib}.a" PARENT_SCOPE )
set( Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${LIB}_LIBRARY} PARENT_SCOPE )
endforeach()
endfunction()
if( BUILD_GITHUB_PLUGIN )
message( FATAL_ERROR
"BUILD_GITHUB_PLUGIN not functional. With this commit we get merely a greenfield for better boost usage and building."
)
# (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}
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"
# [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 ""
)
else( BUILD_GITHUB_PLUGIN )
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"
# 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 library directory" )
endif( BUILD_GITHUB_PLUGIN )
ExternalProject_Add_Step( boost bzr_commit_boost
COMMAND bzr ci -q -m pristine <SOURCE_DIR>
@ -66,8 +168,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 +181,4 @@ ExternalProject_Add_Step( boost bzr_init_boost
DEPENDERS bzr_add_boost
DEPENDEES download
)

View File

@ -3,7 +3,6 @@ include_directories(BEFORE ${INC_BEFORE})
include_directories(
./dialogs
./dialog_about
${Boost_INCLUDE_DIR}
../3d-viewer
../pcbnew
../polygon

View File

@ -7,7 +7,6 @@ add_definitions(-DCVPCB)
include_directories( BEFORE ${INC_BEFORE} )
include_directories(
./dialogs
${Boost_INCLUDE_DIR}
../3d-viewer
../pcbnew
../polygon
@ -50,23 +49,26 @@ if(WIN32)
if( MINGW )
# CVPCB_RESOURCES variable is set by the macro.
mingw_resource_compiler( cvpcb )
else(MINGW)
else()
set( CVPCB_RESOURCES cvpcb.rc )
endif(MINGW)
endif(WIN32)
endif()
endif()
###
# Apple resource files
###
if( APPLE )
set( CVPCB_RESOURCES cvpcb.icns cvpcb_doc.icns )
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/cvpcb.icns"
PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/cvpcb_doc.icns"
PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
set( MACOSX_BUNDLE_ICON_FILE cvpcb.icns )
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.cvpcb )
endif(APPLE)
endif()
###
# Create the cvpcb executable
@ -82,7 +84,7 @@ add_executable(cvpcb WIN32 MACOSX_BUNDLE
###
if( APPLE )
set_target_properties( cvpcb PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist )
endif(APPLE)
endif()
###
# Link executable target cvpcb with correct libraries
@ -104,4 +106,5 @@ target_link_libraries(cvpcb
###
install( TARGETS cvpcb
DESTINATION ${KICAD_BIN}
COMPONENT binary)
COMPONENT binary
)

View File

@ -6,7 +6,6 @@ include_directories(
./dialogs
../common
../common/dialogs
${Boost_INCLUDE_DIR}
${INC_AFTER}
)

View File

@ -18,7 +18,7 @@ class BOARD_DESIGN_SETTINGS
{
public:
bool m_MicroViasAllowed; ///< true to allow micro vias
int m_CurrentViaType; ///< via type (VIA_BLIND_BURIED, VIA_TROUGHT VIA_MICROVIA)
int m_CurrentViaType; ///< via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA)
/// if true, when creating a new track starting on an existing track, use this track width
bool m_UseConnectedTrackWidth;

View File

@ -2,7 +2,6 @@ add_definitions(-DKICAD)
include_directories(BEFORE ${INC_BEFORE})
include_directories(
${Boost_INCLUDE_DIR}
${INC_AFTER}
)

View File

@ -4,7 +4,12 @@ if (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
file( MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/scripting )
find_package( SWIG REQUIRED )
include( ${SWIG_USE_FILE} )
endif(KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
# Infrequently needed headers go at end of search paths, append to INC_AFTER
set( INC_AFTER ${INC_AFTER} ${CMAKE_CURRENT_SOURCE_DIR}/scripting )
#message( STATUS "pcbnew INC_AFTER:${INC_AFTER}" )
endif()
###
@ -16,14 +21,11 @@ include_directories(
./autorouter
../3d-viewer
../common
${Boost_INCLUDE_DIR}
../polygon
../common/dialogs
./scripting
${INC_AFTER}
)
###
# Sources
#
@ -250,7 +252,7 @@ if (KICAD_SCRIPTING)
pcbnew_wrap.cxx
${PCBNEW_SCRIPTING_PYTHON_HELPERS}
)
endif(KICAD_SCRIPTING)
endif()
##
# Scripting build
@ -258,7 +260,13 @@ endif(KICAD_SCRIPTING)
if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
set(SWIG_FLAGS -I${CMAKE_CURRENT_SOURCE_DIR}/../.. -I${CMAKE_CURRENT_SOURCE_DIR} -I${CMAKE_CURRENT_SOURCE_DIR}/../include -I${CMAKE_CURRENT_SOURCE_DIR}/../scripting )
set( SWIG_FLAGS
-I${CMAKE_CURRENT_SOURCE_DIR}/../..
-I${CMAKE_CURRENT_SOURCE_DIR}
-I${CMAKE_CURRENT_SOURCE_DIR}/../include
-I${CMAKE_CURRENT_SOURCE_DIR}/../scripting
)
if( DEBUG )
set( SWIG_FLAGS ${SWIG_FLAGS} -DDEBUG )
endif()
@ -270,7 +278,7 @@ if (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
set( SWIG_FLAGS ${SWIG_FLAGS} -D${d} )
endforeach()
endif(KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
endif()
if( KICAD_SCRIPTING )
@ -295,7 +303,7 @@ if (KICAD_SCRIPTING)
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endif(KICAD_SCRIPTING)
endif()
###
# _pcbnew DLL/DSO file creation
@ -327,7 +335,7 @@ if (KICAD_SCRIPTING_MODULES)
${PCBNEW_EXTRA_LIBS}
)
endif (KICAD_SCRIPTING_MODULES)
endif()
###
# Windows resource file
@ -336,10 +344,10 @@ if(WIN32)
if( MINGW )
# PCBNEW_RESOURCES variable is set by the macro.
mingw_resource_compiler( pcbnew )
else(MINGW)
else()
set( PCBNEW_RESOURCES pcbnew.rc )
endif(MINGW)
endif(WIN32)
endif()
endif()
###
# Set properties for APPLE on pcbnew target
@ -353,7 +361,7 @@ if(APPLE)
set( MACOSX_BUNDLE_ICON_FILE pcbnew.icns )
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.pcbnew )
set( MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist )
endif(APPLE)
endif()
# Create a C++ compilable string initializer containing html text into a *.h file:
add_custom_command(
@ -385,6 +393,16 @@ make_lexer(
)
###
# subcomponents of pcbnew
###
add_subdirectory( pcad2kicadpcb_plugin )
if( BUILD_GITHUB_PLUGIN )
add_subdirectory( github )
endif()
###
# Create the pcbnew executable
###
@ -400,7 +418,7 @@ add_executable(pcbnew WIN32 MACOSX_BUNDLE
###
if( APPLE )
set_target_properties( pcbnew PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist )
endif(APPLE)
endif()
###
# Link executable target pcbnew with correct libraries
@ -436,7 +454,7 @@ if(KICAD_SCRIPTING)
)
install( FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py DESTINATION ${PYTHON_DEST} )
endif(KICAD_SCRIPTING)
endif()
if( KICAD_SCRIPTING_MODULES )
add_custom_target( FixSwigImportsModuleScripting ALL
@ -449,11 +467,10 @@ if (KICAD_SCRIPTING_MODULES)
if( WIN32 )
install( FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.pyd DESTINATION ${PYTHON_DEST} )
else(WIN32)
else()
install( FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.so DESTINATION ${PYTHON_DEST} )
endif(WIN32)
endif(KICAD_SCRIPTING_MODULES)
endif()
endif()
# The specctra test fails to build properly using MS Visual Studio.
@ -461,10 +478,11 @@ if(NOT MSVC)
# This one gets made only when testing.
add_executable( specctra_test EXCLUDE_FROM_ALL specctra_test.cpp specctra.cpp )
target_link_libraries( specctra_test common ${wxWidgets_LIBRARIES} )
endif(NOT MSVC)
endif()
# This one gets made only when testing.
add_executable( layer_widget_test WIN32 EXCLUDE_FROM_ALL
layer_widget.cpp
)
target_link_libraries( layer_widget_test common ${wxWidgets_LIBRARIES} )

View File

@ -0,0 +1,33 @@
# 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
include_directories( . )
set( GITHUB_PLUGIN_SRCS
github_plugin.cpp
PARENT_SCOPE # tell links based in 'directory pcbnew' about it, i.e. "../"
)

View File

@ -1,12 +1,10 @@
add_definitions(-DPCBNEW)
include_directories(BEFORE ${INC_BEFORE})
include_directories(
../../include
../../pcbnew
../../polygon
${INC_AFTER}
)
# Sources for the pcbnew PLUGIN called PCAD_PLUGIN
# This CMakeLists.txt is included from pcbnew, so we are inheriting its include_directories(),
# simply add the current source dir to inherited include_directories() for sources in here only.
include_directories( . )
set( PCAD2PCBNEW_SRCS
pcad2kicad_common.cpp