@@ -54,6 +54,8 @@ add_library(lslobj OBJECT
54
54
src/lsl_outlet_c.cpp
55
55
src/lsl_streaminfo_c.cpp
56
56
src/lsl_xml_element_c.cpp
57
+ src/netinterfaces.h
58
+ src/netinterfaces.cpp
57
59
src/portable_archive/portable_archive_exception.hpp
58
60
src/portable_archive/portable_archive_includes.hpp
59
61
src/portable_archive/portable_iarchive.hpp
@@ -129,30 +131,32 @@ add_library(lslboost OBJECT
129
131
lslboost/libs/chrono/src/chrono.cpp
130
132
lslboost/serialization_objects.cpp
131
133
)
132
- if ( UNIX )
133
- target_sources ( lslboost PRIVATE
134
- lslboost/libs/thread/src/pthread/once.cpp
135
- lslboost/libs/thread/src/pthread/thread.cpp
136
- )
137
- find_package ( Threads REQUIRED )
138
- target_link_libraries ( lslboost PUBLIC Threads::Threads )
139
- target_compile_features ( lslboost PUBLIC cxx_std_11 cxx_lambda_init_captures )
140
- else () # WIN32
141
- target_sources ( lslboost PRIVATE
142
- lslboost/libs/thread/src/win32/thread.cpp
143
- lslboost/libs/thread/src/win32/tss_dll.cpp
144
- lslboost/libs/thread/src/win32/tss_pe.cpp
145
- )
146
- target_link_libraries ( lslboost PRIVATE
147
- bcrypt
148
- $< $< BOOL: ${MINGW} > :wsock32 ws2_32 winmm >
134
+
135
+ if ( UNIX )
136
+ include ( CheckSymbolExists )
137
+ # look for clock_gettime, if not we need to link against librt
138
+ check_symbol_exists ( clock_gettime time.h HAS_GETTIME )
139
+ if ( NOT HAS_GETTIME )
140
+ set ( NEEDS_LIBRT ON CACHE INTERNAL "Link to librt" )
141
+ endif ( )
142
+ endif ()
143
+
144
+ find_package ( Threads REQUIRED )
145
+ target_link_libraries ( lslboost
146
+ PUBLIC
147
+ Threads::Threads
148
+ PRIVATE
149
+ $< $< PLATFORM_ID:Windows > : bcrypt>
150
+ $< $< PLATFORM_ID:Windows > :iphlpapi >
149
151
)
150
- endif ( )
152
+ target_compile_features ( lslboost PUBLIC cxx_std_11 cxx_lambda_init_captures )
151
153
152
154
target_compile_definitions (lslboost
153
155
PUBLIC
154
156
BOOST_ALL_NO_LIB
157
+ BOOST_ASIO_STANDALONE
155
158
BOOST_ASIO_SEPARATE_COMPILATION
159
+ BOOST_THREAD_DONT_PROVIDE_INTERRUPTIONS
156
160
$< $< PLATFORM_ID:Windows> :_WIN32_WINNT=${LSL_WINVER} >
157
161
PRIVATE
158
162
$< $< PLATFORM_ID:Windows> :BOOST_THREAD_BUILD_DLL>
@@ -166,6 +170,7 @@ target_link_libraries(lslobj
166
170
lslboost
167
171
PUBLIC
168
172
$< $< AND:$< BOOL:${LSL_DEBUGLOG} > ,$< PLATFORM_ID:Linux> > :dl>
173
+ $< $< BOOL:${NEEDS_LIBRT} > :rt>
169
174
)
170
175
target_include_directories (lslobj
171
176
PUBLIC $< BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR} /include>
@@ -193,17 +198,25 @@ if(LSL_BUILD_STATIC)
193
198
add_library (lsl-static STATIC src/buildinfo.cpp )
194
199
target_compile_definitions (lsl-static PRIVATE LSL_LIBRARY_INFO_STR= "${LSL_VERSION_INFO} /link:static" )
195
200
target_link_libraries (lsl-static PUBLIC lslobj PRIVATE lslboost )
201
+ list (APPEND LSL_EXPORT_TARGETS lsl-static )
196
202
# for LSL_CPP_API export header
197
203
target_compile_definitions (lsl-static PUBLIC LIBLSL_STATIC )
198
204
endif ()
199
205
200
206
if (LSL_FORCE_FANCY_LIBNAME )
201
- set (CMAKE_DEBUG_POSTFIX "-debug" )
202
207
math (EXPR lslplatform "8 * ${CMAKE_SIZEOF_VOID_P} " )
203
208
set_target_properties (lsl PROPERTIES
204
209
PREFIX ""
205
210
OUTPUT_NAME "liblsl${lslplatform} "
211
+ DEBUG_POSTFIX "-debug"
212
+ )
213
+ if (LSL_BUILD_STATIC )
214
+ set_target_properties (lsl-static PROPERTIES
215
+ PREFIX ""
216
+ OUTPUT_NAME "liblsl${lslplatform} -static"
217
+ DEBUG_POSTFIX "-debug"
206
218
)
219
+ endif ()
207
220
endif ()
208
221
209
222
if (LSL_UNIXFOLDERS )
0 commit comments