File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,16 @@ project(
34
34
#set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO ON CACHE STRING "")
35
35
36
36
option (MRDOX_BUILD_TESTS "Build tests" ON )
37
+ option (MRDOX_BUILD_SHARED "Link shared" OFF )
38
+
39
+ if (MRDOX_BUILD_SHARED )
40
+ set (MRDOX_LINK_MODE SHARED )
41
+ set (MRDOX_LINK_MODE_DEFINITION -DMRDOX_SHARED_LINK )
42
+ else ()
43
+ set (MRDOX_LINK_MODE_DEFINITION -DMRDOX_STATIC_LINK )
44
+ endif ()
45
+
46
+
37
47
38
48
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
39
49
set (MRDOX_GCC ON )
@@ -84,7 +94,7 @@ file(GLOB_RECURSE LIB_SOURCES CONFIGURE_DEPENDS
84
94
source /lib/*.cpp
85
95
source /lib/*.natvis )
86
96
87
- add_library (mrdox-api ${LIB_INCLUDES} ${LIB_SOURCES} )
97
+ add_library (mrdox-api ${MRDOX_LINK_MODE} ${ LIB_INCLUDES} ${LIB_SOURCES} )
88
98
target_compile_features (mrdox-api PUBLIC cxx_std_20 )
89
99
target_include_directories (mrdox-api
90
100
PUBLIC
@@ -95,7 +105,7 @@ target_include_directories(mrdox-api
95
105
target_compile_definitions (
96
106
mrdox-api
97
107
PUBLIC
98
- -DMRDOX_STATIC_LINK
108
+ ${MRDOX_LINK_MODE_DEFINITION}
99
109
PRIVATE
100
110
-DMRDOX_LIB
101
111
)
Original file line number Diff line number Diff line change @@ -41,6 +41,13 @@ namespace mrdox {
41
41
# define MRDOX_VISIBLE
42
42
43
43
// (unknown)
44
+ #elif defined(__GNUC__)
45
+ # if defined(MRDOX_LIB) // building library
46
+ # define MRDOX_DECL
47
+ # else
48
+ # define MRDOX_DECL __attribute__ ((visibility(" default" )))
49
+ #endif
50
+ # define MRDOX_VISIBLE __attribute__ ((visibility(" default" )))
44
51
#else
45
52
# error unknown platform for dynamic linking
46
53
#endif
Original file line number Diff line number Diff line change 3
3
# See https://llvm.org/LICENSE.txt for license information.
4
4
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5
5
#
6
- # Copyright (c) 2023 Vinnie Falco ([email protected] )
6
+ # Copyright (c) 2023 Klemens Morgenstern ([email protected] )
7
7
#
8
8
# Official repository: https://github.com/cppalliance/mrdox
9
9
#
You can’t perform that action at this time.
0 commit comments