File tree 2 files changed +51
-0
lines changed
2 files changed +51
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ set(BRENDER_OBJECTS)
20
20
21
21
foreach (target ${BRENDER_TARGETS} )
22
22
add_subdirectory (${target} )
23
+ target_compile_definitions (${target} PRIVATE -DBR_EXPORTS=1)
23
24
list (APPEND BRENDER_OBJECTS "$<TARGET_OBJECTS:${target} >" )
24
25
endforeach ()
25
26
@@ -33,6 +34,15 @@ endforeach ()
33
34
##
34
35
add_library (brender)
35
36
37
+ get_target_property (target_type brender TYPE )
38
+ if (target_type STREQUAL SHARED_LIBRARY)
39
+ target_compile_definitions (brender-inc INTERFACE -DBR_BUILD_STATIC=0)
40
+ target_compile_definitions (brender-inc INTERFACE -DBR_BUILD_SHARED=1)
41
+ else ()
42
+ target_compile_definitions (brender-inc INTERFACE -DBR_BUILD_STATIC=1)
43
+ target_compile_definitions (brender-inc INTERFACE -DBR_BUILD_SHARED=0)
44
+ endif ()
45
+
36
46
##
37
47
# Link all the subtargets privately so our consumers don't inherit their
38
48
# includes, which pulls in DDI.
Original file line number Diff line number Diff line change 9
9
#ifndef _COMPILER_H_
10
10
#define _COMPILER_H_
11
11
12
+ /*
13
+ * Defined to 1 if built as a shared library.
14
+ */
15
+ #if !defined(BR_BUILD_SHARED )
16
+ #define BR_BUILD_SHARED 0
17
+ #endif
18
+
19
+ /*
20
+ * Defined to 1 if built as a static library.
21
+ */
22
+ #if !defined(BR_BUILD_STATIC )
23
+ #define BR_BUILD_STATIC 0
24
+ #endif
25
+
26
+ #if (!BR_BUILD_SHARED && !BR_BUILD_STATIC ) || (BR_BUILD_SHARED && BR_BUILD_STATIC )
27
+ #error Invalid linkage configuration
28
+ #endif
29
+
30
+ #if !defined(BR_EXPORTS )
31
+ #define BR_EXPORTS 0
32
+ #endif
33
+
12
34
#if defined(__H2INC__ )
13
35
typedef signed char int8_t ;
14
36
typedef signed short int16_t ;
@@ -218,6 +240,25 @@ typedef float br_float;
218
240
219
241
#define BR_STR (s ) #s
220
242
243
+ /*
244
+ * Handle static/shared library stuff.
245
+ */
246
+ #if BR_BUILD_SHARED
247
+ #define BR_API_EXPORT BR_DLL_EXPORT
248
+ #define BR_API_IMPORT BR_DLL_IMPORT
249
+ #endif
250
+
251
+ #if BR_BUILD_STATIC
252
+ #define BR_API_EXPORT
253
+ #define BR_API_IMPORT
254
+ #endif
255
+
256
+ #if BR_EXPORTS
257
+ #define BR_API BR_API_EXPORT
258
+ #else
259
+ #define BR_API BR_API_IMPORT
260
+ #endif
261
+
221
262
#if defined(__H2INC__ )
222
263
/*
223
264
* Avoid some tokens that masm chokes on
You can’t perform that action at this time.
0 commit comments