summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-03-23 22:47:25 -0500
committerAdam <Adam@anope.org>2013-03-23 22:47:25 -0500
commit6b2d45c154ddbd5ea4381156f5b763c8d0c29e07 (patch)
tree8332980d359c445ef36f9fe75249f484b3a85013
parent21f7e4a8cdad2f29fda2768215c3a5352a9fa632 (diff)
win: Made config, modules, data, and log paths configurable.
Update win/README with instructions on how to use cmake-gui. Always build m_regex_stdlib, since all VS versions we support support it.
-rw-r--r--win/.gitignore1
-rw-r--r--win/CMakeLists.txt17
-rw-r--r--win/README.txt11
-rw-r--r--win/inspircd_config.h.cmake (renamed from win/inspircd_config.h)8
-rw-r--r--win/inspircd_version.h.cmake4
-rw-r--r--win/modules/CMakeLists.txt4
6 files changed, 32 insertions, 13 deletions
diff --git a/win/.gitignore b/win/.gitignore
index a49a10efa..f53ca0701 100644
--- a/win/.gitignore
+++ b/win/.gitignore
@@ -1,2 +1,3 @@
inspircd_version.h
+inspircd_config.h
inspircd.rc
diff --git a/win/CMakeLists.txt b/win/CMakeLists.txt
index 83d6dddb5..f26b9a6c7 100644
--- a/win/CMakeLists.txt
+++ b/win/CMakeLists.txt
@@ -2,6 +2,14 @@ cmake_minimum_required(VERSION 2.8)
project(InspIRCd CXX)
+set(CONF_PATH "conf" CACHE PATH "Configuration file path")
+set(MODULE_PATH "modules" CACHE PATH "Module path")
+set(DATA_PATH "data" CACHE PATH "Data path")
+set(LOG_PATH "log" CACHE PATH "Log file path")
+
+set(EXTRA_INCLUDES "" CACHE PATH "Extra include paths")
+set(EXTRA_LIBS "" CACHE PATH "Extra library paths")
+
set(INSPIRCD_BASE "${CMAKE_CURRENT_SOURCE_DIR}/../")
# Use our own NSIS template
@@ -14,12 +22,6 @@ string(REGEX REPLACE ".*InspIRCd-[0-9]*\\.([0-9]*).*" "\\1" MINOR_VERSION "${VER
string(REGEX REPLACE ".*InspIRCd-[0-9]*\\.[0-9]*\\.([0-9]*).*" "\\1" PATCH_VERSION "${VERSIONSH}")
set(FULL_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}")
-# Write out inspircd_version.h
-file(WRITE "${INSPIRCD_BASE}/win/inspircd_version.h" "#define BRANCH \"${MAJOR_VERSION}.${MINOR_VERSION}\"\n")
-file(APPEND "${INSPIRCD_BASE}/win/inspircd_version.h" "#define VERSION \"${FULL_VERSION}\"\n")
-file(APPEND "${INSPIRCD_BASE}/win/inspircd_version.h" "#define REVISION \"0\"\n")
-file(APPEND "${INSPIRCD_BASE}/win/inspircd_version.h" "#define SYSTEM \"${CMAKE_SYSTEM}\"\n")
-
if(MSVC)
# Without /SAFESEH:NO old libraries compiled with VS 2010 or older won't link correctly to VS2012 (eg, extra module libs)
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /SAFESEH:NO")
@@ -54,6 +56,9 @@ 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")
+
add_executable(inspircd ${INSPIRCD_SOURCES} "${INSPIRCD_BASE}/win/inspircd.rc")
target_link_libraries(inspircd win32_memory)
set_target_properties(inspircd PROPERTIES ENABLE_EXPORTS ON)
diff --git a/win/README.txt b/win/README.txt
index 24f4fd7e6..908cd3920 100644
--- a/win/README.txt
+++ b/win/README.txt
@@ -8,9 +8,12 @@ Prerequisites:
Configuring:
First copy any extra modules from extras (such as m_mysql) to the modules directory that you want to build.
- Run CMake to generate build files. The CMake scripts are set up to do an out of source build from the
- "win\build" directory, so navigate there before running CMake, eg:
-
+ Run CMake to generate build files. This can be done using the CMake GUI by setting the source code path to "win",
+ and the binary path to "win/build", followed by pressing "Configure". Modify any variables you need, such as install
+ prefix, and then press "Generate".
+
+ Alternatively CMake can be run from Command Prompt from the "win\build" directory, eg:
+
c:\Users\Adam\Desktop\inspircd\win\build>cmake -G "Visual Studio 11" ..
-- Check for working CXX compiler using: Visual Studio 11
-- Check for working CXX compiler using: Visual Studio 11 -- works
@@ -29,6 +32,8 @@ Configuring:
cmake -DEXTRA_INCLUDES:STRING="C:\inspircd-includes" -DEXTRA_LIBS:STRING="C:\inspircd-libs" -G "Visual Studio 11" ..
+ See the CMake GUI for a full list of variables that can be set.
+
Additionally, place any DLL files required by any extra modules in to the win directory for the installer to pick up.
Building:
diff --git a/win/inspircd_config.h b/win/inspircd_config.h.cmake
index 168eeb761..f98cd391e 100644
--- a/win/inspircd_config.h
+++ b/win/inspircd_config.h.cmake
@@ -1,10 +1,10 @@
#ifndef INSPIRCD_CONFIG_H
#define INSPIRCD_CONFIG_H
-#define CONFIG_PATH "conf"
-#define MOD_PATH "modules"
-#define DATA_PATH "data"
-#define LOG_PATH "logs"
+#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"
diff --git a/win/inspircd_version.h.cmake b/win/inspircd_version.h.cmake
new file mode 100644
index 000000000..1aec12b24
--- /dev/null
+++ b/win/inspircd_version.h.cmake
@@ -0,0 +1,4 @@
+#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/modules/CMakeLists.txt b/win/modules/CMakeLists.txt
index 70ab6d106..5778d944a 100644
--- a/win/modules/CMakeLists.txt
+++ b/win/modules/CMakeLists.txt
@@ -1,3 +1,7 @@
+# m_regex_stdlib is supported by every version of Visual Studio we support,
+# so copy the file out of extra/
+file(COPY "${INSPIRCD_BASE}/src/modules/extra/m_regex_stdlib.cpp" DESTINATION "${INSPIRCD_BASE}/src/modules/")
+
file(GLOB INSPIRCD_MODULES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${INSPIRCD_BASE}/src/commands/*.cpp" "${INSPIRCD_BASE}/src/modules/*.cpp")
list(SORT INSPIRCD_MODULES)