From 6b2d45c154ddbd5ea4381156f5b763c8d0c29e07 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 23 Mar 2013 22:47:25 -0500 Subject: 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. --- win/.gitignore | 1 + win/CMakeLists.txt | 17 +++++++++++------ win/README.txt | 11 ++++++++--- win/inspircd_config.h | 13 ------------- win/inspircd_config.h.cmake | 13 +++++++++++++ win/inspircd_version.h.cmake | 4 ++++ win/modules/CMakeLists.txt | 4 ++++ 7 files changed, 41 insertions(+), 22 deletions(-) delete mode 100644 win/inspircd_config.h create mode 100644 win/inspircd_config.h.cmake create mode 100644 win/inspircd_version.h.cmake (limited to 'win') 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 deleted file mode 100644 index 168eeb761..000000000 --- a/win/inspircd_config.h +++ /dev/null @@ -1,13 +0,0 @@ -#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 MAXBUF 514 - -#include "inspircd_win32wrapper.h" -#include "threadengines/threadengine_win32.h" - -#endif \ No newline at end of file diff --git a/win/inspircd_config.h.cmake b/win/inspircd_config.h.cmake new file mode 100644 index 000000000..f98cd391e --- /dev/null +++ b/win/inspircd_config.h.cmake @@ -0,0 +1,13 @@ +#ifndef INSPIRCD_CONFIG_H +#define INSPIRCD_CONFIG_H + +#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_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) -- cgit v1.2.3