diff --git a/.gitignore b/.gitignore index eca5bc34b..a0e5fee74 100644 --- a/.gitignore +++ b/.gitignore @@ -104,3 +104,6 @@ Stamp tmp Source Dependencies_* + +# vcpkg +vcpkg_installed/ diff --git a/BUILDING_ON_WINDOWS_WITH_VCPKG.md b/BUILDING_ON_WINDOWS_WITH_VCPKG.md new file mode 100644 index 000000000..4bfac943d --- /dev/null +++ b/BUILDING_ON_WINDOWS_WITH_VCPKG.md @@ -0,0 +1,35 @@ +# Building on Windows with vcpkg + +## Prerequisites + +1. Install [Visual Studio](https://visualstudio.microsoft.com/) with "Desktop development with C++" (~9.66 GB) +1. Install [CMake](https://cmake.org/) (~109 MB) +1. Install [git](https://git-scm.com/) (~264 MB) +1. Install [vcpkg](https://vcpkg.io/) (~80 MB) + - `git clone https://github.com/Microsoft/vcpkg.git` + - `cd .\vcpkg\` + - `.\bootstrap-vcpkg.bat` + - `.\vcpkg integrate install` + - `.\vcpkg integrate powershell` + - `cd ..` +1. Configure the environment for vcpkg + - `set VCPKG_DEFAULT_TRIPLET=x64-windows` + - [default](https://github.com/microsoft/vcpkg/blob/master/docs/users/triplets.md#additional-remarks) is `x86-windows` + - `set VCPKG_ROOT=C:\path\to\vcpkg\` + - `set PATH=%PATH%;%VCPKG_ROOT%` + +## Building + +1. Clone + - `git clone --recurse-submodules https://github.com/Chatterino/chatterino2.git` +1. Install dependencies (~21 GB) + - `cd .\chatterino2\` + - `vcpkg install` +1. Build + - `mkdir .\build\` + - `cd .\build\` + - (cmd) `cmake .. -DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%/scripts/buildsystems/vcpkg.cmake` + - (ps1) `cmake .. -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"` + - `cmake --build . --parallel --config Release` +1. Run + - `.\bin\chatterino2.exe` diff --git a/CMakeLists.txt b/CMakeLists.txt index b2cd73c37..0c01861df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,7 @@ find_package(Sanitizers) # Find boost on the system find_package(Boost REQUIRED) +find_package(Boost COMPONENTS random) # Find OpenSSL on the system find_package(OpenSSL REQUIRED) diff --git a/README.md b/README.md index 180d18e53..29d1881dc 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,8 @@ git submodule update --init --recursive [Building on Windows](../master/BUILDING_ON_WINDOWS.md) +[Building on Windows with vcpkg](../master/BUILDING_ON_WINDOWS_WITH_VCPKG.md) + [Building on Linux](../master/BUILDING_ON_LINUX.md) [Building on Mac](../master/BUILDING_ON_MAC.md) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d37369cd9..1d419251b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -649,7 +649,7 @@ if (WIN32) endif () if (MSVC) - target_compile_options(${LIBRARY_PROJECT} PUBLIC /EHsc) + target_compile_options(${LIBRARY_PROJECT} PUBLIC /EHsc /bigobj) endif () if (APPLE AND BUILD_APP) @@ -682,7 +682,7 @@ if (USE_CONAN AND TARGET CONAN_PKG::boost) else () target_link_libraries(${LIBRARY_PROJECT} PUBLIC - Boost::boost + ${Boost_LIBRARIES} ) endif () diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9b1641d25..017b72149 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -25,7 +25,7 @@ add_sanitizers(${PROJECT_NAME}) target_link_libraries(${PROJECT_NAME} PRIVATE chatterino-lib) -target_link_libraries(${PROJECT_NAME} PRIVATE gtest) +target_link_libraries(${PROJECT_NAME} PRIVATE ${GTEST_BOTH_LIBRARIES}) target_compile_definitions(${PROJECT_NAME} PRIVATE CHATTERINO_TEST diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 000000000..aea44f56e --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json", + "name": "chatterino", + "version": "2.0.0", + "dependencies": [ + "benchmark", + "boost-asio", + "boost-foreach", + "boost-interprocess", + "boost-random", + "boost-variant", + "gtest", + "openssl", + "qt5-multimedia", + "qt5-tools" + ], + "builtin-baseline": "2ac61f87f69f0484b8044f95ab274038fbaf7bdd", + "overrides": [ + { "name": "openssl", "version-string": "1.1.1n" } + ] +}