summaryrefslogtreecommitdiff
path: root/gui/CMakeLists.txt
blob: b74e3eceb63a399921acc960ae9e15ad38e8835e (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
# CMake will throw a cryptic message if an user unwittingly invokes it from
# this directory.
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
    message (FATAL_ERROR
        "qapitrace must be built from the top source directory.\n"
        "Read docs/INSTALL.markdown for detailed build instructions."
    )
endif ()

add_definitions (-DQT_FORCE_ASSERTS)

if (APPLE)
    # Recent builds of Qt no longer support i386 architecture
    set (CMAKE_OSX_ARCHITECTURES "x86_64")
endif()

add_library (qubjson STATIC
    qubjson.cpp
)

add_gtest (qubjson_test qubjson_test.cpp)
target_link_libraries (qubjson_test qubjson)

set(qapitrace_SRCS
   androiddevicedialog.cpp
   androidfiledialog.cpp
   androidretracer.cpp
   androidutils.cpp
   apisurface.cpp
   apitrace.cpp
   apicalldelegate.cpp
   apitracecall.cpp
   apitracefilter.cpp
   apitracemodel.cpp
   argumentseditor.cpp
   glsledit.cpp
   imageviewer.cpp
   jumpwidget.cpp
   mainwindow.cpp
   main.cpp
   pixelwidget.cpp
   profiledialog.cpp
   profiletablemodel.cpp
   retracer.cpp
   saverthread.cpp
   searchwidget.cpp
   settingsdialog.cpp
   shaderssourcewidget.cpp
   tracedialog.cpp
   traceloader.cpp
   traceprocess.cpp
   trimprocess.cpp
   vertexdatainterpreter.cpp
   leaktracethread.cpp
   graphing/frameaxiswidget.cpp
   graphing/graphwidget.cpp
   graphing/graphaxiswidget.cpp
   graphing/graphview.cpp
   graphing/heatmapview.cpp
   graphing/heatmapverticalaxiswidget.cpp
   graphing/histogramview.cpp
   graphing/timeaxiswidget.cpp
 )

qt5_add_resources(qapitrace_SRCS qapitrace.qrc)

set(qapitrace_UIS
   ui/androidfiledialog.ui
   ui/androiddevicedialog.ui
   ui/argumentseditor.ui
   ui/imageviewer.ui
   ui/jumpwidget.ui
   ui/mainwindow.ui
   ui/profiledialog.ui
   ui/profilereplaydialog.ui
   ui/retracerdialog.ui
   ui/settings.ui
   ui/tracedialog.ui
   ui/searchwidget.ui
   ui/shaderssourcewidget.ui
   )

set (CMAKE_AUTOMOC ON)
# Silence `Note: No relevant classes found. No output generated.`
set (CMAKE_AUTOMOC_MOC_OPTIONS "-nn")

QT5_WRAP_UI(qapitrace_UIS_H ${qapitrace_UIS})
set(CMAKE_INCLUDE_CURRENT_DIR ON)

#add_app_icon(qapitrace_SRCS ../icons/hi*-qapitrace.png)
include_directories(
    ${CMAKE_SOURCE_DIR} # for image/*
)

add_executable (qapitrace ${qapitrace_SRCS} ${qapitrace_UIS_H})

# Avoid qt5_use_modules. See also:
# - https://bugreports.qt.io/browse/QTBUG-39457
# - http://doc.qt.io/qt-5/cmake-manual.html
# - http://www.kdab.com/using-cmake-with-qt-5/
if (Qt5Core_VERSION_STRING VERSION_LESS 5.2.0)
    qt5_use_modules (qubjson Widgets)
    qt5_use_modules (qubjson_test Widgets)
    qt5_use_modules (qapitrace Widgets WebKitWidgets)
else ()
    target_link_libraries (qubjson Qt5::Widgets)
    target_link_libraries (qubjson_test Qt5::Widgets)
    target_link_libraries (qapitrace Qt5::Widgets Qt5::WebKitWidgets)
endif ()

target_link_libraries (qapitrace
    qubjson
    image
    common
    ${ZLIB_LIBRARIES}
    ${SNAPPY_LIBRARIES}
    ${CMAKE_THREAD_LIBS_INIT}
)

if (WIN32 AND NOT (CMAKE_BUILD_TYPE STREQUAL "Debug"))
    # Use Windows subsystem (i.e., no console).
    set_target_properties (qapitrace PROPERTIES CMAKE_WIN32_EXECUTABLE TRUE)
    if (MSVC)
        # When the Windows subsystem is chosen by default MSVC expects WinMain()
        # entry point, but we rather use plain old main() everywhere.
        set_target_properties (qapitrace PROPERTIES LINK_FLAGS "/ENTRY:mainCRTStartup")
    endif ()
endif ()


########### install files ###############

install (TARGETS qapitrace RUNTIME DESTINATION bin)
install_pdb (qapitrace RUNTIME DESTINATION bin)
#install (FILES qapitrace.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})