]> git.proxmox.com Git - ceph.git/blame - ceph/src/jaegertracing/opentelemetry-cpp/tools/vcpkg/ports/sdl2-image/CMakeLists.txt
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / tools / vcpkg / ports / sdl2-image / CMakeLists.txt
CommitLineData
1e59de90
TL
1cmake_minimum_required(VERSION 2.6)
2project(SDL2_image C)
3
4### configuration ###
5
6list(APPEND CMAKE_MODULE_PATH "${CURRENT_INSTALLED_DIR}/share/libwebp")
7# enable all file formats which are supported natively
8set(SUPPORTED_FORMATS BMP GIF LBM PCX PNM TGA XPM XCF XV SVG)
9
10# enable all file formats which are supported through external dependencies
11# first try to load them statically (lib file in vcpkg installation)
12# if this fails try to make them a dynamic dependency (dll will be loaded at runtime) if possible. vcpkg cannot resolve these dependencies!
13# else do not support this file format at all
14
15# Can be explicitly enabled or disabled via USE_XYZ
16set(DEPENDENCIES PNG JPEG TIFF WEBP)
17
18# patch library names for preprocessor flags
19set(JPEG_FLAG JPG)
20set(TIFF_FLAG TIF)
21
22# names of potentially dynamically loaded libraries
23set(JPEG_DYNAMIC \"libjpeg-9.dll\")
24set(PNG_DYNAMIC \"libpng16-16.dll\")
25set(TIFF_DYNAMIC \"libtiff-5.dll\")
26set(WEBP_DYNAMIC \"libwebp-4.dll\")
27
28### implementation ###
29
30add_library(SDL2_image
31 IMG.c
32 IMG_bmp.c
33 IMG_gif.c
34 IMG_jpg.c
35 IMG_lbm.c
36 IMG_pcx.c
37 IMG_png.c
38 IMG_pnm.c
39 IMG_svg.c
40 IMG_tga.c
41 IMG_tif.c
42 IMG_webp.c
43 IMG_xcf.c
44 IMG_xpm.c
45 IMG_xv.c
46 IMG_xxx.c
47 IMG_WIC.c
48 version.rc
49 )
50
51if (APPLE)
52 target_sources(SDL2_image PRIVATE
53 IMG_ImageIO.m
54 )
55 target_compile_options(SDL2_image BEFORE PRIVATE
56 "-x" "objective-c"
57 )
58endif()
59
60set_target_properties(SDL2_image PROPERTIES DEFINE_SYMBOL DLL_EXPORT)
61
62foreach(FORMAT ${SUPPORTED_FORMATS})
63 add_definitions(-DLOAD_${FORMAT})
64endforeach(FORMAT)
65
66# SDL
67find_path(SDL_INCLUDE_DIR SDL2/SDL.h)
68find_package(SDL2 CONFIG REQUIRED)
69
70include_directories(${SDL_INCLUDE_DIR})
71include_directories(${SDL_INCLUDE_DIR}/SDL2)
72include_directories(${CMAKE_SOURCE_DIR})
73
74target_link_libraries(SDL2_image SDL2::SDL2)
75
76# external dependencies
77foreach(DEPENDENCY IN LISTS DEPENDENCIES)
78 if(NOT USE_${DEPENDENCY})
79 continue()
80 endif()
81 find_package(${DEPENDENCY})
82
83 if(NOT DEFINED ${DEPENDENCY}_FLAG)
84 set(${DEPENDENCY}_FLAG ${DEPENDENCY})
85 endif()
86
87 add_definitions(-DLOAD_${${DEPENDENCY}_FLAG})
88 if(${DEPENDENCY}_FOUND)
89 message(STATUS " --> linking statically.")
90 target_link_libraries(SDL2_image ${${DEPENDENCY}_LIBRARIES})
91 elseif(DEFINED ${DEPENDENCY}_DYNAMIC)
92 message(STATUS " --> linking dynamically.")
93 add_definitions(-DLOAD_${${DEPENDENCY}_FLAG}_DYNAMIC=${${DEPENDENCY}_DYNAMIC})
94 set(RUNTIME_DEPENDENCIES ON)
95 else()
96 message(STATUS " --> skipping.")
97 endif()
98endforeach(DEPENDENCY)
99
100if(DEFINED RUNTIME_DEPENDENCIES)
101 include_directories(VisualC/external/include)
102endif()
103
104
105install(TARGETS SDL2_image
106 EXPORT SDL2_image
107 RUNTIME DESTINATION bin
108 ARCHIVE DESTINATION lib
109 LIBRARY DESTINATION lib)
110
111install(FILES SDL_image.h DESTINATION include/SDL2 CONFIGURATIONS Release)
112
113file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/sdl2-image-config.cmake"
114[[include(CMakeFindDependencyMacro)
115find_dependency(SDL2 CONFIG)
116include("${CMAKE_CURRENT_LIST_DIR}/sdl2-image-targets.cmake")
117]])
118
119install(FILES ${CMAKE_CURRENT_BINARY_DIR}/sdl2-image-config.cmake DESTINATION share/sdl2-image)
120
121install(EXPORT SDL2_image
122 DESTINATION share/sdl2-image/
123 FILE sdl2-image-targets.cmake
124 NAMESPACE SDL2::
125)
126
127message(STATUS "Link-time dependencies:")
128message(STATUS " " SDL2::SDL2)
129foreach(DEPENDENCY ${DEPENDENCIES})
130 if(${DEPENDENCY}_FOUND)
131 message(STATUS " " ${DEPENDENCY})
132 endif()
133endforeach(DEPENDENCY)
134
135if(DEFINED RUNTIME_DEPENDENCIES)
136 message(STATUS "Run-time dependencies:")
137 foreach(DEPENDENCY ${DEPENDENCIES})
138 if(NOT ${DEPENDENCY}_FOUND AND DEFINED ${DEPENDENCY}_DYNAMIC)
139 message(STATUS " " ${${DEPENDENCY}_DYNAMIC})
140 endif()
141 endforeach(DEPENDENCY)
142endif()