|
1 | | -/* |
2 | | - ============================================================================== |
3 | | -
|
4 | | - blueprint.cpp |
5 | | - Created: 26 Nov 2018 3:19:03pm |
6 | | -
|
7 | | - ============================================================================== |
8 | | -*/ |
9 | | - |
10 | 1 | #ifdef BLUEPRINT_H_INCLUDED |
11 | | - /* When you add this cpp file to your project, you mustn't include it in a file where you've |
12 | | - already included any other headers - just put it inside a file on its own, possibly with your config |
13 | | - flags preceding it, but don't include anything else. That also includes avoiding any automatic prefix |
14 | | - header files that the compiler may be using. |
15 | | - */ |
16 | | - #error "Incorrect use of the Blueprint cpp file" |
| 2 | + /** When you add this cpp file to your project, you mustn't include it in a file where you've |
| 3 | + already included any other headers - just put it inside a file on its own, possibly with your config |
| 4 | + flags preceding it, but don't include anything else. That also includes avoiding any automatic prefix |
| 5 | + header files that the compiler may be using. |
| 6 | + */ |
| 7 | + #error "Incorrect use of the Blueprint cpp file!" |
17 | 8 | #endif |
18 | 9 |
|
19 | | -/* We're careful to include the duktape source files before the module header |
20 | | - * file because `duktape.c` sets certain preprocessor definitions that enable |
21 | | - * necessary features in the duktape header. We need those defines to preempt |
22 | | - * the loading of the duktape header. This also, therefore, is the place for |
23 | | - * custom preprocessor definitions. |
24 | | - * |
25 | | - * We force Duktape to use a time provider on Windows that is compatible with |
26 | | - * Windows 7 SP1. It looks like W7SP1 is quite happy with plugins built with |
27 | | - * the 8.1 SDK, but the GetSystemTimePreciseAsFileTime() call used in here is |
28 | | - * just not supported without the 8.1 dll available. |
29 | | - */ |
30 | | -#if defined (_WIN32) || defined (_WIN64) |
31 | | -#define DUK_USE_DATE_NOW_WINDOWS 1 |
32 | | -#endif |
| 10 | +//============================================================================== |
| 11 | +#define JUCE_CORE_INCLUDE_NATIVE_HEADERS 1 |
33 | 12 |
|
34 | | -/* |
35 | | - * For whatever reason it is necessary to define this to resolve errors caused by both |
36 | | - * duktape and juce including parts of the winsock2 API. There may be a better way to |
37 | | - * resolve this. |
38 | | - */ |
39 | | -#if defined (_WIN32) || defined (_WIN64) |
40 | | -#define _WINSOCKAPI_ |
41 | | -#endif |
42 | | - |
43 | | -// Disable compiler warnings for external source files (duktape & yoga) |
44 | | -#if _MSC_VER |
45 | | - #pragma warning(push) |
46 | | - #pragma warning(disable : 4018) // signed/unsigned mismatch |
47 | | - #pragma warning(disable : 4127) // conditional expression is constant |
48 | | - #pragma warning(disable : 4244) // possible loss of data |
49 | | - #pragma warning(disable : 4505) // unreferenced local function |
50 | | - #pragma warning(disable : 4611) // object destruction is non-portable |
51 | | - #pragma warning(disable : 4702) // unreachable code |
52 | | -#elif __clang__ |
53 | | - #pragma clang diagnostic push |
54 | | - #pragma clang diagnostic ignored "-Wextra-semi" |
55 | | - #pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" |
56 | | - #pragma clang diagnostic ignored "-Wswitch-enum" |
57 | | - #pragma clang diagnostic ignored "-Wshorten-64-to-32" |
58 | | - #pragma clang diagnostic ignored "-Wshadow-field-in-constructor" |
59 | | - #pragma clang diagnostic ignored "-Wsign-conversion" |
60 | | - #pragma clang diagnostic ignored "-Wused-but-marked-unused" |
61 | | - #pragma clang diagnostic ignored "-Wformat-nonliteral" |
62 | | - #if __clang_major__ > 10 |
63 | | - #pragma clang diagnostic ignored "-Wc++98-compat-extra-semi" |
64 | | - #pragma clang diagnostic ignored "-Wimplicit-int-conversion" |
65 | | - #pragma clang diagnostic ignored "-Wimplicit-float-conversion" |
66 | | - #else |
67 | | - #pragma clang diagnostic ignored "-Wconversion" |
68 | | - #endif |
69 | | -#elif __GNUC__ |
70 | | - #pragma GCC diagnostic push |
71 | | - #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" |
72 | | - #pragma GCC diagnostic ignored "-Wsign-conversion" |
73 | | - #pragma GCC diagnostic ignored "-Wswitch-enum" |
74 | | - #pragma GCC diagnostic ignored "-Wunused-variable" |
75 | | - #pragma GCC diagnostic ignored "-Wredundant-decls" |
76 | | -#endif |
| 13 | +#undef DUK_COMPILING_DUKTAPE |
| 14 | +#define DUK_COMPILING_DUKTAPE 1 |
77 | 15 |
|
| 16 | +//============================================================================== |
| 17 | +#include "blueprint.h" |
78 | 18 |
|
79 | | -// We rely on the JUCE_DEBUG macro in duk_config.h at the moment to determine |
80 | | -// when we enable duktape debug features. This is a bit of a hack to make this |
81 | | -// work. We should be able to do better and may do so once we enable custom duktape |
82 | | -// configs. |
83 | | -#include <juce_core/system/juce_TargetPlatform.h> |
| 19 | +//============================================================================== |
| 20 | +#include "internal/BeginIgnoringThirdPartyWarnings.h" |
84 | 21 |
|
85 | | -#include "duktape/src-noline/duktape.c" |
86 | | -#include "duktape/extras/console/duk_console.c" |
| 22 | +extern "C" |
| 23 | +{ |
| 24 | + #undef DUK_COMPILING_DUKTAPE |
| 25 | + #include "duktape/src-noline/duktape.c" |
| 26 | + #include "duktape/extras/console/duk_console.c" |
87 | 27 |
|
88 | | -#if defined (_WIN32) || defined (_WIN64) |
| 28 | + #if JUCE_WINDOWS |
89 | 29 | #include "duktape/examples/debug-trans-socket/duk_trans_socket_windows.c" |
90 | | -#else |
| 30 | + #else |
91 | 31 | #include "duktape/examples/debug-trans-socket/duk_trans_socket_unix.c" |
92 | | -#endif |
93 | | - |
94 | | -#include "blueprint.h" |
| 32 | + #endif |
| 33 | +} |
95 | 34 |
|
96 | 35 | #include "yoga/yoga/log.cpp" |
97 | 36 | #include "yoga/yoga/event/event.cpp" |
|
105 | 44 | #include "yoga/yoga/YGValue.cpp" |
106 | 45 | #include "yoga/yoga/Yoga.cpp" |
107 | 46 |
|
108 | | -// Enable compiler warnings |
109 | | -#if _MSC_VER |
110 | | - #pragma warning (pop) |
111 | | -#elif __clang__ |
112 | | - #pragma clang diagnostic pop |
113 | | -#elif __GNUC__ |
114 | | - #pragma GCC diagnostic pop |
115 | | -#endif |
| 47 | +#include "internal/EndIgnoringThirdPartyWarnings.h" |
116 | 48 |
|
| 49 | +//============================================================================== |
117 | 50 | #include "core/blueprint_AppHarness.cpp" |
118 | 51 | #include "core/blueprint_EcmascriptEngine.cpp" |
119 | | - |
120 | | -#if JUCE_MODULE_AVAILABLE_juce_audio_processors |
121 | | - #include "core/blueprint_GenericEditor.cpp" |
122 | | -#endif |
123 | | - |
124 | 52 | #include "core/blueprint_ReactApplicationRoot.cpp" |
125 | 53 | #include "core/blueprint_ShadowView.cpp" |
126 | 54 | #include "core/blueprint_TextShadowView.cpp" |
127 | 55 | #include "core/blueprint_View.cpp" |
128 | 56 | #include "core/blueprint_ViewManager.cpp" |
129 | 57 | #include "core/blueprint_ScrollView.cpp" |
130 | 58 |
|
131 | | -#ifdef BLUEPRINT_INCLUDE_TESTS |
132 | | -#include "tests/blueprint_EcmascriptEngineTests.cpp" |
| 59 | +#if JUCE_MODULE_AVAILABLE_juce_audio_processors |
| 60 | + #include "core/blueprint_GenericEditor.cpp" |
| 61 | +#endif |
| 62 | + |
| 63 | +#if BLUEPRINT_INCLUDE_UNIT_TESTS |
| 64 | + #include "tests/blueprint_EcmascriptEngineTests.cpp" |
133 | 65 | #endif |
0 commit comments