Changeset: 3806138c2668 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3806138c2668
Modified Files:
        CMakeLists.txt
        common/options/CMakeLists.txt
        common/options/monet_getopt.h
        common/options/monet_options.h
        common/utils/CMakeLists.txt
        common/utils/mcrypt.h
        common/utils/msabaoth.h
        common/utils/mutils.h
        common/utils/muuid.h
        monetdb_config.h.in
        tools/merovingian/daemon/CMakeLists.txt
Branch: cmake-fun
Log Message:

Change monet_options, mcrypt, mutils, muuid and msabaoth to shared libraries.


diffs (truncated from 407 to 300 lines):

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -178,15 +178,16 @@ set(PREFIX "${CMAKE_INSTALL_PREFIX}")
 set(EXEC_PREFIX "${CMAKE_INSTALL_PREFIX}")
 
 if(WIN32)
+       string(REPLACE "/" "\\\\" TRIMMED_INSTALL_PREFIX 
"${CMAKE_INSTALL_PREFIX}")
        set(BINDIR "${CMAKE_INSTALL_PREFIX}/bin")
-       set(BIN_DIR "${CMAKE_INSTALL_PREFIX}\\\\bin")
+       set(BIN_DIR "${TRIMMED_INSTALL_PREFIX}\\\\bin")
        set(DATADIR "${CMAKE_INSTALL_PREFIX}/share")
-       set(DATA_DIR "${CMAKE_INSTALL_PREFIX}\\\\share")
+       set(DATA_DIR "${TRIMMED_INSTALL_PREFIX}\\\\share")
        set(INCLUDEDIR "${CMAKE_INSTALL_PREFIX}/include")
        set(LIBDIR "${CMAKE_INSTALL_PREFIX}/lib")
-       set(LIB_DIR "${CMAKE_INSTALL_PREFIX}\\\\lib")
+       set(LIB_DIR "${TRIMMED_INSTALL_PREFIX}\\\\lib")
        set(LOCALSTATEDIR "${CMAKE_INSTALL_PREFIX}/var")
-       set(LOCALSTATE_DIR "${CMAKE_INSTALL_PREFIX}\\\\var")
+       set(LOCALSTATE_DIR "${TRIMMED_INSTALL_PREFIX}\\\\var")
 else()
        include(GNUInstallDirs REQUIRED)
        set(BINDIR "${CMAKE_INSTALL_FULL_BINDIR}")
@@ -760,7 +761,6 @@ endif()
 set(DIR_SEP      "'${OS_DIRSEP}'")
 set(DIR_SEP_STR  ${OS_DIRSEP})
 set(PATH_SEP     "'${OS_PATHSEP}'")
-set(PATH_SEP_STR ${OS_PATHSEP})
 set(SO_PREFIX    "${CMAKE_SHARED_LIBRARY_PREFIX}")
 set(SO_EXT       "${CMAKE_SHARED_LIBRARY_SUFFIX}")
 
diff --git a/common/options/CMakeLists.txt b/common/options/CMakeLists.txt
--- a/common/options/CMakeLists.txt
+++ b/common/options/CMakeLists.txt
@@ -6,6 +6,8 @@
 # Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
 #]]
 
-add_library(moptions STATIC monet_options.c monet_options.h monet_getopt.h)
-set_target_properties(moptions PROPERTIES POSITION_INDEPENDENT_CODE ON)
+add_library(moptions SHARED monet_options.c monet_options.h monet_getopt.h)
+target_compile_definitions(moptions PRIVATE LIBMOPTIONS LIBGDK LIBMAPI)
+
+install(TARGETS moptions DESTINATION ${LIBDIR})
 install(FILES monet_options.h DESTINATION ${INCLUDEDIR}/monetdb)
