-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
197 lines (165 loc) · 6.49 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
cmake_minimum_required(VERSION 3.25)
project(wampy)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer")
if (DESKTOP EQUAL 1)
set(arch x86)
set(CONNECTOR_SOURCE src/connector/mpd.cpp src/connector/hagoromo.cpp server/armv5-unknown-linux-gnueabihf/command_names.cpp)
else ()
set(arch arm)
set(CONNECTOR_SOURCE src/connector/hagoromo.cpp server/armv5-unknown-linux-gnueabihf/command_names.cpp)
# https://stackoverflow.com/questions/23583317/c-11-threads-error-pure-virtual-function-called
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4")
endif ()
set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/install/${arch})
set(PROTOBUF_INCLUDE libs/protobuf/build-${arch}/include/)
set(PROTOBUF_SOURCE server/armv5-unknown-linux-gnueabihf/command.pb.cc)
include_directories(
libs/imgui
libs/imgui/backends
libs/glfw/include
libs/GLES
libs/GLES2
libs/glad/include/KHR
libs/glad/include
libs/GL
libs/zlib
libs/ImageMagick
libs/ImageMagick/Magick++/lib
libs/glm
libs/alsa-lib/src/include
libs/mINI/src
libs/sqlite/build-${arch}/install/include
libs
server/armv5-unknown-linux-gnueabihf
${PROTOBUF_INCLUDE}
server/qt/qtbase/src/plugins/platforms/eglfs
server/qt/qtbase/
server/qt/qtbase/include/
server/qt/qtbase/include/QtCore
server/qt/qtbase/include/QtWidgets
server/qt/qtbase/include/QtGui
server/qt/qtbase/include/QtGui/5.3.2/QtGui
server/qt/qtbase/include/QtANGLE
server/qt/qtdeclarative/include/
server/qt/qtdeclarative/include/QtQml
server/qt/qtdeclarative/include/QtQuick
)
set(GLFW_BUILD_WAYLAND false)
set(GLFW_INCLUDE_ES2 true)
set(GLFW_INCLUDE_GLEXT true)
set(GL_GLEXT_PROTOTYPES true)
set(GLFW_EXPOSE_NATIVE_EGL true)
set(GLFW_BUILD_X11 OFF)
if (DESKTOP EQUAL 1)
set(GLFW_BUILD_X11 ON)
endif ()
add_subdirectory(libs/glfw)
link_libraries(glfw)
set(ZLIB_BUILD_EXAMPLES FALSE)
add_subdirectory(libs/zlib)
set_property(TARGET zlib PROPERTY VERSION)
set_property(TARGET zlib PROPERTY SOVERSION)
set(BUILD_DOCS OFF)
#set(BUILD_SHARED_LIBS OFF)
add_subdirectory(libs/mINI)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMAGICKCORE_HDRI_ENABLE=1 ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMAGICKCORE_HDRI_ENABLE=1 ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMAGICKCORE_QUANTUM_DEPTH=32")
# profiling
# exec; kill -10 <pid>
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-all")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --verbose")
add_compile_definitions(IMGUI_USER_CONFIG="../../src/imgui.config.h")
set(IMGUI_DIR libs/imgui)
add_executable(${PROJECT_NAME}
src/main.cpp
src/imgui.config.h
${IMGUI_DIR}/imgui.cpp
${IMGUI_DIR}/imgui_draw.cpp
${IMGUI_DIR}/imgui_tables.cpp
${IMGUI_DIR}/imgui_widgets.cpp
${IMGUI_DIR}/backends/imgui_impl_opengl3.cpp
${IMGUI_DIR}/backends/imgui_impl_glfw.cpp
libs/glad/src/glad.c
libs/GLES2/gl2platform.h
libs/glad/include/KHR/khrplatform.h
libs/GL/glcorearb.h
libs/glfw/deps/glad/gl.h
libs/glm/glm/ext/matrix_transform.inl
libs/zlib/contrib/minizip/unzip.c
libs/zlib/contrib/minizip/ioapi.c
libs/ImageMagick/Magick++/lib/Color.cpp
${PROTOBUF_SOURCE}
src/dac/cxd3778gf_table.cpp
src/util/util.cpp
src/wstring.cpp
src/w1/w1.cpp
src/cassette/tape.cpp
src/digital_clock/digital_clock.cpp
${CONNECTOR_SOURCE}
src/imgui_curve.cpp
src/imgui_widgets.cpp
src/connector/song.cpp
src/skinVariant.cpp
src/magick/magick.cpp
src/winamp/winamp.cpp
src/cassette/cassette.cpp
src/config.cpp
# libs/imgui/imgui_demo.cpp
src/shader.cpp
src/dac/dac.cpp)
#add_executable(dac
# src/dac/cxd3778gf_table.cpp
# src/dac/dac.cpp
# src/dac/main.cpp
# )
set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/install/${arch})
find_library(JPEG jpeg PATHS libs/libjpeg-turbo/build-${arch}/release/lib REQUIRED NO_DEFAULT_PATH)
target_link_libraries(${PROJECT_NAME} "${JPEG}")
target_link_libraries(${PROJECT_NAME} zlib)
# dynamic linking
set(ENV{PKG_CONFIG_LIBDIR} "${CMAKE_SOURCE_DIR}/libs/ImageMagick/build-${arch}/lib/pkgconfig")
find_package(ImageMagick COMPONENTS MagickCore MagickWand Magick++ REQUIRED)
include_directories(${ImageMagick_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} ${ImageMagick_LIBRARIES})
find_library(PROTOBUF protobuf REQUIRED PATHS libs/protobuf/build-${arch}/lib/ REQUIRED)
target_link_libraries(${PROJECT_NAME} "${PROTOBUF}")
set(CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/libs/sqlite/build-${arch}/install")
find_package(SQLite3 REQUIRED)
target_link_libraries(${PROJECT_NAME} "${SQLite3_LIBRARIES}")
add_custom_target(version
${CMAKE_COMMAND} -D SRC=${CMAKE_SOURCE_DIR}/src/Version.h.in
-D DST=${CMAKE_SOURCE_DIR}/src/Version.h
-P ${CMAKE_SOURCE_DIR}/GenerateVersion.cmake
)
add_dependencies(${PROJECT_NAME} version)
if (DESKTOP EQUAL 1)
find_library(GLES GLESv2 PATHS /usr/lib)
target_link_libraries(${PROJECT_NAME} ${GLES})
target_compile_definitions(${PROJECT_NAME} PRIVATE DESKTOP=1)
else ()
set_target_properties(${PROJECT_NAME} PROPERTIES
BUILD_WITH_INSTALL_RPATH FALSE
INSTALL_RPATH_USE_LINK_PATH FALSE
INSTALL_RPATH "./;../lib/;/system/lib;/system/vendor/unknown321/lib;/lib;/system/vendor/sony/lib")
find_library(MALI Mali_linux PATHS libs)
# find_library(ASOUND asound PATHS libs)
target_link_libraries(${PROJECT_NAME} ${MALI})
# target_link_libraries(${PROJECT_NAME} "${ASOUND}")
endif ()
install(TARGETS ${PROJECT_NAME})
# dynamic linking
foreach (Library ${ImageMagick_LIBRARIES})
install(FILES ${Library} DESTINATION lib)
endforeach ()
# https://gitlab.kitware.com/cmake/cmake/-/issues/23249
get_filename_component(JPEG_NAME ${JPEG} REALPATH)
install(FILES ${JPEG_NAME} DESTINATION lib)
get_filename_component(PROTOBUF_NAME ${PROTOBUF} REALPATH)
install(FILES ${PROTOBUF_NAME} DESTINATION lib)