diff options
| author | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-12-17 20:16:55 +0000 |
|---|---|---|
| committer | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-12-17 20:16:55 +0000 |
| commit | 2d72446860abac08dc4f36b10fde7536f7897956 (patch) | |
| tree | 25dc114bb696bc8752d68e6e050da8d3dda5f282 /src/tools | |
| parent | 1cd73b4dadb8e618a0ec56289408922be42aac8a (diff) | |
More CMake work, mostly to handle both *nix and Windows builds.
Also some tweaks to generation files (like version.sh) to take both input and output files as arguments, to handle CMake when it's used for an out-of-source build.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1836 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/CMakeLists.txt | 26 | ||||
| -rw-r--r-- | src/tools/anopesmtp.c | 4 | ||||
| -rw-r--r-- | src/tools/db-convert.c | 6 | ||||
| -rw-r--r-- | src/tools/db-merger.c | 16 | ||||
| -rw-r--r-- | src/tools/smtp.h | 6 |
5 files changed, 30 insertions, 28 deletions
diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index f73a671b4..18a064683 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -10,9 +10,9 @@ list(SORT TOOLS_SRCS) set_source_files_properties(${TOOLS_SRCS} PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}") -set(anopesmtp.c_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/smtp.h) -set(db-convert.c_HEADERS sysconf.h) -set(db-merger.c_HEADERS sysconf.h) +set(anopesmtp.c_HEADERS ${Anope_BINARY_DIR}/include/sysconf.h ${CMAKE_CURRENT_SOURCE_DIR}/smtp.h) +set(db-convert.c_HEADERS ${Anope_BINARY_DIR}/include/sysconf.h) +set(db-merger.c_HEADERS ${Anope_BINARY_DIR}/include/sysconf.h) foreach(SRC ${TOOLS_SRCS}) #string(REGEX REPLACE "\\." "_" SRC_TARGET ${SRC}) @@ -34,17 +34,19 @@ foreach(SRC ${TOOLS_SRCS}) if(${SRC}_HEADERS) foreach(HEADER ${${SRC}_HEADERS}) string(SUBSTRING ${HEADER} 0 1 FIRST_CHAR) - if(FIRST_CHAR STREQUAL "/") + string(SUBSTRING ${HEADER} 1 1 SECOND_CHAR) + if(FIRST_CHAR STREQUAL "/" OR SECOND_CHAR STREQUAL ":") set(HEADERS ${HEADERS} ${HEADER}) - else(FIRST_CHAR STREQUAL "/") + else(FIRST_CHAR STREQUAL "/" OR SECOND_CHAR STREQUAL ":") set(HEADERS ${HEADERS} ${Anope_SOURCE_DIR}/include/${HEADER}) - endif(FIRST_CHAR STREQUAL "/") + endif(FIRST_CHAR STREQUAL "/" OR SECOND_CHAR STREQUAL ":") endforeach(HEADER) endif(${SRC}_HEADERS) if(HEADERS) set_source_files_properties(${SRC} PROPERTIES OBJECT_DEPENDS "${HEADERS}") endif(HEADERS) add_executable(${EXE} ${SRC}) + set_target_properties(${EXE} PROPERTIES LINK_FLAGS "${LDFLAGS}") add_dependencies(${EXE} services) #set_target_properties(${EXE} PROPERTIES COMPILE_FLAGS ${CXXFLAGS}) install(TARGETS ${EXE} @@ -52,6 +54,12 @@ foreach(SRC ${TOOLS_SRCS}) ) endforeach(SRC) -if(RUNGROUP) - install(CODE "execute_process(COMMAND ${CHMOD} 2775 \"${BINDIR}/tools\")") -endif(RUNGROUP) +if(WIN32) + target_link_libraries(anopesmtp wsock32) +endif(WIN32) + +if(NOT WIN32) + if(RUNGROUP) + install(CODE "execute_process(COMMAND ${CHMOD} 2775 \"${BINDIR}/tools\")") + endif(RUNGROUP) +endif(NOT WIN32) diff --git a/src/tools/anopesmtp.c b/src/tools/anopesmtp.c index c775921bd..6101fb4a9 100644 --- a/src/tools/anopesmtp.c +++ b/src/tools/anopesmtp.c @@ -20,7 +20,7 @@ static int curday = 0; /*************************************************************************/ -#ifdef _WIN32 +/*#ifdef _WIN32 int strcasecmp(const char *s1, const char *s2) { register int c; @@ -35,7 +35,7 @@ int strcasecmp(const char *s1, const char *s2) return -1; return 1; } -#endif +#endif*/ static int get_logname(char *name, int count, struct tm *tm) { diff --git a/src/tools/db-convert.c b/src/tools/db-convert.c index 38c2e675d..d561c5333 100644 --- a/src/tools/db-convert.c +++ b/src/tools/db-convert.c @@ -25,10 +25,10 @@ #ifndef _WIN32 #include <unistd.h> #else -#include "sysconf.h" #include <windows.h> #include <io.h> #endif +#include "sysconf.h" #include <string> #include <iostream> @@ -63,10 +63,6 @@ } \ } while (0) -typedef int16_t int16; -typedef u_int16_t uint16; -typedef int32_t int32; -typedef u_int32_t uint32; typedef struct memo_ Memo; typedef struct dbFILE_ dbFILE; typedef struct nickalias_ NickAlias; diff --git a/src/tools/db-merger.c b/src/tools/db-merger.c index 81d03bba8..63bdb48a4 100644 --- a/src/tools/db-merger.c +++ b/src/tools/db-merger.c @@ -55,11 +55,11 @@ #ifndef _WIN32 #include <unistd.h> #else -#include "sysconf.h" #include <windows.h> #include <io.h> #define open _open #endif +#include "sysconf.h" /* Some SUN fixs */ #ifdef __sun @@ -131,10 +131,6 @@ } \ } while (0) -typedef int16_t int16; -typedef u_int16_t uint16; -typedef int32_t int32; -typedef u_int32_t uint32; typedef struct memo_ Memo; typedef struct dbFILE_ dbFILE; typedef struct nickalias_ NickAlias; @@ -270,7 +266,7 @@ struct botinfo_ { struct badword_ { uint16 in_use; char *word; - uint16 type; + uint16 type; }; struct hostcore_ { @@ -575,7 +571,7 @@ int main(int argc, char *argv[]) scanf("%s", input); } if (input[0] == '1') { /* get alias #2 out of the list, then free() it, then add #1 to the list */ - printf("Deleting nick alias %s (#2).\n", naptr->nick); + printf("Deleting nick alias %s (#2).\n", naptr->nick); naptr->nc->aliascount--; /* tell the core it has one alias less */ delnick(naptr, 0); /* removes the alias from the list and free()s it */ na->nc = ncptr; @@ -620,7 +616,7 @@ int main(int argc, char *argv[]) free(s); } /* getc_db() */ } /* for() loop */ - close_db(f); /* End of section Ib */ + close_db(f); /* End of section Ib */ } else nonick = 1; } @@ -632,7 +628,7 @@ int main(int argc, char *argv[]) for (NickCore *nc = nclists[i]; nc; nc = ncnext) { ncnext = nc->next; if (nc->aliascount < 1) { - printf("Deleting core %s (%s).\n", nc->display, nc->email); + printf("Deleting core %s (%s).\n", nc->display, nc->email); delcore(nc); } } @@ -718,7 +714,7 @@ int main(int argc, char *argv[]) last = &chanlists[i]; prev = NULL; - + while ((c = getc_db(f)) == 1) { int j; diff --git a/src/tools/smtp.h b/src/tools/smtp.h index ef6a0d0aa..70a9a2033 100644 --- a/src/tools/smtp.h +++ b/src/tools/smtp.h @@ -14,6 +14,8 @@ #ifndef SMTP_H #define SMTP_H +#include "sysconf.h" + /*************************************************************************/ /* Some Linux boxes (or maybe glibc includes) require this for the @@ -82,10 +84,10 @@ extern int connect(int, struct sockaddr *, int); #endif -#ifdef _WIN32 +/*#ifdef _WIN32 #define PATH_MAX MAX_PATH #define snprintf _snprintf -#endif +#endif*/ /*************************************************************************/ |
