Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix build mac/windows
authorBruno Donassolo <donassolo@Brunos-MBP.home>
Fri, 16 Apr 2021 19:12:18 +0000 (21:12 +0200)
committerBruno Donassolo <bruno.donassolo@inria.fr>
Fri, 4 Jun 2021 11:42:15 +0000 (13:42 +0200)
examples/platforms/CMakeLists.txt
src/s4u/s4u_Engine.cpp

index 70bb080..67de03a 100644 (file)
@@ -4,4 +4,7 @@ foreach (platf routing_cluster)
   add_library       (${platf} SHARED ${platf}.cpp)
   target_link_libraries(${platf} simgrid)
   add_dependencies(platf_cpp ${platf})
+  set_target_properties(${platf}
+      PROPERTIES SUFFIX .so
+  )
 endforeach()
index a97f220..bc91b66 100644 (file)
@@ -23,7 +23,9 @@
 #include <simgrid/Exception.hpp>
 
 #include <algorithm>
+#ifndef _WIN32
 #include <dlfcn.h>
+#endif /* _WIN32 */
 #include <string>
 
 XBT_LOG_NEW_CATEGORY(s4u, "Log channels of the S4U (Simgrid for you) interface");
@@ -111,7 +113,10 @@ const std::vector<simgrid::kernel::resource::Model*>& Engine::get_all_models() c
 void Engine::load_platform(const std::string& platf) const
 {
   double start = xbt_os_time();
-  if (boost::algorithm::ends_with(platf, ".so")) {
+  if (boost::algorithm::ends_with(platf, ".so") or boost::algorithm::ends_with(platf, ".dylib")) {
+#ifdef _WIN32
+    xbt_die("loading platform through shared library isn't supported on windows");
+#else
     void* handle = dlopen(platf.c_str(), RTLD_LAZY);
     xbt_assert(handle, "Impossible to open platform file: %s", platf.c_str());
     typedef void (*load_fct_t)(const Engine&);
@@ -121,6 +126,7 @@ void Engine::load_platform(const std::string& platf) const
     xbt_assert(not dlsym_error, "Error: %s", dlsym_error);
     callable(*this);
     dlclose(handle);
+#endif /* _WIN32 */
   } else {
     parse_platform_file(platf);
   }