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.

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