diff --git a/common/options/monet_getopt.h b/common/options/monet_getopt.h
--- a/common/options/monet_getopt.h
+++ b/common/options/monet_getopt.h
@@ -46,13 +46,26 @@
 extern "C" {
 #endif
 
+#ifndef moptions_export
+/* avoid using "#ifdef WIN32" so that this file does not need our config.h */
+#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__)
+#if !defined(LIBMOPTIONS) && !defined(LIBGDK) && !defined(LIBMAPI)
+#define moptions_export extern __declspec(dllimport)
+#else
+#define moptions_export extern __declspec(dllexport)
+#endif
+#else
+#define moptions_export extern
+#endif
+#endif
+
 /* For communication from `getopt' to the caller.
    When `getopt' finds an option that takes an argument,
    the argument value is returned here.
    Also, when `ordering' is RETURN_IN_ORDER,
    each non-option ARGV-element is returned here.  */
 
-       extern char *optarg;
+       moptions_export char *optarg;
 
 /* Index in ARGV of the next element to be scanned.
    This is used for communication to and from the caller
@@ -66,16 +79,16 @@ extern "C" {
    Otherwise, `optind' communicates from one call to the next
    how much of ARGV has been scanned so far.  */
 
-       extern int optind;
+       moptions_export int optind;
 
 /* Callers store zero here to inhibit the error message `getopt' prints
    for unrecognized options.  */
 
-       extern int opterr;
+       moptions_export int opterr;
 
 /* Set to an option character which was unrecognized.  */
 
-       extern int optopt;
+       moptions_export int optopt;
 
 #ifndef __need_getopt
 /* Describe the long-named options requested by the application.
@@ -150,28 +163,28 @@ extern "C" {
    differences in the consts, in stdlib.h.  To avoid compilation
    errors, only prototype getopt for the GNU C library.  */
 #ifndef HAVE_GETOPT
-       extern int getopt(int __argc__, char *const *__argv__, const char 
*__shortopts);
+       moptions_export int getopt(int __argc__, char *const *__argv__, const 
char *__shortopts);
 #endif
 # else                         /* not __GNU_LIBRARY__ */
 #ifndef HAVE_GETOPT
-       extern int getopt();
+       moptions_export int getopt();
 #endif
 # endif                                /* __GNU_LIBRARY__ */
 
 # ifndef __need_getopt
-       extern int getopt_long(int __argc__, char *const *__argv__, const char 
*__shortopts, const struct option *__longopts, int *__longind);
-       extern int getopt_long_only(int __argc__, char *const *__argv__, const 
char *__shortopts, const struct option *__longopts, int *__longind);
+       moptions_export int getopt_long(int __argc__, char *const *__argv__, 
const char *__shortopts, const struct option *__longopts, int *__longind);
+       moptions_export int getopt_long_only(int __argc__, char *const 
*__argv__, const char *__shortopts, const struct option *__longopts, int 
*__longind);
 
 /* Internal only.  Users should not call this directly.  */
        extern int _getopt_internal(int __argc__, char *const *__argv__, const 
char *__shortopts, const struct option *__longopts, int *__longind, int 
__long_only);
 # endif
 #else                          /* not __STDC__ */
 #ifndef HAVE_GETOPT
-       extern int getopt();
+       moptions_export int getopt();
 #endif
 # ifndef __need_getopt
-       extern int getopt_long();
-       extern int getopt_long_only();
+       moptions_export int getopt_long();
+       moptions_export int getopt_long_only();
 
        extern int _getopt_internal();
 # endif
diff --git a/common/options/monet_options.h b/common/options/monet_options.h
--- a/common/options/monet_options.h
+++ b/common/options/monet_options.h
@@ -25,27 +25,40 @@ typedef struct opt {
 extern "C" {
 #endif
 
+#ifndef moptions_export
+/* avoid using "#ifdef WIN32" so that this file does not need our config.h */
+#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__)
+#if !defined(LIBMOPTIONS) && !defined(LIBGDK) && !defined(LIBMAPI)
+#define moptions_export extern __declspec(dllimport)
+#else
+#define moptions_export extern __declspec(dllexport)
+#endif
+#else
+#define moptions_export extern
+#endif
+#endif
+
 /* mo_print_options will print the option set on stderr */
-extern void mo_print_options(opt *set, int setlen);
+moptions_export void mo_print_options(opt *set, int setlen);
 
 /* mo_find_option, finds the option with the given name in the option set
    (set,setlen). */
-extern char *mo_find_option(opt *set, int setlen, const char *name);
+moptions_export char *mo_find_option(opt *set, int setlen, const char *name);
 
 /* mo_system_config will add the options from the system config file
    (returns the new setlen) */
-extern int mo_system_config(opt **Set, int setlen);
+moptions_export int mo_system_config(opt **Set, int setlen);
 
 /* mo_builtin_settings, will place the builtin settings into a new
    option set (returns the length of this set). */
-extern int mo_builtin_settings(opt **Set);
+moptions_export int mo_builtin_settings(opt **Set);
 
 /* mo_add_option will add a single option to the option set
    (returns new length) */
-extern int mo_add_option(opt **Set, int setlen, opt_kind kind, const char 
*name, const char *value);
+moptions_export int mo_add_option(opt **Set, int setlen, opt_kind kind, const 
char *name, const char *value);
 
 /* mo_free_options will free the resouces take by the options set */
-extern void mo_free_options(opt *set, int setlen);
+moptions_export void mo_free_options(opt *set, int setlen);
 
 #ifdef __cplusplus
 }
diff --git a/common/utils/CMakeLists.txt b/common/utils/CMakeLists.txt
--- a/common/utils/CMakeLists.txt
+++ b/common/utils/CMakeLists.txt
@@ -8,9 +8,14 @@
 
 include_directories(${CRYPTO_INCLUDE_DIR})
 
-add_library(mutils STATIC mutils.h mutils.c prompt.c mprompt.h revision.c)
-set_target_properties(mutils PROPERTIES POSITION_INDEPENDENT_CODE ON)
-add_library(mcrypt STATIC mcrypt.h mcrypt.c)
-set_target_properties(mcrypt PROPERTIES POSITION_INDEPENDENT_CODE ON)
-add_library(msabaoth STATIC muuid.h muuid.c msabaoth.h msabaoth.c)
-set_target_properties(msabaoth PROPERTIES POSITION_INDEPENDENT_CODE ON)
+add_library(mutils SHARED mutils.h mutils.c prompt.c mprompt.h revision.c)
+target_compile_definitions(mutils PRIVATE LIBMUTILS LIBGDK LIBMEROUTIL)
+install(TARGETS mutils DESTINATION ${LIBDIR})
+
+add_library(mcrypt SHARED mcrypt.h mcrypt.c)
+target_compile_definitions(mcrypt PRIVATE LIBMAPI LIBMCRYPT)
+install(TARGETS mcrypt DESTINATION ${LIBDIR})
+
+add_library(msabaoth SHARED muuid.h muuid.c msabaoth.h msabaoth.c)
+target_compile_definitions(msabaoth PRIVATE LIBMSABAOTH LIBMUUID LIBMAL 
LIBATOMS LIBKERNEL LIBOPTIMIZER LIBSCHEDULER LIBMONETDB5)
+install(TARGETS msabaoth DESTINATION ${LIBDIR})
diff --git a/common/utils/mcrypt.h b/common/utils/mcrypt.h
--- a/common/utils/mcrypt.h
+++ b/common/utils/mcrypt.h
@@ -9,15 +9,25 @@
 #ifndef _SEEN_MCRYPT_H
 #define _SEEN_MCRYPT_H 1
 
-extern const char *mcrypt_getHashAlgorithms(void);
-extern char *mcrypt_MD5Sum(const char *string, size_t len);
-extern char *mcrypt_SHA1Sum(const char *string, size_t len);
-extern char *mcrypt_SHA224Sum(const char *string, size_t len);
-extern char *mcrypt_SHA256Sum(const char *string, size_t len);
-extern char *mcrypt_SHA384Sum(const char *string, size_t len);
-extern char *mcrypt_SHA512Sum(const char *string, size_t len);
-extern char *mcrypt_RIPEMD160Sum(const char *string, size_t len);
-extern char *mcrypt_BackendSum(const char *string, size_t len);
-extern char *mcrypt_hashPassword(const char *algo, const char *password, const 
char *challenge);
+#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__)
+#if !defined(LIBMAPI) && !defined(LIBMCRYPT)
+#define mcrypt_export extern __declspec(dllimport)
+#else
+#define mcrypt_export extern __declspec(dllexport)
+#endif
+#else
+#define mcrypt_export extern
 #endif
 
+mcrypt_export const char *mcrypt_getHashAlgorithms(void);
+mcrypt_export char *mcrypt_MD5Sum(const char *string, size_t len);
+mcrypt_export char *mcrypt_SHA1Sum(const char *string, size_t len);
+mcrypt_export char *mcrypt_SHA224Sum(const char *string, size_t len);
+mcrypt_export char *mcrypt_SHA256Sum(const char *string, size_t len);
+mcrypt_export char *mcrypt_SHA384Sum(const char *string, size_t len);
+mcrypt_export char *mcrypt_SHA512Sum(const char *string, size_t len);
+mcrypt_export char *mcrypt_RIPEMD160Sum(const char *string, size_t len);
+mcrypt_export char *mcrypt_BackendSum(const char *string, size_t len);
+mcrypt_export char *mcrypt_hashPassword(const char *algo, const char 
*password, const char *challenge);
+#endif
+
diff --git a/common/utils/msabaoth.h b/common/utils/msabaoth.h
--- a/common/utils/msabaoth.h
+++ b/common/utils/msabaoth.h
@@ -51,22 +51,32 @@ typedef struct Ssabuplog {
        double crashavg30; /* average of crashes in the last 30 start attempts 
*/
 } sabuplog;
 
-extern void msab_dbpathinit(const char *dbpath);
-extern void msab_dbfarminit(const char *dbfarm);
-extern char *msab_getDBfarm(char **ret);
-extern char *msab_getDBname(char **ret);
-extern char *msab_marchScenario(const char *lang);
-extern char *msab_retreatScenario(const char *lang);
-extern char *msab_marchConnection(const char *host, const int port);
-extern char *msab_wildRetreat(void);
-extern char *msab_registerStarting(void);
-extern char *msab_registerStarted(void);
-extern char *msab_registerStop(void);
-extern char *msab_getMyStatus(sabdb** ret);
-extern char *msab_getStatus(sabdb** ret, char *dbname);
-extern char *msab_freeStatus(sabdb** ret);
-extern char *msab_getUplogInfo(sabuplog *ret, const sabdb *db);
-extern char *msab_serialise(char **ret, const sabdb *db);
-extern char *msab_deserialise(sabdb **ret, char *sabdb);
+#ifdef WIN32
+#if !defined(LIBMAL) && !defined(LIBATOMS) && !defined(LIBKERNEL) && 
!defined(LIBMAL) && !defined(LIBOPTIMIZER) && !defined(LIBSCHEDULER) && 
!defined(LIBMONETDB5) && !defined(LIBMSABAOTH)
+#define msab_export extern __declspec(dllimport)
+#else
+#define msab_export extern __declspec(dllexport)
+#endif
+#else
+#define msab_export extern
+#endif
+
+msab_export void msab_dbpathinit(const char *dbpath);
+msab_export void msab_dbfarminit(const char *dbfarm);
+msab_export char *msab_getDBfarm(char **ret);
+msab_export char *msab_getDBname(char **ret);
+msab_export char *msab_marchScenario(const char *lang);
+msab_export char *msab_retreatScenario(const char *lang);
+msab_export char *msab_marchConnection(const char *host, const int port);
+msab_export char *msab_wildRetreat(void);
+msab_export char *msab_registerStarting(void);
+msab_export char *msab_registerStarted(void);
+msab_export char *msab_registerStop(void);
+msab_export char *msab_getMyStatus(sabdb** ret);
+msab_export char *msab_getStatus(sabdb** ret, char *dbname);
+msab_export char *msab_freeStatus(sabdb** ret);
+msab_export char *msab_getUplogInfo(sabuplog *ret, const sabdb *db);
+msab_export char *msab_serialise(char **ret, const sabdb *db);
+msab_export char *msab_deserialise(sabdb **ret, char *sabdb);
 
 #endif
diff --git a/common/utils/mutils.h b/common/utils/mutils.h
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to