Minor CMake configuration file fixes.

* Move add_directory()s in main CMakeList.txt after all find_package()
  macros are run so all flags in the main CMakeList.txt are propagated
  to the sub-folder CMakeList.txt files.
* Remove commented out include of config.h
* Make the link maps only build on linux as -${TO_LINKER},-cref
  -${TO_LINKER},-Map=blah just gives warnings on osx w/ clang
* Make the link maps only build with flag -DKICAD_MAKE_LINK_MAPS is
  defined during CMake configuration as they are highly specific.
* Moved the code for setting link maps into the main CMakeList.txt
  file to avoid duplication.
* Removed -D__ASSERTMACRO__ from osx as its no longer needed
* Removed a couple of other OSX only things that wouldn't work anyway
* Moved set (BU_CHMOD_BUNDLE_ITEMS) to the main CMakeList.txt as
  otherwise it would only work for the KiCad build not the other
  applications
* Made KICAD_SCRIPTING_MODULES enable KICAD_SCRIPTING as currently if
  you have modules enabled without the scripting base it will on build.
  This could be changed to a fatal error saying you need to also enable
  scripting but it seems unnecessary.
* Removed duplication of pcbnew.py install code under modules and
  scripting since you can't have modules without scripting now
This commit is contained in:
Simon Wells 2016-02-29 14:08:03 -05:00 committed by Wayne Stambaugh
parent 8522b0deb7
commit 4d2a05856f
8 changed files with 55 additions and 162 deletions

View File

@ -60,6 +60,12 @@ option( KICAD_SCRIPTING_WXPYTHON
# when not defined by user, the default is python.exe under Windows and python2 for others # when not defined by user, the default is python.exe under Windows and python2 for others
# python binary file should be is exec path. # python binary file should be is exec path.
# KICAD_SCRIPTING_MODULES requires KICAD_SCRIPTING enable it here if KICAD_SCRIPTING_MODULES is ON
if ( KICAD_SCRIPTING_MODULES AND NOT KICAD_SCRIPTING )
message(STATUS "Changing KICAD_SCRIPTING to ON as needed by KICAD_SCRIPTING_MODULES")
set ( KICAD_SCRIPTING ON )
endif()
option( BUILD_GITHUB_PLUGIN "Build the GITHUB_PLUGIN for pcbnew." ON ) option( BUILD_GITHUB_PLUGIN "Build the GITHUB_PLUGIN for pcbnew." ON )
@ -209,27 +215,7 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-strict-aliasing" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-strict-aliasing" )
if( APPLE ) if( APPLE )
set( CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} -headerpad_max_install_names") # needed by fixbundle
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__ASSERTMACROS__" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__ASSERTMACROS__" )
# Allows .dylib relocation in the future - needed by fixbundle
set( CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} -headerpad_max_install_names")
if( NOT CMAKE_CXX_COMPILER )
EXEC_PROGRAM( wx-config ARGS --cc OUTPUT_VARIABLE CMAKE_C_COMPILER )
endif()
if( NOT CMAKE_CXX_COMPILER )
EXEC_PROGRAM( wx-config ARGS --cxx OUTPUT_VARIABLE CMAKE_CXX_COMPILER )
endif()
# There seems to be no consistent behavior when -mmacosx-min-version is
# not specified, so force user to set minimum OSX version to build for
if( NOT CMAKE_OSX_DEPLOYMENT_TARGET )
message( FATAL_ERROR "Please specify target OS X version using -DCMAKE_OSX_DEPLOYMENT_TARGET=10.x" )
endif()
endif() endif()
endif( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) endif( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
@ -360,6 +346,11 @@ else()
set( \${default_embedded_path_var} \"\${path}\" PARENT_SCOPE ) set( \${default_embedded_path_var} \"\${path}\" PARENT_SCOPE )
endfunction(gp_item_default_embedded_path_override) endfunction(gp_item_default_embedded_path_override)
# If `BU_CHMOD_BUNDLE_ITEMS` is not set, `install_name_tool` will fail to re-write some
# loader paths due to lack of writable permissions if the build dependencies were installed
# by brew (or didn't have writable permissions)
set ( BU_CHMOD_BUNDLE_ITEMS ON )
" "
) )
endif() endif()
@ -487,7 +478,6 @@ set( INC_BEFORE
set( INC_AFTER set( INC_AFTER
${Boost_INCLUDE_DIR} ${Boost_INCLUDE_DIR}
#include <config.h>
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
) )
@ -590,12 +580,6 @@ if( EXISTS ${CMAKE_SOURCE_DIR}/include/config.h )
add_definitions( -DHAVE_SVN_REVISION ) add_definitions( -DHAVE_SVN_REVISION )
endif() endif()
#================================================
# Let CMake look in these directories for nested
# 'CMakeLists.txt' files to process
#================================================
if( APPLE ) if( APPLE )
# Remove app bundles in ${KICAD_BIN} before installing anything new. # Remove app bundles in ${KICAD_BIN} before installing anything new.
# Must be defined before all includes so that it is executed first. # Must be defined before all includes so that it is executed first.
@ -614,39 +598,10 @@ if( APPLE )
) )
endif() endif()
############################
# 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( lib_dxf )
add_subdirectory( pcbnew )
add_subdirectory( polygon )
add_subdirectory( pagelayout_editor )
add_subdirectory( potrace )
add_subdirectory( bitmap2component )
add_subdirectory( pcb_calculator )
add_subdirectory( kicad ) # should follow pcbnew, eeschema
add_subdirectory( tools )
add_subdirectory( utils )
add_subdirectory( qa )
#add_subdirectory( new )
#############
# Resources #
#############
add_subdirectory( demos )
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
@ -671,6 +626,18 @@ endif()
configure_file( ${PROJECT_SOURCE_DIR}/CMakeModules/config.h.cmake configure_file( ${PROJECT_SOURCE_DIR}/CMakeModules/config.h.cmake
${CMAKE_BINARY_DIR}/config.h ) ${CMAKE_BINARY_DIR}/config.h )
###
# Generate Map file
###
if( KICAD_MAKE_LINK_MAPS )
# Currently only works on linux/gcc
if( UNIX AND NOT APPLE )
set( MAKE_LINK_MAPS true )
else()
set( MAKE_LINK_MAPS false )
endif()
endif()
#================================================ #================================================
# "make uninstall" rules # "make uninstall" rules
#================================================ #================================================
@ -740,7 +707,6 @@ endif()
#include( CTest ) #include( CTest )
if( UNIX AND NOT APPLE ) if( UNIX AND NOT APPLE )
# Create a *.deb file: # Create a *.deb file:
@ -756,3 +722,31 @@ if( UNIX AND NOT APPLE )
include( CPack ) include( CPack )
endif() endif()
#================================================
# Let CMake look in these directories for nested
# 'CMakeLists.txt' files to process
#================================================
# 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( lib_dxf )
add_subdirectory( pcbnew )
add_subdirectory( polygon )
add_subdirectory( pagelayout_editor )
add_subdirectory( potrace )
add_subdirectory( bitmap2component )
add_subdirectory( pcb_calculator )
add_subdirectory( kicad ) # should follow pcbnew, eeschema
add_subdirectory( tools )
add_subdirectory( utils )
add_subdirectory( qa )
# Resources
add_subdirectory( demos )
add_subdirectory( template )

