summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2003-06-30 14:30:38 (GMT)
committerBrad King <brad.king@kitware.com>2003-06-30 14:30:38 (GMT)
commitef76ed76f8a31f706ee675160e5c57c34b608516 (patch)
treeb0bad156b6f2fb3b4bfdb57a13a55a0b2d45f0bb
parentac2de4f5defce85b7980d70656668d8aebc62079 (diff)
downloadCMake-ef76ed76f8a31f706ee675160e5c57c34b608516.zip
CMake-ef76ed76f8a31f706ee675160e5c57c34b608516.tar.gz
CMake-ef76ed76f8a31f706ee675160e5c57c34b608516.tar.bz2
ENH: Added DLL support.
-rw-r--r--Source/kwsys/Base64.h.in32
-rw-r--r--Source/kwsys/CMakeLists.txt17
-rw-r--r--Source/kwsys/Configure.h.in30
-rw-r--r--Source/kwsys/Directory.cxx2
-rw-r--r--Source/kwsys/Directory.hxx.in4
-rw-r--r--Source/kwsys/EncodeExecutable.c5
-rw-r--r--Source/kwsys/Process.h.in34
-rw-r--r--Source/kwsys/ProcessWin32.c4
-rw-r--r--Source/kwsys/RegularExpression.cxx4
-rw-r--r--Source/kwsys/RegularExpression.hxx.in10
-rw-r--r--Source/kwsys/SystemTools.hxx.in4
11 files changed, 104 insertions, 42 deletions
diff --git a/Source/kwsys/Base64.h.in b/Source/kwsys/Base64.h.in
index d9202d5..e250371 100644
--- a/Source/kwsys/Base64.h.in
+++ b/Source/kwsys/Base64.h.in
@@ -17,11 +17,14 @@
#ifndef @KWSYS_NAMESPACE@_Base64_h
#define @KWSYS_NAMESPACE@_Base64_h
+#include <@KWSYS_NAMESPACE@/Configure.h>
+
/* Redefine all public interface symbol names to be in the proper
namespace. These macros are used internally to kwsys only, and are
not visible to user code. Use kwsysHeaderDump.pl to reproduce
these macros after making changes to the interface. */
#define kwsys(x) @KWSYS_NAMESPACE@##x
+#define kwsysEXPORT kwsys(_EXPORT)
#define kwsysBase64 kwsys(Base64)
#define kwsysBase64_Decode kwsys(Base64_Decode)
#define kwsysBase64_Decode3 kwsys(Base64_Decode3)
@@ -38,17 +41,20 @@ extern "C"
/**
* Encode 3 bytes into a 4 byte string.
*/
-void kwsysBase64_Encode3(const unsigned char *src, unsigned char *dest);
+kwsysEXPORT void kwsysBase64_Encode3(const unsigned char *src,
+ unsigned char *dest);
/**
* Encode 2 bytes into a 4 byte string.
*/
-void kwsysBase64_Encode2(const unsigned char *src, unsigned char *dest);
+kwsysEXPORT void kwsysBase64_Encode2(const unsigned char *src,
+ unsigned char *dest);
/**
* Encode 1 bytes into a 4 byte string.
*/
-void kwsysBase64_Encode1(const unsigned char *src, unsigned char *dest);
+kwsysEXPORT void kwsysBase64_Encode1(const unsigned char *src,
+ unsigned char *dest);
/**
* Encode 'length' bytes from the input buffer and store the encoded
@@ -63,16 +69,17 @@ void kwsysBase64_Encode1(const unsigned char *src, unsigned char *dest);
* the extra padding needed to complete the encode 4 bytes will stop
* the decoding anyway).
*/
-unsigned long kwsysBase64_Encode(const unsigned char *input,
- unsigned long length,
- unsigned char *output,
- int mark_end);
+kwsysEXPORT unsigned long kwsysBase64_Encode(const unsigned char *input,
+ unsigned long length,
+ unsigned char *output,
+ int mark_end);
/**
* Decode 4 bytes into a 3 byte string. Returns the number of bytes
* actually decoded.
*/
-int kwsysBase64_Decode3(const unsigned char *src, unsigned char *dest);
+kwsysEXPORT int kwsysBase64_Decode3(const unsigned char *src,
+ unsigned char *dest);
/**
* Decode bytes from the input buffer and store the decoded stream
@@ -86,10 +93,10 @@ int kwsysBase64_Decode3(const unsigned char *src, unsigned char *dest);
* much decoded data to expect (of course, the buffer must be large
* enough).
*/
-unsigned long kwsysBase64_Decode(const unsigned char *input,
- unsigned long length,
- unsigned char *output,
- unsigned long max_input_length);
+kwsysEXPORT unsigned long kwsysBase64_Decode(const unsigned char *input,
+ unsigned long length,
+ unsigned char *output,
+ unsigned long max_input_length);
#if defined(__cplusplus)
} /* extern "C" */
@@ -99,6 +106,7 @@ unsigned long kwsysBase64_Decode(const unsigned char *input,
undefine them to keep the namespace clean. */
#if !defined(KWSYS_IN_BASE64_C)
# undef kwsys
+# undef kwsysEXPORT
# undef kwsysBase64
# undef kwsysBase64_Decode
# undef kwsysBase64_Decode3
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt
index dfb9828..eb80660 100644
--- a/Source/kwsys/CMakeLists.txt
+++ b/Source/kwsys/CMakeLists.txt
@@ -147,6 +147,19 @@ SET(KWSYS_NO_STD_NAMESPACE ${CMAKE_NO_STD_NAMESPACE})
SET(KWSYS_NO_ANSI_STREAM_HEADERS ${CMAKE_NO_ANSI_STREAM_HEADERS})
SET(KWSYS_NO_ANSI_STRING_STREAM ${CMAKE_NO_ANSI_STRING_STREAM})
+# Choose default shared/static build if not specified.
+IF(KWSYS_BUILD_SHARED MATCHES "^KWSYS_BUILD_SHARED$")
+ SET(KWSYS_BUILD_SHARED ${BUILD_SHARED_LIBS})
+ENDIF(KWSYS_BUILD_SHARED MATCHES "^KWSYS_BUILD_SHARED$")
+
+IF(KWSYS_BUILD_SHARED)
+ SET(KWSYS_BUILD_SHARED 1)
+ SET(KWSYS_LIBRARY_TYPE SHARED)
+ELSE(KWSYS_BUILD_SHARED)
+ SET(KWSYS_BUILD_SHARED 0)
+ SET(KWSYS_LIBRARY_TYPE STATIC)
+ENDIF(KWSYS_BUILD_SHARED)
+
#-----------------------------------------------------------------------------
# Choose a directory for the generated headers.
IF(NOT KWSYS_HEADER_ROOT)
@@ -192,7 +205,7 @@ ENDFOREACH(header)
# Build a list of classes and headers we need to implement the
# selected components. Initialize with required components.
SET(KWSYS_CLASSES)
-SET(KWSYS_H_FILES)
+SET(KWSYS_H_FILES Configure)
SET(KWSYS_HXX_FILES Configure)
# Enforce component dependencies (none currently exists).
@@ -283,7 +296,7 @@ ENDFOREACH(h)
#-----------------------------------------------------------------------------
# Add the library with the configured name and list of sources.
-ADD_LIBRARY(${KWSYS_NAMESPACE} ${KWSYS_SRCS})
+ADD_LIBRARY(${KWSYS_NAMESPACE} ${KWSYS_LIBRARY_TYPE} ${KWSYS_SRCS})
# Create an install target for the library.
IF(KWSYS_LIBRARY_INSTALL_DIR)
diff --git a/Source/kwsys/Configure.h.in b/Source/kwsys/Configure.h.in
new file mode 100644
index 0000000..5af7a96
--- /dev/null
+++ b/Source/kwsys/Configure.h.in
@@ -0,0 +1,30 @@
+/*=========================================================================
+
+ Program: KWSys - Kitware System Library
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef @KWSYS_NAMESPACE@_Configure_h
+#define @KWSYS_NAMESPACE@_Configure_h
+
+#if defined(_WIN32) && @KWSYS_BUILD_SHARED@
+# if defined(@KWSYS_NAMESPACE@_EXPORTS)
+# define @KWSYS_NAMESPACE@_EXPORT __declspec(dllexport)
+# else
+# define @KWSYS_NAMESPACE@_EXPORT __declspec(dllexport)
+# endif
+#else
+# define @KWSYS_NAMESPACE@_EXPORT
+#endif
+
+#endif
diff --git a/Source/kwsys/Directory.cxx b/Source/kwsys/Directory.cxx
index d8a0b8e..5e409b6 100644
--- a/Source/kwsys/Directory.cxx
+++ b/Source/kwsys/Directory.cxx
@@ -16,6 +16,8 @@
=========================================================================*/
#include <Directory.hxx>
+#include <Configure.hxx>
+
#include <std/string>
#include <std/vector>
diff --git a/Source/kwsys/Directory.hxx.in b/Source/kwsys/Directory.hxx.in
index 89cbf9d..28ba2e3 100644
--- a/Source/kwsys/Directory.hxx.in
+++ b/Source/kwsys/Directory.hxx.in
@@ -17,7 +17,7 @@
#ifndef @KWSYS_NAMESPACE@_Directory_hxx
#define @KWSYS_NAMESPACE@_Directory_hxx
-#include <@KWSYS_NAMESPACE@/Configure.hxx>
+#include <@KWSYS_NAMESPACE@/Configure.h>
namespace @KWSYS_NAMESPACE@
{
@@ -32,7 +32,7 @@ class DirectoryInternals;
*
* Directory currently works with Windows and Unix operating systems.
*/
-class Directory
+class @KWSYS_NAMESPACE@_EXPORT Directory
{
public:
Directory();
diff --git a/Source/kwsys/EncodeExecutable.c b/Source/kwsys/EncodeExecutable.c
index ef76eb2..9db0fb9 100644
--- a/Source/kwsys/EncodeExecutable.c
+++ b/Source/kwsys/EncodeExecutable.c
@@ -50,6 +50,7 @@ int main(int argc, char* argv[])
/* Prepend header comment. */
fprintf(ofp, "/*\n * DO NOT EDIT\n * This file is generated by:\n");
fprintf(ofp, " * %s\n */\n\n", argv[0]);
+ fprintf(ofp, "#include <Configure.h>\n\n");
fprintf(ofp, "#include <stdio.h>\n\n");
/* Split file up in 1024-byte chunks. */
@@ -74,8 +75,8 @@ int main(int argc, char* argv[])
fclose(ifp);
/* Provide a function to write the data to a file. */
- fprintf(ofp, "extern int %sEncodedWriteArray%s(const char* fname)\n",
- argv[3], argv[4]);
+ fprintf(ofp, "extern %s_EXPORT int %sEncodedWriteArray%s(const char* fname)\n",
+ argv[3], argv[3], argv[4]);
fprintf(ofp, "{\n");
fprintf(ofp, " FILE* ofp = fopen(fname, \"wb\");\n");
fprintf(ofp, " if(!ofp) { return 0; }\n");
diff --git a/Source/kwsys/Process.h.in b/Source/kwsys/Process.h.in
index 7d713a4..6c6ae55 100644
--- a/Source/kwsys/Process.h.in
+++ b/Source/kwsys/Process.h.in
@@ -17,11 +17,14 @@
#ifndef @KWSYS_NAMESPACE@_Process_h
#define @KWSYS_NAMESPACE@_Process_h
+#include <@KWSYS_NAMESPACE@/Configure.h>
+
/* Redefine all public interface symbol names to be in the proper
namespace. These macros are used internally to kwsys only, and are
not visible to user code. Use kwsysHeaderDump.pl to reproduce
these macros after making changes to the interface. */
#define kwsys(x) @KWSYS_NAMESPACE@##x
+#define kwsysEXPORT kwsys(_EXPORT)
#define kwsysProcess kwsys(Process)
#define kwsysProcess_s kwsys(Process_s)
#define kwsysProcess_New kwsys(Process_New)
@@ -70,20 +73,21 @@ typedef struct kwsysProcess_s kwsysProcess;
/**
* Create a new Process instance.
*/
-kwsysProcess* kwsysProcess_New();
+kwsysEXPORT kwsysProcess* kwsysProcess_New();
/**
* Delete an existing Process instance. If the instance is currently
* executing a process, this blocks until the process terminates.
*/
-void kwsysProcess_Delete(kwsysProcess* cp);
+kwsysEXPORT void kwsysProcess_Delete(kwsysProcess* cp);
/**
* Set the command line to be executed. Argument is an array of
* pointers to the command and each argument. Ths array must end with
* a NULL pointer.
*/
-void kwsysProcess_SetCommand(kwsysProcess* cp, char const* const* command);
+kwsysEXPORT void kwsysProcess_SetCommand(kwsysProcess* cp,
+ char const* const* command);
/**
* Set the timeout for the child process. The timeout period begins
@@ -91,7 +95,7 @@ void kwsysProcess_SetCommand(kwsysProcess* cp, char const* const* command);
* the timeout expires, it will be killed. A non-positive (<= 0)
* value will disable the timeout.
*/
-void kwsysProcess_SetTimeout(kwsysProcess* cp, double timeout);
+kwsysEXPORT void kwsysProcess_SetTimeout(kwsysProcess* cp, double timeout);
/**
* Get the current state of the Process instance. Possible states are:
@@ -104,7 +108,7 @@ void kwsysProcess_SetTimeout(kwsysProcess* cp, double timeout);
* kwsysProcess_State_Expired = Child process's timeout expired.
* kwsysProcess_State_Killed = Child process terminated by Kill method.
*/
-int kwsysProcess_GetState(kwsysProcess* cp);
+kwsysEXPORT int kwsysProcess_GetState(kwsysProcess* cp);
enum kwsysProcess_State_e
{
kwsysProcess_State_Starting,
@@ -128,7 +132,7 @@ enum kwsysProcess_State_e
* kwsysProcess_Exception_Numerical = Child crashed with a numerical exception.
* kwsysProcess_Exception_Other = Child terminated for another reason.
*/
-int kwsysProcess_GetExitException(kwsysProcess* cp);
+kwsysEXPORT int kwsysProcess_GetExitException(kwsysProcess* cp);
enum kwsysProcess_Exception_e
{
kwsysProcess_Exception_None,
@@ -149,25 +153,25 @@ enum kwsysProcess_Exception_e
* If GetState returns "Exited", use GetExitValue to get the
* platform-independent child return value.
*/
-int kwsysProcess_GetExitCode(kwsysProcess* cp);
+kwsysEXPORT int kwsysProcess_GetExitCode(kwsysProcess* cp);
/**
* When GetState returns "Exited", this method returns the child's
* platform-independent exit code (such as the value returned by the
* child's main).
*/
-int kwsysProcess_GetExitValue(kwsysProcess* cp);
+kwsysEXPORT int kwsysProcess_GetExitValue(kwsysProcess* cp);
/**
* When GetState returns "Error", this method returns a string
* describing the problem. Otherwise, it returns NULL.
*/
-const char* kwsysProcess_GetErrorString(kwsysProcess* cp);
+kwsysEXPORT const char* kwsysProcess_GetErrorString(kwsysProcess* cp);
/**
* Start executing the child process.
*/
-void kwsysProcess_Execute(kwsysProcess* cp);
+kwsysEXPORT void kwsysProcess_Execute(kwsysProcess* cp);
/**
* Block until data are available on a requested pipe, a timeout
@@ -198,8 +202,9 @@ void kwsysProcess_Execute(kwsysProcess* cp);
* call. Time elapsed has been subtracted from timeout
* argument.
*/
-int kwsysProcess_WaitForData(kwsysProcess* cp, int pipes, char** data,
- int* length, double* timeout);
+kwsysEXPORT int kwsysProcess_WaitForData(kwsysProcess* cp, int pipes,
+ char** data, int* length,
+ double* timeout);
enum kwsysProcess_Pipes_e
{
kwsysProcess_Pipe_STDOUT=1,
@@ -225,14 +230,14 @@ enum kwsysProcess_Pipes_e
* argument.
* 1 = Child has terminated or was not running.
*/
-int kwsysProcess_WaitForExit(kwsysProcess* cp, double* timeout);
+kwsysEXPORT int kwsysProcess_WaitForExit(kwsysProcess* cp, double* timeout);
/**
* Forcefully terminate the child process that is currently running.
* The caller should call WaitForExit after this returns to wait for
* the child to terminate.
*/
-void kwsysProcess_Kill(kwsysProcess* cp);
+kwsysEXPORT void kwsysProcess_Kill(kwsysProcess* cp);
#if defined(__cplusplus)
} /* extern "C" */
@@ -242,6 +247,7 @@ void kwsysProcess_Kill(kwsysProcess* cp);
Otherwise, undefine them to keep the namespace clean. */
#if !defined(KWSYS_IN_PROCESS_C)
# undef kwsys
+# undef kwsysEXPORT
# undef kwsysProcess
# undef kwsysProcess_s
# undef kwsysProcess_New
diff --git a/Source/kwsys/ProcessWin32.c b/Source/kwsys/ProcessWin32.c
index f44d25e..7d11393 100644
--- a/Source/kwsys/ProcessWin32.c
+++ b/Source/kwsys/ProcessWin32.c
@@ -51,7 +51,7 @@ Q190351 and Q150956.
/* The maximum amount to read from a pipe at a time. */
#define CMPE_PIPE_BUFFER_SIZE 1024
-#define kwsysEncodedWriteArrayProcessFwd kwsys(EncodedWriteArrayProcessFwd)
+#define kwsysEncodedWriteArrayProcessFwd9x kwsys(EncodedWriteArrayProcessFwd9x)
typedef LARGE_INTEGER kwsysProcessTime;
@@ -72,7 +72,7 @@ static kwsysProcessTime kwsysProcessTimeFromDouble(double d);
static int kwsysProcessTimeLess(kwsysProcessTime in1, kwsysProcessTime in2);
static kwsysProcessTime kwsysProcessTimeAdd(kwsysProcessTime in1, kwsysProcessTime in2);
static kwsysProcessTime kwsysProcessTimeSubtract(kwsysProcessTime in1, kwsysProcessTime in2);
-extern int kwsysEncodedWriteArrayProcessFwd9x(const char* fname);
+extern kwsysEXPORT int kwsysEncodedWriteArrayProcessFwd9x(const char* fname);
/*--------------------------------------------------------------------------*/
/* A structure containing data for each pipe's thread. */
diff --git a/Source/kwsys/RegularExpression.cxx b/Source/kwsys/RegularExpression.cxx
index f9a3291..ef204a1 100644
--- a/Source/kwsys/RegularExpression.cxx
+++ b/Source/kwsys/RegularExpression.cxx
@@ -413,7 +413,7 @@ static char* reg (int paren, int *flagp) {
// Make an OPEN node, if parenthesized.
if (paren) {
- if (regnpar >= RegularExpressionNSUBEXP) {
+ if (regnpar >= RegularExpression::NSUBEXP) {
//RAISE Error, SYM(RegularExpression), SYM(Too_Many_Parens),
printf ("RegularExpression::compile(): Too many parentheses.\n");
return 0;
@@ -925,7 +925,7 @@ static int regtry (const char* string, const char* *start,
sp1 = start;
ep = end;
- for (i = RegularExpressionNSUBEXP; i > 0; i--) {
+ for (i = RegularExpression::NSUBEXP; i > 0; i--) {
*sp1++ = 0;
*ep++ = 0;
}
diff --git a/Source/kwsys/RegularExpression.hxx.in b/Source/kwsys/RegularExpression.hxx.in
index b156bec..c89f661 100644
--- a/Source/kwsys/RegularExpression.hxx.in
+++ b/Source/kwsys/RegularExpression.hxx.in
@@ -35,6 +35,7 @@
#ifndef @KWSYS_NAMESPACE@_RegularExpression_hxx
#define @KWSYS_NAMESPACE@_RegularExpression_hxx
+#include <@KWSYS_NAMESPACE@/Configure.h>
#include <@KWSYS_NAMESPACE@/Configure.hxx>
#include <@KWSYS_NAMESPACE@/std/string>
@@ -47,8 +48,6 @@
namespace @KWSYS_NAMESPACE@
{
-const int RegularExpressionNSUBEXP = 10;
-
/** \class RegularExpression
* \brief Implements pattern matching with regular expressions.
*
@@ -186,7 +185,7 @@ const int RegularExpressionNSUBEXP = 10;
* the line. It would match "drepa qrepb" in "rep drepa qrepb".
*
*/
-class RegularExpression
+class @KWSYS_NAMESPACE@_EXPORT RegularExpression
{
public:
/**
@@ -273,9 +272,10 @@ public:
kwsys_std::string::size_type end(int n) const;
kwsys_std::string match(int n) const;
+ enum { NSUBEXP = 10 };
private:
- const char* startp[RegularExpressionNSUBEXP];
- const char* endp[RegularExpressionNSUBEXP];
+ const char* startp[NSUBEXP];
+ const char* endp[NSUBEXP];
char regstart; // Internal use only
char reganch; // Internal use only
const char* regmust; // Internal use only
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index 1c1a2b4..c59529f 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -21,6 +21,8 @@
#include <@KWSYS_NAMESPACE@/std/string>
#include <@KWSYS_NAMESPACE@/std/vector>
+#include <@KWSYS_NAMESPACE@/Configure.h>
+
/* Define this macro temporarily to keep the code readable. */
#if !defined (KWSYS_NAMESPACE) && !defined(@KWSYS_NAMESPACE@_NAME_IS_KWSYS)
# define kwsys_std @KWSYS_NAMESPACE@_std
@@ -32,7 +34,7 @@ namespace @KWSYS_NAMESPACE@
/** \class SystemTools
* \brief A collection of useful platform-independent system functions.
*/
-class SystemTools
+class @KWSYS_NAMESPACE@_EXPORT SystemTools
{
public:
/**