SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
WAIHelper.h
Go to the documentation of this file.
1 #ifndef WAI_HELPER_H
2 #define WAI_HELPER_H
3 
4 #include <cstdarg>
5 #include <cstdio>
6 
7 // Generic helper definitions for shared library support
8 #if defined _WIN32 || defined __CYGWIN__
9 # define WAI_HELPER_DLL_IMPORT __declspec(dllimport)
10 # define WAI_HELPER_DLL_EXPORT __declspec(dllexport)
11 # define WAI_HELPER_DLL_LOCAL
12 #else
13 # if __GNUC__ >= 4
14 # define WAI_HELPER_DLL_IMPORT __attribute__((visibility("default")))
15 # define WAI_HELPER_DLL_EXPORT __attribute__((visibility("default")))
16 # define WAI_HELPER_DLL_LOCAL __attribute__((visibility("hidden")))
17 # else
18 # define WAI_HELPER_DLL_IMPORT
19 # define WAI_HELPER_DLL_EXPORT
20 # define WAI_HELPER_DLL_LOCAL
21 # endif
22 #endif
23 
24 // Now we use the generic helper definitions above to define WAI_API and WAI_LOCAL.
25 // WAI_API is used for the public API symbols. It either DLL imports or DLL exports (or does nothing for static build)
26 // WAI_LOCAL is used for non-api symbols.
27 
28 #ifdef WAI_DLL // defined if WAI is compiled as a DLL
29 # ifdef WAI_DLL_EXPORTS // defined if we are building the WAI DLL (instead of using it)
30 # define WAI_API WAI_HELPER_DLL_EXPORT
31 # else
32 # define WAI_API WAI_HELPER_DLL_IMPORT
33 # endif // WAI_DLL_EXPORTS
34 # define WAI_LOCAL WAI_HELPER_DLL_LOCAL
35 #else // WAI_DLL is not defined: this means WAI is a static lib.
36 # define WAI_API
37 # define WAI_LOCAL
38 #endif // WAI_DLL
39 
40 #ifdef __APPLE__
41 # include <TargetConditionals.h>
42 # if TARGET_OS_IOS
43 # define WAI_OS_MACIOS
44 # else
45 # define WAI_OS_MACOS
46 # endif
47 #elif defined(ANDROID) || defined(ANDROID_NDK)
48 # include <android/log.h>
49 # define WAI_OS_ANDROID
50 #elif defined(_WIN32)
51 # define WAI_OS_WINDOWS
52 # define STDCALL __stdcall
53 #elif defined(linux) || defined(__linux) || defined(__linux__)
54 # define WAI_OS_LINUX
55 #else
56 # error "WAI has not been ported to this OS"
57 #endif
58 
59 //typedef void (*DebugLogCallback)(const char* str);
60 //void registerDebugCallback(DebugLogCallback callback);
61 //void WAI_API WAI_LOG(const char* format, ...);
62 
63 #ifdef WAI_BUILD_DEBUG
64 # define wai_assert(expression) \
65  if (!(expression)) { *(int*)0 = 0; }
66 #else
67 # define wai_assert(expression)
68 #endif
69 
70 #endif