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.

250 lines
7.7 KiB

18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
  1. project(kicad)
  2. if(WIN32)
  3. cmake_minimum_required(VERSION 2.6.1 FATAL_ERROR)
  4. else(WIN32)
  5. cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR)
  6. endif(WIN32)
  7. # Path to local CMake modules.
  8. set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
  9. # Command line option to enable or disable building minizip. Minizip
  10. # building is enabled by default. Use -DKICAD_MINZIP=OFF to disable
  11. # building minizip.
  12. option(KICAD_MINIZIP "enable/disable building minizip (default ON)" ON)
  13. # Russian GOST and CYRILLIC patch
  14. option(KICAD_CYRILLIC "enable/disable building using cyrillic (needs unicode) (default OFF)")
  15. option(wxUSE_UNICODE "enable/disable building unicode (default OFF)")
  16. option(KICAD_GOST "enable/disable building using GOST notation for multiple gates per package (default OFF)")
  17. if(APPLE)
  18. option(KICAD_AUIMANAGER "Enable use of wxAuiManager (default ON)" ON)
  19. option(KICAD_AUITOOLBAR "Enable use of wxAuiToolBar (default ON)" ON)
  20. else(APPLE)
  21. option(KICAD_AUIMANAGER "Enable use of wxAuiManager (default OFF)" OFF)
  22. option(KICAD_AUITOOLBAR "Enable use of wxAuiToolBar (default OFF)" OFF)
  23. endif(APPLE)
  24. # Comment this out if you don't want to build with Python support.
  25. # OPTION(KICAD_PYTHON "enable/disable building with Python support (default OFF)")
  26. #================================================
  27. # Set flags for GCC.
  28. #================================================
  29. if(CMAKE_COMPILER_IS_GNUCXX)
  30. # Set default flags for Release build.
  31. set(CMAKE_C_FLAGS_RELEASE "-Wall -O2 -DNDEBUG")
  32. set(CMAKE_CXX_FLAGS_RELEASE "-Wall -O2 -DNDEBUG")
  33. set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s")
  34. # Set default flags for Debug build.
  35. set(CMAKE_C_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG")
  36. set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG")
  37. endif(CMAKE_COMPILER_IS_GNUCXX)
  38. if(KICAD_CYRILLIC)
  39. add_definitions(-DKICAD_CYRILLIC)
  40. endif(KICAD_CYRILLIC)
  41. if(wxUSE_UNICODE)
  42. add_definitions(-DwxUSE_UNICODE)
  43. endif(wxUSE_UNICODE)
  44. if(KICAD_GOST)
  45. add_definitions(-DKICAD_GOST)
  46. endif(KICAD_GOST)
  47. # Locations for install targets.
  48. set(KICAD_BIN bin
  49. CACHE PATH "Location of KiCad binaries.")
  50. if(UNIX)
  51. # Everything without leading / is relative to CMAKE_INSTALL_PREFIX.
  52. set(KICAD_PLUGINS lib/kicad/plugins
  53. CACHE PATH "Location of KiCad plugins.")
  54. set(KICAD_DATA share/kicad
  55. CACHE PATH "Location of KiCad data files.")
  56. set(KICAD_DOCS share/doc/kicad
  57. CACHE PATH "Location of KiCad documentation files.")
  58. endif(UNIX)
  59. if(WIN32)
  60. # Like all variables, CMAKE_INSTALL_PREFIX can be over-ridden on the command line.
  61. set(CMAKE_INSTALL_PREFIX c:/kicad
  62. CACHE PATH "")
  63. # Everything without leading / is relative to CMAKE_INSTALL_PREFIX.
  64. set(KICAD_PLUGINS ${KICAD_BIN}/plugins
  65. CACHE PATH "Location of KiCad plugins.")
  66. set(KICAD_DATA share
  67. CACHE PATH "Location of KiCad data files.")
  68. set(KICAD_DOCS doc
  69. CACHE PATH "Location of KiCad documentation files.")
  70. endif(WIN32)
  71. set(KICAD_DEMOS ${KICAD_DATA}/demos
  72. CACHE PATH "Location of KiCad demo files.")
  73. set(KICAD_INTERNAT ${KICAD_DATA}/internat
  74. CACHE PATH "Location of KiCad i18n files.")
  75. set(KICAD_TEMPLATE ${KICAD_DATA}/template
  76. CACHE PATH "Location of KiCad template files.")
  77. mark_as_advanced(KICAD_BIN
  78. KICAD_PLUGINS
  79. KICAD_DATA
  80. KICAD_DOCS
  81. KICAD_DEMOS
  82. KICAD_INTERNAT
  83. KICAD_TEMPLATE)
  84. #================================================
  85. # Find libraries that are needed to build KiCad.
  86. #================================================
  87. include(CheckFindPackageResult)
  88. #######################
  89. # Find OpenGL library #
  90. #######################
  91. find_package(OpenGL QUIET)
  92. check_find_package_result(OPENGL_FOUND "OpenGL")
  93. ######################
  94. # Find Boost library #
  95. ######################
  96. # kicad now includes needed boost files.
  97. # the two next lines can be uncommented to use the native boost lib.
  98. # but this is not a good idea
  99. #find_package(Boost 1.36 QUIET)
  100. #check_find_package_result(Boost_FOUND "Boost")
  101. ##########################
  102. # Find wxWidgets library #
  103. ##########################
  104. # Here you can define what libraries of wxWidgets you need for your
  105. # application. You can figure out what libraries you need here;
  106. # http://www.wxwidgets.org/manuals/2.8/wx_librarieslist.html
  107. if( KICAD_AUIMANAGER OR KICAD_AUITOOLBAR )
  108. find_package(wxWidgets COMPONENTS gl html adv core net base aui QUIET)
  109. else( KICAD_AUIMANAGER OR KICAD_AUITOOLBAR )
  110. find_package(wxWidgets COMPONENTS gl html adv core net base QUIET)
  111. endif( KICAD_AUIMANAGER OR KICAD_AUITOOLBAR )
  112. check_find_package_result(wxWidgets_FOUND "wxWidgets")
  113. # Include wxWidgets macros.
  114. include(${wxWidgets_USE_FILE})
  115. # Include MinGW resource compiler.
  116. include(MinGWResourceCompiler)
  117. # Generate build system specific header file.
  118. include(PerformFeatureChecks)
  119. perform_feature_checks()
  120. # Automagically create version header file.
  121. include(CreateSVNVersionHeader)
  122. create_svn_version_header()
  123. if(EXISTS ${CMAKE_SOURCE_DIR}/include/config.h)
  124. # This file may exist (created by an alternate process to the svn test above),
  125. # e.g. could be created by a checkout script that produces a source tar file.
  126. # This directive means the about box will have the svn date & revision in it,
  127. # but the hard coded release date (program version) will be preserved.
  128. add_definitions(-DHAVE_SVN_REVISION)
  129. endif(EXISTS ${CMAKE_SOURCE_DIR}/include/config.h)
  130. # Include paths.
  131. include_directories(${CMAKE_SOURCE_DIR}/include
  132. ${CMAKE_SOURCE_DIR}/share
  133. ${CMAKE_BINARY_DIR})
  134. #================================================
  135. # Let CMake look in these directories for nested
  136. # 'CMakeLists.txt' files to process
  137. #================================================
  138. ############
  139. # Binaries #
  140. ############
  141. add_subdirectory(3d-viewer)
  142. add_subdirectory(bitmaps)
  143. add_subdirectory(common)
  144. add_subdirectory(cvpcb)
  145. add_subdirectory(eeschema)
  146. add_subdirectory(gerbview)
  147. add_subdirectory(kicad)
  148. add_subdirectory(pcbnew)
  149. add_subdirectory(polygon)
  150. add_subdirectory(polygon/kbool/src)
  151. #############
  152. # Resources #
  153. #############
  154. add_subdirectory(demos)
  155. add_subdirectory(internat)
  156. add_subdirectory(template)
  157. #================================================
  158. # Installation parameters
  159. #================================================
  160. install(FILES INSTALL.txt
  161. DESTINATION ${KICAD_DOCS}
  162. COMPONENT resources)
  163. install(FILES resources/freeroute.jnlp
  164. DESTINATION ${KICAD_BIN}
  165. COMPONENT resources)
  166. ###
  167. # Install scripts
  168. ###
  169. if(UNIX)
  170. install(DIRECTORY scripts
  171. DESTINATION ${KICAD_DOCS}
  172. COMPONENT resources
  173. PATTERN ".svn" EXCLUDE)
  174. endif(UNIX)
  175. ###
  176. # FreeDesktop .desktop and MIME resources
  177. ###
  178. if(UNIX)
  179. # Set paths
  180. set(UNIX_MIME_DIR resources/linux/mime)
  181. set(UNIX_MIMELNK_FILES ${UNIX_MIME_DIR}/mimelnk)
  182. set(UNIX_MIME_FILES ${UNIX_MIME_DIR}/mime)
  183. set(UNIX_ICONS_FILES ${UNIX_MIME_DIR}/icons)
  184. set(UNIX_APPLICATIONS_FILES ${UNIX_MIME_DIR}/applications)
  185. # Install Mimelnk directory
  186. install(DIRECTORY ${UNIX_MIMELNK_FILES}
  187. DESTINATION ${CMAKE_INSTALL_PREFIX}/share
  188. COMPONENT resources
  189. PATTERN ".svn" EXCLUDE)
  190. # Install Mime directory
  191. install(DIRECTORY ${UNIX_ICONS_FILES}
  192. DESTINATION ${CMAKE_INSTALL_PREFIX}/share
  193. COMPONENT resources
  194. PATTERN ".svn" EXCLUDE)
  195. # Install Icons
  196. install(DIRECTORY ${UNIX_MIME_FILES}
  197. DESTINATION ${CMAKE_INSTALL_PREFIX}/share
  198. COMPONENT resources
  199. PATTERN ".svn" EXCLUDE)
  200. # Install Applications directory (.desktop files)
  201. install(DIRECTORY ${UNIX_APPLICATIONS_FILES}
  202. DESTINATION ${CMAKE_INSTALL_PREFIX}/share
  203. COMPONENT resources
  204. PATTERN ".svn" EXCLUDE)
  205. endif(UNIX)