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
|
project('qtdemo', 'cpp',
version : '0.1',
default_options : ['warning_level=3',
'buildtype=release',
'cpp_std=c++17'])
cxx = meson.get_compiler('cpp')
qt5_mod = import('qt5')
qt5_dep = dependency('qt5', modules: ['Core', 'Widgets', 'Gui'], static: true)
qt5_path = '3rdparty/qt/'
# qt library
subdir(qt5_path)
MHF_HDR = []
MHF_HDR += include_directories('include')
MHF_HDR += QT_HDR
MHF_SRC = []
MHF_SRC += 'main.cpp'
MHF_SRC += QT_SRC
MHF_SRC += qt5_mod.compile_ui(sources : [qt5_path + 'mainWindow.ui'])
MHF_SRC += qt5_mod.compile_moc(sources: [qt5_path + 'source/mainWindow.cpp'],
headers: [qt5_path + 'include/mainWindow.h'])
LIBS = []
LIBS += qt5_dep
LIBS += cxx.find_library('Qt5Core', dirs: meson.get_external_property('qt_root') + 'lib/', static: true)
LIBS += cxx.find_library('qtpcre2', dirs: meson.get_external_property('qt_root') + 'lib/', static: true)
LIBS += cxx.find_library('QT5Widgets', dirs: meson.get_external_property('qt_root') + 'lib/', static: true)
LIBS += cxx.find_library('Qt5Gui', dirs: meson.get_external_property('qt_root') + 'lib/', static: true)
LIBS += cxx.find_library('qtlibpng', dirs: meson.get_external_property('qt_root') + 'lib/', static: true)
LIBS += cxx.find_library('qtharfbuzz', dirs: meson.get_external_property('qt_root') + 'lib/', static: true)
# plugins
LIBS += cxx.find_library('qwindows', dirs: meson.get_external_property('qt_root') + 'plugins/platforms', static: true)
LIBS += cxx.find_library('Qt5FontDatabaseSupport', dirs: meson.get_external_property('qt_root') + 'lib/', static: true)
LIBS += cxx.find_library('qtfreetype', dirs: meson.get_external_property('qt_root') + 'lib/', static: true)
LIBS += cxx.find_library('Qt5WindowsUIAutomationSupport', dirs: meson.get_external_property('qt_root') + 'lib/', static: true)
LIBS += cxx.find_library('Qt5EventDispatcherSupport', dirs: meson.get_external_property('qt_root') + 'lib/', static: true)
LIBS += cxx.find_library('Qt5ThemeSupport', dirs: meson.get_external_property('qt_root') + 'lib/', static: true)
if build_machine.system() == 'windows'
CXXFLAGS = ['-DWINDOWS']
else
CXXFLAGS = []
endif
CXXFLAGS += '-w'
CXXFLAGS += '-static'
LD_FLAGS = []
LD_FLAGS += '-lz'
LD_FLAGS += '-lwsock32'
LD_FLAGS += '-lopengl32'
# GetFileVersionInfoSizeW
LD_FLAGS += '-lversion'
# __imp_GetUserProfileDirectoryW
LD_FLAGS += '-luserenv'
# NetShareEnum
LD_FLAGS += '-lnetapi32'
# __imp_timeSetEvent
LD_FLAGS += '-lwinmm'
# DwmGetWindowAttribute
LD_FLAGS += '-ldwmapi'
# ImmGetOpenStatus
LD_FLAGS += '-limm32'
# WTSFreeMemory
LD_FLAGS += '-lwtsapi32'
# generate qtdemo
executable('qtdemo',
sources: MHF_SRC,
include_directories: MHF_HDR,
c_args : '',
cpp_args : CXXFLAGS,
link_args : LD_FLAGS,
dependencies: LIBS,
gui_app : true
)
|