You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

872 lines
31 KiB

18 years ago
9 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
18 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
  1. #
  2. # This program source code file is part of KICAD, a free EDA CAD application.
  3. #
  4. # Copyright (C) 2007-2016 Kicad Developers, see AUTHORS.txt for contributors.
  5. #
  6. # This program is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU General Public License
  8. # as published by the Free Software Foundation; either version 2
  9. # of the License, or (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, you may find one here:
  18. # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  19. # or you may search the http://www.gnu.org website for the version 2 license,
  20. # or you may write to the Free Software Foundation, Inc.,
  21. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  22. #
  23. # Default to CMAKE_BUILD_TYPE = Release unless overridden on command line
  24. # http://www.cmake.org/pipermail/cmake/2008-September/023808.html
  25. if( DEFINED CMAKE_BUILD_TYPE )
  26. set( CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Set to either \"Release\" or \"Debug\"" )
  27. else()
  28. set( CMAKE_BUILD_TYPE Release CACHE STRING "Set to either \"Release\" or \"Debug\"" )
  29. endif()
  30. project( kicad )
  31. include( GNUInstallDirs )
  32. cmake_minimum_required( VERSION 2.8.12 FATAL_ERROR )
  33. # because of http://public.kitware.com/Bug/view.php?id=10395
  34. # Path to local CMake modules.
  35. set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules )
  36. #
  37. # KiCad build options should be added below.
  38. #
  39. # If you add a new build option, please add it's state to the
  40. # OnCopyVersionInfo() function in common/dialog_about/dialog_about.cpp
  41. # so that build option settings can be included in bug reports.
  42. #
  43. option( USE_WX_GRAPHICS_CONTEXT
  44. "Use wxGraphicsContext for rendering (default OFF). Warning, this is experimental" )
  45. option( USE_WX_OVERLAY
  46. "Use wxOverlay: Always ON for MAC (default OFF). Warning, this is experimental" )
  47. option( KICAD_SCRIPTING
  48. "Build the Python scripting support inside KiCad binaries (default OFF)."
  49. )
  50. option( KICAD_SCRIPTING_MODULES
  51. "Build native portion of the pcbnew Python module: _pcbnew.{pyd,so} for OS command line use of Python."
  52. )
  53. option( KICAD_SCRIPTING_WXPYTHON
  54. "Build wxPython implementation for wx interface building in Python and py.shell (default OFF)."
  55. )
  56. option( KICAD_SCRIPTING_ACTION_MENU
  57. "Build a tools menu with registred python plugins: actions plugins (default OFF)."
  58. )
  59. option( KICAD_USE_OCE
  60. "Build tools and plugins related to OpenCascade Community Edition (default OFF)"
  61. )
  62. option( KICAD_INSTALL_DEMOS
  63. "Install kicad demos and examples (default ON)"
  64. ON )
  65. # when option KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES is enabled:
  66. # PYTHON_EXECUTABLE can be defined when invoking cmake
  67. # ( use -DPYTHON_EXECUTABLE=<python path>/python.exe or python2 )
  68. # when not defined by user, the default is python.exe under Windows and python2 for others
  69. # python binary file should be is exec path.
  70. # KICAD_SCRIPTING_MODULES requires KICAD_SCRIPTING enable it here if KICAD_SCRIPTING_MODULES is ON
  71. if ( KICAD_SCRIPTING_MODULES AND NOT KICAD_SCRIPTING )
  72. message(STATUS "Changing KICAD_SCRIPTING to ON as needed by KICAD_SCRIPTING_MODULES")
  73. set ( KICAD_SCRIPTING ON )
  74. endif()
  75. # same with KICAD_SCRIPTING_ACTION_MENUS
  76. if ( KICAD_SCRIPTING_ACTION_MENU AND NOT KICAD_SCRIPTING )
  77. message(STATUS "Changing KICAD_SCRIPTING to ON as needed by KICAD_SCRIPTING_ACTION_MENU")
  78. set ( KICAD_SCRIPTING ON )
  79. endif()
  80. option( BUILD_GITHUB_PLUGIN "Build the GITHUB_PLUGIN for pcbnew." ON )
  81. option( KICAD_SPICE "Build Kicad with internal Spice simulator." OFF )
  82. # Global setting: exports are explicit
  83. set( CMAKE_CXX_VISIBILITY_PRESET "hidden" )
  84. set( CMAKE_VISIBILITY_INLINES_HIDDEN ON )
  85. # Global setting: build everything position independent
  86. set( CMAKE_POSITION_INDEPENDENT_CODE ON )
  87. # Global setting: Use C++11
  88. set(CMAKE_CXX_STANDARD 11)
  89. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  90. # CMP0063: CMake < 3.3 does not handle hidden visibility for static libraries,
  91. # and 3.3 is backwards compatible when the minimum version is smaller than 3.3.
  92. if( POLICY CMP0063 )
  93. cmake_policy( GET CMP0063 VISIBILITY_POLICY )
  94. if( VISIBILITY_POLICY STREQUAL NEW )
  95. message( WARNING "Compatibility code for CMake < 3.3 can be removed, search for CMP0063" )
  96. else()
  97. cmake_policy( SET CMP0063 NEW )
  98. endif()
  99. else()
  100. if( CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY AND NOT APPLE )
  101. set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY}hidden" )
  102. endif()
  103. if( CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN AND NOT APPLE )
  104. set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN}" )
  105. endif()
  106. endif()
  107. # Add option to add user directories for linker, if any
  108. LINK_DIRECTORIES( ${LINK_DIRECTORIES_PATH} )
  109. if( UNIX )
  110. set( KICAD_USER_CONFIG_DIR $ENV{HOME} CACHE PATH "Location of user specific KiCad config files" )
  111. elseif( MINGW )
  112. set( KICAD_USER_CONFIG_DIR $ENV{APPDATA} CACHE PATH "Location of user specific KiCad config files" )
  113. endif()
  114. mark_as_advanced( KICAD_USER_CONFIG_DIR )
  115. # Set default data file path to CMAKE_INSTALL_PREFIX if it wasn't specified during the
  116. # CMake configuration. The value of DEFAULT_INSTALL_PATH is expanded in config.h and
  117. # used in the source code to define the base path for kicad search paths and environment
  118. # variables.
  119. if( NOT DEFAULT_INSTALL_PATH )
  120. set( DEFAULT_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}"
  121. CACHE
  122. PATH
  123. "Location of KiCad data files." )
  124. endif()
  125. message( STATUS "Kicad install dir: <${DEFAULT_INSTALL_PATH}>" )
  126. # Generate build system specific header file.
  127. include( PerformFeatureChecks )
  128. perform_feature_checks()
  129. # Workaround: CMake < 3.1 does not support CMAKE_CXX_STANDARD
  130. if( NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 3.1 )
  131. message( FATAL_ERROR "Remove compatibility code" )
  132. endif()
  133. if( CMAKE_VERSION VERSION_LESS 3.1 AND ( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) )
  134. include(CheckCXXCompilerFlag)
  135. CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
  136. if(COMPILER_SUPPORTS_CXX11)
  137. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
  138. else()
  139. message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
  140. endif()
  141. endif()
  142. # Warn about missing override specifiers, if supported
  143. if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
  144. include(CheckCXXCompilerFlag)
  145. CHECK_CXX_COMPILER_FLAG("-Wsuggest-override" COMPILER_SUPPORTS_WSUGGEST_OVERRIDE)
  146. if(COMPILER_SUPPORTS_WSUGGEST_OVERRIDE)
  147. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override")
  148. endif()
  149. endif()
  150. # Warn about shadowed variables (-Wshadow option), if supported
  151. # Unfortunately, the swig autogenerated files have a lot of shadowed variables
  152. # and -Wno-shadow does not exist.
  153. # Adding -Wshadow can be made only for .cpp files
  154. #and will be added later in CMakeLists.txt
  155. if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
  156. include(CheckCXXCompilerFlag)
  157. CHECK_CXX_COMPILER_FLAG("-Wshadow" COMPILER_SUPPORTS_WSHADOW)
  158. if( COMPILER_SUPPORTS_WSHADOW )
  159. set(WSHADOW_FLAGS "-Wshadow")
  160. endif()
  161. endif()
  162. #================================================
  163. # Set flags for GCC, or treat llvm as GCC
  164. #================================================
  165. if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
  166. execute_process( COMMAND ${CMAKE_C_COMPILER} -dumpversion
  167. OUTPUT_VARIABLE GCC_VERSION
  168. OUTPUT_STRIP_TRAILING_WHITESPACE )
  169. if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
  170. set( TO_LINKER -XLinker )
  171. else()
  172. set( TO_LINKER -Wl )
  173. endif()
  174. # Establish -Wall early, so specialized relaxations of this may come
  175. # subsequently on the command line, such as in pcbnew/github/CMakeLists.txt
  176. set( CMAKE_C_FLAGS "-Wall ${CMAKE_C_FLAGS}" )
  177. set( CMAKE_CXX_FLAGS "-Wall ${CMAKE_CXX_FLAGS}" )
  178. set( CMAKE_C_FLAGS_DEBUG "-g3 -ggdb3 -DDEBUG" )
  179. set( CMAKE_CXX_FLAGS_DEBUG "-g3 -ggdb3 -DDEBUG -Wno-deprecated-declarations" )
  180. if( MINGW )
  181. set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" )
  182. # _UNICODE definition seems needed under mingw/gcc 4.8
  183. # (Kicad uses unicode, and on Windows, wxWidgets >= 2.9.4 is mandatory
  184. # and uses unicode)
  185. if( GCC_VERSION VERSION_EQUAL 4.8.0 OR GCC_VERSION VERSION_GREATER 4.8.0 )
  186. add_definitions(-D_UNICODE)
  187. endif()
  188. # Since version 2.8.5, Cmake uses a response file (.rsp) to
  189. # pass the list of include paths to gcc
  190. # unfortunately, under mingw32+msys, at least with gcc 4.8 and previous,
  191. # this file is not always expanded and in this case include paths defined in this file
  192. # are not taken in account ( this is the case of wxWidgets includes )
  193. # If it is the case, disable this response file for includes ( See Windows-GNU.cmake module )
  194. if( false ) #set to true to disable the include response file
  195. if( WIN32 AND MSYS AND NOT CMAKE_CROSSCOMPILING )
  196. # fixme: it is needed only with MSYS+MINGW32? or always under MINGW
  197. if( ${CMAKE_SIZEOF_VOID_P} MATCHES 4 )
  198. set( CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES 0 )
  199. endif()
  200. endif()
  201. endif()
  202. # for some reasons, cmake does do use always a response file to send the list of objects
  203. # to the archiver, and because this list can be very long, and can create issue
  204. # when it is used in a command line, force use of a response file to store it
  205. SET( CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1 )
  206. # The MinGW compiler can use the microsoft system snprintf as standard and it has a broken
  207. # API with respect to the C99 standard, so make sure we force it to use its own compliant
  208. # snprintf
  209. add_definitions(-D__USE_MINGW_ANSI_STDIO=1)
  210. else()
  211. if( NOT APPLE )
  212. # Thou shalt not link vaporware and tell us it's a valid DSO (apple ld doesn't support it)
  213. set( CMAKE_SHARED_LINKER_FLAGS "${TO_LINKER},--no-undefined" )
  214. set( CMAKE_MODULE_LINKER_FLAGS "${TO_LINKER},--no-undefined" )
  215. set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" )
  216. # Defeat ELF's ability to use the GOT to replace locally implemented functions
  217. # with ones from another module.
  218. # https://bugs.launchpad.net/kicad/+bug/1322354
  219. set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${TO_LINKER},-Bsymbolic" )
  220. set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${TO_LINKER},-Bsymbolic" )
  221. endif()
  222. endif()
  223. # quiet GCC while in boost
  224. if( GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8 OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
  225. set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs" )
  226. endif()
  227. set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-strict-aliasing" )
  228. if( APPLE )
  229. set( CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} -headerpad_max_install_names") # needed by fixbundle
  230. endif()
  231. endif( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
  232. if( USE_WX_OVERLAY OR APPLE )
  233. add_definitions( -DUSE_WX_OVERLAY )
  234. endif()
  235. if( KICAD_SCRIPTING )
  236. add_definitions( -DKICAD_SCRIPTING )
  237. endif()
  238. if( KICAD_SCRIPTING_MODULES )
  239. add_definitions( -DKICAD_SCRIPTING_MODULES )
  240. endif()
  241. if( KICAD_SCRIPTING_WXPYTHON )
  242. add_definitions( -DKICAD_SCRIPTING_WXPYTHON )
  243. endif()
  244. if( KICAD_SCRIPTING_ACTION_MENU )
  245. add_definitions( -DKICAD_SCRIPTING_ACTION_MENU )
  246. endif()
  247. if( KICAD_SPICE )
  248. add_definitions( -DKICAD_SPICE )
  249. endif()
  250. if( KICAD_USE_SCH_IO_MANAGER )
  251. add_definitions( -DKICAD_USE_SCH_IO_MANAGER )
  252. endif()
  253. if( KICAD_USE_OCE )
  254. add_definitions( -DKICAD_USE_OCE )
  255. endif()
  256. if( USE_WX_GRAPHICS_CONTEXT OR APPLE )
  257. add_definitions( -DUSE_WX_GRAPHICS_CONTEXT )
  258. endif()
  259. # KIFACE_SUFFIX is the file extension used for top level program modules which
  260. # implement the KIFACE interface. A valid suffix starts with a period '.'.
  261. if( false )
  262. # This is the eventual situation near milestone C) of modular-kicad blueprint.
  263. # Until then we use .kiface extension so we don't collide with python DSO.
  264. set( KIFACE_SUFFIX ${CMAKE_SHARED_MODULE_SUFFIX} )
  265. else()
  266. # Temporary situation until we can dovetail the python DSO into the kiface DSO.
  267. set( KIFACE_SUFFIX ".kiface" )
  268. endif()
  269. # KIFACE_PREFIX is a basename prefix used for top level program modules which
  270. # implement the KIFACE.
  271. set( KIFACE_PREFIX "_" )
  272. #message( STATUS "KIFACE_SUFFIX:${KIFACE_SUFFIX} KIFACE_PREFIX:${KIFACE_PREFIX}" )
  273. #================================================
  274. # Locations for install targets.
  275. #================================================
  276. if( NOT APPLE )
  277. # Everything without leading / is relative to CMAKE_INSTALL_PREFIX.
  278. set( KICAD_BIN bin
  279. CACHE PATH "Location of KiCad binaries." )
  280. if( WIN32 )
  281. set( KICAD_PLUGINS ${KICAD_BIN}/scripting/plugins
  282. CACHE PATH "Location of KiCad plugins." )
  283. set( KICAD_LIB ${KICAD_BIN}
  284. CACHE PATH "Location of KiCad shared objects" )
  285. set( KICAD_USER_PLUGIN ${KICAD_BIN}/plugins
  286. CACHE PATH "Location of KiCad user-loaded plugins" )
  287. else()
  288. set( KICAD_PLUGINS ${CMAKE_INSTALL_LIBDIR}/kicad/plugins
  289. CACHE PATH "Location of KiCad plugins." )
  290. set( KICAD_LIB ${CMAKE_INSTALL_LIBDIR}
  291. CACHE PATH "Location of KiCad shared objects" )
  292. set( KICAD_USER_PLUGIN ${CMAKE_INSTALL_LIBDIR}/kicad/plugins
  293. CACHE PATH "Location of KiCad user-loaded plugins" )
  294. endif()
  295. set( KICAD_DATA share/kicad
  296. CACHE PATH "Location of KiCad data files." )
  297. set( KICAD_DOCS share/doc/kicad
  298. CACHE PATH "Location of KiCad documentation files." )
  299. set( KICAD_DEMOS ${KICAD_DATA}/demos
  300. CACHE PATH "Location of KiCad demo files." )
  301. set( KICAD_TEMPLATE ${KICAD_DATA}/template
  302. CACHE PATH "Location of KiCad template files." )
  303. else()
  304. # everything without leading / is relative to CMAKE_INSTALL_PREFIX.
  305. # CMAKE_INSTALL_PREFIX is root of .dmg image
  306. set( KICAD_BIN ${CMAKE_INSTALL_PREFIX}
  307. CACHE PATH "Location of KiCad binaries." FORCE )
  308. # some paths to single app bundle
  309. set( OSX_BUNDLE_MAIN "kicad.app" )
  310. set( OSX_BUNDLE_BIN_DIR "Contents/MacOS" )
  311. set( OSX_BUNDLE_LIB_DIR "Contents/Frameworks" )
  312. set( OSX_BUNDLE_KIFACE_DIR "Contents/PlugIns" )
  313. set( OSX_BUNDLE_SUP_DIR "Contents/SharedSupport" )
  314. set( OSX_BUNDLE_APP_DIR "Contents/Applications" )
  315. set( OSX_BUNDLE_BUILD_DIR "${CMAKE_BINARY_DIR}/kicad/${OSX_BUNDLE_MAIN}" )
  316. set( OSX_BUNDLE_BUILD_BIN_DIR "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_BIN_DIR}" )
  317. set( OSX_BUNDLE_BUILD_LIB_DIR "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_LIB_DIR}" )
  318. set( OSX_BUNDLE_BUILD_KIFACE_DIR "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_KIFACE_DIR}" )
  319. set( OSX_BUNDLE_BUILD_PLUGIN_DIR "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_KIFACE_DIR}" )
  320. set( OSX_BUNDLE_INSTALL_DIR "${KICAD_BIN}/${OSX_BUNDLE_MAIN}" )
  321. set( OSX_BUNDLE_INSTALL_BIN_DIR "${OSX_BUNDLE_INSTALL_DIR}/${OSX_BUNDLE_BIN_DIR}" )
  322. set( OSX_BUNDLE_INSTALL_LIB_DIR "${OSX_BUNDLE_INSTALL_DIR}/${OSX_BUNDLE_LIB_DIR}" )
  323. set( OSX_BUNDLE_INSTALL_KIFACE_DIR "${OSX_BUNDLE_INSTALL_DIR}/${OSX_BUNDLE_KIFACE_DIR}" )
  324. set( OSX_BUNDLE_INSTALL_PLUGIN_DIR "${OSX_BUNDLE_INSTALL_DIR}/${OSX_BUNDLE_KIFACE_DIR}" )
  325. # everything provided with the application bundle goes into
  326. # kicad.app/Contents/SharedSupport => accessible via GetDataDir()
  327. # everything else to the .dmg image
  328. set( KICAD_DATA ${OSX_BUNDLE_INSTALL_DIR}/${OSX_BUNDLE_SUP_DIR}
  329. CACHE PATH "Location of KiCad data files." FORCE )
  330. set( KICAD_LIB ${OSX_BUNDLE_INSTALL_DIR}/${OSX_BUNDLE_LIB_DIR}
  331. CACHE PATH "Location of KiCad shared objects" FORCE )
  332. set( KICAD_USER_PLUGIN ${OSX_BUNDLE_INSTALL_PLUGIN_DIR}
  333. CACHE PATH "Location of KiCad user-loaded plugins" FORCE )
  334. set( KICAD_TEMPLATE ${KICAD_DATA}/template
  335. CACHE PATH "Location of KiCad template files." FORCE )
  336. set( KICAD_PLUGINS ${KICAD_DATA}/plugins
  337. CACHE PATH "Location of KiCad plugins." FORCE )
  338. set( KICAD_DOCS doc
  339. CACHE PATH "Location of KiCad documentation files." FORCE )
  340. set( KICAD_DEMOS demos
  341. CACHE PATH "Location of KiCad demo files." FORCE )
  342. # RPATH setttings for building shared libraries
  343. set( CMAKE_MACOSX_RPATH FALSE )
  344. # Override default paths for fixup_bundle
  345. set( OSX_BUNDLE_OVERRIDE_PATHS "
  346. function( gp_item_default_embedded_path_override item default_embedded_path_var )
  347. # by default, embed things right next to the main bundle executable:
  348. set( path \"@executable_path/../../Contents/MacOS\" )
  349. set( overridden 0 )
  350. # embed .dylibs right next to the main bundle executable:
  351. if( item MATCHES \"\\\\.dylib$\" )
  352. set( path \"@executable_path/../Frameworks\" )
  353. set( overridden 1 )
  354. endif()
  355. set( \${default_embedded_path_var} \"\${path}\" PARENT_SCOPE )
  356. endfunction(gp_item_default_embedded_path_override)
  357. # If `BU_CHMOD_BUNDLE_ITEMS` is not set, `install_name_tool` will fail to re-write some
  358. # loader paths due to lack of writable permissions if the build dependencies were installed
  359. # by brew (or didn't have writable permissions)
  360. set ( BU_CHMOD_BUNDLE_ITEMS ON )
  361. "
  362. )
  363. endif()
  364. mark_as_advanced( KICAD_BIN
  365. KICAD_PLUGINS
  366. KICAD_USER_PLUGIN
  367. KICAD_LIB
  368. KICAD_DATA
  369. KICAD_DOCS
  370. KICAD_DEMOS
  371. KICAD_TEMPLATE )
  372. include( Functions )
  373. include( ExternalProject )
  374. #================================================
  375. # Find libraries that are needed to build KiCad.
  376. #================================================
  377. include( CheckFindPackageResult )
  378. #
  379. # Find OpenMP support, optional
  380. #
  381. find_package( OpenMP )
  382. if( OPENMP_FOUND )
  383. set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}" )
  384. set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
  385. add_definitions( -DUSE_OPENMP )
  386. # MinGW does not include the OpenMP link library and FindOpenMP.cmake does not
  387. # set it either. Not sure this is the most elegant solution but it works.
  388. if( MINGW )
  389. set( OPENMP_LIBRARIES gomp )
  390. endif()
  391. endif()
  392. #
  393. # Find wxWidgets library, required
  394. #
  395. # Here you can define what libraries of wxWidgets you need for your
  396. # application. You can figure out what libraries you need here;
  397. # http://www.wxwidgets.org/manuals/2.8/wx_librarieslist.html
  398. # Turn on wxWidgets compatibility mode for some classes
  399. add_definitions( -DWX_COMPATIBILITY )
  400. # See line 41 of CMakeModules/FindwxWidgets.cmake
  401. set( wxWidgets_CONFIG_OPTIONS ${wxWidgets_CONFIG_OPTIONS} --static=no )
  402. find_package( wxWidgets 3.0.0 COMPONENTS gl aui adv html core net base xml stc REQUIRED )
  403. # Include wxWidgets macros.
  404. include( ${wxWidgets_USE_FILE} )
  405. #
  406. # Find OpenGL library, required
  407. #
  408. find_package( OpenGL REQUIRED )
  409. # Dick 5-Feb-2014:
  410. # Marco: We cannot use both ExternalProject_Add() add and find_package()
  411. # in the same CMake tree and have them both reference the same package:
  412. # http://stackoverflow.com/questions/6351609/cmake-linking-to-library-downloaded-from-externalproject-add
  413. # https://www.mail-archive.com/cmake@cmake.org/msg47501.html
  414. # Handle target used to specify if a target needs wx-widgets or other libraries
  415. # Always defined, empty if no libraries are to be built
  416. add_custom_target( lib-dependencies )
  417. #
  418. # Find GLEW library, required
  419. #
  420. if( NOT GLEW_FOUND )
  421. find_package( GLEW REQUIRED )
  422. check_find_package_result( GLEW_FOUND "GLEW" )
  423. endif()
  424. #
  425. # Find GLM library, required
  426. #
  427. find_package( GLM 0.9.5.1 REQUIRED )
  428. #
  429. # Find CURL library, required for github plugin
  430. #
  431. if( BUILD_GITHUB_PLUGIN )
  432. find_package( CURL REQUIRED )
  433. endif()
  434. #
  435. # Find Cairo library, required
  436. #
  437. find_package( Cairo 1.8.8 REQUIRED )
  438. find_package( Pixman 0.30 REQUIRED )
  439. #
  440. # Find Boost headers, required.
  441. find_package( Boost 1.54.0 REQUIRED )
  442. # Include MinGW resource compiler.
  443. include( MinGWResourceCompiler )
  444. # Find GDI+ on windows if wxGraphicsContext is available.
  445. if( MINGW AND USE_WX_GRAPHICS_CONTEXT )
  446. find_package( GdiPlus )
  447. check_find_package_result( GDI_PLUS_FOUND "GDI+" )
  448. endif()
  449. # Find ngspice library, required for integrated circuit simulator
  450. if( KICAD_SPICE )
  451. find_package( ngspice REQUIRED )
  452. endif()
  453. # Find OpenCascade Community Edition, required for STEP plugin and tools
  454. if( KICAD_USE_OCE )
  455. set( LIBS_OCE TKBinXCAF TKPCAF TKSTEP TKXDESTEP TKIGES TKXDEIGES )
  456. find_package( OCE 0.16 REQUIRED ${LIBS_OCE} )
  457. endif()
  458. # Assist with header file searching optimization:
  459. # INC_BEFORE and INC_AFTER are two lists which go at the front and back of the
  460. # header file search lists, respectively.
  461. # INC_BEFORE is for use with "include_directories( BEFORE ...)", which _reverses_
  462. # the order during insertion. (So put first wanted last, which is
  463. # ${CMAKE_SOURCE_DIR/include.) Use '.' for current source dir since
  464. # we don't want expansion here and now, which would happen if using ${CMAKE_CURRENT_SOURCE_DIR}.
  465. # Instead we use '.' which is applicable to any source directory below here as a result of
  466. # this lack of expansion.
  467. set( INC_BEFORE
  468. .
  469. ${CMAKE_SOURCE_DIR}/include
  470. )
  471. set( INC_AFTER
  472. ${Boost_INCLUDE_DIR}
  473. ${CMAKE_BINARY_DIR}
  474. )
  475. # Find Python and other scripting resources
  476. if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
  477. # SWIG 3.0 or later require for C++11 support.
  478. find_package( SWIG 3.0 REQUIRED )
  479. include( ${SWIG_USE_FILE} )
  480. # force a python version < 3.0
  481. set( PythonInterp_FIND_VERSION 2.6 )
  482. set( PythonLibs_FIND_VERSION 2.6 )
  483. find_package( PythonInterp )
  484. check_find_package_result( PYTHONINTERP_FOUND "Python Interpreter" )
  485. if( NOT PYTHON_VERSION_MAJOR EQUAL 2 )
  486. message( FATAL_ERROR "Python 2.x is required." )
  487. endif()
  488. # Get the correct Python site package install path from the Python interpreter found by
  489. # FindPythonInterp unless the user specifically defined a custom path.
  490. if( NOT PYTHON_SITE_PACKAGE_PATH )
  491. execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig;print\"%s\"%distutils.sysconfig.get_python_lib(plat_specific=0, standard_lib=0, prefix='')"
  492. OUTPUT_VARIABLE PYTHON_SITE_PACKAGE_PATH
  493. OUTPUT_STRIP_TRAILING_WHITESPACE
  494. )
  495. if( NOT PYTHON_SITE_PACKAGE_PATH )
  496. message( FATAL_ERROR "Error occurred while attempting to find the Python site library path." )
  497. endif()
  498. endif()
  499. if( NOT APPLE )
  500. set( PYTHON_DEST "${PYTHON_SITE_PACKAGE_PATH}"
  501. CACHE PATH "Python module install path."
  502. )
  503. else()
  504. # relative path for python in bundle
  505. set( PYTHON_LIB_DIR "python/site-packages" )
  506. # install into bundle Frameworks folder
  507. set( PYTHON_DEST "${OSX_BUNDLE_BUILD_LIB_DIR}/${PYTHON_LIB_DIR}"
  508. CACHE PATH "Python module install path."
  509. )
  510. endif()
  511. mark_as_advanced( PYTHON_DEST )
  512. message( STATUS "Python module install path: ${PYTHON_DEST}" )
  513. find_package( PythonLibs 2.6 )
  514. if( KICAD_SCRIPTING_WXPYTHON )
  515. # Check to see if the correct version of wxPython is installed based on the version of
  516. # wxWidgets found. At least the major an minor version should match.
  517. set( _wxpy_version "${wxWidgets_VERSION_MAJOR}.${wxWidgets_VERSION_MINOR}" )
  518. set( _py_cmd "import wxversion;print wxversion.checkInstalled('${_wxpy_version}')" )
  519. # Add user specified Python site package path.
  520. if( PYTHON_SITE_PACKAGE_PATH )
  521. set( _py_cmd
  522. "import sys;sys.path.insert(0, \"${PYTHON_SITE_PACKAGE_PATH}\");${_py_cmd}" )
  523. endif()
  524. execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "${_py_cmd}"
  525. RESULT_VARIABLE WXPYTHON_VERSION_RESULT
  526. OUTPUT_VARIABLE WXPYTHON_VERSION_FOUND
  527. OUTPUT_STRIP_TRAILING_WHITESPACE
  528. )
  529. # message( STATUS "WXPYTHON_VERSION_FOUND: ${WXPYTHON_VERSION_FOUND}" )
  530. # message( STATUS "WXPYTHON_VERSION_RESULT: ${WXPYTHON_VERSION_RESULT}" )
  531. # Check to see if any version of wxPython is installed on the system.
  532. if( WXPYTHON_VERSION_RESULT GREATER 0 )
  533. message( FATAL_ERROR "wxPython does not appear to be installed on the system." )
  534. endif()
  535. if( NOT WXPYTHON_VERSION_FOUND STREQUAL "True" )
  536. message( FATAL_ERROR
  537. "wxPython version ${_wxpy_version} does not appear to be installed on the system." )
  538. endif()
  539. set( WXPYTHON_VERSION ${_wxpy_version} CACHE STRING "wxPython version found." )
  540. message( STATUS "wxPython version ${_wxpy_version} found." )
  541. endif()
  542. #message( STATUS "PYTHON_INCLUDE_DIRS:${PYTHON_INCLUDE_DIRS}" )
  543. # Infrequently needed headers go at end of search paths, append to INC_AFTER which
  544. # although is used for all components, should be a harmless hit for something like eeschema
  545. # so long as unused search paths are at the end like this.
  546. set( INC_AFTER ${INC_AFTER} ${PYTHON_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/scripting )
  547. #message( STATUS "/ INC_AFTER:${INC_AFTER}" )
  548. endif()
  549. if( EXISTS ${CMAKE_SOURCE_DIR}/include/config.h )
  550. # This file may exist ( created by an alternate process to the svn test above),
  551. # e.g. could be created by a checkout script that produces a source tar file.
  552. # This directive means the about box will have the svn date & revision in it,
  553. # but the hard coded release date ( program version) will be preserved.
  554. add_definitions( -DHAVE_SVN_REVISION )
  555. endif()
  556. if( APPLE )
  557. # Remove app bundles in ${KICAD_BIN} before installing anything new.
  558. # Must be defined before all includes so that it is executed first.
  559. install( CODE "
  560. message( STATUS \"Removing existing application bundles...\" )
  561. # Remove links to standalone apps
  562. file( REMOVE ${KICAD_BIN}/bitmap2component.app )
  563. file( REMOVE ${KICAD_BIN}/eeschema.app )
  564. file( REMOVE ${KICAD_BIN}/gerbview.app )
  565. file( REMOVE ${KICAD_BIN}/pcb_calculator.app )
  566. file( REMOVE ${KICAD_BIN}/pcbnew.app )
  567. file( REMOVE ${KICAD_BIN}/pl_editor.app )
  568. # Remove main bundle
  569. file( REMOVE_RECURSE ${KICAD_BIN}/${OSX_BUNDLE_MAIN} )
  570. " COMPONENT Runtime
  571. )
  572. endif()
  573. #================================================
  574. # Doxygen Output
  575. #================================================
  576. find_package( Doxygen )
  577. if( DOXYGEN_FOUND )
  578. add_custom_target( doxygen-docs
  579. ${CMAKE_COMMAND} -E remove_directory Documentation/doxygen
  580. COMMAND ${DOXYGEN_EXECUTABLE}
  581. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  582. DEPENDS Doxyfile
  583. COMMENT "building doxygen docs into directory Documentation/doxygen/html"
  584. )
  585. add_custom_target( dev-docs
  586. ${CMAKE_COMMAND} -E remove_directory Documentation/development/doxygen
  587. COMMAND ${DOXYGEN_EXECUTABLE}
  588. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Documentation/development
  589. DEPENDS Doxyfile
  590. COMMENT "building developer's resource docs into directory Documentation/development/doxygen/html"
  591. )
  592. else()
  593. message( STATUS "WARNING: Doxygen not found - doxygen-docs (Source Docs) target not created" )
  594. endif()
  595. # Generate config.h.
  596. configure_file( ${PROJECT_SOURCE_DIR}/CMakeModules/config.h.cmake
  597. ${CMAKE_BINARY_DIR}/config.h )
  598. ###
  599. # Generate Map file
  600. ###
  601. if( KICAD_MAKE_LINK_MAPS )
  602. # Currently only works on linux/gcc
  603. if( UNIX AND NOT APPLE )
  604. set( MAKE_LINK_MAPS true )
  605. else()
  606. set( MAKE_LINK_MAPS false )
  607. endif()
  608. endif()
  609. #================================================
  610. # "make uninstall" rules
  611. #================================================
  612. configure_file(
  613. "${CMAKE_MODULE_PATH}/cmake_uninstall.cmake.in"
  614. "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
  615. IMMEDIATE @ONLY )
  616. add_custom_target( uninstall
  617. "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" )
  618. #================================================
  619. # Installation
  620. #================================================
  621. install( FILES INSTALL.txt
  622. DESTINATION ${KICAD_DOCS}
  623. COMPONENT resources )
  624. ###
  625. # Install scripts
  626. ###
  627. if( UNIX )
  628. install( DIRECTORY scripts
  629. DESTINATION ${KICAD_DOCS}
  630. COMPONENT resources
  631. )
  632. endif()
  633. ###
  634. # FreeDesktop .desktop and MIME resources
  635. ###
  636. if( UNIX AND NOT APPLE )
  637. # Set paths
  638. set( UNIX_MIME_DIR resources/linux/mime )
  639. set( UNIX_MIME_FILES ${UNIX_MIME_DIR}/mime )
  640. set( UNIX_ICON_FILES ${UNIX_MIME_DIR}/icons )
  641. set( UNIX_APPLICATIONS_FILES ${UNIX_MIME_DIR}/applications )
  642. set( UNIX_APPDATA_FILES resources/linux/appdata )
  643. # Install Mime directory
  644. install( DIRECTORY ${UNIX_ICON_FILES}
  645. DESTINATION ${CMAKE_INSTALL_PREFIX}/share
  646. COMPONENT resources
  647. )
  648. # Install Icons
  649. install( DIRECTORY ${UNIX_MIME_FILES}
  650. DESTINATION ${CMAKE_INSTALL_PREFIX}/share
  651. COMPONENT resources
  652. )
  653. # Install Applications directory (.desktop files)
  654. install( DIRECTORY ${UNIX_APPLICATIONS_FILES}
  655. DESTINATION ${CMAKE_INSTALL_PREFIX}/share
  656. COMPONENT resources
  657. )
  658. # Install AppStream directory (app store entry)
  659. install( DIRECTORY ${UNIX_APPDATA_FILES}
  660. DESTINATION ${CMAKE_INSTALL_PREFIX}/share
  661. COMPONENT resources
  662. )
  663. endif()
  664. #include( CTest )
  665. if( UNIX AND NOT APPLE )
  666. # Create a *.deb file:
  667. set( CPACK_GENERATOR "DEB" )
  668. set( CPACK_DEBIAN_PACKAGE_MAINTAINER "http://launchpad.net/kicad" )
  669. set( CPACK_PACKAGE_VERSION_MAJOR 1 )
  670. set( CPACK_PACKAGE_VERSION_MINOR 0 )
  671. set( CPACK_PACKAGE_VERSION_PATCH 0 )
  672. #set( CPACK_PACKAGE_CONTACT Firstname Lastname <email@company.com> )
  673. set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "KiCad built by CMake build system." )
  674. include( CPack )
  675. endif()
  676. #================================================
  677. # Let CMake look in these directories for nested
  678. # 'CMakeLists.txt' files to process
  679. #================================================
  680. # Binaries ( CMake targets )
  681. add_subdirectory( bitmaps_png )
  682. add_subdirectory( common )
  683. add_subdirectory( 3d-viewer )
  684. add_subdirectory( cvpcb )
  685. add_subdirectory( eeschema )
  686. add_subdirectory( gerbview )
  687. add_subdirectory( lib_dxf )
  688. add_subdirectory( pcbnew )
  689. add_subdirectory( polygon )
  690. add_subdirectory( pagelayout_editor )
  691. add_subdirectory( potrace )
  692. add_subdirectory( bitmap2component )
  693. add_subdirectory( pcb_calculator )
  694. add_subdirectory( plugins ) # 3D plugins must be built before kicad
  695. add_subdirectory( kicad ) # should follow pcbnew, eeschema
  696. add_subdirectory( tools )
  697. add_subdirectory( utils )
  698. add_subdirectory( qa )
  699. # Resources
  700. if ( KICAD_INSTALL_DEMOS )
  701. add_subdirectory( demos )
  702. endif ( KICAD_INSTALL_DEMOS )
  703. add_subdirectory( template )