summaryrefslogtreecommitdiff
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/.gitignore3
-rw-r--r--win/CMakeLists.txt6
-rw-r--r--win/config.h.cmake (renamed from win/inspircd_config.h.cmake)11
-rw-r--r--win/inspircd_memory_functions.cpp1
-rw-r--r--win/inspircd_version.h.cmake4
-rw-r--r--win/inspircd_win32wrapper.cpp9
-rw-r--r--win/inspircd_win32wrapper.h29
-rw-r--r--win/modules/CMakeLists.txt17
-rw-r--r--win/win32service.cpp4
-rw-r--r--win/win32service.h2
10 files changed, 55 insertions, 31 deletions
diff --git a/win/.gitignore b/win/.gitignore
index f53ca0701..4b875ca61 100644
--- a/win/.gitignore
+++ b/win/.gitignore
@@ -1,3 +1,2 @@
-inspircd_version.h
-inspircd_config.h
+config.h
inspircd.rc
diff --git a/win/CMakeLists.txt b/win/CMakeLists.txt
index e6a854d99..a9c58bcfc 100644
--- a/win/CMakeLists.txt
+++ b/win/CMakeLists.txt
@@ -12,6 +12,9 @@ set(EXTRA_LIBS "" CACHE PATH "Extra library paths")
set(INSPIRCD_BASE "${CMAKE_CURRENT_SOURCE_DIR}/../")
+# Build with multiple processes
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
+
# Use our own NSIS template
set(CMAKE_MODULE_PATH "${INSPIRCD_BASE}/win")
@@ -56,8 +59,7 @@ if(MSVC)
endif(MSVC)
configure_file("${INSPIRCD_BASE}/win/inspircd.rc.cmake" "${INSPIRCD_BASE}/win/inspircd.rc")
-configure_file("${INSPIRCD_BASE}/win/inspircd_version.h.cmake" "${INSPIRCD_BASE}/win/inspircd_version.h")
-configure_file("${INSPIRCD_BASE}/win/inspircd_config.h.cmake" "${INSPIRCD_BASE}/win/inspircd_config.h")
+configure_file("${INSPIRCD_BASE}/win/config.h.cmake" "${INSPIRCD_BASE}/win/config.h")
add_executable(inspircd ${INSPIRCD_SOURCES} "${INSPIRCD_BASE}/win/inspircd.rc")
target_link_libraries(inspircd win32_memory)
diff --git a/win/inspircd_config.h.cmake b/win/config.h.cmake
index f98cd391e..081163fab 100644
--- a/win/inspircd_config.h.cmake
+++ b/win/config.h.cmake
@@ -1,13 +1,14 @@
-#ifndef INSPIRCD_CONFIG_H
-#define INSPIRCD_CONFIG_H
+#pragma once
+
+#define BRANCH "@MAJOR_VERSION@.@MINOR_VERSION@"
+#define VERSION "@FULL_VERSION@"
+#define REVISION "release"
+#define SYSTEM "@CMAKE_SYSTEM@"
#define CONFIG_PATH "@CONF_PATH@"
#define MOD_PATH "@MODULE_PATH@"
#define DATA_PATH "@DATA_PATH@"
#define LOG_PATH "@LOG_PATH@"
-#define MAXBUF 514
#include "inspircd_win32wrapper.h"
#include "threadengines/threadengine_win32.h"
-
-#endif \ No newline at end of file
diff --git a/win/inspircd_memory_functions.cpp b/win/inspircd_memory_functions.cpp
index 398708317..2093bf3a8 100644
--- a/win/inspircd_memory_functions.cpp
+++ b/win/inspircd_memory_functions.cpp
@@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include <windows.h>
#include <exception>
#include <new>
diff --git a/win/inspircd_version.h.cmake b/win/inspircd_version.h.cmake
deleted file mode 100644
index 1aec12b24..000000000
--- a/win/inspircd_version.h.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-#define BRANCH "@MAJOR_VERSION@.@MINOR_VERSION@"
-#define VERSION "@FULL_VERSION@"
-#define REVISION "0"
-#define SYSTEM "@CMAKE_SYSTEM@" \ No newline at end of file
diff --git a/win/inspircd_win32wrapper.cpp b/win/inspircd_win32wrapper.cpp
index 048baf38b..eba18dca3 100644
--- a/win/inspircd_win32wrapper.cpp
+++ b/win/inspircd_win32wrapper.cpp
@@ -22,6 +22,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "inspircd_win32wrapper.h"
#include "inspircd.h"
#include "configreader.h"
@@ -85,7 +86,7 @@ CoreExport int insp_inet_pton(int af, const char *src, void *dst)
}
return 1;
}
-
+
return 0;
}
@@ -163,7 +164,7 @@ int getopt_long(int ___argc, char *const *___argv, const char *__shortopts, cons
// optind++; // Trash this next argument, we won't be needing it.
par = ___argv[optind-1];
}
- }
+ }
// increment the argument for next time
// optind++;
@@ -189,9 +190,9 @@ int getopt_long(int ___argc, char *const *___argv, const char *__shortopts, cons
{
if (__longopts[i].val == -1 || par == 0)
return 1;
-
+
return __longopts[i].val;
- }
+ }
break;
}
}
diff --git a/win/inspircd_win32wrapper.h b/win/inspircd_win32wrapper.h
index 75404ef8b..a7f2b4354 100644
--- a/win/inspircd_win32wrapper.h
+++ b/win/inspircd_win32wrapper.h
@@ -19,13 +19,11 @@
*/
+#pragma once
+
/* Windows Port
Wrapper Functions/Definitions
By Burlex */
-
-#ifndef INSPIRCD_WIN32WRAPPER_H
-#define INSPIRCD_WIN32WRAPPER_H
-
/*
* Starting with PSAPI version 2 for Windows 7 and Windows Server 2008 R2, this function is defined as K32GetProcessMemoryInfo in Psapi.h and exported
* in Kernel32.lib and Kernel32.dll. However, you should always call this function as GetProcessMemoryInfo. To ensure correct resolution of symbols
@@ -45,9 +43,6 @@
#define VC_EXTRALEAN
#define WIN32_LEAN_AND_MEAN
-/* They just have to be *different*, don't they. */
-#define PATH_MAX MAX_PATH
-
/* Macros for exporting symbols - dependant on what is being compiled */
#ifdef DLL_BUILD
@@ -73,6 +68,15 @@
#include <sys/stat.h>
#include <direct.h>
#include <process.h>
+#include <io.h>
+
+#define F_OK 0 /* test for existence of file */
+#define X_OK (1<<0) /* test for execute or search permission */
+#define W_OK (1<<1) /* test for write permission */
+#define R_OK (1<<2) /* test for read permission */
+
+/* Windows defines this already. */
+#undef ERROR
/* strcasecmp is not defined on windows by default */
#define strcasecmp _stricmp
@@ -92,6 +96,10 @@ CoreExport const char * insp_inet_ntop(int af, const void * src, char * dst, soc
#define snprintf _snprintf
#define vsnprintf _vsnprintf
+#ifndef va_copy
+#define va_copy(dest, src) (dest = src)
+#endif
+
/* Unix-style sleep (argument is in seconds) */
__inline void sleep(int seconds) { Sleep(seconds * 1000); }
@@ -99,6 +107,9 @@ __inline void sleep(int seconds) { Sleep(seconds * 1000); }
#define popen _popen
#define pclose _pclose
+/* _access */
+#define access _access
+
/* IPV4 only convert string to address struct */
__inline int inet_aton(const char *cp, struct in_addr *addr)
{
@@ -201,5 +212,5 @@ private:
DWORD dwErrorCode;
};
-#endif
-
+// Same value as EXIT_STATUS_FORK (EXIT_STATUS_FORK is unused on Windows)
+#define EXIT_STATUS_SERVICE 4
diff --git a/win/modules/CMakeLists.txt b/win/modules/CMakeLists.txt
index 5778d944a..386d3600d 100644
--- a/win/modules/CMakeLists.txt
+++ b/win/modules/CMakeLists.txt
@@ -8,9 +8,15 @@ list(SORT INSPIRCD_MODULES)
add_definitions("-DDLL_BUILD")
foreach(MODULE_NAME ${INSPIRCD_MODULES})
- string(REGEX REPLACE "^.*[/\\](.*).cpp$" "\\1.so" SO_NAME ${MODULE_NAME})
+ string(REGEX REPLACE "^.*[/\\](.*).cpp$" "\\1" BASE_NAME ${MODULE_NAME})
+ set(SO_NAME "${BASE_NAME}.so")
add_library(${SO_NAME} MODULE ${MODULE_NAME})
- set_target_properties(${SO_NAME} PROPERTIES PREFIX "" SUFFIX "")
+ set_target_properties(${SO_NAME} PROPERTIES
+ PREFIX ""
+ SUFFIX ""
+ COMPILE_DEFINITIONS "MODNAME=\"${BASE_NAME}\""
+ )
+
target_link_libraries(${SO_NAME} inspircd)
add_dependencies(${SO_NAME} inspircd)
if(MSVC)
@@ -24,7 +30,12 @@ file(GLOB INSPIRCD_MODULES_SPANNINGTREE RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${
list(SORT INSPIRCD_MODULES_SPANNINGTREE)
add_library(m_spanningtree.so MODULE ${INSPIRCD_MODULES_SPANNINGTREE})
-set_target_properties(m_spanningtree.so PROPERTIES PREFIX "" SUFFIX "")
+set_target_properties(m_spanningtree.so PROPERTIES
+ PREFIX ""
+ SUFFIX ""
+ COMPILE_DEFINITIONS "MODNAME=\"m_spanningtree\""
+)
+
target_link_libraries(m_spanningtree.so inspircd)
add_dependencies(m_spanningtree.so inspircd)
if(MSVC)
diff --git a/win/win32service.cpp b/win/win32service.cpp
index c34e9957d..448829a1d 100644
--- a/win/win32service.cpp
+++ b/win/win32service.cpp
@@ -17,7 +17,7 @@
*/
-#include "inspircd_config.h"
+#include "config.h"
#include "inspircd.h"
#include "exitcodes.h"
#include <windows.h>
@@ -280,7 +280,7 @@ int main(int argc, char* argv[])
}
else
{
- return EXIT_STATUS_INTERNAL;
+ return EXIT_STATUS_SERVICE;
}
}
return 0;
diff --git a/win/win32service.h b/win/win32service.h
index e4500be13..d8177eabc 100644
--- a/win/win32service.h
+++ b/win/win32service.h
@@ -15,7 +15,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#pragma once
+
#ifdef _WIN32
/* Hook for win32service.cpp to exit properly with the service specific error code */