-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
152 lines (127 loc) · 4 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
cmake_minimum_required( VERSION 3.18 FATAL_ERROR )
project( ImageViewer )
set( SRC_FILES
src/main.cpp
src/folder_info.cpp
src/folder_info.h
# src/thumbnail.cpp
# src/thumbnail.h
src/log.cpp
src/log.h
src/util.cpp
src/util.h
src/args.cpp
src/args.h
src/platform.h
src/render.h
src/undo_system.cpp
# UI
src/ui/imagelist.cpp
src/ui/imagelist.h
src/ui/imageview.cpp
src/ui/imageview.h
src/ui/settings.cpp
src/ui/settings.h
src/formats/imageloader.cpp
src/formats/imageloader.h
# Image Formats
# src/formats/format_win32_wic.cpp
src/formats/format_png.cpp
src/formats/format_jpeg.cpp
# src/formats/format_gif.cpp # ew
# src/formats/format_jpegxl.cpp
)
if( MSVC )
set( PLAT_FILES
${CMAKE_CURRENT_LIST_DIR}/src/win/drag_drop.cpp
${CMAKE_CURRENT_LIST_DIR}/src/win/folder_monitor.cpp
${CMAKE_CURRENT_LIST_DIR}/src/win/platform_win32.cpp
${CMAKE_CURRENT_LIST_DIR}/src/win/platform_win32.h
)
else()
set( PLAT_FILES
${CMAKE_CURRENT_LIST_DIR}/src/linux/drag_drop.cpp
${CMAKE_CURRENT_LIST_DIR}/src/linux/folder_monitor.cpp
${CMAKE_CURRENT_LIST_DIR}/src/linux/platform_x11.cpp
${CMAKE_CURRENT_LIST_DIR}/src/linux/platform_linux.cpp
${CMAKE_CURRENT_LIST_DIR}/src/linux/platform_linux.h
)
endif()
include( core.cmake )
set( JXL_DIR "${CMAKE_CURRENT_LIST_DIR}/thirdparty/libjxl" )
include_directories(
"thirdparty"
"thirdparty/async"
"thirdparty/libspng/spng"
"thirdparty/libjpeg-turbo"
"${JXL_DIR}/lib/include"
"${JXL_DIR}/build/lib/include"
)
set( SPNG_LIB_DIR ${CMAKE_CURRENT_LIST_DIR}/thirdparty/libspng/build/${CMAKE_BUILD_TYPE} )
link_directories(
${SPNG_LIB_DIR}
"thirdparty/libjpeg-turbo/build"
"${JXL_DIR}/build/lib"
)
add_executable( ImageViewer ${SRC_FILES} ${PLAT_FILES} )
set_target_properties(
ImageViewer PROPERTIES
# OUTPUT_NAME proto_img_view
ENABLE_EXPORTS true
)
target_link_libraries(
ImageViewer
PRIVATE
spng
ImGui
turbojpeg-static
# why don't these work????????
# jxl_dec-static
# jxl_threads-static
jxl_dec
jxl_threads
)
if( MSVC )
target_link_libraries( ImageViewer PRIVATE Shlwapi )
endif()
if ( ${CMAKE_BUILD_TYPE} NOT STREQUAL '' )
add_custom_command( TARGET ImageViewer POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SPNG_LIB_DIR}/spng.dll ${IMGVIEW_BUILD}/spng.dll
)
endif()
# set output directories for all builds (Debug, Release, etc.)
foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG )
set_target_properties(
ImageViewer PROPERTIES
RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${IMGVIEW_BUILD}/${OUTPUTCONFIG}
LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${IMGVIEW_BUILD}/${OUTPUTCONFIG}
)
if( MSVC )
# uhhh
if ( ${OUTPUTCONFIG} STREQUAL DEBUG )
add_custom_command( TARGET ImageViewer POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SPNG_LIB_DIR}/Debug/spng.dll ${IMGVIEW_BUILD}/${OUTPUTCONFIG}/spng.dll
)
add_custom_command( TARGET ImageViewer POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${JXL_DIR}/build/Debug/jxl_threads.dll ${IMGVIEW_BUILD}/${OUTPUTCONFIG}/jxl_threads.dll
)
add_custom_command( TARGET ImageViewer POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${JXL_DIR}/build/Debug/jxl_dec.dll ${IMGVIEW_BUILD}/${OUTPUTCONFIG}/jxl_dec.dll
)
else()
add_custom_command( TARGET ImageViewer POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SPNG_LIB_DIR}/Release/spng.dll ${IMGVIEW_BUILD}/${OUTPUTCONFIG}/spng.dll
)
add_custom_command( TARGET ImageViewer POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${JXL_DIR}/build/Release/jxl_threads.dll ${IMGVIEW_BUILD}/${OUTPUTCONFIG}/jxl_threads.dll
)
add_custom_command( TARGET ImageViewer POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${JXL_DIR}/build/Release/jxl_dec.dll ${IMGVIEW_BUILD}/${OUTPUTCONFIG}/jxl_dec.dll
)
endif()
endif()
endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES )
add_subdirectory( imgui )
add_subdirectory( src/render_sdl )
add_subdirectory( src/render_vk )