From 01894d62efda704fdab4a705faad054b35927c24 Mon Sep 17 00:00:00 2001 From: WrinklyNinja Date: Sun, 20 Oct 2013 11:37:58 +0100 Subject: [PATCH] Switched development to MSVC 2013. Updated instructions and build settings to reflect this. Also using the Boost SVN r86365, since neither the 1.54 release nor the 1.55 beta want to build using MSVC 2013. --- CMakeLists.txt | 104 ++++++++++++++++++++++++++++--------------------- README.md | 93 +++++++++++++++++++++++++++++++------------ 2 files changed, 127 insertions(+), 70 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 35ede588..cd865776 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,8 +17,7 @@ set (BOSS_SRC "${CMAKE_SOURCE_DIR}/src/backend/metadata.cpp" "${CMAKE_SOURCE_DIR}/src/backend/network.cpp" "${CMAKE_SOURCE_DIR}/src/backend/globals.cpp" "${CMAKE_SOURCE_DIR}/src/backend/graph.cpp" - "${PROJECT_LIBS_DIR}/pugixml/src/pugixml.cpp" - "${PROJECT_LIBS_DIR}/boost/libs/iostreams/src/file_descriptor.cpp") + "${PROJECT_LIBS_DIR}/pugixml/src/pugixml.cpp") set (BOSS_GUI_SRC ${BOSS_SRC} "${CMAKE_SOURCE_DIR}/src/gui/ids.cpp" @@ -41,14 +40,11 @@ include_directories ("${CMAKE_SOURCE_DIR}/src" "${PROJECT_LIBS_DIR}/zlib" "${PROJECT_LIBS_DIR}/pugixml/src" "${PROJECT_LIBS_DIR}/libgit2/include" - "${PROJECT_LIBS_DIR}/wxWidgets/include" - "${PROJECT_LIBS_DIR}/wxWidgets/lib/wx/include/${COMPILER_PREFIX}-msw-unicode-static-3.0") + "${PROJECT_LIBS_DIR}/wxWidgets/include") -link_directories ("${PROJECT_LIBS_DIR}/yaml-cpp/build" - "${PROJECT_LIBS_DIR}/libloadorder/build" +link_directories ("${PROJECT_LIBS_DIR}/libloadorder/build" "${PROJECT_LIBS_DIR}/zlib/build" "${PROJECT_LIBS_DIR}/libgit2/build" - "${PROJECT_LIBS_DIR}/wxWidgets/lib" "${PROJECT_LIBS_DIR}/boost/stage-${PROJECT_ARCH}/lib") @@ -58,7 +54,7 @@ link_directories ("${PROJECT_LIBS_DIR}/yaml-cpp/build" # Settings when compiling for Windows. Since it's a Windows-only app this is always true, but useful to check for copy/paste into other projects. IF (CMAKE_SYSTEM_NAME MATCHES "Windows") - add_definitions (-DUNICODE -D_UNICODE -D__WXMSW__ -DNDEBUG -DLIBLO_STATIC) + add_definitions (-DUNICODE -D_UNICODE -D__WXMSW__ -DNDEBUG -DLIBLO_STATIC -DWIN32 -D_WINDOWS) IF (${PROJECT_LINK} MATCHES "STATIC") add_definitions (-DBOSS_STATIC) ELSE () @@ -68,56 +64,74 @@ ENDIF () # MinGW settings. IF (MINGW) - link_directories("${PROJECT_LIBS_DIR}/openssl") + include_directories("${PROJECT_LIBS_DIR}/wxWidgets/lib/wx/include/${COMPILER_PREFIX}-msw-unicode-static-3.0") + link_directories("${PROJECT_LIBS_DIR}/yaml-cpp/build" + "${PROJECT_LIBS_DIR}/openssl" + "${PROJECT_LIBS_DIR}/wxWidgets/lib") set (CMAKE_C_FLAGS "-m${PROJECT_ARCH} -O3") set (CMAKE_CXX_FLAGS "-m${PROJECT_ARCH} -O3") set (CMAKE_EXE_LINKER_FLAGS "-static-libstdc++ -static-libgcc -Wl,--subsystem,windows") set (CMAKE_SHARED_LINKER_FLAGS "-static-libstdc++ -static-libgcc -Wl,--subsystem,windows") set (CMAKE_MODULE_LINKER_FLAGS "-static-libstdc++ -static-libgcc -Wl,--subsystem,windows") -ENDIF () - -# MSVC settings. -IF (MSVC) - set (CMAKE_CXX_FLAGS "/EHsc") - set (BOOST_SUFFIX "-vc110-mt-1_52") -ENDIF () - -set (BOSS_LIBS ${BOSS_LIBS} - version - git2 - zlibstatic - loadorder${PROJECT_ARCH} - yaml-cpp - boost_log_setup${BOOST_SUFFIX} - boost_log${BOOST_SUFFIX} - boost_locale${BOOST_SUFFIX} - boost_thread_win32${BOOST_SUFFIX} - boost_chrono${BOOST_SUFFIX} - boost_date_time${BOOST_SUFFIX} - boost_filesystem${BOOST_SUFFIX} - boost_system${BOOST_SUFFIX} - boost_regex${BOOST_SUFFIX}) - -IF (MINGW) set (BOSS_LIBS ${BOSS_LIBS} + yaml-cpp + boost_log_setup + boost_log + boost_locale + boost_thread_win32 + boost_chrono + boost_date_time + boost_filesystem + boost_system + boost_regex + version + git2 + zlibstatic + loadorder${PROJECT_ARCH} ssl crypto ws2_32) -ELSE () + set (BOSS_GUI_LIBS ${BOSS_LIBS} + wx_mswu_webview-3.0-${COMPILER_PREFIX} + wx_mswu_core-3.0-${COMPILER_PREFIX} + wx_baseu-3.0-${COMPILER_PREFIX} + wx_mswu_adv-3.0-${COMPILER_PREFIX} + wxpng-3.0-${COMPILER_PREFIX} + wxzlib-3.0-${COMPILER_PREFIX} + comctl32) +ELSEIF (MSVC) + include_directories("${PROJECT_LIBS_DIR}/wxWidgets/lib/vc_lib/mswu") + link_directories("${PROJECT_LIBS_DIR}/yaml-cpp/build/Release" + "${PROJECT_LIBS_DIR}/wxWidgets/lib/vc_lib") + set (CMAKE_CXX_FLAGS "/EHsc") + set (CMAKE_EXE_LINKER_FLAGS "/SUBSYSTEM:WINDOWS") + set (BOOST_SUFFIX "-vc120-mt-1_55") set (BOSS_LIBS ${BOSS_LIBS} + libyaml-cppmd + libboost_log_setup${BOOST_SUFFIX} + libboost_log${BOOST_SUFFIX} + libboost_locale${BOOST_SUFFIX} + libboost_thread${BOOST_SUFFIX} + libboost_chrono${BOOST_SUFFIX} + libboost_date_time${BOOST_SUFFIX} + libboost_filesystem${BOOST_SUFFIX} + libboost_system${BOOST_SUFFIX} + libboost_regex${BOOST_SUFFIX} + version + git2 + zlibstatic + loadorder${PROJECT_ARCH} ws2_32) + set (BOSS_GUI_LIBS ${BOSS_LIBS} + wxmsw30u_webview + wxmsw30u_adv + wxmsw30u_core + wxbase30u + wxpng + wxzlib + comctl32) ENDIF () -set (BOSS_GUI_LIBS ${BOSS_LIBS} - wx_mswu_webview-3.0-${COMPILER_PREFIX} - wx_mswu_core-3.0-${COMPILER_PREFIX} - wx_baseu-3.0-${COMPILER_PREFIX} - wx_mswu_adv-3.0-${COMPILER_PREFIX} - wxpng-3.0-${COMPILER_PREFIX} - wxzlib-3.0-${COMPILER_PREFIX} - comctl32) - - ############################## # Actual Building diff --git a/README.md b/README.md index ace978c5..dc47b6c6 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,9 @@ At the moment, BOSSv3 is in beta testing, and so is not recommended for use unle This repository holds the source code and documentation for BOSS v3. The masterlists for v3 are stored in separate repostories on [GitHub](https://github.com/boss-developers). The source code, documentation and masterlists for previous versions of BOSS are stored on [Google Code](http://code.google.com/p/better-oblivion-sorting-software/). -## Build Instructions +## Building BOSS -BOSS uses [CMake](http://cmake.org) v2.8.9 or later for cross-platform building support, though development takes place on Linux, and the instructions below reflect this. Building on Windows should be straightforward using analogous commands though. +BOSS uses [CMake](http://cmake.org) v2.8.9 or later for cross-platform building support, as though it is a Windows application, development has taken place on Windows and Linux. BOSS requires the following libraries: @@ -38,16 +38,9 @@ BOSS requires the following libraries: * [yaml-cpp](http://code.google.com/p/yaml-cpp/) v0.5.1 or later. * [zlib](http://zlib.net) v1.2.7 or later. - BOSS expects all libraries' folders to be present alongside the BOSS repository folder that contains this readme, or otherwise installed such that the compiler and linker used can find them without suppling additional paths. All paths below are relative to the folder(s) containing the libraries and BOSS. -BOSS can also make use of [GraphVis](http://www.graphviz.org/Download_windows.php) binaries. If provided, they should be installed as detailed below. - -Alphanum, Libespm and PugiXML do not require any additional setup. The rest of the libraries must be built separately. - -### GraphVis - -Put the following binaries into `resources/graphvis/` in the BOSS repository root, then run `dot.exe -c`. +BOSS can also make use of [GraphVis](http://www.graphviz.org/Download_windows.php) binaries. If provided, the following binaries should be placed into `resources/graphvis/` in the BOSS repository root: * cdt.dll * cgraph.dll @@ -79,22 +72,75 @@ Put the following binaries into `resources/graphvis/` in the BOSS repository roo * Pathplan.dll * zlib1.dll -### Boost +Once the binaries have been placed there, run `dot.exe -c`. + +Alphanum, Libespm and PugiXML do not require any additional setup. The rest of the libraries must be built separately. Instructions for building them and BOSS itself on Windows and Linux are given below. They assume that Visual C++ 2013 is being used on Windows, and mingw-w64 is being used on Linux, though they should be similar for other compilers. + +### Windows + +#### Boost + +``` +bootstrap.bat +b2 toolset=msvc-12.0 threadapi=win32 link=static variant=release address-model=32 --with-log --with-date_time --with-thread --with-filesystem --with-locale --with-regex --with-system --with-iostreams --stagedir=stage-32 +``` + +#### wxWidgets + +Just build the solution provided by wxWidgets. + +#### zlib + +1. Add `/safeseh` to both lines in `contrib\masmx86\bld_ml32.bat`. +2. Build the solution in `contrib\vstudio`. +3. Copy `build\zconf.h` to `.\zconf.h`. + +#### yaml-cpp + +1. Set CMake up so that it builds the binaries in the `build` subdirectory of the yaml-cpp folder. +2. Define `BOOST_ROOT` to point to where the Boost folder is. +3. Configure CMake, then generate a build system for Visual Studio 12. +4. Open the generated solution file, and build it. + +#### Libloadorder + +Follow the instructions in libloadorder's README.md to build it as a static library. + +#### Libgit2 + +1. Set CMake up so that it builds the binaries in the `build` subdirectory of the libgit2 folder. +2. Configure CMake. +3. Undefine `BUILD_SHARED_LIBS`. +4. Generate a build system for Visual Studio 12. +5. Open the generated solution file, and build it. + +#### BOSS + +1. Set CMake up so that it builds the binaries in the `build` subdirectory of the BOSS folder. +2. Define `PROJECT_ARCH=32` or `PROJECT_ARCH=64` to build 32 or 64 bit executables respectively. +3. Define `PROJECT_LINK=STATIC` to build a static API, or `PROJECT_LINK=SHARED` to build a DLL API. +4. Define `PROEJCT_LIBS_DIR` to point to the folder holding all the required libraries' folders. +5. Configure CMake, then generate a build system for Visual Studio 12. +6. Open the generated solution file, and build it. + +### Linux + +#### Boost ``` ./bootstrap.sh echo "using gcc : 4.6.3 : i686-w64-mingw32-g++ : i686-w64-mingw32-windres i686-w64-mingw32-ar i686-w64-mingw32-ranlib ;" > tools/build/v2/user-config.jam -./b2 toolset=gcc-4.6.3 target-os=windows threadapi=win32 link=static runtime-link=static variant=release address-model=32 cxxflags=-fPIC --with-log --with-date_time --with-thread --with-filesystem --with-locale --with-regex --with-system --stagedir=stage-mingw-32 +./b2 toolset=gcc-4.6.3 target-os=windows threadapi=win32 link=static runtime-link=static variant=release address-model=32 cxxflags=-fPIC --with-log --with-date_time --with-thread --with-filesystem --with-locale --with-regex --with-system --with-iostreams --stagedir=stage-32 ``` -### wxWidgets +#### wxWidgets ``` ./configure --host=i686-w64-mingw32 --disable-shared --enable-stl make ``` -### zlib +#### zlib ``` mkdir build && cd build @@ -103,37 +149,34 @@ make cp zconf.h ../zconf.h ``` -### yaml-cpp +#### yaml-cpp ``` cmake . -DCMAKE_C_FLAGS=-m32 -DPROJECT_ARCH=32 -DCMAKE_TOOLCHAIN_FILE=../BOSSv3/mingw-toolchain.cmake -DBOOST_ROOT=../boost +make ``` -### Libespm - -Follow the instructions in libespm's README.md to build it as a static library. - -### Libloadorder +#### Libloadorder Follow the instructions in libloadorder's README.md to build it as a static library. -### OpenSSL +#### OpenSSL ``` ./Configure --cross-compile-prefix=i686-w64-mingw32- mingw make ``` -### Libgit2 +#### Libgit2 ``` mkdir build && cd build -cmake .. -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS=-m32 -DPROJECT_ARCH=32 -DCMAKE_TOOLCHAIN_FILE=../BOSSv3/mingw-toolchain.cmake +cmake .. -DBUILD_SHARED_LIBS=OFF -DOPENSSL_ROOT_DIR=../openssl -DCMAKE_C_FLAGS=-m32 -DPROJECT_ARCH=32 -DCMAKE_TOOLCHAIN_FILE=../BOSSv3/mingw-toolchain.cmake make ``` -If building with SSL support using OpenSSL, also pass `-DOPENSSL_ROOT_DIR=../openssl`. +If building with SSL support using OpenSSL, also pass ``. -### BOSS +#### BOSS ``` mkdir build && cd build