refactor MIDISceneChange color property addition by moving it into SceneChange to...
[ardour.git] / libs / ardour / control_protocol_manager.cc
index d9cefb44f27eec403f08838b19e405babe2c4cdc..fdac48e731124aa8620be3913c68bb239c8c6d6e 100644 (file)
@@ -30,7 +30,7 @@
 #include "ardour/debug.h"
 #include "ardour/control_protocol_manager.h"
 
-#include "ardour/control_protocol_search_path.h"
+#include "ardour/search_paths.h"
 
 
 using namespace ARDOUR;
@@ -245,14 +245,37 @@ ControlProtocolManager::discover_control_protocols ()
 {
        vector<std::string> cp_modules;
 
+#ifdef COMPILER_MSVC
+   /**
+    * Different build targets (Debug / Release etc) use different versions
+    * of the 'C' runtime (which can't be 'mixed & matched'). Therefore, in
+    * case the supplied search path contains multiple version(s) of a given
+    * module, only select the one(s) which match the current build target
+    */
+       #if defined (_DEBUG)
+               Glib::PatternSpec dll_extension_pattern("*D.dll");
+       #elif defined (RDC_BUILD)
+               Glib::PatternSpec dll_extension_pattern("*RDC.dll");
+       #elif defined (_WIN64)
+               Glib::PatternSpec dll_extension_pattern("*64.dll");
+       #else
+               Glib::PatternSpec dll_extension_pattern("*32.dll");
+       #endif
+#else
+       Glib::PatternSpec dll_extension_pattern("*.dll");
+#endif
+
        Glib::PatternSpec so_extension_pattern("*.so");
        Glib::PatternSpec dylib_extension_pattern("*.dylib");
 
-       find_matching_files_in_search_path (control_protocol_search_path (),
-                                           so_extension_pattern, cp_modules);
+       find_files_matching_pattern (cp_modules, control_protocol_search_path (),
+                                    dll_extension_pattern);
+
+       find_files_matching_pattern (cp_modules, control_protocol_search_path (),
+                                    so_extension_pattern);
 
-       find_matching_files_in_search_path (control_protocol_search_path (),
-                                           dylib_extension_pattern, cp_modules);
+       find_files_matching_pattern (cp_modules, control_protocol_search_path (),
+                                    dylib_extension_pattern);
 
        DEBUG_TRACE (DEBUG::ControlProtocols, 
                     string_compose (_("looking for control protocols in %1\n"), control_protocol_search_path().to_string()));