]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
MSYS2: automatically copy dlls as part of build
authorTimePath <andrew.hardaker1995@gmail.com>
Sat, 29 Jul 2017 10:28:12 +0000 (20:28 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sat, 29 Jul 2017 10:28:12 +0000 (20:28 +1000)
CMakeLists.txt
contrib/CMakeLists.txt
plugins/CMakeLists.txt
radiant/CMakeLists.txt

index 78efba947a1ca4b171924105d550179342932979..626e15da7b6cc252492ad906a933d9325a8345b0 100644 (file)
@@ -105,6 +105,16 @@ endif ()
 include_directories("${PROJECT_SOURCE_DIR}/include")
 include_directories("${PROJECT_SOURCE_DIR}/libs")
 
 include_directories("${PROJECT_SOURCE_DIR}/include")
 include_directories("${PROJECT_SOURCE_DIR}/libs")
 
+macro(copy_dlls target)
+    if (WIN32)
+        add_custom_command(TARGET ${target} POST_BUILD
+            COMMAND bash
+            ARGS -c "ldd '$<TARGET_FILE:${target}>' | grep -v /c/Windows | awk '{ print $1 }' | while read dll; do cp \"$(which $dll)\" '${PROJECT_BINARY_DIR}'; done"
+            VERBATIM
+        )
+    endif ()
+endmacro()
+
 #-----------------------------------------------------------------------
 # Libraries
 #-----------------------------------------------------------------------
 #-----------------------------------------------------------------------
 # Libraries
 #-----------------------------------------------------------------------
index 7899526fd03405306101ef6a3e41f869beba4d47..9802014614cb89f3f5f4319eaaff4308518329c5 100644 (file)
@@ -5,6 +5,7 @@ macro(radiant_plugin name)
     message(STATUS "Found Plugin ${name}")
     add_library(${name} MODULE ${ARGN})
     add_dependencies(plugins ${name})
     message(STATUS "Found Plugin ${name}")
     add_library(${name} MODULE ${ARGN})
     add_dependencies(plugins ${name})
+    copy_dlls(${name})
 endmacro()
 
 add_subdirectory(bobtoolz)
 endmacro()
 
 add_subdirectory(bobtoolz)
index 134902e490d15d204485d65f2380917430a303e6..bc9fcad327271775b40df4d48273012a01c17650 100644 (file)
@@ -5,6 +5,7 @@ macro(radiant_plugin name)
     message(STATUS "Found Module ${name}")
     add_library(${name} MODULE ${ARGN})
     add_dependencies(modules ${name})
     message(STATUS "Found Module ${name}")
     add_library(${name} MODULE ${ARGN})
     add_dependencies(modules ${name})
+    copy_dlls(${name})
 endmacro()
 
 add_subdirectory(archivepak)
 endmacro()
 
 add_subdirectory(archivepak)
index 958384cca45818b4b847e0f1d1baa9f44757922c..287cc951695f4ed0b7280f20d0e4dd455b530c7e 100644 (file)
@@ -128,3 +128,5 @@ target_link_libraries(radiant
 if (X11_LIBRARIES)
     target_link_libraries(radiant ${X11_LIBRARIES})
 endif ()
 if (X11_LIBRARIES)
     target_link_libraries(radiant ${X11_LIBRARIES})
 endif ()
+
+copy_dlls(radiant)