-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
153 lines (133 loc) · 3.44 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
cmake_minimum_required(VERSION 3.29)
option(TRACY_ENABLE "Enable Tracy" OFF)
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_CXX_STANDARD 20)
project(ModernCore
LANGUAGES C CXX
)
include(FindPkgConfig)
include(cmake/config.cmake)
include(cmake/CPM.cmake)
if(NOT TRACY_ENABLE)
set(TRACY_OPTIONS "TRACY_STATIC ON")
endif()
CPMAddPackage(
NAME tracy
GITHUB_REPOSITORY wolfpld/tracy
GIT_TAG master
OPTIONS ${TRACY_OPTIONS}
EXCLUDE_FROM_ALL TRUE
)
CPMAddPackage(
NAME stb
GITHUB_REPOSITORY nothings/stb
GIT_TAG 2e2bef463a5b53ddf8bb788e25da6b8506314c08
DOWNLOAD_ONLY TRUE
)
CPMAddPackage(
NAME base64
GITHUB_REPOSITORY aklomp/base64
GIT_TAG v0.5.2
OPTIONS
"BASE64_BUILD_CLI OFF"
"BASE64_WITH_OpenMP OFF"
EXCLUDE_FROM_ALL TRUE
)
pkg_check_modules(CAIRO REQUIRED cairo)
pkg_check_modules(EXR REQUIRED OpenEXR)
pkg_check_modules(HEIF REQUIRED libheif)
pkg_check_modules(JPEG REQUIRED libjpeg)
pkg_check_modules(JXL REQUIRED libjxl libjxl_threads)
pkg_check_modules(PNG REQUIRED libpng)
pkg_check_modules(RAW REQUIRED libraw)
pkg_check_modules(RSVG REQUIRED librsvg-2.0)
pkg_check_modules(SIXEL REQUIRED libsixel)
pkg_check_modules(TIFF REQUIRED libtiff-4)
pkg_check_modules(WEBP REQUIRED libwebpdemux)
pkg_check_modules(ZLIB REQUIRED zlib)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}/src)
add_compile_definitions(DISABLE_CALLSTACK)
if(TRACY_ENABLE)
add_definitions(-DTRACY_ENABLE)
add_compile_options(-g -O3 -fno-omit-frame-pointer)
endif()
# mcoreutil
set(MCOREUTIL_SRC
src/util/Bitmap.cpp
src/util/BitmapAnim.cpp
src/util/BitmapHdr.cpp
src/util/Callstack.cpp
src/util/FileBuffer.cpp
src/util/Home.cpp
src/util/Logs.cpp
src/util/stb_image_resize_impl.cpp
)
add_library(mcoreutil ${MCOREUTIL_SRC})
target_link_libraries(mcoreutil PRIVATE
Tracy::TracyClient
)
target_include_directories(mcoreutil PRIVATE ${stb_SOURCE_DIR})
# mcoreimage
set(MCOREIMAGE_SRC
src/image/bcdec.c
src/image/DdsLoader.cpp
src/image/ExrLoader.cpp
src/image/HeifLoader.cpp
src/image/ImageLoader.cpp
src/image/JpgLoader.cpp
src/image/JxlLoader.cpp
src/image/PcxLoader.cpp
src/image/PngLoader.cpp
src/image/PvrLoader.cpp
src/image/RawLoader.cpp
src/image/StbImageLoader.cpp
src/image/TiffLoader.cpp
src/image/WebpLoader.cpp
src/image/vector/PdfImage.cpp
src/image/vector/SvgImage.cpp
)
add_library(mcoreimage ${MCOREIMAGE_SRC})
target_link_libraries(mcoreimage PRIVATE
mcoreutil
Tracy::TracyClient
${CAIRO_LINK_LIBRARIES}
${EXR_LINK_LIBRARIES}
${HEIF_LINK_LIBRARIES}
${JPEG_LINK_LIBRARIES}
${JXL_LINK_LIBRARIES}
${PNG_LINK_LIBRARIES}
${RAW_LINK_LIBRARIES}
${RSVG_LINK_LIBRARIES}
${TIFF_LINK_LIBRARIES}
${WEBP_LINK_LIBRARIES}
)
target_include_directories(mcoreimage PRIVATE
${CAIRO_INCLUDE_DIRS}
${EXR_INCLUDE_DIRS}
${HEIF_INCLUDE_DIRS}
${JPEG_INCLUDE_DIRS}
${JXL_INCLUDE_DIRS}
${PNG_INCLUDE_DIRS}
${RAW_INCLUDE_DIRS}
${RSVG_INCLUDE_DIRS}
${TIFF_INCLUDE_DIRS}
${WEBP_INCLUDE_DIRS}
${stb_SOURCE_DIR}
)
# vv
set(VV_SRC
src/tools/vv/vv.cpp
src/tools/vv/Terminal.cpp
)
add_executable(vv ${VV_SRC})
target_include_directories(vv PRIVATE
${SIXEL_INCLUDE_DIRS}
)
target_link_libraries(vv PRIVATE
mcoreutil
mcoreimage
Tracy::TracyClient
base64
${SIXEL_LINK_LIBRARIES}
${ZLIB_LINK_LIBRARIES}
)