forked from KiCad/kicad-source-mirror
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
179 lines (157 loc) · 5.24 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# Add all the warnings to the files
if( COMPILER_SUPPORTS_WARNINGS )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARN_FLAGS_CXX}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARN_FLAGS_C}")
endif()
add_compile_definitions( PL_EDITOR )
include_directories(BEFORE ${INC_BEFORE})
include_directories(
dialogs
${CMAKE_SOURCE_DIR}/common/dialogs
${INC_AFTER}
)
set( DIALOGS_SRCS
dialogs/properties_frame.cpp
dialogs/properties_frame_base.cpp
dialogs/dialogs_for_printing.cpp
dialogs/dialog_new_dataitem_base.cpp
dialogs/dialog_design_inspector_base.cpp
dialogs/design_inspector.cpp
dialogs/panel_pl_editor_color_settings.cpp
dialogs/panel_pl_editor_color_settings_base.cpp
dialogs/panel_pl_editor_display_options.cpp
)
set( PL_EDITOR_SRCS
pl_editor_layout.cpp
files.cpp
pl_editor_frame.cpp
pl_editor_settings.cpp
pl_draw_panel_gal.cpp
pl_editor_undo_redo.cpp
menubar.cpp
toolbars_pl_editor.cpp
tools/pl_actions.cpp
tools/pl_selection.cpp
tools/pl_selection_tool.cpp
tools/pl_drawing_tools.cpp
tools/pl_edit_tool.cpp
tools/pl_editor_control.cpp
tools/pl_point_editor.cpp
)
set( PL_EDITOR_EXTRA_SRCS
)
if( WIN32 )
if( MINGW )
# PL_EDITOR_RESOURCES variable is set by the macro.
mingw_resource_compiler( pl_editor )
else()
set( PL_EDITOR_RESOURCES ${CMAKE_SOURCE_DIR}/resources/msw/pl_editor.rc )
endif()
endif()
if( APPLE )
# setup bundle
set( PL_EDITOR_RESOURCES pagelayout_editor.icns pagelayout_editor_doc.icns )
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pagelayout_editor.icns" PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pagelayout_editor_doc.icns" PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
set( MACOSX_BUNDLE_ICON_FILE pagelayout_editor.icns )
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad.kicad )
set( MACOSX_BUNDLE_NAME pl_editor )
endif()
# a very small program launcher for pl_editor_kiface
add_executable( pl_editor WIN32 MACOSX_BUNDLE
${CMAKE_SOURCE_DIR}/common/single_top.cpp
${CMAKE_SOURCE_DIR}/common/pgm_base.cpp
${PL_EDITOR_RESOURCES}
)
set_source_files_properties( ${CMAKE_SOURCE_DIR}/common/single_top.cpp PROPERTIES
COMPILE_DEFINITIONS "TOP_FRAME=FRAME_PL_EDITOR;PGM_DATA_FILE_EXT=\"kicad_wks\";BUILD_KIWAY_DLL"
)
target_link_libraries( pl_editor
#singletop # replaces common, giving us restrictive control and link warnings.
# There's way too much crap coming in from common yet.
gal
common
core
${wxWidgets_LIBRARIES}
)
target_link_options( pl_editor PRIVATE
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,--cref,-Map=pl_editor.map>
)
# the main pl_editor program, in DSO form.
add_library( pl_editor_kiface MODULE
pl_editor.cpp
${PL_EDITOR_SRCS}
${DIALOGS_SRCS}
${PL_EDITOR_EXTRA_SRCS}
)
target_link_libraries( pl_editor_kiface
gal
common
core
${wxWidgets_LIBRARIES}
)
set_target_properties( pl_editor_kiface PROPERTIES
OUTPUT_NAME pl_editor
PREFIX ${KIFACE_PREFIX}
SUFFIX ${KIFACE_SUFFIX}
)
target_include_directories( pl_editor_kiface PRIVATE
$<TARGET_PROPERTY:thread-pool,INTERFACE_INCLUDE_DIRECTORIES>
)
set_source_files_properties( pl_editor.cpp PROPERTIES
# The KIFACE is in pcbnew.cpp, export it:
COMPILE_DEFINITIONS "BUILD_KIWAY_DLL;COMPILING_DLL"
)
target_link_options( pl_editor_kiface PRIVATE
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,--cref,-Map=_pl_editor.kiface.map>
)
# if building pl_editor, then also build pl_editor_kiface if out of date.
add_dependencies( pl_editor pl_editor_kiface )
# these 2 binaries are a matched set, keep them together:
if( APPLE )
set_target_properties( pl_editor PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${PROJECT_BINARY_DIR}/pagelayout_editor/Info.plist
)
# puts binaries into the *.app bundle while linking
set_target_properties( pl_editor_kiface PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR}
)
# put individual bundle outside of main bundle as a first step
# will be pulled into the main bundle when creating main bundle
install( TARGETS pl_editor
DESTINATION ${KICAD_BIN}
COMPONENT binary
)
install( CODE "
# override default embedded path settings
${OSX_BUNDLE_OVERRIDE_PATHS}
# do all the work
include( BundleUtilities )
fixup_bundle( ${KICAD_BIN}/pl_editor.app/Contents/MacOS/pl_editor
\"\"
\"${PYTHON_FRAMEWORK}\"
)
" COMPONENT Runtime
)
else()
if( MSVC )
target_sources( pl_editor_kiface PRIVATE ${CMAKE_SOURCE_DIR}/resources/msw/pl_editor-dll.rc )
endif()
install( TARGETS pl_editor
DESTINATION ${KICAD_BIN}
COMPONENT binary
)
install( TARGETS pl_editor_kiface
DESTINATION ${KICAD_KIFACE}
COMPONENT binary
)
endif()
if( KICAD_WIN32_INSTALL_PDBS )
# Get the PDBs to copy over for MSVC
install(FILES $<TARGET_PDB_FILE:pl_editor> DESTINATION ${KICAD_BIN})
install(FILES $<TARGET_PDB_FILE:pl_editor_kiface> DESTINATION ${KICAD_KIFACE})
endif()