diff --git a/.travis.yml b/.travis.yml index e202e8fa..e223376f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,7 @@ addons: sources: - boost-latest - ubuntu-toolchain-r-test + - kubuntu-backports packages: - libboost-log1.55-dev - libboost-date-time1.55-dev @@ -20,6 +21,8 @@ addons: - libssl-dev - gcc-5 - g++-5 + - cmake + - cmake-data sauce_connect: true install: diff --git a/CMakeLists.txt b/CMakeLists.txt index bbdfeb5c..f49ca572 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 2.8.12.1) cmake_policy(SET CMP0015 NEW) project (LOOT) include(ExternalProject) @@ -111,15 +111,45 @@ ExternalProject_Get_Property(yaml-cpp SOURCE_DIR BINARY_DIR) set(YAML_CPP_INCLUDE_DIRS "${SOURCE_DIR}/include") set(YAML_CPP_LIBRARIES "${BINARY_DIR}/${CMAKE_CFG_INTDIR}/libyaml-cpp${CMAKE_STATIC_LIBRARY_SUFFIX}") +IF (CMAKE_SYSTEM_NAME MATCHES "Windows") + set(CEF_URL "http://opensource.spotify.com/cefbuilds/cef_binary_3.2704.1427.g95055fe_windows32.tar.bz2") + set(CEF_URL_HASH "4d18043de4eb55c4c8f7d29f097da39b0dfbf4e8") + set(CEF_PRECOMPILED_BINARIES "libcef.dll" "natives_blob.bin" "snapshot_blob.bin" "d3dcompiler_47.dll" "libEGL.dll" "libGLESv2.dll") + set(CEF_CONFIG_DIR_NAME ${CMAKE_CFG_INTDIR}) + set(CEF_LIB libcef${CMAKE_STATIC_LIBRARY_SUFFIX}) +ELSE () + set(CEF_URL "http://opensource.spotify.com/cefbuilds/cef_binary_3.2704.1427.g95055fe_linux64.tar.bz2") + set(CEF_URL_HASH "6b2945cb917d81dc0862aaa5b643b8c7e51e0e6c") + set(CEF_PRECOMPILED_BINARIES "libcef.so" "natives_blob.bin" "snapshot_blob.bin" "chrome-sandbox") + set(CEF_CONFIG_DIR_NAME "Release") + set(CEF_LIB libcef${CMAKE_SHARED_LIBRARY_SUFFIX}) +ENDIF() + +ExternalProject_Add(cef + PREFIX "external" + URL ${CEF_URL} + URL_HASH SHA1=${CEF_URL_HASH} + BUILD_COMMAND ${CMAKE_COMMAND} --build . --target libcef_dll_wrapper --config $(CONFIGURATION) + INSTALL_COMMAND "") +ExternalProject_Get_Property(cef SOURCE_DIR BINARY_DIR) +set(CEF_INCLUDE_DIRS "${SOURCE_DIR}") +set(CEF_LIBRARIES "${SOURCE_DIR}/${CEF_CONFIG_DIR_NAME}/${CEF_LIB}" + "${BINARY_DIR}/libcef_dll_wrapper/${CMAKE_CFG_INTDIR}/libcef_dll_wrapper${CMAKE_STATIC_LIBRARY_SUFFIX}") +set(CEF_RESOURCES_DIR "${SOURCE_DIR}/Resources") +set(CEF_RESOURCES "cef.pak" + "cef_100_percent.pak" + "cef_200_percent.pak" + "devtools_resources.pak" + "icudtl.dat") +set(CEF_LOCALES_DIR "${CEF_RESOURCES_DIR}/locales") +set(CEF_LOCALE_FILE "en-US.pak") +set(CEF_PRECOMPILED_BINARIES_DIR "${SOURCE_DIR}/${CEF_CONFIG_DIR_NAME}") + ############################## # General Settings ############################## -IF (NOT DEFINED CEF_ROOT) - set (CEF_ROOT "../../cef") -ENDIF () - set (LOOT_SRC "${CMAKE_SOURCE_DIR}/src/backend/app/loot_paths.cpp" "${CMAKE_SOURCE_DIR}/src/backend/app/loot_settings.cpp" "${CMAKE_SOURCE_DIR}/src/backend/app/loot_state.cpp" @@ -224,7 +254,7 @@ set (LOOT_TESTS_HEADERS "${CMAKE_SOURCE_DIR}/src/tests/base_game_test.h" "${CMAKE_SOURCE_DIR}/src/tests/api/loot_update_masterlist_test.h" "${CMAKE_SOURCE_DIR}/src/tests/api/loot_write_minimal_list_test.h" "${CMAKE_SOURCE_DIR}/src/tests/api/test_api.h" - + "${CMAKE_SOURCE_DIR}/src/tests/backend/app/loot_paths_test.h" "${CMAKE_SOURCE_DIR}/src/tests/backend/app/loot_settings_test.h" "${CMAKE_SOURCE_DIR}/src/tests/backend/app/loot_state_test.h" @@ -267,18 +297,13 @@ include_directories ("${CMAKE_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}/include" ${LIBLOADORDER_INCLUDE_DIRS} ${LIBGIT2_INCLUDE_DIRS} - ${CEF_ROOT} + ${CEF_INCLUDE_DIRS} ${LIBESPM_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${YAML_CPP_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS} ${PSEUDOSEM_INCLUDE_DIRS}) -# Look in build and build/ folders to support single and multiarch builds. -link_directories ("${CEF_ROOT}" - "${CEF_ROOT}/build/libcef_dll") - - ############################## # System-Specific Settings ############################## @@ -309,12 +334,9 @@ IF (CMAKE_COMPILER_IS_GNUCXX) z crypto) set (LOOT_GUI_LIBS ${LOOT_LIBS} - cef - cef_dll_wrapper X11) IF (NOT MINGW) - link_directories("${CEF_ROOT}/Release") add_definitions(-DNDEBUG) ENDIF () ENDIF () @@ -330,7 +352,6 @@ IF (MINGW) ws2_32 shlwapi) set (LOOT_GUI_LIBS ${LOOT_LIBS} - cef_sandbox rpcrt4 comctl32) ELSEIF (MSVC) @@ -356,8 +377,6 @@ ELSEIF (MSVC) crypt32 Rpcrt4) set (LOOT_GUI_LIBS ${LOOT_LIBS} - libcef - libcef_dll_wrapper rpcrt4 comctl32 Psapi) @@ -380,8 +399,8 @@ target_link_libraries(tests loot_api ${Boost_LIBRARIES} ${GTEST_LIBRARIES} ${LOO # Build application. add_executable (LOOT ${LOOT_GUI_SRC} ${LOOT_GUI_HEADERS}) -add_dependencies (LOOT libespm libgit2 libloadorder pseudosem yaml-cpp) -target_link_libraries (LOOT ${Boost_LIBRARIES} ${LIBGIT2_LIBRARIES} ${LIBLOADORDER_LIBRARIES} ${LOOT_GUI_LIBS} ${YAML_CPP_LIBRARIES}) +add_dependencies (LOOT cef libespm libgit2 libloadorder pseudosem yaml-cpp) +target_link_libraries (LOOT ${Boost_LIBRARIES} ${CEF_LIBRARIES} ${LIBGIT2_LIBRARIES} ${LIBLOADORDER_LIBRARIES} ${LOOT_GUI_LIBS} ${YAML_CPP_LIBRARIES}) # Build validator. add_executable (metadata-validator ${LOOT_VALIDATOR_SRC} ${LOOT_VALIDATOR_HEADERS}) @@ -424,44 +443,29 @@ IF (CMAKE_SYSTEM_NAME MATCHES "Windows") COMMAND "mt.exe" -manifest \"${CMAKE_SOURCE_DIR}/src/gui/LOOT.exe.manifest\" -inputresource:"$(TargetDir)$(TargetFileName)"\;\#1 -outputresource:"$(TargetDir)$(TargetFileName)"\;\#1 COMMENT "Adding manifest..." ) - - # Copy CEF binaries. - FOREACH(cef_dll libcef.dll natives_blob.bin snapshot_blob.bin d3dcompiler_47.dll libEGL.dll libGLESv2.dll) - add_custom_command(TARGET LOOT POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${CMAKE_SOURCE_DIR}/${CEF_ROOT}/$/${cef_dll}" - $/${cef_dll}) - ENDFOREACH() - - IF (NOT CMAKE_CL_64) - add_custom_command(TARGET LOOT POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${CMAKE_SOURCE_DIR}/${CEF_ROOT}/$/wow_helper.exe" - $/wow_helper.exe) - ENDIF () -ELSE () - # Copy CEF binaries. - FOREACH(cef_dll libcef.so natives_blob.bin snapshot_blob.bin chrome-sandbox) - add_custom_command(TARGET LOOT POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${CMAKE_SOURCE_DIR}/${CEF_ROOT}/Release/${cef_dll}" - $/${cef_dll}) - ENDFOREACH() ENDIF () -# Copy CEF resources. -FOREACH(cef_resource icudtl.dat cef.pak cef_100_percent.pak cef_200_percent.pak devtools_resources.pak) +# Copy CEF binaries. +FOREACH(cef_dll ${CEF_PRECOMPILED_BINARIES}) add_custom_command(TARGET LOOT POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${CMAKE_SOURCE_DIR}/${CEF_ROOT}/Resources/${cef_resource}" + "${CEF_PRECOMPILED_BINARIES_DIR}/${cef_dll}" + $/${cef_dll}) +ENDFOREACH() + +# Copy CEF resources. +FOREACH(cef_resource ${CEF_RESOURCES}) + add_custom_command(TARGET LOOT POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${CEF_RESOURCES_DIR}/${cef_resource}" $/${cef_resource}) ENDFOREACH() # Copy CEF en-US locale resource. add_custom_command(TARGET LOOT POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${CMAKE_SOURCE_DIR}/${CEF_ROOT}/Resources/locales/en-US.pak" - $/resources/l10n/en-US.pak) + "${CEF_LOCALES_DIR}/${CEF_LOCALE_FILE}" + $/resources/l10n/${CEF_LOCALE_FILE}) # Copy UI fonts. Not necessary for the build, but useful for testing. FOREACH(font Roboto-Bold.ttf Roboto-BoldItalic.ttf Roboto-Italic.ttf Roboto-Light.ttf Roboto-LightItalic.ttf Roboto-Medium.ttf Roboto-MediumItalic.ttf Roboto-Regular.ttf) diff --git a/README.md b/README.md index fa254236..6224d546 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,8 @@ LOOT is intended to make using mods easier, and mod users should still possess a LOOT's build process uses [CMake](http://cmake.org). Most of LOOT's C++ dependencies are managed by CMake, but the following must be obtained manually: * [Boost](http://www.boost.org) v1.55+ -* [Chromium Embedded Framework](https://bitbucket.org/chromiumembedded/cef) branch 2623 (only required if building the GUI) -Building LOOT's GUI also uses [Node.js](http://nodejs.org/). With it installed, run `npm install` then `./node_modules/.bin/bower install` from the repository root to install the additional tools and dependencies required. +Building LOOT's GUI also uses [Node.js](http://nodejs.org/). With it installed, run `npm install` then `node_modules/.bin/bower install` from the repository root to install the additional tools and dependencies required. The GUI's HTML file is automatically built when building the LOOT GUI binary, but it can also be built by running `node scripts/vulcanize.js` from the repository root. @@ -33,7 +32,6 @@ Parameter | Values | Default |Description ----------|--------|---------|----------- `BUILD_SHARED_LIBS` | `ON`, `OFF` | `OFF` | Whether or not to build a shared loot API binary. `PROJECT_STATIC_RUNTIME` | `ON`, `OFF` | `ON` | Whether to link the C++ runtime statically or not. This also affects the whether static or shared Boost libraries are used. -`CEF_ROOT` | path | `../../cef` | Path to the root of the Chromium Embedded Framework folder. The default paths given in the table above are relative to LOOT's `CMakeLists.txt`. You may also need to set `BOOST_ROOT` if CMake cannot find Boost. diff --git a/docs/BUILD.LINUX.md b/docs/BUILD.LINUX.md index acb7d2f7..fb749ba3 100644 --- a/docs/BUILD.LINUX.md +++ b/docs/BUILD.LINUX.md @@ -1,13 +1,15 @@ # Build Instructions using GCC Linux binaries can be built for LOOT, and these instructions are for doing so on -Ubuntu Desktop 14.04, though they may also apply to other versions and +Ubuntu 12.04, though they may also apply to other versions and distributions. +## Building + Most of the procedure for building the API, tests and metadata validator can be found in the `.travis.yml` file, which is the configuration file for LOOT's Travis CI instance. However, Travis instances have a few more libraries and -utilities by default than Ubuntu Desktop 14.04 does, and the procedure does not +utilities by default than Ubuntu 12.04 does, and the procedure does not cover building the GUI application, so these differences will be covered here. Linux builds of the GUI application should be considered officially @@ -15,29 +17,29 @@ Linux builds of the GUI application should be considered officially ## Installing Missing Dependencies -To install Node.js (for building the HTML UI) and the libcurl and X11 -development libraries (for libgit2 and the UI respectively), run the following: +### Base Dependencies + +``` +sudo apt-get install python-software-properties git build-essential libcurl4-openssl-dev +``` + +### UI Dependencies ``` sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 68576280 sudo apt-add-repository 'deb https://deb.nodesource.com/node_4.x precise main' sudo apt-get update -sudo apt-get install nodejs npm libcurl4-openssl-dev libx11-dev -sudo ln -s /usr/bin/nodejs /usr/bin/node -sudo npm install -g bower vulcanize@0.7.11 +sudo apt-get install nodejs libx11-dev libgtk2.0-dev libnss3-dev libgconf2-dev libxss-dev libasound2-dev libxtst-dev ``` -If you wish to build the GUI application, you must also manually download the -Chromium Embedded Framework binary archive, then extract it and run +## Pre-built Boost Packages Workaround + +The pre-built Boost packages for Boost 1.55 and below in Ubuntu were built without C++11 support, which causes an error when linking with a C++11-built LOOT binary. While it's better to use a build of Boost with C++11 support when building LOOT, the error can be worked around by running the following before running CMake: ``` -mkdir build && cd build -cmake .. -make +export TRAVIS=1 ``` -from the extracted folder. - ## Runtime Differences Not all LOOT's features have been implemented for Linux builds. Issues labelled diff --git a/docs/BUILD.MSVC.md b/docs/BUILD.MSVC.md index 175429f3..da7b9b4d 100644 --- a/docs/BUILD.MSVC.md +++ b/docs/BUILD.MSVC.md @@ -11,19 +11,6 @@ b2 toolset=msvc threadapi=win32 link=static runtime-link=static variant=release `link`, `runtime-link` and `address-model` can all be modified if shared linking or 64 bit builds are desired. LOOT uses statically-linked Boost libraries by default: to change this, edit [CMakeLists.txt](../CMakeLists.txt). -#### Chromium Embedded Framework - -Most of the required binaries are pre-built, but the libcef_dll_wrapper dynamic library must be built. - -1. Configure CMake and generate a build system for Visual Studio by running: - - ``` - mkdir build && cd build - cmake.exe .. -G "Visual Studio 14" - ``` - -2. Open the generated solution file, and build it with `Release` configuration. - #### LOOT 1. Set CMake up so that it builds the binaries in the `build` subdirectory of the LOOT folder. diff --git a/docs/LOOT Readme.html b/docs/LOOT Readme.html index d18092b2..10e9f152 100644 --- a/docs/LOOT Readme.html +++ b/docs/LOOT Readme.html @@ -226,7 +226,7 @@ figure > div {

