summaryrefslogtreecommitdiff
path: root/pagelayout_editor/CMakeLists.txt
blob: 5177c5647dd600f56b3cd00e0bcde7429fbe8dc3 (plain)
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
# the map generation creates on Windows/gcc a lot of useless warnings
# so disable it on windows
if( WIN32 AND NOT CMAKE_CROSSCOMPILING )
    set( MAKE_LINK_MAPS false )
else()
    set( MAKE_LINK_MAPS true )
endif()

add_definitions(-DPL_EDITOR)

include_directories(BEFORE ${INC_BEFORE})
include_directories(
    dialogs
    ../common/dialogs
    ${INC_AFTER}
    )

set( PL_EDITOR_SRCS
    dialogs/properties_frame_base.cpp
    dialogs/dialogs_for_printing.cpp
    dialogs/dialog_new_dataitem_base.cpp
    dialogs/dialog_new_dataitem.cpp
    class_pl_editor_screen.cpp
    class_pl_editor_layout.cpp
    design_tree_frame.cpp
    events_functions.cpp
    controle.cpp
    files.cpp
    onleftclick.cpp
    onrightclick.cpp
    page_layout_writer.cpp
    pl_editor_config.cpp
    pl_editor_frame.cpp
    pl_editor_undo_redo.cpp
    properties_frame.cpp
    hotkeys.cpp
    menubar.cpp
    toolbars_pl_editor.cpp
    )

set( PL_EDITOR_EXTRA_SRCS
    ../common/base_screen.cpp
    ../common/base_units.cpp
    ../common/eda_text.cpp
    ../common/class_page_info.cpp
    ../common/dialogs/dialog_page_settings.cpp
)


if( MINGW )
    # PL_EDITOR_RESOURCES variable is set by the macro.
    mingw_resource_compiler( pl_editor )
else()
    set( PL_EDITOR_RESOURCES pl_editor.rc )
endif()


if( APPLE )
    # setup bundle
    set( PL_EDITOR_RESOURCES pl_editor.icns pl_editor_doc.icns )
    set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pl_editor.icns" PROPERTIES
        MACOSX_PACKAGE_LOCATION Resources
        )
    set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pl_editor_doc.icns" PROPERTIES
        MACOSX_PACKAGE_LOCATION Resources
        )
    set( MACOSX_BUNDLE_ICON_FILE pl_editor.icns )
    set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-pcb.kicad )
    set( MACOSX_BUNDLE_NAME pl_editor )
endif()

# a very small program launcher for pl_editor_kiface
add_executable( pl_editor WIN32 MACOSX_BUNDLE
    ../common/single_top.cpp
    ../common/pgm_base.cpp
    ${PL_EDITOR_RESOURCES}
    )
set_source_files_properties( ../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.
    common
    bitmaps
    ${wxWidgets_LIBRARIES}
    )

if( MAKE_LINK_MAPS )
    set_target_properties( pl_editor PROPERTIES
        LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=pl_editor.map" )
endif()

# 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
    common
    polygon
    bitmaps
    gal
    ${wxWidgets_LIBRARIES}
    ${GDI_PLUS_LIBRARIES}
    )
set_target_properties( pl_editor_kiface PROPERTIES
    OUTPUT_NAME     pl_editor
    PREFIX          ${KIFACE_PREFIX}
    SUFFIX          ${KIFACE_SUFFIX}
    )
set_source_files_properties( pl_editor.cpp PROPERTIES
    # The KIFACE is in pcbnew.cpp, export it:
    COMPILE_DEFINITIONS     "BUILD_KIWAY_DLL;COMPILING_DLL"
    )

if( MAKE_LINK_MAPS )
    set_target_properties( pl_editor_kiface PROPERTIES
        LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=_pl_editor.kiface.map" )
endif()

# 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 ${CMAKE_CURRENT_SOURCE_DIR}/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
            \"\"
            \"\"
            )
        " COMPONENT Runtime
        )
else()
    install( TARGETS pl_editor
        DESTINATION ${KICAD_BIN}
        COMPONENT binary
        )
    install( TARGETS pl_editor_kiface
        DESTINATION ${KICAD_BIN}
        COMPONENT binary
        )
endif()