Commit 230b60e6 authored by Brian Sidebotham's avatar Brian Sidebotham
Browse files

* Merge changes from trunk

parents a71823b4 24ed7f50
Loading
Loading
Loading
Loading
+50 −61
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ set( USE_KIWAY_DLLS true ) # this is now mandatory, the code is the same anyway
# have this option turned OFF, the xml export's referential integrity is broken
# on library part name.  Hence the default is ON now, as of 29-Jan-2014.
option( KICAD_KEEPCASE
    "ON= case specific string matching on component names, OFF= match names as if they were spelt using uppercase."
    "Use case sensitive string matching for component names (default ON)."
    ON
    )

@@ -46,25 +46,28 @@ option( USE_WX_OVERLAY
    "Use wxOverlay: Always ON for MAC (default OFF).  Warning, this is experimental" )

option( KICAD_SCRIPTING
    "set this option ON to build the scripting support inside kicad binaries"
    "Build the Python scripting support inside KiCad binaries (default OFF)."
    )

option( KICAD_SCRIPTING_MODULES
    "set this option ON to build kicad modules that can be used from scripting languages"
    "Build KiCad Python modules that can be used from scripting languages (default OFF)."
    )

option( KICAD_SCRIPTING_WXPYTHON
    "set this option ON to build wxpython implementation for wx interface building in python and py.shell"
    "Build wxPython implementation for wx interface building in Python and py.shell (default OFF)."
    )

option( KICAD_BUILD_STATIC
    "Builds Kicad and all libraries static"
    "Build dependencies as static libraries.  OSX only. (default OFF)."
    )

option( KICAD_BUILD_DYNAMIC
    "Builds Kicad and all libraries dynamic (required for wxPython)"
    "Build dependencies as shared libraries.  Required for wxPython support.  OXS only. (default OFF)."
    )

option( USE_OSX_DEPS_BUILDER
    "Build dependencies from source instead of dependencies installed on system. OSX only. (default OFF)."
    )