Installation & Uninstallation

-

LOOT does not support Windows XP or earlier. +

LOOT requires Windows 7 or later.

LOOT can be installed either using its automated installer or manually. To install LOOT manually, extract the downloaded archive to a location of your choice. diff --git a/src/gui/handler.cpp b/src/gui/handler.cpp index 5e2c714c..e846afb9 100644 --- a/src/gui/handler.cpp +++ b/src/gui/handler.cpp @@ -36,7 +36,6 @@ #include "../backend/helpers/version.h" #include -#include #include #include #include diff --git a/src/gui/loot_app.cpp b/src/gui/loot_app.cpp index 8e08564f..f411a333 100644 --- a/src/gui/loot_app.cpp +++ b/src/gui/loot_app.cpp @@ -32,7 +32,6 @@ #include #include -#include #include #include diff --git a/src/gui/loot_handler.cpp b/src/gui/loot_handler.cpp index c738964b..838e94dc 100644 --- a/src/gui/loot_handler.cpp +++ b/src/gui/loot_handler.cpp @@ -33,7 +33,6 @@ #include "../backend/helpers/json.h" #include -#include #include #include #include @@ -268,7 +267,7 @@ namespace loot { if (!CefCurrentlyOn(TID_UI)) { // Execute on the UI thread. CefPostTask(TID_UI, - NewCefRunnableMethod(this, &LootHandler::CloseAllBrowsers, force_close)); + base::Bind(&LootHandler::CloseAllBrowsers, this, force_close)); return; }