From 6a25e05e3cae7b3e91c681b95cf2e185484edea0 Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Tue, 20 Aug 2013 13:03:21 -0500 Subject: [PATCH] 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/. --- .bzrignore | 2 +- 3d-viewer/CMakeLists.txt | 1 - CMakeLists.txt | 428 +++++++++++---------- CMakeModules/config.h.cmake | 4 + CMakeModules/download_boost.cmake | 143 ++++++- common/CMakeLists.txt | 1 - cvpcb/CMakeLists.txt | 61 +-- eeschema/CMakeLists.txt | 1 - include/class_board_design_settings.h | 2 +- kicad/CMakeLists.txt | 1 - pcbnew/CMakeLists.txt | 174 +++++---- pcbnew/github/CMakeLists.txt | 33 ++ pcbnew/pcad2kicadpcb_plugin/CMakeLists.txt | 18 +- 13 files changed, 520 insertions(+), 349 deletions(-) create mode 100644 pcbnew/github/CMakeLists.txt diff --git a/.bzrignore b/.bzrignore index de20aa512d..03bd5c449c 100644 --- a/.bzrignore +++ b/.bzrignore @@ -1,4 +1,4 @@ -include/boost +boost_root .downloads-by-cmake common/netlist_keywords.* common/netlist_lexer.h diff --git a/3d-viewer/CMakeLists.txt b/3d-viewer/CMakeLists.txt index 26e834be43..56af4eba6a 100644 --- a/3d-viewer/CMakeLists.txt +++ b/3d-viewer/CMakeLists.txt @@ -2,7 +2,6 @@ add_definitions(-DPCBNEW) include_directories(BEFORE ${INC_BEFORE}) include_directories( - ${Boost_INCLUDE_DIR} ../pcbnew ../polygon ${INC_AFTER} diff --git a/CMakeLists.txt b/CMakeLists.txt index fe85f4c05a..5e5747a661 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,10 @@ -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 # 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. @@ -15,32 +15,32 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules) # # Russian GOST patch -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( wxUSE_UNICODE "enable/disable building unicode ( default OFF)" ) +option( KICAD_GOST "enable/disable building using GOST notation for multiple gates per package ( default OFF)" ) #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 - "Use wxGraphicsContext for rendering (default OFF). Warning, this is experimental") +option( USE_WX_GRAPHICS_CONTEXT + "Use wxGraphicsContext for rendering ( default OFF). Warning, this is experimental" ) -option(USE_WX_OVERLAY - "Use wxOverlay: Always ON for MAC (default OFF). Warning, this is experimental") +option( USE_WX_OVERLAY + "Use wxOverlay: Always ON for MAC ( default OFF). Warning, this is experimental" ) #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)" ) -option(KICAD_SCRIPTING +option( KICAD_SCRIPTING "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" ) -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" ) @@ -51,13 +51,16 @@ option(KICAD_SCRIPTING_WXPYTHON # 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) -if(KICAD_STABLE_VERSION) - add_definitions(-DKICAD_STABLE_VERSION) - message( "Building stable version of KiCad") +if( KICAD_STABLE_VERSION) + add_definitions( -DKICAD_STABLE_VERSION ) + 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 @@ -72,14 +75,14 @@ set( DOWNLOAD_DIR ${PROJECT_SOURCE_DIR}/.downloads-by-cmake # 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_DEBUG_FLAGS "") + set( KICAD_GCC_RELEASE_BUILD_FLAGS "-O2" ) + 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_STRIP_TRAILING_WHITESPACE) + OUTPUT_STRIP_TRAILING_WHITESPACE ) # 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 @@ -88,38 +91,38 @@ if(CMAKE_COMPILER_IS_GNUCXX) # see if the problem has been resolved. Wayne. # # 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). # 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 # 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) - set(KICAD_GCC_RELEASE_BUILD_FLAGS "-Wno-narrowing -O1") - set(KICAD_GCC_DEBUG_BUILD_FLAGS "-Wno-narrowing") + 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_DEBUG_BUILD_FLAGS "-Wno-narrowing" ) endif() - if(CMAKE_BUILD_TYPE STREQUAL Debug) - message(STATUS - "Setting GCC version ${GCC_VERSION} build flags \"${KICAD_GCC_DEBUG_BUILD_FLAGS}\"") + if( CMAKE_BUILD_TYPE STREQUAL Debug ) + message( STATUS + "Setting GCC version ${GCC_VERSION} build flags \"${KICAD_GCC_DEBUG_BUILD_FLAGS}\"" ) else() - message(STATUS - "Setting GCC version ${GCC_VERSION} build flags \"${KICAD_GCC_RELEASE_BUILD_FLAGS}\"") + message( STATUS + "Setting GCC version ${GCC_VERSION} build flags \"${KICAD_GCC_RELEASE_BUILD_FLAGS}\"" ) endif() - if(MINGW) + if( MINGW ) # According to some sources, under Windows -fPIC option is not needed: # http://mingw.5.n7.nabble.com/Option-fPIC-not-supported-td18480.html # Set default flags for Release build. - 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_EXE_LINKER_FLAGS_RELEASE "-s -static-libgcc -static-libstdc++") + 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_EXE_LINKER_FLAGS_RELEASE "-s -static-libgcc -static-libstdc++" ) # Set default flags for Debug build. - 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_MODULE_LINKER_FLAGS "-static-libgcc -static-libstdc++") # SWIG macros on Windows + 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_MODULE_LINKER_FLAGS "-static-libgcc -static-libstdc++") # SWIG macros on Windows else() # We build DLL/DSOs from static libraries, so create position independent code @@ -129,17 +132,17 @@ if(CMAKE_COMPILER_IS_GNUCXX) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC" ) # Thou shalt not link vaporware and tell us it's a valid DSO: - set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined") - set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined") # needed by SWIG macros on linux + set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" ) + set( CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined" ) # needed by SWIG macros on linux # Set default flags for Release build. - 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_EXE_LINKER_FLAGS_RELEASE "-s") + 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_EXE_LINKER_FLAGS_RELEASE "-s" ) # Set default flags for Debug build. - 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_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" ) endif() # quiet GCC 4.8.1 while in boost @@ -147,110 +150,109 @@ if(CMAKE_COMPILER_IS_GNUCXX) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs" ) endif() -endif(CMAKE_COMPILER_IS_GNUCXX) +endif( CMAKE_COMPILER_IS_GNUCXX ) -if(wxUSE_UNICODE) - add_definitions(-DwxUSE_UNICODE) +if( wxUSE_UNICODE ) + add_definitions( -DwxUSE_UNICODE ) endif() -if(KICAD_GOST) - add_definitions(-DKICAD_GOST) +if( KICAD_GOST ) + add_definitions( -DKICAD_GOST ) endif() -if(KICAD_KEEPCASE) - add_definitions(-DKICAD_KEEPCASE) +if( KICAD_KEEPCASE ) + add_definitions( -DKICAD_KEEPCASE ) endif() -if(USE_WX_OVERLAY OR APPLE) - add_definitions(-DUSE_WX_OVERLAY) +if( USE_WX_OVERLAY OR APPLE ) + add_definitions( -DUSE_WX_OVERLAY ) endif() -if(KICAD_SCRIPTING) - add_definitions(-DKICAD_SCRIPTING) +if( KICAD_SCRIPTING ) + add_definitions( -DKICAD_SCRIPTING ) endif() -if(KICAD_SCRIPTING_MODULES) - add_definitions(-DKICAD_SCRIPTING_MODULES) +if( KICAD_SCRIPTING_MODULES ) + add_definitions( -DKICAD_SCRIPTING_MODULES ) endif() -if(KICAD_SCRIPTING_WXPYTHON) - add_definitions(-DKICAD_SCRIPTING_WXPYTHON) +if( KICAD_SCRIPTING_WXPYTHON ) + add_definitions( -DKICAD_SCRIPTING_WXPYTHON ) endif() -if(USE_WX_GRAPHICS_CONTEXT) - add_definitions(-DUSE_WX_GRAPHICS_CONTEXT) +if( USE_WX_GRAPHICS_CONTEXT ) + add_definitions( -DUSE_WX_GRAPHICS_CONTEXT ) endif() # 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 # defining -DUSE_IMAGES_IN_MENUS=ON/OFF to force the preferred behavior. -if(NOT DEFINED USE_IMAGES_IN_MENUS) - if(NOT APPLE) - set(USE_IMAGES_IN_MENUS ON) +if( NOT DEFINED USE_IMAGES_IN_MENUS ) + if( NOT APPLE ) + set( USE_IMAGES_IN_MENUS ON ) endif() else() - if(USE_IMAGES_IN_MENUS) - set(USE_IMAGES_IN_MENUS ON) + if( USE_IMAGES_IN_MENUS ) + set( USE_IMAGES_IN_MENUS ON ) endif() endif() # Locations for install targets. -set(KICAD_BIN bin - CACHE PATH "Location of KiCad binaries.") +set( KICAD_BIN bin + CACHE PATH "Location of KiCad binaries." ) -if(UNIX) +if( UNIX ) # Everything without leading / is relative to CMAKE_INSTALL_PREFIX. - set(KICAD_PLUGINS lib/kicad/plugins - CACHE PATH "Location of KiCad plugins.") - set(KICAD_DATA share/kicad - CACHE PATH "Location of KiCad data files.") - set(KICAD_DOCS share/doc/kicad - CACHE PATH "Location of KiCad documentation files.") + set( KICAD_PLUGINS lib/kicad/plugins + CACHE PATH "Location of KiCad plugins." ) + set( KICAD_DATA share/kicad + CACHE PATH "Location of KiCad data files." ) + set( KICAD_DOCS share/doc/kicad + CACHE PATH "Location of KiCad documentation files." ) endif() -if(MINGW) +if( MINGW ) # Like all variables, CMAKE_INSTALL_PREFIX can be over-ridden on the command line. - set(CMAKE_INSTALL_PREFIX c:/kicad - CACHE PATH "") + set( CMAKE_INSTALL_PREFIX c:/kicad + CACHE PATH "" ) # Everything without leading / is relative to CMAKE_INSTALL_PREFIX. - set(KICAD_PLUGINS ${KICAD_BIN}/plugins - CACHE PATH "Location of KiCad plugins.") - set(KICAD_DATA share - CACHE PATH "Location of KiCad data files.") - set(KICAD_DOCS doc - CACHE PATH "Location of KiCad documentation files.") + set( KICAD_PLUGINS ${KICAD_BIN}/plugins + CACHE PATH "Location of KiCad plugins." ) + set( KICAD_DATA share + CACHE PATH "Location of KiCad data files." ) + set( KICAD_DOCS doc + CACHE PATH "Location of KiCad documentation files." ) endif() -set(KICAD_DEMOS ${KICAD_DATA}/demos - CACHE PATH "Location of KiCad demo files.") -set(KICAD_TEMPLATE ${KICAD_DATA}/template - CACHE PATH "Location of KiCad template files.") +set( KICAD_DEMOS ${KICAD_DATA}/demos + CACHE PATH "Location of KiCad demo files." ) +set( KICAD_TEMPLATE ${KICAD_DATA}/template + CACHE PATH "Location of KiCad template files." ) -mark_as_advanced(KICAD_BIN +mark_as_advanced( KICAD_BIN KICAD_PLUGINS KICAD_DATA KICAD_DOCS KICAD_DEMOS - KICAD_TEMPLATE) + KICAD_TEMPLATE ) -include(Functions) +include( Functions ) include( ExternalProject ) #================================================ # Find libraries that are needed to build KiCad. #================================================ -include(CheckFindPackageResult) +include( CheckFindPackageResult ) ####################### # Find OpenGL library # ####################### -find_package(OpenGL QUIET) -check_find_package_result(OPENGL_FOUND "OpenGL") +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 ) @@ -262,115 +264,129 @@ include( download_boost ) # 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 -if(APPLE) - find_package(wxWidgets COMPONENTS gl adv html core net base xml QUIET) -else(APPLE) - find_package(wxWidgets COMPONENTS gl aui adv html core net base xml QUIET) -endif(APPLE) -check_find_package_result(wxWidgets_FOUND "wxWidgets") +if( APPLE ) + find_package( wxWidgets COMPONENTS gl adv html core net base xml QUIET ) +else( APPLE ) + find_package( wxWidgets COMPONENTS gl aui adv html core net base xml QUIET ) +endif( APPLE ) +check_find_package_result( wxWidgets_FOUND "wxWidgets" ) # Include wxWidgets macros. -include(${wxWidgets_USE_FILE}) +include( ${wxWidgets_USE_FILE} ) # Include MinGW resource compiler. -include(MinGWResourceCompiler) +include( MinGWResourceCompiler ) # Generate build system specific header file. -include(PerformFeatureChecks) +include( PerformFeatureChecks ) perform_feature_checks() # Find GDI+ on windows if wxGraphicsContext is available. -if(MINGW AND USE_WX_GRAPHICS_CONTEXT) - find_package(GdiPlus) - check_find_package_result(GDI_PLUS_FOUND "GDI+") +if( MINGW AND USE_WX_GRAPHICS_CONTEXT ) + find_package( GdiPlus ) + check_find_package_result( GDI_PLUS_FOUND "GDI+" ) endif() -# Find Python and other scripting resources -if(KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) - set(PythonInterp_FIND_VERSION) - find_package(PythonInterp) - check_find_package_result(PYTHONINTERP_FOUND "Python Interpreter") - - # Get the correct Python site package install path from the Python interpreter found by - # FindPythonInterp unless the user specifically defined a custom path. - if(NOT PYTHON_SITE_PACKAGE_PATH) - execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig;print\"%s\"%distutils.sysconfig.get_python_lib()" - OUTPUT_VARIABLE PYTHON_SITE_PACKAGE_PATH - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - - if(NOT PYTHON_SITE_PACKAGE_PATH) - message(FATAL_ERROR "Error occurred while attemping to find the Python site library path.") - endif() - endif() - - 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) - - - -# Automagically create version header file. -include(CreateBzrVersionHeader) -create_bzr_version_header() - -if(EXISTS ${CMAKE_SOURCE_DIR}/include/config.h) - # 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. - # 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. - 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 +# 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 +set( INC_AFTER + ${Boost_INCLUDE_DIR} #include ${CMAKE_BINARY_DIR} ) + +# Find Python and other scripting resources +if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES ) + set( PythonInterp_FIND_VERSION ) + find_package( PythonInterp ) + check_find_package_result( PYTHONINTERP_FOUND "Python Interpreter" ) + + # Get the correct Python site package install path from the Python interpreter found by + # FindPythonInterp unless the user specifically defined a custom path. + if( NOT PYTHON_SITE_PACKAGE_PATH ) + execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig;print\"%s\"%distutils.sysconfig.get_python_lib()" + OUTPUT_VARIABLE PYTHON_SITE_PACKAGE_PATH + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + if( NOT PYTHON_SITE_PACKAGE_PATH ) + message( FATAL_ERROR "Error occurred while attemping to find the Python site library path." ) + endif() + endif() + + 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 ) + + #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. +include( CreateBzrVersionHeader ) +create_bzr_version_header() + +if( EXISTS ${CMAKE_SOURCE_DIR}/include/config.h ) + # 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. + # 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. + add_definitions( -DHAVE_SVN_REVISION ) +endif() + + #================================================ # Let CMake look in these directories for nested # 'CMakeLists.txt' files to process #================================================ ############################ -# Binaries (CMake targets) # +# Binaries ( CMake targets ) # ############################ -add_subdirectory(bitmaps_png) -add_subdirectory(common) -add_subdirectory(3d-viewer) -add_subdirectory(cvpcb) -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) -add_subdirectory(bitmap2component) -add_subdirectory(pcb_calculator) -add_subdirectory(tools) -#add_subdirectory(new) +add_subdirectory( bitmaps_png ) +add_subdirectory( common ) +add_subdirectory( 3d-viewer ) +add_subdirectory( cvpcb ) +add_subdirectory( eeschema ) +add_subdirectory( gerbview ) +add_subdirectory( kicad ) +add_subdirectory( pcbnew ) +add_subdirectory( polygon ) +add_subdirectory( pagelayout_editor ) +add_subdirectory( potrace ) +add_subdirectory( bitmap2component ) +add_subdirectory( pcb_calculator ) +add_subdirectory( tools ) +#add_subdirectory( new ) # 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 ) @@ -385,14 +401,14 @@ add_dependencies( pl_editor boost ) ############# # Resources # ############# -add_subdirectory(demos) -add_subdirectory(template) +add_subdirectory( demos ) +add_subdirectory( template ) #================================================ # Doxygen Output #================================================ -find_package(Doxygen) -if(DOXYGEN_FOUND) +find_package( Doxygen ) +if( DOXYGEN_FOUND ) add_custom_target( doxygen-docs ${CMAKE_COMMAND} -E remove_directory Documentation/doxygen COMMAND ${DOXYGEN_EXECUTABLE} @@ -411,67 +427,67 @@ endif() configure_file( "${CMAKE_MODULE_PATH}/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" - IMMEDIATE @ONLY) + IMMEDIATE @ONLY ) -add_custom_target(uninstall - "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") +add_custom_target( uninstall + "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" ) #================================================ # Installation parameters #================================================ -install(FILES INSTALL.txt +install( FILES INSTALL.txt DESTINATION ${KICAD_DOCS} - COMPONENT resources) + COMPONENT resources ) -install(FILES resources/freeroute.jnlp +install( FILES resources/freeroute.jnlp DESTINATION ${KICAD_BIN} - COMPONENT resources) + COMPONENT resources ) ### # Install scripts ### -if(UNIX) - install(DIRECTORY scripts +if( UNIX ) + install( DIRECTORY scripts DESTINATION ${KICAD_DOCS} COMPONENT resources - PATTERN ".svn" EXCLUDE) + PATTERN ".svn" EXCLUDE ) endif() ### # FreeDesktop .desktop and MIME resources ### -if(UNIX) +if( UNIX ) # Set paths - set(UNIX_MIME_DIR resources/linux/mime) - set(UNIX_MIMELNK_FILES ${UNIX_MIME_DIR}/mimelnk) - set(UNIX_MIME_FILES ${UNIX_MIME_DIR}/mime) - set(UNIX_ICONS_FILES ${UNIX_MIME_DIR}/icons) - set(UNIX_APPLICATIONS_FILES ${UNIX_MIME_DIR}/applications) + set( UNIX_MIME_DIR resources/linux/mime ) + set( UNIX_MIMELNK_FILES ${UNIX_MIME_DIR}/mimelnk ) + set( UNIX_MIME_FILES ${UNIX_MIME_DIR}/mime ) + set( UNIX_ICONS_FILES ${UNIX_MIME_DIR}/icons ) + set( UNIX_APPLICATIONS_FILES ${UNIX_MIME_DIR}/applications ) # Install Mimelnk directory - install(DIRECTORY ${UNIX_MIMELNK_FILES} + install( DIRECTORY ${UNIX_MIMELNK_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/share COMPONENT resources - PATTERN ".svn" EXCLUDE) + PATTERN ".svn" EXCLUDE ) # Install Mime directory - install(DIRECTORY ${UNIX_ICONS_FILES} + install( DIRECTORY ${UNIX_ICONS_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/share COMPONENT resources - PATTERN ".svn" EXCLUDE) + PATTERN ".svn" EXCLUDE ) # Install Icons - install(DIRECTORY ${UNIX_MIME_FILES} + install( DIRECTORY ${UNIX_MIME_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/share COMPONENT resources - PATTERN ".svn" EXCLUDE) + PATTERN ".svn" EXCLUDE ) # Install Applications directory (.desktop files) - install(DIRECTORY ${UNIX_APPLICATIONS_FILES} + install( DIRECTORY ${UNIX_APPLICATIONS_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/share COMPONENT resources - PATTERN ".svn" EXCLUDE) + PATTERN ".svn" EXCLUDE ) endif() -include(CTest) +include( CTest ) diff --git a/CMakeModules/config.h.cmake b/CMakeModules/config.h.cmake index eec9fc8547..db9ba8ee84 100644 --- a/CMakeModules/config.h.cmake +++ b/CMakeModules/config.h.cmake @@ -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_ diff --git a/CMakeModules/download_boost.cmake b/CMakeModules/download_boost.cmake index aa183b0282..b4667d4874 100644 --- a/CMakeModules/download_boost.cmake +++ b/CMakeModules/download_boost.cmake @@ -22,11 +22,38 @@ -# 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. + + +#--------------------------------------------------------------------- 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() + +#-------------------------------------------------------------------- + + string( REGEX REPLACE "\\." "_" BOOST_VERS "${BOOST_RELEASE}" ) 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 # easily, simply by editing the working tree in and doing "bzr diff" in there. -# include only the headers in the repo. -# repo = "${headers}/../.bzr" = "/.bzr" -set( headers ${PREFIX}/src/boost/boost ) +# path to the boost headers in the repo. +# repo = "${headers_src}/../.bzr" = "/.bzr" +set( headers_src "${PREFIX}/src/boost/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} +# 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() - # The patch command executes with the working directory set to - 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: - 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 - ) + 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}" + 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 + 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 + 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 /include/boost + # to /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 @@ -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 ) + diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index c105dffdc3..45a7662fc1 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -3,7 +3,6 @@ include_directories(BEFORE ${INC_BEFORE}) include_directories( ./dialogs ./dialog_about - ${Boost_INCLUDE_DIR} ../3d-viewer ../pcbnew ../polygon diff --git a/cvpcb/CMakeLists.txt b/cvpcb/CMakeLists.txt index 4cb273bf1f..2447f4cd3e 100644 --- a/cvpcb/CMakeLists.txt +++ b/cvpcb/CMakeLists.txt @@ -1,13 +1,12 @@ -add_definitions(-DCVPCB) +add_definitions( -DCVPCB ) ### # Includes ### -include_directories(BEFORE ${INC_BEFORE}) +include_directories( BEFORE ${INC_BEFORE} ) include_directories( ./dialogs - ${Boost_INCLUDE_DIR} ../3d-viewer ../pcbnew ../polygon @@ -18,14 +17,14 @@ include_directories( ### # Sources ### -set(CVPCB_DIALOGS +set( CVPCB_DIALOGS dialogs/dialog_cvpcb_config.cpp dialogs/dialog_cvpcb_config_fbp.cpp dialogs/dialog_display_options.cpp dialogs/dialog_display_options_base.cpp ) -set(CVPCB_SRCS +set( CVPCB_SRCS ../common/base_units.cpp ../pcbnew/board_items_to_polygon_shape_transform.cpp ../pcbnew/class_drc_item.cpp @@ -46,32 +45,35 @@ set(CVPCB_SRCS ### # Windows resource file ### -if(WIN32) - if(MINGW) +if( WIN32 ) + if( MINGW ) # CVPCB_RESOURCES variable is set by the macro. - mingw_resource_compiler(cvpcb) - else(MINGW) - set(CVPCB_RESOURCES cvpcb.rc) - endif(MINGW) -endif(WIN32) + mingw_resource_compiler( cvpcb ) + else() + set( CVPCB_RESOURCES cvpcb.rc ) + 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) +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() ### # Create the cvpcb executable ### -add_executable(cvpcb WIN32 MACOSX_BUNDLE +add_executable( cvpcb WIN32 MACOSX_BUNDLE ${CVPCB_SRCS} ${CVPCB_DIALOGS} ${CVPCB_RESOURCES} @@ -80,14 +82,14 @@ add_executable(cvpcb WIN32 MACOSX_BUNDLE ### # Set properties for APPLE on cvpcb target ### -if(APPLE) - set_target_properties(cvpcb PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist) -endif(APPLE) +if( APPLE ) + set_target_properties( cvpcb PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist ) +endif() ### # Link executable target cvpcb with correct libraries ### -target_link_libraries(cvpcb +target_link_libraries( cvpcb 3d-viewer pcbcommon pcad2kicadpcb @@ -102,6 +104,7 @@ target_link_libraries(cvpcb ### # Add cvpcb as install target ### -install(TARGETS cvpcb - DESTINATION ${KICAD_BIN} - COMPONENT binary) +install( TARGETS cvpcb + DESTINATION ${KICAD_BIN} + COMPONENT binary + ) diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index 6c22e75182..049c14c65e 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -6,7 +6,6 @@ include_directories( ./dialogs ../common ../common/dialogs - ${Boost_INCLUDE_DIR} ${INC_AFTER} ) diff --git a/include/class_board_design_settings.h b/include/class_board_design_settings.h index 3e18736f50..75a22dc99d 100644 --- a/include/class_board_design_settings.h +++ b/include/class_board_design_settings.h @@ -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; diff --git a/kicad/CMakeLists.txt b/kicad/CMakeLists.txt index e1993fa18a..b86d4b5035 100644 --- a/kicad/CMakeLists.txt +++ b/kicad/CMakeLists.txt @@ -2,7 +2,6 @@ add_definitions(-DKICAD) include_directories(BEFORE ${INC_BEFORE}) include_directories( - ${Boost_INCLUDE_DIR} ${INC_AFTER} ) diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index be4a999279..805ef45788 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -1,33 +1,35 @@ -add_definitions(-DPCBNEW) +add_definitions( -DPCBNEW ) -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) +if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES ) + file( MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/scripting ) + find_package( SWIG REQUIRED ) + include( ${SWIG_USE_FILE} ) + + # 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 ### -include_directories(BEFORE ${INC_BEFORE}) +include_directories( BEFORE ${INC_BEFORE} ) include_directories( ./dialogs ./autorouter ../3d-viewer ../common - ${Boost_INCLUDE_DIR} ../polygon ../common/dialogs - ./scripting ${INC_AFTER} ) - ### # Sources # -set(PCBNEW_DIALOGS +set( PCBNEW_DIALOGS dialogs/dialog_block_options_base.cpp dialogs/dialog_cleaning_options_base.cpp dialogs/dialog_cleaning_options.cpp @@ -105,7 +107,7 @@ set(PCBNEW_DIALOGS dialogs/dialog_footprint_wizard_list.cpp ) -set(PCBNEW_AUTOROUTER_SRCS +set( PCBNEW_AUTOROUTER_SRCS autorouter/automove.cpp autorouter/autoplac.cpp autorouter/autorout.cpp @@ -117,7 +119,7 @@ set(PCBNEW_AUTOROUTER_SRCS autorouter/work.cpp ) -set(PCBNEW_CLASS_SRCS +set( PCBNEW_CLASS_SRCS tool_modview.cpp modview.cpp modview_frame.cpp @@ -218,12 +220,12 @@ set(PCBNEW_CLASS_SRCS 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 ### -set(PCBNEW_COMMON_SRCS +set( PCBNEW_COMMON_SRCS ../common/dialogs/dialog_page_settings.cpp ../common/base_units.cpp ) @@ -231,36 +233,42 @@ set(PCBNEW_COMMON_SRCS ## # Scripting sources ## -set(PCBNEW_SCRIPTING_DIALOGS +set( PCBNEW_SCRIPTING_DIALOGS dialogs/dialog_scripting_base.cpp dialogs/dialog_scripting.cpp ) -set(PCBNEW_SCRIPTING_PYTHON_HELPERS +set( PCBNEW_SCRIPTING_PYTHON_HELPERS ../scripting/wx_python_helpers.cpp ../scripting/python_scripting.cpp scripting/pcbnew_scripting_helpers.cpp scripting/pcbnew_footprint_wizards.cpp ) -if (KICAD_SCRIPTING) - set(PCBNEW_SCRIPTING_SRCS +if( KICAD_SCRIPTING ) + set( PCBNEW_SCRIPTING_SRCS ${PCBNEW_SCRIPTING_DIALOGS} pcbnew_wrap.cxx ${PCBNEW_SCRIPTING_PYTHON_HELPERS} ) -endif(KICAD_SCRIPTING) +endif() ## # 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 ) - if (DEBUG) - set(SWIG_FLAGS ${SWIG_FLAGS} -DDEBUG) + 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() # collect CFLAGS , and pass them to swig later @@ -270,10 +278,10 @@ 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) +if( KICAD_SCRIPTING ) set( SWIG_OPTS -python -c++ -outdir ${CMAKE_CURRENT_BINARY_DIR} ${SWIG_FLAGS} ) @@ -295,25 +303,25 @@ if (KICAD_SCRIPTING) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) -endif(KICAD_SCRIPTING) +endif() ### # _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" ) endif() -if (KICAD_SCRIPTING_MODULES) +if( KICAD_SCRIPTING_MODULES ) #message( "building pcbnew scripting" ) - set(CMAKE_SWIG_FLAGS ${SWIG_FLAGS}) - 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_link_libraries(pcbnew + set( CMAKE_SWIG_FLAGS ${SWIG_FLAGS} ) + 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_link_libraries( pcbnew 3d-viewer pcbcommon common @@ -327,33 +335,33 @@ if (KICAD_SCRIPTING_MODULES) ${PCBNEW_EXTRA_LIBS} ) -endif (KICAD_SCRIPTING_MODULES) +endif() ### # Windows resource file ### -if(WIN32) - if(MINGW) +if( WIN32 ) + if( MINGW ) # PCBNEW_RESOURCES variable is set by the macro. - mingw_resource_compiler(pcbnew) - else(MINGW) - set(PCBNEW_RESOURCES pcbnew.rc) - endif(MINGW) -endif(WIN32) + mingw_resource_compiler( pcbnew ) + else() + set( PCBNEW_RESOURCES pcbnew.rc ) + endif() +endif() ### # Set properties for APPLE on pcbnew target ### -if(APPLE) - set(PCBNEW_RESOURCES pcbnew.icns pcbnew_doc.icns) - set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/pcbnew.icns" - PROPERTIES MACOSX_PACKAGE_LOCATION Resources) - set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/pcbnew_doc.icns" - PROPERTIES MACOSX_PACKAGE_LOCATION Resources) - 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) +if( APPLE ) + set( PCBNEW_RESOURCES pcbnew.icns pcbnew_doc.icns ) + set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pcbnew.icns" + PROPERTIES MACOSX_PACKAGE_LOCATION Resources ) + set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pcbnew_doc.icns" + PROPERTIES MACOSX_PACKAGE_LOCATION Resources ) + 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() # Create a C++ compilable string initializer containing html text into a *.h file: add_custom_command( @@ -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 ### -add_executable(pcbnew WIN32 MACOSX_BUNDLE +add_executable( pcbnew WIN32 MACOSX_BUNDLE ${PCBNEW_SRCS} ${PCBNEW_COMMON_SRCS} ${PCBNEW_SCRIPTING_SRCS} @@ -398,15 +416,15 @@ add_executable(pcbnew WIN32 MACOSX_BUNDLE ### # Set properties for APPLE on pcbnew target ### -if(APPLE) - set_target_properties(pcbnew PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist) -endif(APPLE) +if( APPLE ) + set_target_properties( pcbnew PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist ) +endif() ### # Link executable target pcbnew with correct libraries ### -target_link_libraries(pcbnew +target_link_libraries( pcbnew 3d-viewer pcbcommon common @@ -423,48 +441,48 @@ target_link_libraries(pcbnew ### # Add pcbnew as install target ### -install(TARGETS pcbnew +install( TARGETS pcbnew DESTINATION ${KICAD_BIN} - COMPONENT binary) + COMPONENT binary ) -if(KICAD_SCRIPTING) - add_custom_target(FixSwigImportsScripting ALL +if( KICAD_SCRIPTING ) + add_custom_target( FixSwigImportsScripting ALL COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../scripting/fixswigimports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py DEPENDS pcbnew COMMENT "Fixing swig_import_helper in Kicad scripting" ) - install(FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py DESTINATION ${PYTHON_DEST}) -endif(KICAD_SCRIPTING) + install( FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py DESTINATION ${PYTHON_DEST} ) +endif() -if (KICAD_SCRIPTING_MODULES) - add_custom_target(FixSwigImportsModuleScripting ALL +if( KICAD_SCRIPTING_MODULES ) + add_custom_target( FixSwigImportsModuleScripting ALL COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../scripting/fixswigimports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py DEPENDS _pcbnew 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. -if(NOT MSVC) +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) + add_executable( specctra_test EXCLUDE_FROM_ALL specctra_test.cpp specctra.cpp ) + target_link_libraries( specctra_test common ${wxWidgets_LIBRARIES} ) +endif() # 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 ) -target_link_libraries(layer_widget_test common ${wxWidgets_LIBRARIES}) +target_link_libraries( layer_widget_test common ${wxWidgets_LIBRARIES} ) + diff --git a/pcbnew/github/CMakeLists.txt b/pcbnew/github/CMakeLists.txt new file mode 100644 index 0000000000..5407515c91 --- /dev/null +++ b/pcbnew/github/CMakeLists.txt @@ -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 +# 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. "../" + ) + diff --git a/pcbnew/pcad2kicadpcb_plugin/CMakeLists.txt b/pcbnew/pcad2kicadpcb_plugin/CMakeLists.txt index 91929c3189..90492ed2df 100644 --- a/pcbnew/pcad2kicadpcb_plugin/CMakeLists.txt +++ b/pcbnew/pcad2kicadpcb_plugin/CMakeLists.txt @@ -1,14 +1,12 @@ -add_definitions(-DPCBNEW) -include_directories(BEFORE ${INC_BEFORE}) -include_directories( - ../../include - ../../pcbnew - ../../polygon - ${INC_AFTER} - ) +# Sources for the pcbnew PLUGIN called PCAD_PLUGIN -set(PCAD2PCBNEW_SRCS +# 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 pcad_plugin.cpp pcb.cpp @@ -30,4 +28,4 @@ set(PCAD2PCBNEW_SRCS s_expr_loader.cpp ) -add_library(pcad2kicadpcb STATIC ${PCAD2PCBNEW_SRCS}) +add_library( pcad2kicadpcb STATIC ${PCAD2PCBNEW_SRCS} )