View File

@ -1,11 +1,3 @@
# the map generation creates on Windows/gcc a lot of useless warnings
# so disable it on windows
if( WIN32 AND NOT CMAKE_CROSSCOMPILING )
set( MAKE_LINK_MAPS false )
else()
set( MAKE_LINK_MAPS true )
endif()
add_definitions( -DCVPCB ) add_definitions( -DCVPCB )
include_directories( BEFORE ${INC_BEFORE} ) include_directories( BEFORE ${INC_BEFORE} )

View File

@ -1,14 +1,5 @@
# the map generation creates on Windows/gcc a lot of useless warnings
# so disable it on windows
if( WIN32 AND NOT CMAKE_CROSSCOMPILING )
set( MAKE_LINK_MAPS false )
else()
set( MAKE_LINK_MAPS true )
endif()
add_definitions( -DEESCHEMA ) add_definitions( -DEESCHEMA )
include_directories( BEFORE ${INC_BEFORE} ) include_directories( BEFORE ${INC_BEFORE} )
include_directories( include_directories(
./dialogs ./dialogs
@ -308,6 +299,7 @@ if( APPLE )
DESTINATION ${KICAD_BIN} DESTINATION ${KICAD_BIN}
COMPONENT binary COMPONENT binary
) )
install( CODE " install( CODE "
# override default embedded path settings # override default embedded path settings
${OSX_BUNDLE_OVERRIDE_PATHS} ${OSX_BUNDLE_OVERRIDE_PATHS}

View File

@ -1,11 +1,3 @@
# the map generation creates on Windows/gcc a lot of useless warnings
# so disable it on windows
if( WIN32 AND NOT CMAKE_CROSSCOMPILING )
set( MAKE_LINK_MAPS false )
else()
set( MAKE_LINK_MAPS true )
endif()
add_definitions(-DGERBVIEW) add_definitions(-DGERBVIEW)
include_directories( BEFORE ${INC_BEFORE} ) include_directories( BEFORE ${INC_BEFORE} )

View File

@ -109,9 +109,6 @@ if( APPLE )
# do all the work # do all the work
include( BundleUtilities ) include( BundleUtilities )
# If `BU_CHMOD_BUNDLE_ITEMS` is not set, `install_name_tool` will fail to re-write some loader paths due to lack of writable permissions if the build dependencies were installed by brew (or didn't have writable permissions)
set(BU_CHMOD_BUNDLE_ITEMS ON)
fixup_bundle( ${OSX_BUNDLE_INSTALL_BIN_DIR}/kicad fixup_bundle( ${OSX_BUNDLE_INSTALL_BIN_DIR}/kicad
\"\${BUNDLE_FIX_LIBS}\" \"\${BUNDLE_FIX_LIBS}\"
\"\" \"\"

View File

@ -1,11 +1,3 @@
# the map generation creates on Windows/gcc a lot of useless warnings
# so disable it on windows
if( WIN32 AND NOT CMAKE_CROSSCOMPILING )
set( MAKE_LINK_MAPS false )
else()
set( MAKE_LINK_MAPS true )
endif()
add_definitions(-DPL_EDITOR) add_definitions(-DPL_EDITOR)
include_directories(BEFORE ${INC_BEFORE}) include_directories(BEFORE ${INC_BEFORE})

View File

@ -1,12 +1,5 @@
# the map generation creates on Windows/gcc a lot of useless warnings
# so disable it on windows
if( WIN32 AND NOT CMAKE_CROSSCOMPILING )
set( MAKE_LINK_MAPS false )
else()
set( MAKE_LINK_MAPS true )
endif()
add_definitions( -DPCBNEW ) add_definitions( -DPCBNEW )
add_subdirectory(router) add_subdirectory(router)
# psnrouter depends on make_lexer outputs in common (bug # 1285878 ) # psnrouter depends on make_lexer outputs in common (bug # 1285878 )
@ -458,7 +451,6 @@ endif()
# Doxygen python documentation # Doxygen python documentation
### ###
find_package( Doxygen )
if( DOXYGEN_FOUND ) if( DOXYGEN_FOUND )
if( KICAD_SCRIPTING ) if( KICAD_SCRIPTING )
@ -494,8 +486,6 @@ if( DOXYGEN_FOUND )
COMMENT "building doxygen docs into directory doxygen-python/html" COMMENT "building doxygen docs into directory doxygen-python/html"
) )
endif() endif()
else()
message( STATUS "WARNING: Doxygen not found - doxygen-docs (Source Docs) target not created" )
endif() endif()
@ -699,18 +689,6 @@ if( KICAD_SCRIPTING_MODULES )
COMMENT "Fixing swig_import_helper in Kicad scripting modules" COMMENT "Fixing swig_import_helper in Kicad scripting modules"
) )
if( NOT APPLE )
install( FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py DESTINATION ${PYTHON_DEST} )
else()
# put everything into bundle at build time, it is relocated at install
add_custom_target( ScriptingModulesPcbnewPyCopy ALL
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py" "${PYTHON_DEST}/"
DEPENDS FixSwigImportsModuleScripting
COMMENT "Copying pcbnew.py into ${PYTHON_DEST}"
)
add_dependencies( ScriptingModulesPcbnewPyCopy ScriptingWxpythonCopy )
endif()
if( MINGW ) if( MINGW )
install( FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.pyd DESTINATION ${PYTHON_DEST} ) install( FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.pyd DESTINATION ${PYTHON_DEST} )
elseif( APPLE ) elseif( APPLE )

View File

@ -1,47 +1,4 @@
set( MAKE_LINK_MAPS true )
if( 0 )
project(kicad-tools)
cmake_minimum_required( VERSION 2.8 FATAL_ERROR )
set( PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../ )
# message( "PROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}" )
# Path to local CMake modules.
set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules )
include( CheckFindPackageResult )
##########################
# Find wxWidgets library #
##########################
# Here you can define what libraries of wxWidgets you need for your
# application. You can figure out what libraries you need here;
# 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")
# Include wxWidgets macros.
include(${wxWidgets_USE_FILE})
# make config.h
include( PerformFeatureChecks )
perform_feature_checks()
endif()
include_directories( include_directories(
${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/pcbnew ${PROJECT_SOURCE_DIR}/pcbnew
@ -77,4 +34,3 @@ add_executable( property_tree
target_link_libraries( property_tree target_link_libraries( property_tree
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
) )