aboutsummaryrefslogtreecommitdiff
path: root/src/libui_sdl/libui/windows/CMakeLists.txt
blob: 24d4ad96635a849a8b6231302ae2d28bec27f036 (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
# 3 june 2016

list(APPEND _LIBUI_SOURCES
	windows/alloc.cpp
	windows/area.cpp
	windows/areadraw.cpp
	windows/areaevents.cpp
	windows/areascroll.cpp
	windows/areautil.cpp
	windows/box.cpp
	windows/button.cpp
	windows/checkbox.cpp
	windows/colorbutton.cpp
	windows/colordialog.cpp
	windows/combobox.cpp
	windows/container.cpp
	windows/control.cpp
	windows/d2dscratch.cpp
	windows/datetimepicker.cpp
	windows/debug.cpp
	windows/draw.cpp
	windows/drawmatrix.cpp
	windows/drawpath.cpp
	windows/drawtext.cpp
	windows/dwrite.cpp
	windows/editablecombo.cpp
	windows/entry.cpp
	windows/events.cpp
	windows/fontbutton.cpp
	windows/fontdialog.cpp
	windows/form.cpp
	windows/gl.cpp
	windows/graphemes.cpp
	windows/grid.cpp
	windows/group.cpp
	windows/init.cpp
	windows/label.cpp
	windows/main.cpp
	windows/menu.cpp
	windows/multilineentry.cpp
	windows/parent.cpp
	windows/progressbar.cpp
	windows/radiobuttons.cpp
	windows/separator.cpp
	windows/sizing.cpp
	windows/slider.cpp
	windows/spinbox.cpp
	windows/stddialogs.cpp
	windows/tab.cpp
	windows/tabpage.cpp
	windows/text.cpp
	windows/utf16.cpp
	windows/utilwin.cpp
	windows/window.cpp
	windows/winpublic.cpp
	windows/winutil.cpp
	windows/resources.rc
)
set(_LIBUI_SOURCES ${_LIBUI_SOURCES} PARENT_SCOPE)

list(APPEND _LIBUI_INCLUDEDIRS
	windows
)
set(_LIBUI_INCLUDEDIRS _LIBUI_INCLUDEDIRS PARENT_SCOPE)

# Windows won't link resources in static libraries; we need to provide the libui.res file in this case.
set(_LIBUINAME libui PARENT_SCOPE)
if(NOT BUILD_SHARED_LIBS)
	set(_LIBUI_STATIC_RES ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/libui.res PARENT_SCOPE)
endif()
macro(_handle_static)
	# TODO this full path feels hacky
	add_custom_command(
		TARGET libui POST_BUILD
		COMMAND
			${CMAKE_COMMAND} -E copy $<TARGET_PROPERTY:libui,BINARY_DIR>/CMakeFiles/libui.dir/windows/resources.rc.obj ${_LIBUI_STATIC_RES}
		COMMENT "Copying libui.res")
endmacro()

# notice that usp10 comes before gdi32
# TODO prune this list
set(_LIBUI_LIBS
	user32 kernel32 usp10 gdi32 comctl32 uxtheme msimg32 comdlg32 d2d1 dwrite ole32 oleaut32 oleacc uuid
PARENT_SCOPE)

if(NOT MSVC)
	if(BUILD_SHARED_LIBS)
		message(FATAL_ERROR
			"Sorry, but libui for Windows can currently only be built as a static library with MinGW. You will need to either build as a static library or switch to MSVC."
		)
	endif()
endif()