Skip to content

Commit fbd414f

Browse files
committed
Update CMakeLists.txt for liblsl search and MinGW dll copy
1 parent 95607ab commit fbd414f

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,15 @@ else()
5858
if(LSL_INSTALL_ROOT)
5959
list(APPEND _lsl_hints "${LSL_INSTALL_ROOT}")
6060
endif()
61-
# Common development layout hints
61+
# Common development layout hints (including CLion cmake-build-* directories)
6262
string(TOLOWER "${CMAKE_BUILD_TYPE}" _build_type_lower)
63+
if(MSVC)
64+
set(_clion_build_dir "cmake-build-${_build_type_lower}-visual-studio")
65+
else()
66+
set(_clion_build_dir "cmake-build-${_build_type_lower}")
67+
endif()
6368
foreach(_root IN ITEMS "../liblsl" "../../LSL/liblsl")
64-
foreach(_build IN ITEMS "build" "cmake-build-${_build_type_lower}")
69+
foreach(_build IN ITEMS "build" "${_clion_build_dir}")
6570
list(APPEND _lsl_hints "${CMAKE_CURRENT_LIST_DIR}/${_root}/${_build}/install")
6671
endforeach()
6772
endforeach()
@@ -323,6 +328,24 @@ elseif(APPLE)
323328
endif()
324329
endif()
325330

331+
# =============================================================================
332+
# MinGW Runtime Deployment
333+
# Copy MinGW runtime DLLs so executables work outside the build environment
334+
# =============================================================================
335+
if(MINGW)
336+
get_filename_component(MINGW_BIN_DIR "${CMAKE_CXX_COMPILER}" DIRECTORY)
337+
set(MINGW_RUNTIME_DLLS
338+
"${MINGW_BIN_DIR}/libgcc_s_seh-1.dll"
339+
"${MINGW_BIN_DIR}/libstdc++-6.dll"
340+
"${MINGW_BIN_DIR}/libwinpthread-1.dll"
341+
)
342+
foreach(_dll ${MINGW_RUNTIME_DLLS})
343+
if(EXISTS "${_dll}")
344+
install(FILES "${_dll}" DESTINATION "${INSTALL_BINDIR}")
345+
endif()
346+
endforeach()
347+
endif()
348+
326349
# =============================================================================
327350
# macOS Code Signing
328351
# =============================================================================

0 commit comments

Comments
 (0)