Commit 0be39929 authored by Dick Hollenbeck's avatar Dick Hollenbeck

Lay basis for a more full featured usage of boost, including compiled...

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/.
parent e04860d6
include/boost boost_root
.downloads-by-cmake .downloads-by-cmake
common/netlist_keywords.* common/netlist_keywords.*
common/netlist_lexer.h common/netlist_lexer.h
......
...@@ -2,7 +2,6 @@ add_definitions(-DPCBNEW) ...@@ -2,7 +2,6 @@ add_definitions(-DPCBNEW)
include_directories(BEFORE ${INC_BEFORE}) include_directories(BEFORE ${INC_BEFORE})
include_directories( include_directories(
${Boost_INCLUDE_DIR}
../pcbnew ../pcbnew
../polygon ../polygon
${INC_AFTER} ${INC_AFTER}
......
project(kicad) project( kicad )
cmake_minimum_required(VERSION 2.8.4 FATAL_ERROR) cmake_minimum_required( VERSION 2.8.4 FATAL_ERROR )
# because of http://public.kitware.com/Bug/view.php?id=10395 # because of http://public.kitware.com/Bug/view.php?id=10395
# 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 )
# #
# KiCad build options should be added below. # KiCad build options should be added below.
...@@ -15,32 +15,32 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules) ...@@ -15,32 +15,32 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
# #
# Russian GOST patch # Russian GOST patch
option(wxUSE_UNICODE "enable/disable building unicode (default OFF)") 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)") option( KICAD_GOST "enable/disable building using GOST notation for multiple gates per package ( default OFF)" )
#for those who bored with uppercase #for those who bored with uppercase
option(KICAD_KEEPCASE "turn-off automatic component name conversion to uppercase if selected") option( KICAD_KEEPCASE "turn-off automatic component name conversion to uppercase if selected" )
option(USE_WX_GRAPHICS_CONTEXT option( USE_WX_GRAPHICS_CONTEXT
"Use wxGraphicsContext for rendering (default OFF). Warning, this is experimental") "Use wxGraphicsContext for rendering ( default OFF). Warning, this is experimental" )
option(USE_WX_OVERLAY option( USE_WX_OVERLAY
"Use wxOverlay: Always ON for MAC (default OFF). Warning, this is experimental") "Use wxOverlay: Always ON for MAC ( default OFF). Warning, this is experimental" )
#One of these 2 option *must* be set to ON: #One of these 2 option *must* be set to ON:
option(KICAD_STABLE_VERSION option( KICAD_STABLE_VERSION
"set this option to ON to build the stable version of KICAD. mainly used to set version ID (default OFF)" "set this option to ON to build the stable version of KICAD. mainly used to set version ID (default OFF)"
) )
option(KICAD_SCRIPTING option( KICAD_SCRIPTING
"set this option ON to build the scripting support inside kicad binaries" "set this option ON to build the scripting support inside kicad binaries"
) )
option(KICAD_SCRIPTING_MODULES option( KICAD_SCRIPTING_MODULES
"set this option ON to build kicad modules that can be used from scripting languages" "set this option ON to build kicad modules that can be used from scripting languages"
) )
option(KICAD_SCRIPTING_WXPYTHON option( KICAD_SCRIPTING_WXPYTHON
"set this option ON to build wxpython implementation for wx interface building in python and py.shell" "set this option ON to build wxpython implementation for wx interface building in python and py.shell"
) )
...@@ -51,13 +51,16 @@ option(KICAD_SCRIPTING_WXPYTHON ...@@ -51,13 +51,16 @@ option(KICAD_SCRIPTING_WXPYTHON
# python binary file should be is exec path. # python binary file should be is exec path.
option(USE_FP_LIB_TABLE "Use the new footprint library table implementation. (default OFF)") 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) #Set version option (stable or testing)
if(KICAD_STABLE_VERSION) if( KICAD_STABLE_VERSION)
add_definitions(-DKICAD_STABLE_VERSION) add_definitions( -DKICAD_STABLE_VERSION )
message( "Building stable version of KiCad") message( STATUS "Building stable version of KiCad" )
endif() endif()
# All CMake downloads go here. Suggested is up in the source tree, not in the build dir where they # All CMake downloads go here. Suggested is up in the source tree, not in the build dir where they
...@@ -72,14 +75,14 @@ set( DOWNLOAD_DIR ${PROJECT_SOURCE_DIR}/.downloads-by-cmake ...@@ -72,14 +75,14 @@ set( DOWNLOAD_DIR ${PROJECT_SOURCE_DIR}/.downloads-by-cmake
# Set flags for GCC. # Set flags for GCC.
#================================================ #================================================
if(CMAKE_COMPILER_IS_GNUCXX) if( CMAKE_COMPILER_IS_GNUCXX )
set(KICAD_GCC_RELEASE_BUILD_FLAGS "-O2") set( KICAD_GCC_RELEASE_BUILD_FLAGS "-O2" )
set(KICAD_GCC_RELEASE_DEBUG_FLAGS "") set( KICAD_GCC_RELEASE_DEBUG_FLAGS "" )
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion execute_process( COMMAND ${CMAKE_C_COMPILER} -dumpversion
OUTPUT_VARIABLE GCC_VERSION OUTPUT_VARIABLE GCC_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE )
# Added -Wno-narrowing on 10/7/12 to prevent a huge number of warnings when # Added -Wno-narrowing on 10/7/12 to prevent a huge number of warnings when
# compiling with GCC 4.7. This appears to be caused by and int to unsigned # compiling with GCC 4.7. This appears to be caused by and int to unsigned
...@@ -88,38 +91,38 @@ if(CMAKE_COMPILER_IS_GNUCXX) ...@@ -88,38 +91,38 @@ if(CMAKE_COMPILER_IS_GNUCXX)
# see if the problem has been resolved. Wayne. # see if the problem has been resolved. Wayne.
# #
# Also note the optimization level is -O1 instead of the usual -O2 level # Also note the optimization level is -O1 instead of the usual -O2 level
# because boost::polygon has a function (inflate polygon) broken by # because boost::polygon has a function ( inflate polygon) broken by
# the -O2 level with GCC 4.7 (works fine with with GCC 4.6). # the -O2 level with GCC 4.7 (works fine with with GCC 4.6).
# This lower optimization level does not have a significant change on the speed. # This lower optimization level does not have a significant change on the speed.
# #
# As newer versions of GCC and/or Boost are released, this code needs reviewed to # As newer versions of GCC and/or Boost are released, this code needs reviewed to
# determine if the problems above have been fixed either in Boost or GCC. # determine if the problems above have been fixed either in Boost or GCC.
if(GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7) if( GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7 )
set(KICAD_GCC_RELEASE_BUILD_FLAGS "-Wno-narrowing -O1") set( KICAD_GCC_RELEASE_BUILD_FLAGS "-Wno-narrowing -O1" )
set(KICAD_GCC_DEBUG_BUILD_FLAGS "-Wno-narrowing") set( KICAD_GCC_DEBUG_BUILD_FLAGS "-Wno-narrowing" )
endif() endif()
if(CMAKE_BUILD_TYPE STREQUAL Debug) if( CMAKE_BUILD_TYPE STREQUAL Debug )
message(STATUS message( STATUS
"Setting GCC version ${GCC_VERSION} build flags \"${KICAD_GCC_DEBUG_BUILD_FLAGS}\"") "Setting GCC version ${GCC_VERSION} build flags \"${KICAD_GCC_DEBUG_BUILD_FLAGS}\"" )
else() else()
message(STATUS message( STATUS
"Setting GCC version ${GCC_VERSION} build flags \"${KICAD_GCC_RELEASE_BUILD_FLAGS}\"") "Setting GCC version ${GCC_VERSION} build flags \"${KICAD_GCC_RELEASE_BUILD_FLAGS}\"" )
endif() endif()
if(MINGW) if( MINGW )
# According to some sources, under Windows -fPIC option is not needed: # According to some sources, under Windows -fPIC option is not needed:
# http://mingw.5.n7.nabble.com/Option-fPIC-not-supported-td18480.html # http://mingw.5.n7.nabble.com/Option-fPIC-not-supported-td18480.html
# Set default flags for Release build. # Set default flags for Release build.
set(CMAKE_C_FLAGS_RELEASE "-Wall ${KICAD_GCC_RELEASE_BUILD_FLAGS} -DNDEBUG") set( CMAKE_C_FLAGS_RELEASE "-Wall ${KICAD_GCC_RELEASE_BUILD_FLAGS} -DNDEBUG" )
set(CMAKE_CXX_FLAGS_RELEASE "-Wall ${KICAD_GCC_RELEASE_BUILD_FLAGS} -DNDEBUG") set( CMAKE_CXX_FLAGS_RELEASE "-Wall ${KICAD_GCC_RELEASE_BUILD_FLAGS} -DNDEBUG" )
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s -static-libgcc -static-libstdc++") set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s -static-libgcc -static-libstdc++" )
# Set default flags for Debug build. # Set default flags for Debug build.
set(CMAKE_C_FLAGS_DEBUG "-Wall ${KICAD_GCC_DEBUG_BUILD_FLAGS} -g3 -ggdb3 -DDEBUG") set( CMAKE_C_FLAGS_DEBUG "-Wall ${KICAD_GCC_DEBUG_BUILD_FLAGS} -g3 -ggdb3 -DDEBUG" )
set(CMAKE_CXX_FLAGS_DEBUG "-Wall ${KICAD_GCC_DEBUG_BUILD_FLAGS} -g3 -ggdb3 -DDEBUG") set( CMAKE_CXX_FLAGS_DEBUG "-Wall ${KICAD_GCC_DEBUG_BUILD_FLAGS} -g3 -ggdb3 -DDEBUG" )
set(CMAKE_MODULE_LINKER_FLAGS "-static-libgcc -static-libstdc++") # SWIG macros on Windows set( CMAKE_MODULE_LINKER_FLAGS "-static-libgcc -static-libstdc++") # SWIG macros on Windows
else() else()
# We build DLL/DSOs from static libraries, so create position independent code # We build DLL/DSOs from static libraries, so create position independent code
...@@ -129,17 +132,17 @@ if(CMAKE_COMPILER_IS_GNUCXX) ...@@ -129,17 +132,17 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC" )
# Thou shalt not link vaporware and tell us it's a valid DSO: # Thou shalt not link vaporware and tell us it's a valid DSO:
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined") set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" )
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined") # needed by SWIG macros on linux set( CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined" ) # needed by SWIG macros on linux
# Set default flags for Release build. # Set default flags for Release build.
set(CMAKE_C_FLAGS_RELEASE "${KICAD_GCC_RELEASE_BUILD_FLAGS} -Wall -DNDEBUG") set( CMAKE_C_FLAGS_RELEASE "${KICAD_GCC_RELEASE_BUILD_FLAGS} -Wall -DNDEBUG" )
set(CMAKE_CXX_FLAGS_RELEASE "${KICAD_GCC_RELEASE_BUILD_FLAGS} -Wall -DNDEBUG") set( CMAKE_CXX_FLAGS_RELEASE "${KICAD_GCC_RELEASE_BUILD_FLAGS} -Wall -DNDEBUG" )
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s") set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" )
# Set default flags for Debug build. # Set default flags for Debug build.
set(CMAKE_C_FLAGS_DEBUG "${KICAD_GCC_DEBUG_BUILD_FLAGS} -Wall -g3 -ggdb3 -DDEBUG") set( CMAKE_C_FLAGS_DEBUG "${KICAD_GCC_DEBUG_BUILD_FLAGS} -Wall -g3 -ggdb3 -DDEBUG" )
set(CMAKE_CXX_FLAGS_DEBUG "${KICAD_GCC_DEBUG_BUILD_FLAGS} -Wall -g3 -ggdb3 -DDEBUG") set( CMAKE_CXX_FLAGS_DEBUG "${KICAD_GCC_DEBUG_BUILD_FLAGS} -Wall -g3 -ggdb3 -DDEBUG" )
endif() endif()
# quiet GCC 4.8.1 while in boost # quiet GCC 4.8.1 while in boost
...@@ -147,110 +150,109 @@ if(CMAKE_COMPILER_IS_GNUCXX) ...@@ -147,110 +150,109 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs" )
endif() endif()
endif(CMAKE_COMPILER_IS_GNUCXX) endif( CMAKE_COMPILER_IS_GNUCXX )
if(wxUSE_UNICODE) if( wxUSE_UNICODE )
add_definitions(-DwxUSE_UNICODE) add_definitions( -DwxUSE_UNICODE )
endif() endif()
if(KICAD_GOST) if( KICAD_GOST )
add_definitions(-DKICAD_GOST) add_definitions( -DKICAD_GOST )
endif() endif()
if(KICAD_KEEPCASE) if( KICAD_KEEPCASE )
add_definitions(-DKICAD_KEEPCASE) add_definitions( -DKICAD_KEEPCASE )
endif() endif()
if(USE_WX_OVERLAY OR APPLE) if( USE_WX_OVERLAY OR APPLE )
add_definitions(-DUSE_WX_OVERLAY) add_definitions( -DUSE_WX_OVERLAY )
endif() endif()
if(KICAD_SCRIPTING) if( KICAD_SCRIPTING )
add_definitions(-DKICAD_SCRIPTING) add_definitions( -DKICAD_SCRIPTING )
endif() endif()
if(KICAD_SCRIPTING_MODULES) if( KICAD_SCRIPTING_MODULES )
add_definitions(-DKICAD_SCRIPTING_MODULES) add_definitions( -DKICAD_SCRIPTING_MODULES )
endif() endif()
if(KICAD_SCRIPTING_WXPYTHON) if( KICAD_SCRIPTING_WXPYTHON )
add_definitions(-DKICAD_SCRIPTING_WXPYTHON) add_definitions( -DKICAD_SCRIPTING_WXPYTHON )
endif() endif()
if(USE_WX_GRAPHICS_CONTEXT) if( USE_WX_GRAPHICS_CONTEXT )
add_definitions(-DUSE_WX_GRAPHICS_CONTEXT) add_definitions( -DUSE_WX_GRAPHICS_CONTEXT )
endif() endif()
# Allow user to override the default settings for adding images to menu items. By default # Allow user to override the default settings for adding images to menu items. By default
# images in menu items are enabled on all platforms except OSX. This can be over ridden by # images in menu items are enabled on all platforms except OSX. This can be over ridden by
# defining -DUSE_IMAGES_IN_MENUS=ON/OFF to force the preferred behavior. # defining -DUSE_IMAGES_IN_MENUS=ON/OFF to force the preferred behavior.
if(NOT DEFINED USE_IMAGES_IN_MENUS) if( NOT DEFINED USE_IMAGES_IN_MENUS )
if(NOT APPLE) if( NOT APPLE )
set(USE_IMAGES_IN_MENUS ON) set( USE_IMAGES_IN_MENUS ON )
endif() endif()
else() else()
if(USE_IMAGES_IN_MENUS) if( USE_IMAGES_IN_MENUS )
set(USE_IMAGES_IN_MENUS ON) set( USE_IMAGES_IN_MENUS ON )
endif() endif()
endif() endif()
# Locations for install targets. # Locations for install targets.
set(KICAD_BIN bin set( KICAD_BIN bin
CACHE PATH "Location of KiCad binaries.") CACHE PATH "Location of KiCad binaries." )
if(UNIX) if( UNIX )
# Everything without leading / is relative to CMAKE_INSTALL_PREFIX. # Everything without leading / is relative to CMAKE_INSTALL_PREFIX.
set(KICAD_PLUGINS lib/kicad/plugins set( KICAD_PLUGINS lib/kicad/plugins
CACHE PATH "Location of KiCad plugins.") CACHE PATH "Location of KiCad plugins." )
set(KICAD_DATA share/kicad set( KICAD_DATA share/kicad
CACHE PATH "Location of KiCad data files.") CACHE PATH "Location of KiCad data files." )
set(KICAD_DOCS share/doc/kicad set( KICAD_DOCS share/doc/kicad
CACHE PATH "Location of KiCad documentation files.") CACHE PATH "Location of KiCad documentation files." )
endif() endif()
if(MINGW) if( MINGW )
# Like all variables, CMAKE_INSTALL_PREFIX can be over-ridden on the command line. # Like all variables, CMAKE_INSTALL_PREFIX can be over-ridden on the command line.
set(CMAKE_INSTALL_PREFIX c:/kicad set( CMAKE_INSTALL_PREFIX c:/kicad
CACHE PATH "") CACHE PATH "" )
# Everything without leading / is relative to CMAKE_INSTALL_PREFIX. # Everything without leading / is relative to CMAKE_INSTALL_PREFIX.
set(KICAD_PLUGINS ${KICAD_BIN}/plugins set( KICAD_PLUGINS ${KICAD_BIN}/plugins
CACHE PATH "Location of KiCad plugins.") CACHE PATH "Location of KiCad plugins." )
set(KICAD_DATA share set( KICAD_DATA share
CACHE PATH "Location of KiCad data files.") CACHE PATH "Location of KiCad data files." )
set(KICAD_DOCS doc set( KICAD_DOCS doc
CACHE PATH "Location of KiCad documentation files.") CACHE PATH "Location of KiCad documentation files." )
endif() endif()
set(KICAD_DEMOS ${KICAD_DATA}/demos set( KICAD_DEMOS ${KICAD_DATA}/demos
CACHE PATH "Location of KiCad demo files.") CACHE PATH "Location of KiCad demo files." )
set(KICAD_TEMPLATE ${KICAD_DATA}/template set( KICAD_TEMPLATE ${KICAD_DATA}/template
CACHE PATH "Location of KiCad template files.") CACHE PATH "Location of KiCad template files." )
mark_as_advanced(KICAD_BIN mark_as_advanced( KICAD_BIN
KICAD_PLUGINS KICAD_PLUGINS
KICAD_DATA KICAD_DATA
KICAD_DOCS KICAD_DOCS
KICAD_DEMOS KICAD_DEMOS
KICAD_TEMPLATE) KICAD_TEMPLATE )
include(Functions) include( Functions )
include( ExternalProject ) include( ExternalProject )
#================================================ #================================================
# Find libraries that are needed to build KiCad. # Find libraries that are needed to build KiCad.
#================================================ #================================================
include(CheckFindPackageResult) include( CheckFindPackageResult )
####################### #######################
# Find OpenGL library # # Find OpenGL library #
####################### #######################
find_package(OpenGL QUIET) find_package( OpenGL QUIET )
check_find_package_result(OPENGL_FOUND "OpenGL") check_find_package_result( OPENGL_FOUND "OpenGL" )
########################## # Download boost and possibly build parts of it
# Download Boost library # #################################################
##########################
include( download_boost ) include( download_boost )
...@@ -262,85 +264,100 @@ include( download_boost ) ...@@ -262,85 +264,100 @@ include( download_boost )
# http://www.wxwidgets.org/manuals/2.8/wx_librarieslist.html # http://www.wxwidgets.org/manuals/2.8/wx_librarieslist.html
# On Apple only wxwidgets 2.9 or higher doesn't need to find aui part of base # On Apple only wxwidgets 2.9 or higher doesn't need to find aui part of base
if(APPLE) if( APPLE )
find_package(wxWidgets COMPONENTS gl adv html core net base xml QUIET) find_package( wxWidgets COMPONENTS gl adv html core net base xml QUIET )
else(APPLE) else( APPLE )
find_package(wxWidgets COMPONENTS gl aui adv html core net base xml QUIET) find_package( wxWidgets COMPONENTS gl aui adv html core net base xml QUIET )
endif(APPLE) endif( APPLE )
check_find_package_result(wxWidgets_FOUND "wxWidgets") check_find_package_result( wxWidgets_FOUND "wxWidgets" )
# Include wxWidgets macros. # Include wxWidgets macros.
include(${wxWidgets_USE_FILE}) include( ${wxWidgets_USE_FILE} )
# Include MinGW resource compiler. # Include MinGW resource compiler.
include(MinGWResourceCompiler) include( MinGWResourceCompiler )
# Generate build system specific header file. # Generate build system specific header file.
include(PerformFeatureChecks) include( PerformFeatureChecks )
perform_feature_checks() perform_feature_checks()
# Find GDI+ on windows if wxGraphicsContext is available. # Find GDI+ on windows if wxGraphicsContext is available.
if(MINGW AND USE_WX_GRAPHICS_CONTEXT) if( MINGW AND USE_WX_GRAPHICS_CONTEXT )
find_package(GdiPlus) find_package( GdiPlus )
check_find_package_result(GDI_PLUS_FOUND "GDI+") check_find_package_result( GDI_PLUS_FOUND "GDI+" )
endif() 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 # Find Python and other scripting resources
if(KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
set(PythonInterp_FIND_VERSION) set( PythonInterp_FIND_VERSION )
find_package(PythonInterp) find_package( PythonInterp )
check_find_package_result(PYTHONINTERP_FOUND "Python Interpreter") check_find_package_result( PYTHONINTERP_FOUND "Python Interpreter" )
# Get the correct Python site package install path from the Python interpreter found by # Get the correct Python site package install path from the Python interpreter found by
# FindPythonInterp unless the user specifically defined a custom path. # FindPythonInterp unless the user specifically defined a custom path.
if(NOT PYTHON_SITE_PACKAGE_PATH) if( NOT PYTHON_SITE_PACKAGE_PATH )
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig;print\"%s\"%distutils.sysconfig.get_python_lib()" execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig;print\"%s\"%distutils.sysconfig.get_python_lib()"
OUTPUT_VARIABLE PYTHON_SITE_PACKAGE_PATH OUTPUT_VARIABLE PYTHON_SITE_PACKAGE_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
) )
if(NOT PYTHON_SITE_PACKAGE_PATH) if( NOT PYTHON_SITE_PACKAGE_PATH )
message(FATAL_ERROR "Error occurred while attemping to find the Python site library path.") message( FATAL_ERROR "Error occurred while attemping to find the Python site library path." )
endif() endif()
endif() endif()
set(PYTHON_DEST "${PYTHON_SITE_PACKAGE_PATH}" CACHE PATH "Python module install path.") set( PYTHON_DEST "${PYTHON_SITE_PACKAGE_PATH}" CACHE PATH "Python module install path." )
mark_as_advanced(PYTHON_DEST) mark_as_advanced( PYTHON_DEST )
message( STATUS "Python module install path: ${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. # Automagically create version header file.
include(CreateBzrVersionHeader) include( CreateBzrVersionHeader )
create_bzr_version_header() create_bzr_version_header()
if(EXISTS ${CMAKE_SOURCE_DIR}/include/config.h) if( EXISTS ${CMAKE_SOURCE_DIR}/include/config.h )
# This file may exist (created by an alternate process to the svn test above), # This file may exist ( created by an alternate process to the svn test above),
# e.g. could be created by a checkout script that produces a source tar file. # e.g. could be created by a checkout script that produces a source tar file.
# This directive means the about box will have the svn date & revision in it, # This directive means the about box will have the svn date & revision in it,
# but the hard coded release date (program version) will be preserved. # but the hard coded release date ( program version) will be preserved.
add_definitions(-DHAVE_SVN_REVISION) add_definitions( -DHAVE_SVN_REVISION )
endif() 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 # Let CMake look in these directories for nested
...@@ -348,29 +365,28 @@ set(INC_AFTER ...@@ -348,29 +365,28 @@ set(INC_AFTER
#================================================ #================================================
############################ ############################
# Binaries (CMake targets) # # Binaries ( CMake targets ) #
############################ ############################
add_subdirectory(bitmaps_png) add_subdirectory( bitmaps_png )
add_subdirectory(common) add_subdirectory( common )
add_subdirectory(3d-viewer) add_subdirectory( 3d-viewer )
add_subdirectory(cvpcb) add_subdirectory( cvpcb )
add_subdirectory(eeschema) add_subdirectory( eeschema )
add_subdirectory(gerbview) add_subdirectory( gerbview )
add_subdirectory(kicad) add_subdirectory( kicad )
add_subdirectory(pcbnew) add_subdirectory( pcbnew )
add_subdirectory(pcbnew/pcad2kicadpcb_plugin) add_subdirectory( polygon )
add_subdirectory(polygon) add_subdirectory( pagelayout_editor )
add_subdirectory(pagelayout_editor) add_subdirectory( potrace )
add_subdirectory(potrace) add_subdirectory( bitmap2component )
add_subdirectory(bitmap2component) add_subdirectory( pcb_calculator )
add_subdirectory(pcb_calculator) add_subdirectory( tools )
add_subdirectory(tools) #add_subdirectory( new )
#add_subdirectory(new)
# Make all libs and executables depend on ExternalProject_Add( boost ), # 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( pcbnew boost )
add_dependencies( eeschema boost ) add_dependencies( eeschema boost )
add_dependencies( cvpcb boost ) add_dependencies( cvpcb boost )
...@@ -385,14 +401,14 @@ add_dependencies( pl_editor boost ) ...@@ -385,14 +401,14 @@ add_dependencies( pl_editor boost )
############# #############
# Resources # # Resources #
############# #############
add_subdirectory(demos) add_subdirectory( demos )
add_subdirectory(template) add_subdirectory( template )
#================================================ #================================================
# Doxygen Output # Doxygen Output
#================================================ #================================================
find_package(Doxygen) find_package( Doxygen )
if(DOXYGEN_FOUND) if( DOXYGEN_FOUND )
add_custom_target( doxygen-docs add_custom_target( doxygen-docs
${CMAKE_COMMAND} -E remove_directory Documentation/doxygen ${CMAKE_COMMAND} -E remove_directory Documentation/doxygen
COMMAND ${DOXYGEN_EXECUTABLE} COMMAND ${DOXYGEN_EXECUTABLE}
...@@ -411,67 +427,67 @@ endif() ...@@ -411,67 +427,67 @@ endif()
configure_file( configure_file(
"${CMAKE_MODULE_PATH}/cmake_uninstall.cmake.in" "${CMAKE_MODULE_PATH}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY) IMMEDIATE @ONLY )
add_custom_target(uninstall add_custom_target( uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" )
#================================================ #================================================
# Installation parameters # Installation parameters
#================================================ #================================================
install(FILES INSTALL.txt install( FILES INSTALL.txt
DESTINATION ${KICAD_DOCS} DESTINATION ${KICAD_DOCS}
COMPONENT resources) COMPONENT resources )
install(FILES resources/freeroute.jnlp install( FILES resources/freeroute.jnlp
DESTINATION ${KICAD_BIN} DESTINATION ${KICAD_BIN}
COMPONENT resources) COMPONENT resources )
### ###
# Install scripts # Install scripts
### ###
if(UNIX) if( UNIX )
install(DIRECTORY scripts install( DIRECTORY scripts
DESTINATION ${KICAD_DOCS} DESTINATION ${KICAD_DOCS}
COMPONENT resources COMPONENT resources
PATTERN ".svn" EXCLUDE) PATTERN ".svn" EXCLUDE )
endif() endif()
### ###
# FreeDesktop .desktop and MIME resources # FreeDesktop .desktop and MIME resources
### ###
if(UNIX) if( UNIX )
# Set paths # Set paths
set(UNIX_MIME_DIR resources/linux/mime) set( UNIX_MIME_DIR resources/linux/mime )
set(UNIX_MIMELNK_FILES ${UNIX_MIME_DIR}/mimelnk) set( UNIX_MIMELNK_FILES ${UNIX_MIME_DIR}/mimelnk )
set(UNIX_MIME_FILES ${UNIX_MIME_DIR}/mime) set( UNIX_MIME_FILES ${UNIX_MIME_DIR}/mime )
set(UNIX_ICONS_FILES ${UNIX_MIME_DIR}/icons) set( UNIX_ICONS_FILES ${UNIX_MIME_DIR}/icons )
set(UNIX_APPLICATIONS_FILES ${UNIX_MIME_DIR}/applications) set( UNIX_APPLICATIONS_FILES ${UNIX_MIME_DIR}/applications )
# Install Mimelnk directory # Install Mimelnk directory
install(DIRECTORY ${UNIX_MIMELNK_FILES} install( DIRECTORY ${UNIX_MIMELNK_FILES}
DESTINATION ${CMAKE_INSTALL_PREFIX}/share DESTINATION ${CMAKE_INSTALL_PREFIX}/share
COMPONENT resources COMPONENT resources
PATTERN ".svn" EXCLUDE) PATTERN ".svn" EXCLUDE )
# Install Mime directory # Install Mime directory
install(DIRECTORY ${UNIX_ICONS_FILES} install( DIRECTORY ${UNIX_ICONS_FILES}
DESTINATION ${CMAKE_INSTALL_PREFIX}/share DESTINATION ${CMAKE_INSTALL_PREFIX}/share
COMPONENT resources COMPONENT resources
PATTERN ".svn" EXCLUDE) PATTERN ".svn" EXCLUDE )
# Install Icons # Install Icons
install(DIRECTORY ${UNIX_MIME_FILES} install( DIRECTORY ${UNIX_MIME_FILES}
DESTINATION ${CMAKE_INSTALL_PREFIX}/share DESTINATION ${CMAKE_INSTALL_PREFIX}/share
COMPONENT resources COMPONENT resources
PATTERN ".svn" EXCLUDE) PATTERN ".svn" EXCLUDE )
# Install Applications directory (.desktop files) # Install Applications directory (.desktop files)
install(DIRECTORY ${UNIX_APPLICATIONS_FILES} install( DIRECTORY ${UNIX_APPLICATIONS_FILES}
DESTINATION ${CMAKE_INSTALL_PREFIX}/share DESTINATION ${CMAKE_INSTALL_PREFIX}/share
COMPONENT resources COMPONENT resources
PATTERN ".svn" EXCLUDE) PATTERN ".svn" EXCLUDE )
endif() endif()
include(CTest) include( CTest )
...@@ -81,4 +81,8 @@ ...@@ -81,4 +81,8 @@
/// Definition to compile with Pcbnew footprint library table implementation. /// Definition to compile with Pcbnew footprint library table implementation.
#cmakedefine USE_FP_LIB_TABLE #cmakedefine USE_FP_LIB_TABLE
/// When defined, build the GITHUB_PLUGIN for pcbnew.
#cmakedefine BUILD_GITHUB_PLUGIN
#endif // CONFIG_H_ #endif // CONFIG_H_
...@@ -22,11 +22,38 @@ ...@@ -22,11 +22,38 @@
# Download and patch boost headers to a particular version. # 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. # 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_RELEASE 1.53.0 )
set( BOOST_MD5 a00d22605d5dbcfb4c9936a9b35bc4c2 ) # re-calc this on every RELEASE change 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}" ) string( REGEX REPLACE "\\." "_" BOOST_VERS "${BOOST_RELEASE}" )
set( PREFIX ${DOWNLOAD_DIR}/boost_${BOOST_VERS} ) set( PREFIX ${DOWNLOAD_DIR}/boost_${BOOST_VERS} )
...@@ -36,26 +63,101 @@ set( PREFIX ${DOWNLOAD_DIR}/boost_${BOOST_VERS} ) ...@@ -36,26 +63,101 @@ set( PREFIX ${DOWNLOAD_DIR}/boost_${BOOST_VERS} )
# 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 working tree 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.
# include only the headers in the repo. # path to the boost headers in the repo.
# repo = "${headers}/../.bzr" = "<SOURCE_DIR>/.bzr" # repo = "${headers_src}/../.bzr" = "<SOURCE_DIR>/.bzr"
set( headers ${PREFIX}/src/boost/boost ) set( headers_src "${PREFIX}/src/boost/boost" )
ExternalProject_Add( boost # don't look at this:
PREFIX ${PREFIX} function( set_boost_lib_names libs )
DOWNLOAD_DIR ${DOWNLOAD_DIR} foreach( lib IN LISTS ${libs} )
URL http://downloads.sourceforge.net/project/boost/boost/${BOOST_RELEASE}/boost_${BOOST_VERS}.tar.bz2 string( TOUPPER ${lib} LIB )
URL_MD5 ${BOOST_MD5} 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()
# 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 "" if( BUILD_GITHUB_PLUGIN )
# remove then re-copy into the include/boost directory during next two steps: message( FATAL_ERROR
BUILD_COMMAND ${CMAKE_COMMAND} -E remove_directory ${PROJECT_SOURCE_DIR}/include/boost "BUILD_GITHUB_PLUGIN not functional. With this commit we get merely a greenfield for better boost usage and building."
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ${headers} ${PROJECT_SOURCE_DIR}/include/boost )
)
# (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 ""
)
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 ${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 ExternalProject_Add_Step( boost bzr_commit_boost
...@@ -66,8 +168,8 @@ ExternalProject_Add_Step( boost bzr_commit_boost ...@@ -66,8 +168,8 @@ ExternalProject_Add_Step( boost bzr_commit_boost
ExternalProject_Add_Step( boost bzr_add_boost ExternalProject_Add_Step( boost bzr_add_boost
# add only the headers to the scratch repo, repo = "../.bzr" from ${headers} # add only the headers to the scratch repo, repo = "../.bzr" from ${headers_src}
COMMAND bzr add -q ${headers} COMMAND bzr add -q ${headers_src}
COMMENT "adding pristine boost files to 'boost scratch repo'" COMMENT "adding pristine boost files to 'boost scratch repo'"
DEPENDERS bzr_commit_boost DEPENDERS bzr_commit_boost
) )
...@@ -79,3 +181,4 @@ ExternalProject_Add_Step( boost bzr_init_boost ...@@ -79,3 +181,4 @@ ExternalProject_Add_Step( boost bzr_init_boost
DEPENDERS bzr_add_boost DEPENDERS bzr_add_boost
DEPENDEES download DEPENDEES download
) )
...@@ -3,7 +3,6 @@ include_directories(BEFORE ${INC_BEFORE}) ...@@ -3,7 +3,6 @@ include_directories(BEFORE ${INC_BEFORE})
include_directories( include_directories(
./dialogs ./dialogs
./dialog_about ./dialog_about
${Boost_INCLUDE_DIR}
../3d-viewer ../3d-viewer
../pcbnew ../pcbnew
../polygon ../polygon
......
add_definitions(-DCVPCB) add_definitions( -DCVPCB )
### ###
# Includes # Includes
### ###
include_directories(BEFORE ${INC_BEFORE}) include_directories( BEFORE ${INC_BEFORE} )
include_directories( include_directories(
./dialogs ./dialogs
${Boost_INCLUDE_DIR}
../3d-viewer ../3d-viewer
../pcbnew ../pcbnew
../polygon ../polygon
...@@ -18,14 +17,14 @@ include_directories( ...@@ -18,14 +17,14 @@ include_directories(
### ###
# Sources # Sources
### ###
set(CVPCB_DIALOGS set( CVPCB_DIALOGS
dialogs/dialog_cvpcb_config.cpp dialogs/dialog_cvpcb_config.cpp
dialogs/dialog_cvpcb_config_fbp.cpp dialogs/dialog_cvpcb_config_fbp.cpp
dialogs/dialog_display_options.cpp dialogs/dialog_display_options.cpp
dialogs/dialog_display_options_base.cpp dialogs/dialog_display_options_base.cpp
) )
set(CVPCB_SRCS set( CVPCB_SRCS
../common/base_units.cpp ../common/base_units.cpp
../pcbnew/board_items_to_polygon_shape_transform.cpp ../pcbnew/board_items_to_polygon_shape_transform.cpp
../pcbnew/class_drc_item.cpp ../pcbnew/class_drc_item.cpp
...@@ -46,32 +45,35 @@ set(CVPCB_SRCS ...@@ -46,32 +45,35 @@ set(CVPCB_SRCS
### ###
# Windows resource file # Windows resource file
### ###
if(WIN32) if( WIN32 )
if(MINGW) if( MINGW )
# CVPCB_RESOURCES variable is set by the macro. # CVPCB_RESOURCES variable is set by the macro.
mingw_resource_compiler(cvpcb) mingw_resource_compiler( cvpcb )
else(MINGW) else()
set(CVPCB_RESOURCES cvpcb.rc) set( CVPCB_RESOURCES cvpcb.rc )
endif(MINGW) endif()
endif(WIN32) endif()
### ###
# Apple resource files # Apple resource files
### ###
if(APPLE) if( APPLE )
set(CVPCB_RESOURCES cvpcb.icns cvpcb_doc.icns) 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.icns"
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/cvpcb_doc.icns" PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
set(MACOSX_BUNDLE_ICON_FILE cvpcb.icns) set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/cvpcb_doc.icns"
set(MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.cvpcb) PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
endif(APPLE)
set( MACOSX_BUNDLE_ICON_FILE cvpcb.icns )
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.cvpcb )
endif()
### ###
# Create the cvpcb executable # Create the cvpcb executable
### ###
add_executable(cvpcb WIN32 MACOSX_BUNDLE add_executable( cvpcb WIN32 MACOSX_BUNDLE
${CVPCB_SRCS} ${CVPCB_SRCS}
${CVPCB_DIALOGS} ${CVPCB_DIALOGS}
${CVPCB_RESOURCES} ${CVPCB_RESOURCES}
...@@ -80,14 +82,14 @@ add_executable(cvpcb WIN32 MACOSX_BUNDLE ...@@ -80,14 +82,14 @@ add_executable(cvpcb WIN32 MACOSX_BUNDLE
### ###
# Set properties for APPLE on cvpcb target # Set properties for APPLE on cvpcb target
### ###
if(APPLE) if( APPLE )
set_target_properties(cvpcb PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist) 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 # Link executable target cvpcb with correct libraries
### ###
target_link_libraries(cvpcb target_link_libraries( cvpcb
3d-viewer 3d-viewer
pcbcommon pcbcommon
pcad2kicadpcb pcad2kicadpcb
...@@ -102,6 +104,7 @@ target_link_libraries(cvpcb ...@@ -102,6 +104,7 @@ target_link_libraries(cvpcb
### ###
# Add cvpcb as install target # Add cvpcb as install target
### ###
install(TARGETS cvpcb install( TARGETS cvpcb
DESTINATION ${KICAD_BIN} DESTINATION ${KICAD_BIN}
COMPONENT binary) COMPONENT binary
)
...@@ -6,7 +6,6 @@ include_directories( ...@@ -6,7 +6,6 @@ include_directories(
./dialogs ./dialogs
../common ../common
../common/dialogs ../common/dialogs
${Boost_INCLUDE_DIR}
${INC_AFTER} ${INC_AFTER}
) )
......
...@@ -18,7 +18,7 @@ class BOARD_DESIGN_SETTINGS ...@@ -18,7 +18,7 @@ class BOARD_DESIGN_SETTINGS
{ {
public: public:
bool m_MicroViasAllowed; ///< true to allow micro vias 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 /// if true, when creating a new track starting on an existing track, use this track width
bool m_UseConnectedTrackWidth; bool m_UseConnectedTrackWidth;
......
...@@ -2,7 +2,6 @@ add_definitions(-DKICAD) ...@@ -2,7 +2,6 @@ add_definitions(-DKICAD)
include_directories(BEFORE ${INC_BEFORE}) include_directories(BEFORE ${INC_BEFORE})
include_directories( include_directories(
${Boost_INCLUDE_DIR}
${INC_AFTER} ${INC_AFTER}
) )
......
add_definitions(-DPCBNEW) add_definitions( -DPCBNEW )
if (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/scripting) file( MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/scripting )
find_package(SWIG REQUIRED) find_package( SWIG REQUIRED )
include(${SWIG_USE_FILE}) 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()
### ###
# Includes # Includes
### ###
include_directories(BEFORE ${INC_BEFORE}) include_directories( BEFORE ${INC_BEFORE} )
include_directories( include_directories(
./dialogs ./dialogs
./autorouter ./autorouter
../3d-viewer ../3d-viewer
../common ../common
${Boost_INCLUDE_DIR}
../polygon ../polygon
../common/dialogs ../common/dialogs
./scripting
${INC_AFTER} ${INC_AFTER}
) )
### ###
# Sources # Sources
# #
set(PCBNEW_DIALOGS set( PCBNEW_DIALOGS
dialogs/dialog_block_options_base.cpp dialogs/dialog_block_options_base.cpp
dialogs/dialog_cleaning_options_base.cpp dialogs/dialog_cleaning_options_base.cpp
dialogs/dialog_cleaning_options.cpp dialogs/dialog_cleaning_options.cpp
...@@ -105,7 +107,7 @@ set(PCBNEW_DIALOGS ...@@ -105,7 +107,7 @@ set(PCBNEW_DIALOGS
dialogs/dialog_footprint_wizard_list.cpp dialogs/dialog_footprint_wizard_list.cpp
) )
set(PCBNEW_AUTOROUTER_SRCS set( PCBNEW_AUTOROUTER_SRCS
autorouter/automove.cpp autorouter/automove.cpp
autorouter/autoplac.cpp autorouter/autoplac.cpp
autorouter/autorout.cpp autorouter/autorout.cpp
...@@ -117,7 +119,7 @@ set(PCBNEW_AUTOROUTER_SRCS ...@@ -117,7 +119,7 @@ set(PCBNEW_AUTOROUTER_SRCS
autorouter/work.cpp autorouter/work.cpp
) )
set(PCBNEW_CLASS_SRCS set( PCBNEW_CLASS_SRCS
tool_modview.cpp tool_modview.cpp
modview.cpp modview.cpp
modview_frame.cpp modview_frame.cpp
...@@ -218,12 +220,12 @@ set(PCBNEW_CLASS_SRCS ...@@ -218,12 +220,12 @@ set(PCBNEW_CLASS_SRCS
class_footprint_wizard.cpp class_footprint_wizard.cpp
) )
set(PCBNEW_SRCS ${PCBNEW_AUTOROUTER_SRCS} ${PCBNEW_CLASS_SRCS} ${PCBNEW_DIALOGS}) set( PCBNEW_SRCS ${PCBNEW_AUTOROUTER_SRCS} ${PCBNEW_CLASS_SRCS} ${PCBNEW_DIALOGS} )
### ###
# We need some extra sources from common # We need some extra sources from common
### ###
set(PCBNEW_COMMON_SRCS set( PCBNEW_COMMON_SRCS
../common/dialogs/dialog_page_settings.cpp ../common/dialogs/dialog_page_settings.cpp
../common/base_units.cpp ../common/base_units.cpp
) )
...@@ -231,36 +233,42 @@ set(PCBNEW_COMMON_SRCS ...@@ -231,36 +233,42 @@ set(PCBNEW_COMMON_SRCS
## ##
# Scripting sources # Scripting sources
## ##
set(PCBNEW_SCRIPTING_DIALOGS set( PCBNEW_SCRIPTING_DIALOGS
dialogs/dialog_scripting_base.cpp dialogs/dialog_scripting_base.cpp
dialogs/dialog_scripting.cpp dialogs/dialog_scripting.cpp
) )
set(PCBNEW_SCRIPTING_PYTHON_HELPERS set( PCBNEW_SCRIPTING_PYTHON_HELPERS
../scripting/wx_python_helpers.cpp ../scripting/wx_python_helpers.cpp
../scripting/python_scripting.cpp ../scripting/python_scripting.cpp
scripting/pcbnew_scripting_helpers.cpp scripting/pcbnew_scripting_helpers.cpp
scripting/pcbnew_footprint_wizards.cpp scripting/pcbnew_footprint_wizards.cpp
) )
if (KICAD_SCRIPTING) if( KICAD_SCRIPTING )
set(PCBNEW_SCRIPTING_SRCS set( PCBNEW_SCRIPTING_SRCS
${PCBNEW_SCRIPTING_DIALOGS} ${PCBNEW_SCRIPTING_DIALOGS}
pcbnew_wrap.cxx pcbnew_wrap.cxx
${PCBNEW_SCRIPTING_PYTHON_HELPERS} ${PCBNEW_SCRIPTING_PYTHON_HELPERS}
) )
endif(KICAD_SCRIPTING) endif()
## ##
# Scripting build # Scripting build
## ##
if (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) 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 )
if (DEBUG) set( SWIG_FLAGS ${SWIG_FLAGS} -DDEBUG )
set(SWIG_FLAGS ${SWIG_FLAGS} -DDEBUG)
endif() endif()
# collect CFLAGS , and pass them to swig later # collect CFLAGS , and pass them to swig later
...@@ -270,10 +278,10 @@ if (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) ...@@ -270,10 +278,10 @@ if (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
set( SWIG_FLAGS ${SWIG_FLAGS} -D${d} ) set( SWIG_FLAGS ${SWIG_FLAGS} -D${d} )
endforeach() endforeach()
endif(KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) endif()
if (KICAD_SCRIPTING) if( KICAD_SCRIPTING )
set( SWIG_OPTS -python -c++ -outdir ${CMAKE_CURRENT_BINARY_DIR} ${SWIG_FLAGS} ) set( SWIG_OPTS -python -c++ -outdir ${CMAKE_CURRENT_BINARY_DIR} ${SWIG_FLAGS} )
...@@ -295,25 +303,25 @@ if (KICAD_SCRIPTING) ...@@ -295,25 +303,25 @@ if (KICAD_SCRIPTING)
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
) )
endif(KICAD_SCRIPTING) endif()
### ###
# _pcbnew DLL/DSO file creation # _pcbnew DLL/DSO file creation
### ###
if ((KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) AND NOT WIN32 AND NOT APPLE) if( ( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES ) AND NOT WIN32 AND NOT APPLE )
set ( PCBNEW_EXTRA_LIBS "rt" ) set ( PCBNEW_EXTRA_LIBS "rt" )
endif() endif()
if (KICAD_SCRIPTING_MODULES) if( KICAD_SCRIPTING_MODULES )
#message( "building pcbnew scripting" ) #message( "building pcbnew scripting" )
set(CMAKE_SWIG_FLAGS ${SWIG_FLAGS}) set( CMAKE_SWIG_FLAGS ${SWIG_FLAGS} )
set_source_files_properties(scripting/pcbnew.i PROPERTIES CPLUSPLUS ON) set_source_files_properties( scripting/pcbnew.i PROPERTIES CPLUSPLUS ON )
swig_add_module(pcbnew python scripting/pcbnew.i ${PCBNEW_SCRIPTING_PYTHON_HELPERS} ${PCBNEW_SRCS} ${PCBNEW_COMMON_SRCS}) swig_add_module( pcbnew python scripting/pcbnew.i ${PCBNEW_SCRIPTING_PYTHON_HELPERS} ${PCBNEW_SRCS} ${PCBNEW_COMMON_SRCS} )
swig_link_libraries(pcbnew swig_link_libraries( pcbnew
3d-viewer 3d-viewer
pcbcommon pcbcommon
common common
...@@ -327,33 +335,33 @@ if (KICAD_SCRIPTING_MODULES) ...@@ -327,33 +335,33 @@ if (KICAD_SCRIPTING_MODULES)
${PCBNEW_EXTRA_LIBS} ${PCBNEW_EXTRA_LIBS}
) )
endif (KICAD_SCRIPTING_MODULES) endif()
### ###
# Windows resource file # Windows resource file
### ###
if(WIN32) if( WIN32 )
if(MINGW) if( MINGW )
# PCBNEW_RESOURCES variable is set by the macro. # PCBNEW_RESOURCES variable is set by the macro.
mingw_resource_compiler(pcbnew) mingw_resource_compiler( pcbnew )
else(MINGW) else()
set(PCBNEW_RESOURCES pcbnew.rc) set( PCBNEW_RESOURCES pcbnew.rc )
endif(MINGW) endif()
endif(WIN32) endif()
### ###
# Set properties for APPLE on pcbnew target # Set properties for APPLE on pcbnew target
### ###
if(APPLE) if( APPLE )
set(PCBNEW_RESOURCES pcbnew.icns pcbnew_doc.icns) set( PCBNEW_RESOURCES pcbnew.icns pcbnew_doc.icns )
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/pcbnew.icns" set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pcbnew.icns"
PROPERTIES MACOSX_PACKAGE_LOCATION Resources) PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/pcbnew_doc.icns" set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pcbnew_doc.icns"
PROPERTIES MACOSX_PACKAGE_LOCATION Resources) PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
set(MACOSX_BUNDLE_ICON_FILE pcbnew.icns) set( MACOSX_BUNDLE_ICON_FILE pcbnew.icns )
set(MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.pcbnew) set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.pcbnew )
set(MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist) 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: # Create a C++ compilable string initializer containing html text into a *.h file:
add_custom_command( add_custom_command(
...@@ -385,10 +393,20 @@ make_lexer( ...@@ -385,10 +393,20 @@ make_lexer(
) )
###
# subcomponents of pcbnew
###
add_subdirectory( pcad2kicadpcb_plugin )
if( BUILD_GITHUB_PLUGIN )
add_subdirectory( github )
endif()
### ###
# Create the pcbnew executable # Create the pcbnew executable
### ###
add_executable(pcbnew WIN32 MACOSX_BUNDLE add_executable( pcbnew WIN32 MACOSX_BUNDLE
${PCBNEW_SRCS} ${PCBNEW_SRCS}
${PCBNEW_COMMON_SRCS} ${PCBNEW_COMMON_SRCS}
${PCBNEW_SCRIPTING_SRCS} ${PCBNEW_SCRIPTING_SRCS}
...@@ -398,15 +416,15 @@ add_executable(pcbnew WIN32 MACOSX_BUNDLE ...@@ -398,15 +416,15 @@ add_executable(pcbnew WIN32 MACOSX_BUNDLE
### ###
# Set properties for APPLE on pcbnew target # Set properties for APPLE on pcbnew target
### ###
if(APPLE) if( APPLE )
set_target_properties(pcbnew PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist) 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 # Link executable target pcbnew with correct libraries
### ###
target_link_libraries(pcbnew target_link_libraries( pcbnew
3d-viewer 3d-viewer
pcbcommon pcbcommon
common common
...@@ -423,48 +441,48 @@ target_link_libraries(pcbnew ...@@ -423,48 +441,48 @@ target_link_libraries(pcbnew
### ###
# Add pcbnew as install target # Add pcbnew as install target
### ###
install(TARGETS pcbnew install( TARGETS pcbnew
DESTINATION ${KICAD_BIN} DESTINATION ${KICAD_BIN}
COMPONENT binary) COMPONENT binary )
if(KICAD_SCRIPTING) if( KICAD_SCRIPTING )
add_custom_target(FixSwigImportsScripting ALL add_custom_target( FixSwigImportsScripting ALL
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../scripting/fixswigimports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../scripting/fixswigimports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py
DEPENDS pcbnew DEPENDS pcbnew
COMMENT "Fixing swig_import_helper in Kicad scripting" COMMENT "Fixing swig_import_helper in Kicad scripting"
) )
install(FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py DESTINATION ${PYTHON_DEST}) install( FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py DESTINATION ${PYTHON_DEST} )
endif(KICAD_SCRIPTING) endif()
if (KICAD_SCRIPTING_MODULES) if( KICAD_SCRIPTING_MODULES )
add_custom_target(FixSwigImportsModuleScripting ALL add_custom_target( FixSwigImportsModuleScripting ALL
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../scripting/fixswigimports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../scripting/fixswigimports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py
DEPENDS _pcbnew DEPENDS _pcbnew
COMMENT "Fixing swig_import_helper in Kicad scripting modules" COMMENT "Fixing swig_import_helper in Kicad scripting modules"
) )
install(FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py DESTINATION ${PYTHON_DEST}) install( FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py DESTINATION ${PYTHON_DEST} )
if (WIN32)
install(FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.pyd DESTINATION ${PYTHON_DEST})
else(WIN32)
install(FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.so DESTINATION ${PYTHON_DEST})
endif(WIN32)
endif(KICAD_SCRIPTING_MODULES) if( WIN32 )
install( FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.pyd DESTINATION ${PYTHON_DEST} )
else()
install( FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.so DESTINATION ${PYTHON_DEST} )
endif()
endif()
# The specctra test fails to build properly using MS Visual Studio. # The specctra test fails to build properly using MS Visual Studio.
if(NOT MSVC) if( NOT MSVC )
# This one gets made only when testing. # This one gets made only when testing.
add_executable(specctra_test EXCLUDE_FROM_ALL specctra_test.cpp specctra.cpp) add_executable( specctra_test EXCLUDE_FROM_ALL specctra_test.cpp specctra.cpp )
target_link_libraries(specctra_test common ${wxWidgets_LIBRARIES}) target_link_libraries( specctra_test common ${wxWidgets_LIBRARIES} )
endif(NOT MSVC) endif()
# This one gets made only when testing. # This one gets made only when testing.
add_executable(layer_widget_test WIN32 EXCLUDE_FROM_ALL add_executable( layer_widget_test WIN32 EXCLUDE_FROM_ALL
layer_widget.cpp layer_widget.cpp
) )
target_link_libraries(layer_widget_test common ${wxWidgets_LIBRARIES}) target_link_libraries( layer_widget_test common ${wxWidgets_LIBRARIES} )
# 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. "../"
)
add_definitions(-DPCBNEW)
include_directories(BEFORE ${INC_BEFORE}) # Sources for the pcbnew PLUGIN called PCAD_PLUGIN
include_directories(
../../include # This CMakeLists.txt is included from pcbnew, so we are inheriting its include_directories(),
../../pcbnew # simply add the current source dir to inherited include_directories() for sources in here only.
../../polygon include_directories( . )
${INC_AFTER}
)
set(PCAD2PCBNEW_SRCS set( PCAD2PCBNEW_SRCS
pcad2kicad_common.cpp pcad2kicad_common.cpp
pcad_plugin.cpp pcad_plugin.cpp
pcb.cpp pcb.cpp
...@@ -30,4 +28,4 @@ set(PCAD2PCBNEW_SRCS ...@@ -30,4 +28,4 @@ set(PCAD2PCBNEW_SRCS
s_expr_loader.cpp s_expr_loader.cpp
) )
add_library(pcad2kicadpcb STATIC ${PCAD2PCBNEW_SRCS}) add_library( pcad2kicadpcb STATIC ${PCAD2PCBNEW_SRCS} )
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment