Revision: 76037
          http://sourceforge.net/p/brlcad/code/76037
Author:   starseeker
Date:     2020-06-05 19:11:32 +0000 (Fri, 05 Jun 2020)
Log Message:
-----------
Client codes need these definitions without including brlcad_config.h, and 
ideally shouldn't have to do their own configure tests either (historically 
they haven't needed to.)

Modified Paths:
--------------
    brlcad/trunk/CMakeLists.txt
    brlcad/trunk/include/common.h

Modified: brlcad/trunk/CMakeLists.txt
===================================================================
--- brlcad/trunk/CMakeLists.txt 2020-06-05 18:07:14 UTC (rev 76036)
+++ brlcad/trunk/CMakeLists.txt 2020-06-05 19:11:32 UTC (rev 76037)
@@ -1966,20 +1966,6 @@
   CONFIG_H_APPEND(BRLCAD "#define HAVE_WARN_UNUSED_RESULT_ATTRIBUTE 1\n")
 endif(HAVE_WARN_UNUSED_RESULT_ATTRIBUTE)
 
-# Check whether the compiler supports __attribute__((visibility ("default")))
-check_c_source_compiles(" __attribute__((visibility (\"default\"))) int 
*func(int *); int *func(int *v){(*v)-=1; return v;} int main(int argc, char 
*argv[]) {int v = 1; int *vp = func(&v); return *vp;}" 
HAVE_VISIBILITY_DEFAULT_ATTRIBUTE)
-if(HAVE_VISIBILITY_DEFAULT_ATTRIBUTE)
-  CONFIG_H_APPEND(BRLCAD "#define COMPILER_DLLEXPORT __attribute__ 
((visibility (\"default\")))\n")
-  CONFIG_H_APPEND(BRLCAD "#define COMPILER_DLLIMPORT __attribute__ 
((visibility (\"default\")))\n")
-endif(HAVE_VISIBILITY_DEFAULT_ATTRIBUTE)
-
-# Check whether the compiler supports __declspec(dllexport)
-check_c_source_compiles(" __declspec(dllexport) int *func(int *); int 
*func(int *v){(*v)-=1; return v;} int main(int argc, char *argv[]) {int v = 1; 
int *vp = func(&v); return *vp;}" HAVE_DECLSPEC_EXPORT_ATTRIBUTE)
-if(HAVE_DECLSPEC_EXPORT_ATTRIBUTE)
-  CONFIG_H_APPEND(BRLCAD "#define COMPILER_DLLEXPORT __declspec(dllexport)\n")
-  CONFIG_H_APPEND(BRLCAD "#define COMPILER_DLLIMPORT __declspec(dllimport)\n")
-endif(HAVE_DECLSPEC_EXPORT_ATTRIBUTE)
-
 # Silence check for unused arguments (used to silence clang warnings about
 # unused options on the command line). By default clang generates a lot of
 # warnings about such arguments, and we don't really care.

Modified: brlcad/trunk/include/common.h
===================================================================
--- brlcad/trunk/include/common.h       2020-06-05 18:07:14 UTC (rev 76036)
+++ brlcad/trunk/include/common.h       2020-06-05 19:11:32 UTC (rev 76037)
@@ -529,11 +529,14 @@
  * define them away so code including the *_EXPORT header logic won't
  * fail.
  */
-#ifndef COMPILER_DLLEXPORT
+#if defined(_MSC_VER)
+#  define COMPILER_DLLEXPORT __declspec(dllexport)
+#  define COMPILER_DLLIMPORT __declspec(dllimport)
+#elif defined(__GNUC__) || defined(__clang__)
+#  define COMPILER_DLLEXPORT __attribute__ ((visibility ("default")))
+#  define COMPILER_DLLIMPORT __attribute__ ((visibility ("default")))
+#else
 #  define COMPILER_DLLEXPORT
-#endif
-
-#ifndef COMPILER_DLLIMPORT
 #  define COMPILER_DLLIMPORT
 #endif
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to