1+ /* *
2+ * @file ccap_config.h
3+ * @author wysaid (this@wysaid.org)
4+ * @brief Common configuration and platform-specific definitions for ccap library.
5+ * @date 2025-09
6+ *
7+ * @note This file contains common macros, constants, and platform detection
8+ * that are shared across both C++ and C interfaces of the library.
9+ */
10+
11+ #pragma once
12+ #ifndef CCAP_CONFIG_H
13+ #define CCAP_CONFIG_H
14+
15+ /* ========== Export/Import Macro Definitions ========== */
16+
17+ // Define CCAP_EXPORT macro for symbol export/import
18+ #if defined(CCAP_SHARED)
19+ #if defined(_WIN32) || defined(__CYGWIN__)
20+ #ifdef CCAP_BUILDING_DLL
21+ #ifdef __GNUC__
22+ #define CCAP_EXPORT __attribute__ ((dllexport))
23+ #else
24+ #define CCAP_EXPORT __declspec (dllexport)
25+ #endif
26+ #else
27+ #ifdef __GNUC__
28+ #define CCAP_EXPORT __attribute__ ((dllimport))
29+ #else
30+ #define CCAP_EXPORT __declspec (dllimport)
31+ #endif
32+ #endif
33+ #else
34+ #if __GNUC__ >= 4
35+ #define CCAP_EXPORT __attribute__ ((visibility (" default" )))
36+ #else
37+ #define CCAP_EXPORT
38+ #endif
39+ #endif
40+ #else
41+ // Static library - no export needed
42+ #define CCAP_EXPORT
43+ #endif
44+
45+ /* ========== Platform Detection ========== */
46+
47+ #if __APPLE__
48+ #include < TargetConditionals.h>
49+ #if (defined(TARGET_OS_IOS) && TARGET_OS_IOS) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
50+ #define CCAP_IOS 1
51+ #else
52+ #define CCAP_MACOS 1
53+ #endif
54+ #elif defined(__ANDROID__)
55+ #define CCAP_ANDROID 1
56+ #elif defined(_WIN32)
57+ #define CCAP_WINDOWS 1
58+ #if defined(_MSC_VER)
59+ #define CCAP_WINDOWS_MSVC 1
60+ #endif
61+ #endif
62+
63+ #if !defined(CCAP_IOS) && !defined(CCAP_ANDROID)
64+ #define CCAP_DESKTOP 1
65+ #endif
66+
67+ /* ========== Common Constants ========== */
68+
69+ // Maximum number of devices supported
70+ #define CCAP_MAX_DEVICES 32
71+
72+ // Maximum length for device name strings
73+ #define CCAP_MAX_DEVICE_NAME_LENGTH 128
74+
75+ // Maximum number of pixel formats per device
76+ #define CCAP_MAX_PIXEL_FORMATS 32
77+
78+ // Maximum number of resolutions per device
79+ #define CCAP_MAX_RESOLUTIONS 64
80+
81+ /* ========== Compatibility Macros ========== */
82+
83+ #ifdef __cplusplus
84+ #if __cplusplus >= 201703L
85+ #define CCAP_CONSTEXPR constexpr
86+ #else
87+ #define CCAP_CONSTEXPR
88+ #endif
89+ #else
90+ #define CCAP_CONSTEXPR
91+ #endif
92+
93+ #endif /* CCAP_CONFIG_H */
0 commit comments