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.

629 lines
18 KiB

16 years ago
16 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
16 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
16 years ago
12 years ago
12 years ago
16 years ago
16 years ago
16 years ago
15 years ago
16 years ago
16 years ago
16 years ago
16 years ago
16 years ago
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
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
16 years ago
18 years ago
18 years ago
16 years ago
16 years ago
  1. set( MAKE_LINK_MAPS false )
  2. add_definitions( -DPCBNEW )
  3. add_subdirectory(router)
  4. if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
  5. file( MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/scripting )
  6. find_package( SWIG REQUIRED )
  7. include( ${SWIG_USE_FILE} )
  8. # Infrequently needed headers go at end of search paths, append to INC_AFTER
  9. set( INC_AFTER ${INC_AFTER} ${CMAKE_CURRENT_SOURCE_DIR}/scripting )
  10. #message( STATUS "pcbnew INC_AFTER:${INC_AFTER}" )
  11. endif()
  12. ###
  13. # Includes
  14. ###
  15. include_directories( BEFORE ${INC_BEFORE} )
  16. include_directories(
  17. ./dialogs
  18. ./autorouter
  19. ../3d-viewer
  20. ../common
  21. ../polygon
  22. ../common/dialogs
  23. ../lib_dxf
  24. ./import_dxf
  25. ${INC_AFTER}
  26. )
  27. ###
  28. # Sources
  29. #
  30. set( PCBNEW_DIALOGS
  31. dialogs/dialog_block_options_base.cpp
  32. dialogs/dialog_cleaning_options_base.cpp
  33. dialogs/dialog_cleaning_options.cpp
  34. dialogs/dialog_copper_zones.cpp
  35. dialogs/dialog_copper_zones_base.cpp
  36. dialogs/dialog_design_rules.cpp
  37. dialogs/dialog_design_rules_base.cpp
  38. dialogs/dialog_dimension_editor_base.cpp
  39. dialogs/dialog_display_options.cpp
  40. dialogs/dialog_display_options_base.cpp
  41. dialogs/dialog_drc_base.cpp
  42. dialogs/dialog_drc.cpp
  43. dialogs/dialog_edit_module_for_BoardEditor.cpp
  44. dialogs/dialog_edit_module_for_BoardEditor_base.cpp
  45. dialogs/dialog_edit_module_for_Modedit_base.cpp
  46. dialogs/dialog_edit_module_for_Modedit.cpp
  47. dialogs/dialog_edit_module_text.cpp
  48. dialogs/dialog_edit_module_text_base.cpp
  49. dialogs/dialog_exchange_modules_base.cpp
  50. dialogs/dialog_export_idf.cpp
  51. dialogs/dialog_export_idf_base.cpp
  52. dialogs/dialog_export_vrml_base.cpp
  53. dialogs/dialog_export_vrml.cpp
  54. dialogs/dialog_find_base.cpp
  55. dialogs/dialog_find.cpp
  56. dialogs/dialog_fp_lib_table_base.cpp
  57. dialogs/dialog_fp_lib_table.cpp
  58. dialogs/dialog_fp_plugin_options_base.cpp
  59. dialogs/dialog_fp_plugin_options.cpp
  60. dialogs/dialog_freeroute_exchange.cpp
  61. dialogs/dialog_freeroute_exchange_base.cpp
  62. dialogs/dialog_gendrill.cpp
  63. dialogs/dialog_gendrill_base.cpp
  64. dialogs/dialog_gen_module_position_file_base.cpp
  65. dialogs/dialog_general_options.cpp
  66. dialogs/dialog_general_options_BoardEditor_base.cpp
  67. dialogs/dialog_global_edit_tracks_and_vias.cpp
  68. dialogs/dialog_global_edit_tracks_and_vias_base.cpp
  69. dialogs/dialog_global_modules_fields_edition.cpp
  70. dialogs/dialog_global_modules_fields_edition_base.cpp
  71. dialogs/dialog_global_pads_edition_base.cpp
  72. dialogs/dialog_graphic_items_options.cpp
  73. dialogs/dialog_graphic_items_options_base.cpp
  74. dialogs/dialog_graphic_item_properties.cpp
  75. dialogs/dialog_graphic_item_properties_base.cpp
  76. dialogs/dialog_graphic_item_properties_for_Modedit.cpp
  77. dialogs/dialog_global_deletion.cpp
  78. dialogs/dialog_global_deletion_base.cpp
  79. dialogs/dialog_keepout_area_properties.cpp
  80. dialogs/dialog_keepout_area_properties_base.cpp
  81. dialogs/dialog_layer_selection_base.cpp
  82. dialogs/dialog_layers_setup.cpp
  83. dialogs/dialog_layers_setup_base.cpp
  84. dialogs/dialog_netlist.cpp
  85. dialogs/dialog_netlist_fbp.cpp
  86. dialogs/dialog_pcb_text_properties.cpp
  87. dialogs/dialog_pcb_text_properties_base.cpp
  88. dialogs/dialog_non_copper_zones_properties_base.cpp
  89. dialogs/dialog_pad_properties.cpp
  90. dialogs/dialog_pad_properties_base.cpp
  91. dialogs/dialog_pcbnew_config_libs_and_paths.cpp
  92. dialogs/dialog_pcbnew_config_libs_and_paths_fbp.cpp
  93. dialogs/dialog_plot_base.cpp
  94. dialogs/dialog_plot.cpp
  95. dialogs/dialog_print_for_modedit.cpp
  96. dialogs/dialog_print_for_modedit_base.cpp
  97. dialogs/dialog_print_using_printer.cpp
  98. dialogs/dialog_print_using_printer_base.cpp
  99. dialogs/dialog_orient_footprints.cpp
  100. dialogs/dialog_orient_footprints_base.cpp
  101. dialogs/dialog_mask_clearance.cpp
  102. dialogs/dialog_mask_clearance_base.cpp
  103. dialogs/dialog_SVG_print.cpp
  104. dialogs/dialog_SVG_print_base.cpp
  105. dialogs/dialog_set_grid.cpp
  106. dialogs/dialog_set_grid_base.cpp
  107. dialogs/dialog_target_properties_base.cpp
  108. footprint_wizard.cpp
  109. footprint_wizard_frame.cpp
  110. dialogs/dialog_footprint_wizard_list_base.cpp
  111. dialogs/dialog_footprint_wizard_list.cpp
  112. )
  113. set( PCBNEW_IMPORT_DXF
  114. import_dxf/dialog_dxf_import_base.cpp
  115. import_dxf/dialog_dxf_import.cpp
  116. import_dxf/dxf2brd_items.cpp
  117. )
  118. set( PCBNEW_AUTOROUTER_SRCS
  119. autorouter/rect_placement/rect_placement.cpp
  120. autorouter/move_and_route_event_functions.cpp
  121. autorouter/auto_place_footprints.cpp
  122. autorouter/autorout.cpp
  123. autorouter/routing_matrix.cpp
  124. autorouter/dist.cpp
  125. autorouter/queue.cpp
  126. autorouter/spread_footprints.cpp
  127. autorouter/solve.cpp
  128. autorouter/graphpcb.cpp
  129. autorouter/work.cpp
  130. )
  131. set( PCBNEW_CLASS_SRCS
  132. tool_modview.cpp
  133. modview_frame.cpp
  134. pcbframe.cpp
  135. attribut.cpp
  136. board_items_to_polygon_shape_transform.cpp
  137. board_undo_redo.cpp
  138. block.cpp
  139. block_module_editor.cpp
  140. build_BOM_from_board.cpp
  141. class_pcb_layer_widget.cpp
  142. class_pcb_layer_box_selector.cpp
  143. clean.cpp
  144. connect.cpp
  145. controle.cpp
  146. dimension.cpp
  147. cross-probing.cpp
  148. deltrack.cpp
  149. ${PCBNEW_DIALOGS}
  150. ${PCBNEW_IMPORT_DXF}
  151. dragsegm.cpp
  152. drc.cpp
  153. drc_clearance_test_functions.cpp
  154. drc_marker_functions.cpp
  155. edgemod.cpp
  156. edit.cpp
  157. editedge.cpp
  158. editmod.cpp
  159. editrack.cpp
  160. editrack-part2.cpp
  161. edit_pcb_text.cpp
  162. edit_track_width.cpp
  163. edtxtmod.cpp
  164. event_handlers_tracks_vias_sizes.cpp
  165. export_d356.cpp
  166. export_gencad.cpp
  167. export_idf.cpp
  168. export_vrml.cpp
  169. vrml_board.cpp
  170. files.cpp
  171. gen_drill_report_files.cpp
  172. gen_modules_placefile.cpp
  173. gendrill_Excellon_writer.cpp
  174. globaleditpad.cpp
  175. highlight.cpp
  176. hotkeys.cpp
  177. hotkeys_board_editor.cpp
  178. hotkeys_module_editor.cpp
  179. idf.cpp
  180. initpcb.cpp
  181. layer_widget.cpp
  182. librairi.cpp
  183. loadcmp.cpp
  184. magnetic_tracks_functions.cpp
  185. menubar_modedit.cpp
  186. menubar_pcbframe.cpp
  187. minimun_spanning_tree.cpp
  188. modedit.cpp
  189. modedit_onclick.cpp
  190. modeditoptions.cpp
  191. modedit_undo_redo.cpp
  192. moduleframe.cpp
  193. modules.cpp
  194. move-drag_pads.cpp
  195. move_or_drag_track.cpp
  196. muonde.cpp
  197. muwave_command.cpp
  198. netlist.cpp
  199. onleftclick.cpp
  200. onrightclick.cpp
  201. pad_edition_functions.cpp
  202. pcbnew.cpp
  203. pcbnew_config.cpp
  204. pcbplot.cpp
  205. plot_board_layers.cpp
  206. plot_brditems_plotter.cpp
  207. print_board_functions.cpp
  208. printout_controler.cpp
  209. ratsnest.cpp
  210. ratsnest_data.cpp
  211. ratsnest_viewitem.cpp
  212. # specctra.cpp #moved in pcbcommon lib
  213. # specctra_export.cpp
  214. # specctra_keywords.cpp
  215. specctra_import.cpp
  216. swap_layers.cpp
  217. target_edit.cpp
  218. tool_modedit.cpp
  219. tool_onrightclick.cpp
  220. tool_pcb.cpp
  221. toolbars_update_user_interface.cpp
  222. tracepcb.cpp
  223. tr_modif.cpp
  224. xchgmod.cpp
  225. zones_convert_brd_items_to_polygons_with_Boost.cpp
  226. zones_convert_to_polygons_aux_functions.cpp
  227. zones_by_polygon.cpp
  228. zones_by_polygon_fill_functions.cpp
  229. zone_filling_algorithm.cpp
  230. zones_functions_for_undo_redo.cpp
  231. zones_non_copper_type_functions.cpp
  232. zones_polygons_insulated_copper_islands.cpp
  233. zones_polygons_test_connections.cpp
  234. zones_test_and_combine_areas.cpp
  235. class_footprint_wizard.cpp
  236. tools/selection_tool.cpp
  237. tools/selection_area.cpp
  238. tools/bright_box.cpp
  239. tools/move_tool.cpp
  240. tools/pcb_tools.cpp
  241. tools/common_actions.cpp
  242. )
  243. set( PCBNEW_SRCS ${PCBNEW_AUTOROUTER_SRCS} ${PCBNEW_CLASS_SRCS} ${PCBNEW_DIALOGS} )
  244. ###
  245. # We need some extra sources from common
  246. ###
  247. set( PCBNEW_COMMON_SRCS
  248. ../common/dialogs/dialog_page_settings.cpp
  249. ../common/base_units.cpp
  250. )
  251. ##
  252. # Scripting sources
  253. ##
  254. set( PCBNEW_SCRIPTING_DIALOGS
  255. dialogs/dialog_scripting_base.cpp
  256. dialogs/dialog_scripting.cpp
  257. )
  258. set( PCBNEW_SCRIPTING_PYTHON_HELPERS
  259. ../scripting/wx_python_helpers.cpp
  260. ../scripting/python_scripting.cpp
  261. scripting/pcbnew_scripting_helpers.cpp
  262. scripting/pcbnew_footprint_wizards.cpp
  263. )
  264. if( KICAD_SCRIPTING )
  265. set( PCBNEW_SCRIPTING_SRCS
  266. ${PCBNEW_SCRIPTING_DIALOGS}
  267. pcbnew_wrap.cxx
  268. ${PCBNEW_SCRIPTING_PYTHON_HELPERS}
  269. )
  270. endif()
  271. ##
  272. # Scripting build
  273. ##
  274. if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
  275. set( SWIG_FLAGS
  276. -I${CMAKE_CURRENT_SOURCE_DIR}/../..
  277. -I${CMAKE_CURRENT_SOURCE_DIR}
  278. -I${CMAKE_CURRENT_SOURCE_DIR}/../include
  279. -I${CMAKE_CURRENT_SOURCE_DIR}/../scripting
  280. )
  281. if( DEBUG )
  282. set( SWIG_FLAGS ${SWIG_FLAGS} -DDEBUG )
  283. endif()
  284. # collect CFLAGS , and pass them to swig later
  285. get_directory_property( DirDefs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS )
  286. foreach( d ${DirDefs} )
  287. set( SWIG_FLAGS ${SWIG_FLAGS} -D${d} )
  288. endforeach()
  289. endif()
  290. if( KICAD_SCRIPTING )
  291. set( SWIG_OPTS -python -c++ -outdir ${CMAKE_CURRENT_BINARY_DIR} ${SWIG_FLAGS} )
  292. if( EXISTS ${CMAKE_CURRENT_BINARY_DIR}/doxygen-xml )
  293. set( SWIG_OPTS ${SWIG_OPTS} -DENABLE_DOCSTRINGS_FROM_DOXYGEN )
  294. set( SWIG_OPTS ${SWIG_OPTS} -I${CMAKE_CURRENT_BINARY_DIR}/docstrings )
  295. endif()
  296. add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pcbnew_wrap.cxx
  297. OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py
  298. DEPENDS pcbcommon
  299. DEPENDS scripting/pcbnew.i
  300. DEPENDS scripting/board.i
  301. DEPENDS scripting/board_item.i
  302. DEPENDS scripting/module.i
  303. DEPENDS scripting/plugins.i
  304. DEPENDS scripting/units.i
  305. DEPENDS ../scripting/dlist.i
  306. DEPENDS ../scripting/kicad.i
  307. DEPENDS ../scripting/wx.i
  308. DEPENDS ../scripting/kicadplugins.i
  309. COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/docstrings
  310. COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/docstrings/docstrings.i # this makes docstrings.i available if it doesn't exist
  311. COMMAND ${SWIG_EXECUTABLE} ${SWIG_OPTS} -o ${CMAKE_CURRENT_BINARY_DIR}/pcbnew_wrap.cxx scripting/pcbnew.i
  312. COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripting/build_tools/fix_swig_imports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py
  313. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  314. )
  315. endif()
  316. ###
  317. # _pcbnew DLL/DSO file creation
  318. ###
  319. if( BUILD_GITHUB_PLUGIN )
  320. set( GITHUB_PLUGIN_LIBRARIES github_plugin )
  321. endif()
  322. if( ( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES ) AND NOT WIN32 AND NOT APPLE )
  323. list( APPEND PCBNEW_EXTRA_LIBS rt )
  324. endif()
  325. if( KICAD_SCRIPTING_MODULES )
  326. #message( "building pcbnew scripting" )
  327. set( CMAKE_SWIG_FLAGS ${SWIG_FLAGS} )
  328. set_source_files_properties( scripting/pcbnew.i PROPERTIES CPLUSPLUS ON )
  329. swig_add_module( pcbnew python scripting/pcbnew.i ${PCBNEW_SCRIPTING_PYTHON_HELPERS} ${PCBNEW_SRCS} ${PCBNEW_COMMON_SRCS} )
  330. swig_link_libraries( pcbnew
  331. 3d-viewer
  332. pcbcommon
  333. pnsrouter
  334. common
  335. pcad2kicadpcb
  336. lib_dxf
  337. ${GITHUB_PLUGIN_LIBRARIES}
  338. polygon
  339. bitmaps
  340. gal
  341. ${GLEW_LIBRARIES}
  342. ${CAIRO_LIBRARIES}
  343. ${PIXMAN_LIBRARY}
  344. ${wxWidgets_LIBRARIES}
  345. ${OPENGL_LIBRARIES}
  346. ${GDI_PLUS_LIBRARIES}
  347. ${PYTHON_LIBRARIES}
  348. ${PCBNEW_EXTRA_LIBS}
  349. ${Boost_LIBRARIES} # must follow GITHUB
  350. )
  351. # create .i files from XML doxygen parsing, docstrings.i will include all of them
  352. add_custom_target( qa
  353. COMMAND PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR} ${PYTHON_EXECUTABLE} test.py
  354. COMMENT "running qa"
  355. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/scripting/qa
  356. )
  357. if( MAKE_LINK_MAPS )
  358. # generate a link map with cross reference
  359. set_target_properties( _pcbnew PROPERTIES LINK_FLAGS "-Wl,-cref -Wl,-Map=_pcbnew.map" )
  360. endif()
  361. endif()
  362. ###
  363. # Doxygen python documentation
  364. ###
  365. find_package( Doxygen )
  366. if( DOXYGEN_FOUND )
  367. if( KICAD_SCRIPTING )
  368. # create XML files from doxygen parsing
  369. add_custom_target( doxygen-python-xml
  370. ${CMAKE_COMMAND} -E remove_directory doxygen-python-xml
  371. COMMAND SOURCES_DIR=${CMAKE_SOURCE_DIR} ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile_xml
  372. WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
  373. DEPENDS Doxyfile_xml
  374. COMMENT "building doxygen docs into directory doxygen-python/html"
  375. )
  376. # create .i files from XML doxygen parsing, docstrings.i will include all of them
  377. add_custom_target( xml-to-docstrings
  378. COMMAND ${CMAKE_COMMAND} -E remove_directory docstrings
  379. COMMAND ${CMAKE_COMMAND} -E make_directory docstrings
  380. COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripting/build_tools/extract_docstrings.py pcbnew.py doxygen-xml/xml docstrings
  381. COMMAND ${CMAKE_COMMAND} -E remove pcbnew.py # force removal so it will be recreated later with the new docstrings
  382. COMMENT "building docstring files"
  383. WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
  384. DEPENDS pcbnew.py
  385. DEPENDS doxygen-python-xml
  386. )
  387. # create doxygen-python html
  388. add_custom_target( doxygen-python
  389. ${CMAKE_COMMAND} -E remove_directory doxygen-python
  390. COMMAND PYTHON_SOURCES_TO_DOC=${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile_python
  391. WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
  392. DEPENDS Doxyfile_python
  393. DEPENDS xml-to-docstrings
  394. DEPENDS pcbnew.py
  395. COMMENT "building doxygen docs into directory doxygen-python/html"
  396. )
  397. endif()
  398. else()
  399. message( STATUS "WARNING: Doxygen not found - doxygen-docs (Source Docs) target not created" )
  400. endif()
  401. ###
  402. # Windows resource file
  403. ###
  404. if( WIN32 )
  405. if( MINGW )
  406. # PCBNEW_RESOURCES variable is set by the macro.
  407. mingw_resource_compiler( pcbnew )
  408. else()
  409. set( PCBNEW_RESOURCES pcbnew.rc )
  410. endif()
  411. endif()
  412. ###
  413. # Set properties for APPLE on pcbnew target
  414. ###
  415. if( APPLE )
  416. set( PCBNEW_RESOURCES pcbnew.icns pcbnew_doc.icns )
  417. set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pcbnew.icns"
  418. PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
  419. set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pcbnew_doc.icns"
  420. PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
  421. set( MACOSX_BUNDLE_ICON_FILE pcbnew.icns )
  422. set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.pcbnew )
  423. set( MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist )
  424. endif()
  425. # Create a C++ compilable string initializer containing html text into a *.h file:
  426. add_custom_command(
  427. OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_freeroute_exchange_help_html.h
  428. COMMAND ${CMAKE_COMMAND}
  429. -DinputFile=${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_freeroute_exchange_help.html
  430. -DoutputFile=${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_freeroute_exchange_help_html.h
  431. -P ${CMAKE_MODULE_PATH}/Html2C.cmake
  432. DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_freeroute_exchange_help.html
  433. COMMENT "creating ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_freeroute_exchange_help_html.h
  434. from ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_freeroute_exchange_help.html"
  435. )
  436. set_source_files_properties( dialogs/dialog_freeroute_exchange.cpp
  437. PROPERTIES
  438. OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_freeroute_exchange_help_html.h
  439. )
  440. # auto-generate specctra_lexer.h and specctra_keywords.cpp
  441. make_lexer(
  442. ${CMAKE_CURRENT_SOURCE_DIR}/specctra.keywords
  443. ${CMAKE_CURRENT_SOURCE_DIR}/specctra_lexer.h
  444. ${CMAKE_CURRENT_SOURCE_DIR}/specctra_keywords.cpp
  445. DSN
  446. # Pass header file with dependency on *_lexer.h as extra_arg
  447. specctra.h
  448. )
  449. ###
  450. # subcomponents of pcbnew
  451. ###
  452. add_subdirectory( pcad2kicadpcb_plugin )
  453. if( BUILD_GITHUB_PLUGIN )
  454. add_subdirectory( github )
  455. endif()
  456. ###
  457. # Create the pcbnew executable
  458. ###
  459. add_executable( pcbnew WIN32 MACOSX_BUNDLE
  460. ${PCBNEW_SRCS}
  461. ${PCBNEW_COMMON_SRCS}
  462. ${PCBNEW_SCRIPTING_SRCS}
  463. ${PCBNEW_RESOURCES}
  464. )
  465. ###
  466. # Set properties for APPLE on pcbnew target
  467. ###
  468. if( APPLE )
  469. set_target_properties( pcbnew PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist )
  470. endif()
  471. ###
  472. # Link executable target pcbnew with correct libraries
  473. ###
  474. target_link_libraries( pcbnew
  475. 3d-viewer
  476. pcbcommon
  477. pnsrouter
  478. common
  479. pcad2kicadpcb
  480. polygon
  481. bitmaps
  482. gal
  483. lib_dxf
  484. ${GITHUB_PLUGIN_LIBRARIES}
  485. ${wxWidgets_LIBRARIES}
  486. ${OPENGL_LIBRARIES}
  487. ${GDI_PLUS_LIBRARIES}
  488. ${PYTHON_LIBRARIES}
  489. ${PCBNEW_EXTRA_LIBS}
  490. ${GLEW_LIBRARIES}
  491. ${CAIRO_LIBRARIES}
  492. ${PIXMAN_LIBRARY}
  493. ${Boost_LIBRARIES} # must follow GITHUB
  494. )
  495. # Only for win32 cross compilation using MXE
  496. if( WIN32 AND MSYS AND CMAKE_CROSSCOMPILING )
  497. target_link_libraries( pcbnew
  498. opengl32
  499. glu32
  500. pixman-1
  501. fontconfig
  502. freetype
  503. bz2
  504. )
  505. endif()
  506. if( MAKE_LINK_MAPS )
  507. # generate a link map with cross reference
  508. set_target_properties( pcbnew PROPERTIES LINK_FLAGS "-Wl,-cref -Wl,-Map=pcbnew.map" )
  509. endif()
  510. ###
  511. # Add pcbnew as install target
  512. ###
  513. install( TARGETS pcbnew
  514. DESTINATION ${KICAD_BIN}
  515. COMPONENT binary )
  516. if( KICAD_SCRIPTING )
  517. add_custom_target( FixSwigImportsScripting ALL
  518. COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripting/build_tools/fix_swig_imports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py
  519. DEPENDS pcbnew
  520. COMMENT "Fixing swig_import_helper in Kicad scripting"
  521. )
  522. install( FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py DESTINATION ${PYTHON_DEST} )
  523. endif()
  524. if( KICAD_SCRIPTING_MODULES )
  525. add_custom_target( FixSwigImportsModuleScripting ALL
  526. COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripting/build_tools/fix_swig_imports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py
  527. DEPENDS _pcbnew
  528. COMMENT "Fixing swig_import_helper in Kicad scripting modules"
  529. )
  530. install( FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py DESTINATION ${PYTHON_DEST} )
  531. if( WIN32 )
  532. install( FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.pyd DESTINATION ${PYTHON_DEST} )
  533. else()
  534. install( FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.so DESTINATION ${PYTHON_DEST} )
  535. endif()
  536. endif()
  537. # This one gets made only when testing.
  538. add_executable( specctra_test EXCLUDE_FROM_ALL specctra_test.cpp specctra.cpp )
  539. target_link_libraries( specctra_test common ${wxWidgets_LIBRARIES} )
  540. # This one gets made only when testing.
  541. add_executable( layer_widget_test WIN32 EXCLUDE_FROM_ALL
  542. layer_widget.cpp
  543. )
  544. target_link_libraries( layer_widget_test common ${wxWidgets_LIBRARIES} )