# WARNING: KiCad developers strongly advise you to build Boost with supplied patches,
# as it is known to work with KiCad.  Other versions may contain bugs that may result
@@ -269,7 +272,6 @@ if( USE_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.
@@ -353,9 +355,30 @@ include( ExternalProject )
#================================================
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

# Turn on wxWidgets compatibility mode for some classes
add_definitions( -DWX_COMPATIBILITY )

# See line 41 of CMakeModules/FindwxWidgets.cmake
set( wxWidgets_CONFIG_OPTIONS --static=no )

# On Apple only wxwidgets 2.9 or higher doesn't need to find aui part of base
# Seems no longer needed on wx-3
if( APPLE AND ( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES OR KICAD_SCRIPTING_WXPYTHON) )
    find_package( wxWidgets 3.0.0 COMPONENTS gl adv html core net base xml REQUIRED )
else()
    find_package( wxWidgets 3.0.0 COMPONENTS gl aui adv html core net base xml REQUIRED )
endif()

# Include wxWidgets macros.
include( ${wxWidgets_USE_FILE} )

#######################
# Find OpenGL library #
#######################
@@ -372,7 +395,10 @@ check_find_package_result( OPENGL_FOUND "OpenGL" )
# Always defined, empty if no libraries are to be built
add_custom_target( lib-dependencies )

if( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC )
# Only download and build all dependencies from source on OSX if the user specifically requests
# it.  Otherwise, respect the developers wishes to use the dependencies already installed on
# their systme.
if( APPLE AND USE_OSX_DEPS_BUILDER )

    # This should be built in all cases, if swig exec is not avaiable
    # will be impossible also enable SCRIPTING being for PCBNEW required immediately
@@ -417,21 +443,14 @@ if( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC )

        set( PYTHON_DEST ${LIBWXPYTHON_ROOT}/wxPython/lib/python2.6/site-packages )

        set(wxWidgets_BIN_DIR           ${LIBWXPYTHON_ROOT}/bin/wxrc )
        set(wxWidgets_CONFIG_EXECUTABLE ${LIBWXPYTHON_ROOT}/bin/wx-config )
        set(wxWidgets_INCLUDE_DIRS      ${LIBWXPYTHON_ROOT}/include/wx-3.0 )
        set(wxWidgets_LIBRARY_DIRS      ${LIBWXPYTHON_ROOT}/lib )

        add_dependencies( lib-dependencies libwxpython )
        add_dependencies( lib-dependencies swig )

    else()
        include( download_wxwidgets )
        add_dependencies( lib-dependencies libwx )
    endif()

    include( download_libpng )

    include( download_pkgconfig )
    set( PKG_CONFIG_EXECUTABLE "${PKGCONFIG_ROOT}/bin/pkg-config" )
    include( download_glew )
@@ -450,11 +469,13 @@ if( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC )
    add_dependencies( lib-dependencies pkgconfig )

    if( KICAD_BUILD_DYNAMIC AND APPLE )
        add_custom_target( osx_fix_bundles ALL DEPENDS cvpcb eeschema gerbview kicad pcbnew bitmap2component pcb_calculator pl_editor)
        add_custom_command(TARGET osx_fix_bundles POST_BUILD COMMAND ${PROJECT_SOURCE_DIR}/scripts/osx_fixbundle.sh ${PROJECT_SOURCE_DIR} COMMENT "Migrating dylibs to bundles")
        add_custom_target( osx_fix_bundles ALL DEPENDS
            cvpcb eeschema gerbview kicad pcbnew bitmap2component pcb_calculator pl_editor)
        add_custom_command(TARGET osx_fix_bundles
            POST_BUILD COMMAND ${PROJECT_SOURCE_DIR}/scripts/osx_fixbundle.sh ${PROJECT_SOURCE_DIR}
            COMMENT "Migrating dylibs to bundles")
    endif()
endif()

endif( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC)

#####################
# Find GLEW library #
@@ -492,31 +513,6 @@ else()
    include( download_boost )
endif()

##########################
# 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

# See line 41 of CMakeModules/FindwxWidgets.cmake
set( wxWidgets_CONFIG_OPTIONS --static=no )

# On Apple only wxwidgets 2.9 or higher doesn't need to find aui part of base
# Seems no more needed on wx-3
if( APPLE AND ( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES OR KICAD_SCRIPTING_WXPYTHON) )
    find_package( wxWidgets COMPONENTS gl adv html core net base xml QUIET )
else()
    find_package( wxWidgets COMPONENTS gl aui adv html core net base xml QUIET )
endif()

if( NOT (KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC) )
    check_find_package_result( wxWidgets_FOUND "wxWidgets" )
endif()

# Include wxWidgets macros.
include( ${wxWidgets_USE_FILE} )

# Include MinGW resource compiler.
include( MinGWResourceCompiler )

@@ -553,14 +549,6 @@ set( INC_AFTER

# Find Python and other scripting resources
if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )

    if( APPLE )
        set( PYTHON_LIBRARY /System/Library/Frameworks/Python.framework/Versions/2.6/Python  )
        set( PYTHON_INCLUDE_DIR /System/Library/Frameworks/Python.framework/Versions//2.6/include/python2.6 )
        set( PythonInterp_FIND_VERSION 2.6 )
        set( PythonLibs_FIND_VERSION 2.6 )
    endif()

    # force a python version < 3.0
    set( PythonInterp_FIND_VERSION 2.6 )
    set( PythonLibs_FIND_VERSION 2.6 )
@@ -572,6 +560,7 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
    if( NOT PYTHON_VERSION_MAJOR EQUAL 2 )
        message( FATAL_ERROR "Python 2.x is required." )
    endif()

    # 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 )
+160 −0
Original line number Diff line number Diff line
#.rst:
# CMakeParseArguments
# -------------------
#
#
#
# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords>
# <multi_value_keywords> args...)
#
# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions
# for parsing the arguments given to that macro or function.  It
# processes the arguments and defines a set of variables which hold the
# values of the respective options.
#
# The <options> argument contains all options for the respective macro,
# i.e.  keywords which can be used when calling the macro without any
# value following, like e.g.  the OPTIONAL keyword of the install()
# command.
#
# The <one_value_keywords> argument contains all keywords for this macro
# which are followed by one value, like e.g.  DESTINATION keyword of the
# install() command.
#
# The <multi_value_keywords> argument contains all keywords for this
# macro which can be followed by more than one value, like e.g.  the
# TARGETS or FILES keywords of the install() command.
#
# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the
# keywords listed in <options>, <one_value_keywords> and
# <multi_value_keywords> a variable composed of the given <prefix>
# followed by "_" and the name of the respective keyword.  These
# variables will then hold the respective value from the argument list.
# For the <options> keywords this will be TRUE or FALSE.
#
# All remaining arguments are collected in a variable
# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see
# whether your macro was called with unrecognized parameters.
#
# As an example here a my_install() macro, which takes similar arguments
# as the real install() command:
#
# ::
#
#    function(MY_INSTALL)
#      set(options OPTIONAL FAST)
#      set(oneValueArgs DESTINATION RENAME)
#      set(multiValueArgs TARGETS CONFIGURATIONS)
#      cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
#      ...
#
#
#
# Assume my_install() has been called like this:
#
# ::
#
#    my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub)
#
#
#
# After the cmake_parse_arguments() call the macro will have set the
# following variables:
#
# ::
#
#    MY_INSTALL_OPTIONAL = TRUE
#    MY_INSTALL_FAST = FALSE (this option was not used when calling my_install()
#    MY_INSTALL_DESTINATION = "bin"
#    MY_INSTALL_RENAME = "" (was not used)
#    MY_INSTALL_TARGETS = "foo;bar"
#    MY_INSTALL_CONFIGURATIONS = "" (was not used)
#    MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL"
#
#
#
# You can then continue and process these variables.
#
# Keywords terminate lists of values, e.g.  if directly after a
# one_value_keyword another recognized keyword follows, this is
# interpreted as the beginning of the new option.  E.g.
# my_install(TARGETS foo DESTINATION OPTIONAL) would result in
# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION
# would be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor.

#=============================================================================
# Copyright 2010 Alexander Neundorf <neundorf@kde.org>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
#  License text for the above reference.)


if(__CMAKE_PARSE_ARGUMENTS_INCLUDED)
  return()
endif()
set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE)


function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames)
  # first set all result variables to empty/FALSE
  foreach(arg_name ${_singleArgNames} ${_multiArgNames})
    set(${prefix}_${arg_name})
  endforeach()

  foreach(option ${_optionNames})
    set(${prefix}_${option} FALSE)
  endforeach()

  set(${prefix}_UNPARSED_ARGUMENTS)

  set(insideValues FALSE)
  set(currentArgName)

  # now iterate over all arguments and fill the result variables
  foreach(currentArg ${ARGN})
    list(FIND _optionNames "${currentArg}" optionIndex)  # ... then this marks the end of the arguments belonging to this keyword
    list(FIND _singleArgNames "${currentArg}" singleArgIndex)  # ... then this marks the end of the arguments belonging to this keyword
    list(FIND _multiArgNames "${currentArg}" multiArgIndex)  # ... then this marks the end of the arguments belonging to this keyword

    if(${optionIndex} EQUAL -1  AND  ${singleArgIndex} EQUAL -1  AND  ${multiArgIndex} EQUAL -1)
      if(insideValues)
        if("${insideValues}" STREQUAL "SINGLE")
          set(${prefix}_${currentArgName} ${currentArg})
          set(insideValues FALSE)
        elseif("${insideValues}" STREQUAL "MULTI")
          list(APPEND ${prefix}_${currentArgName} ${currentArg})
        endif()
      else()
        list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg})
      endif()
    else()
      if(NOT ${optionIndex} EQUAL -1)
        set(${prefix}_${currentArg} TRUE)
        set(insideValues FALSE)
      elseif(NOT ${singleArgIndex} EQUAL -1)
        set(currentArgName ${currentArg})
        set(${prefix}_${currentArgName})
        set(insideValues "SINGLE")
      elseif(NOT ${multiArgIndex} EQUAL -1)
        set(currentArgName ${currentArg})
        set(${prefix}_${currentArgName})
        set(insideValues "MULTI")
      endif()
    endif()

  endforeach()

  # propagate the result variables to the caller:
  foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames})
    set(${prefix}_${arg_name}  ${${prefix}_${arg_name}} PARENT_SCOPE)
  endforeach()
  set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE)

endfunction()
Loading