Przeglądaj źródła

OSX Load Plugins Issue
Dynamic loading of libraries was failing in eclcc on OSX

Signed-off-by: Gordon Smith <gordonjsmith@gmail.com>

Gordon Smith 13 lat temu
rodzic
commit
79ec042ef8
3 zmienionych plików z 31 dodań i 10 usunięć
  1. 22 10
      cmake_modules/FindBINUTILS.cmake
  2. 4 0
      ecl/hqlcpp/hqlres.cpp
  3. 5 0
      system/include/platform.h

+ 22 - 10
cmake_modules/FindBINUTILS.cmake

@@ -37,17 +37,29 @@ IF (NOT BINUTILS_FOUND)
   if (USE_NATIVE_LIBRARIES)
     FIND_PATH (BINUTILS_INCLUDE_DIR NAMES bfd.h)
     FIND_LIBRARY (BINUTILS_LIBRARIES NAMES bfd)
-    FIND_LIBRARY (IBERTY_LIBRARIES NAMES iberty_pic)
-    FIND_LIBRARY (IBERTY_LIBRARIES NAMES iberty)
+    if ( NOT APPLE )
+      FIND_LIBRARY (IBERTY_LIBRARIES NAMES iberty_pic)
+      FIND_LIBRARY (IBERTY_LIBRARIES NAMES iberty)
+    endif ( NOT APPLE )
   endif()
   include(FindPackageHandleStandardArgs)
-  find_package_handle_standard_args(BinUtils DEFAULT_MSG
-    BINUTILS_LIBRARIES
-    BINUTILS_INCLUDE_DIR
-    IBERTY_LIBRARIES
-  )
-  IF (BINUTILS_FOUND)
-    set (BINUTILS_LIBRARIES ${BINUTILS_LIBRARIES} ${IBERTY_LIBRARIES} )
-  ENDIF()
+  if ( NOT APPLE )
+    find_package_handle_standard_args(BinUtils DEFAULT_MSG
+      BINUTILS_LIBRARIES
+      BINUTILS_INCLUDE_DIR
+      IBERTY_LIBRARIES
+    )
+    IF (BINUTILS_FOUND)
+      set (BINUTILS_LIBRARIES ${BINUTILS_LIBRARIES} ${IBERTY_LIBRARIES} )
+    ENDIF()
+  else ( NOT APPLE )
+    find_package_handle_standard_args(BinUtils DEFAULT_MSG
+      BINUTILS_LIBRARIES
+      BINUTILS_INCLUDE_DIR
+    )
+    IF (BINUTILS_FOUND)
+      set (BINUTILS_LIBRARIES ${BINUTILS_LIBRARIES} )
+    ENDIF()
+  endif ( NOT APPLE )
   MARK_AS_ADVANCED(BINUTILS_INCLUDE_DIR BINUTILS_LIBRARIES)
 ENDIF()

+ 4 - 0
ecl/hqlcpp/hqlres.cpp

@@ -415,7 +415,11 @@ void ResourceManager::flush(const char *filename, bool flushText, bool target64b
         bfd_init ();
         bfd_set_default_target(target64bit ? "x86_64-unknown-linux-gnu" : "x86_32-unknown-linux-gnu");
         const bfd_arch_info_type *temp_arch_info = bfd_scan_arch ("i386");
+#if defined __APPLE__
+        file = bfd_openw(filename, NULL);//MORE: Quick fix to get working on OSX
+#else
         file = bfd_openw(filename, target64bit ? "elf64-x86-64" : NULL);//MORE: Test on 64 bit to see if we can always pass NULL
+#endif
         verifyex(file);
         verifyex(bfd_set_arch_mach(file, temp_arch_info->arch, temp_arch_info->mach));
         verifyex(bfd_set_start_address(file, 0));

+ 5 - 0
system/include/platform.h

@@ -411,8 +411,13 @@ typedef int socklen_t;
 // #define  inline
 
 #define SharedObjectPrefix          "lib"
+#if defined (__APPLE__)
+#define SharedObjectExtension       ".dylib"
+#define LibraryExtension            ".dylib"
+#else
 #define SharedObjectExtension       ".so"
 #define LibraryExtension            ".so"
+#endif
 #define ProcessExtension            ""
 #define GetSharedProcedure(h,name)  dlsym(h,(char *)name)
 #define LoadSucceeded(h)            (h != NULL)