-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathCMakeLists.txt
225 lines (196 loc) · 6.06 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# Vaca - Visual Application Components Abstraction
# Copyright (c) 2022 David Capello
# Copyright (c) 2005-2010 David Capello, Jie Zhang
#
# This file is distributed under the terms of the MIT license,
# please read LICENSE.txt for more information.
cmake_minimum_required(VERSION 3.11)
project(vaca)
########################################
# Options
option(SHARED "Build shared libraries" on)
option(THEMES "Build examples using WinXP themes" on)
set(VACA_PLATFORM "Windows" CACHE STRING
"Vaca as Win32 API wrapper or as Cocoa API wrapper")
# TODO macOS port is not supported, and not planned, but it might be
# fun to implement in the future
set_property(CACHE VACA_PLATFORM PROPERTY STRINGS
"Windows" "macOS")
if(VACA_PLATFORM STREQUAL "Windows")
set(VACA_WINDOWS 1)
set(vaca_platform_def "-DVACA_WINDOWS")
elseif(VACA_PLATFORM STREQUAL "macOS")
set(VACA_MACOS 1)
set(vaca_platform_def "-DVACA_MACOS")
endif()
set(BUILD_SHARED_LIBS ${SHARED})
########################################
# Directories
include_directories(${CMAKE_SOURCE_DIR})
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
########################################
# Main target: Vaca Library
set(VACA_SOURCES
vaca/Anchor.cpp
vaca/AnchorLayout.cpp
vaca/Application.cpp
vaca/BandedDockArea.cpp
vaca/BasicDockArea.cpp
vaca/Bix.cpp
vaca/BoxConstraint.cpp
vaca/BoxLayout.cpp
vaca/Brush.cpp
vaca/Button.cpp
vaca/ButtonBase.cpp
vaca/CancelableEvent.cpp
vaca/CheckBox.cpp
vaca/ClientLayout.cpp
vaca/Clipboard.cpp
vaca/CloseEvent.cpp
vaca/Color.cpp
vaca/ColorDialog.cpp
vaca/ComboBox.cpp
vaca/Command.cpp
vaca/CommandEvent.cpp
vaca/CommonDialog.cpp
vaca/Component.cpp
vaca/ConditionVariable.cpp
vaca/Constraint.cpp
vaca/ConsumableEvent.cpp
vaca/Cursor.cpp
vaca/CustomButton.cpp
vaca/CustomLabel.cpp
vaca/Debug.cpp
vaca/Dialog.cpp
vaca/DockArea.cpp
vaca/DockBar.cpp
vaca/DockFrame.cpp
vaca/DropFilesEvent.cpp
vaca/Event.cpp
vaca/Exception.cpp
vaca/FileDialog.cpp
vaca/FindFiles.cpp
vaca/FindTextDialog.cpp
vaca/FocusEvent.cpp
vaca/Font.cpp
vaca/FontDialog.cpp
vaca/Frame.cpp
vaca/Graphics.cpp
vaca/GraphicsPath.cpp
vaca/GroupBox.cpp
vaca/HttpRequest.cpp
vaca/Icon.cpp
vaca/Image.cpp
vaca/ImageList.cpp
vaca/KeyEvent.cpp
vaca/Keys.cpp
vaca/Label.cpp
vaca/Layout.cpp
vaca/LayoutEvent.cpp
vaca/LinkLabel.cpp
vaca/ListBox.cpp
vaca/ListColumn.cpp
vaca/ListItem.cpp
vaca/ListView.cpp
vaca/Mdi.cpp
vaca/Menu.cpp
vaca/MenuItemEvent.cpp
vaca/Message.cpp
vaca/MouseEvent.cpp
vaca/MsgBox.cpp
vaca/Mutex.cpp
vaca/PaintEvent.cpp
vaca/Pen.cpp
vaca/Point.cpp
vaca/PreferredSizeEvent.cpp
vaca/ProgressBar.cpp
vaca/Property.cpp
vaca/RadioButton.cpp
vaca/ReBar.cpp
vaca/Rect.cpp
vaca/Referenceable.cpp
vaca/Region.cpp
vaca/ResizeEvent.cpp
vaca/ResourceId.cpp
vaca/RichEdit.cpp
vaca/Scintilla.cpp
vaca/ScrollEvent.cpp
vaca/ScrollInfo.cpp
vaca/ScrollableWidget.cpp
vaca/Separator.cpp
vaca/SetCursorEvent.cpp
vaca/Size.cpp
vaca/Slider.cpp
vaca/SpinButton.cpp
vaca/Spinner.cpp
vaca/SplitBar.cpp
vaca/StatusBar.cpp
vaca/String.cpp
vaca/System.cpp
vaca/Tab.cpp
vaca/TextEdit.cpp
vaca/Thread.cpp
vaca/TimePoint.cpp
vaca/Timer.cpp
vaca/ToggleButton.cpp
vaca/ToolBar.cpp
vaca/TreeNode.cpp
vaca/TreeView.cpp
vaca/TreeViewEvent.cpp
vaca/Vaca.cpp
vaca/Widget.cpp
vaca/WidgetClass.cpp)
if(VACA_WINDOWS)
set(VACA_SOURCES ${VACA_SOURCES} vaca/win32/win32.cpp)
endif(VACA_WINDOWS)
add_library(vaca ${VACA_SOURCES})
target_compile_features(vaca PUBLIC cxx_std_14)
######################################################################
# Post-build commands to run examples and tests
add_custom_command(TARGET vaca
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/scintilla/SciLexer.dll ${CMAKE_CURRENT_BINARY_DIR}/examples
COMMENT "Copying SciLexer DLL to examples directory")
if(BUILD_SHARED_LIBS)
add_custom_command(
TARGET vaca
BYPRODUCTS
${CMAKE_CURRENT_BINARY_DIR}/examples/vaca.dll
${CMAKE_CURRENT_BINARY_DIR}/tests/vaca.dll
${CMAKE_CURRENT_BINARY_DIR}/tests/gtest.dll
${CMAKE_CURRENT_BINARY_DIR}/tests/gtest_main.dll
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:vaca> ${CMAKE_CURRENT_BINARY_DIR}/examples
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:vaca> ${CMAKE_CURRENT_BINARY_DIR}/tests
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:gtest> ${CMAKE_CURRENT_BINARY_DIR}/tests
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:gtest_main> ${CMAKE_CURRENT_BINARY_DIR}/tests
COMMENT "Copying dlls to examples and tests directories")
endif(BUILD_SHARED_LIBS)
########################################
# Flags
set(win32_flags "-DWINVER=0x0500 -D_WIN32_IE=0x0500 -D_WIN32_WINNT=0x0500")
set(unicode_flags "-DUNICODE -D_UNICODE")
if(NOT BUILD_SHARED_LIBS)
set(static_flags "-DVACA_STATIC")
endif(NOT BUILD_SHARED_LIBS)
set(common_flags "${win32_flags} ${unicode_flags} ${static_flags}")
set_target_properties(vaca PROPERTIES
COMPILE_FLAGS "-DVACA_SRC ${common_flags} ${vaca_platform_def}")
target_link_libraries(vaca
User32 Shell32 ComCtl32 ComDlg32 Gdi32 Msimg32
WinMM AdvAPI32 Ole32 ShLwApi Vfw32 WinInet)
########################################
# Installation commands
FILE(GLOB vaca_h_files "${CMAKE_CURRENT_SOURCE_DIR}/vaca/*.h")
INSTALL(FILES ${vaca_h_files} DESTINATION include/vaca)
INSTALL(TARGETS vaca
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
########################################
# Examples
add_subdirectory(examples)
########################################
# Tests
enable_testing()
add_subdirectory(tests)