mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Use CMakeDeps
and CMakeToolchain
as Generators on Conan (#4335)
* deps(conan): use `CMakeDeps` as generator * chore: add changelog entry * deps(conan): add `CMakeToolchain` generator * fix: use generated toolchain file * docs: mention toolchain as well * fix: spelling * fix: formatting * revert: use nmake * docs: fix documentation
This commit is contained in:
parent
6a4f0befd4
commit
b80d41c327
6 changed files with 22 additions and 35 deletions
10
.github/workflows/build.yml
vendored
10
.github/workflows/build.yml
vendored
|
@ -85,16 +85,22 @@ jobs:
|
|||
if: startsWith(matrix.os, 'windows')
|
||||
uses: ilammy/msvc-dev-cmd@v1.12.0
|
||||
|
||||
- name: Setup Conan (Windows)
|
||||
if: startsWith(matrix.os, 'windows')
|
||||
run: |
|
||||
conan profile new --detect --force default
|
||||
conan profile update conf.tools.cmake.cmaketoolchain:generator="NMake Makefiles" default
|
||||
|
||||
- name: Build (Windows)
|
||||
if: startsWith(matrix.os, 'windows')
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
conan install .. -b missing
|
||||
conan install .. -s build_type=Release -b missing -pr:b=default
|
||||
cmake `
|
||||
-G"NMake Makefiles" `
|
||||
-DCMAKE_BUILD_TYPE=Release `
|
||||
-DUSE_CONAN=ON `
|
||||
-DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" `
|
||||
-DCHATTERINO_LTO="$Env:C2_ENABLE_LTO" `
|
||||
..
|
||||
set cl=/MP
|
||||
|
|
|
@ -131,7 +131,7 @@ Open up your terminal with the Visual Studio environment variables, then enter t
|
|||
|
||||
1. `mkdir build`
|
||||
2. `cd build`
|
||||
3. `cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DUSE_CONAN=ON ..`
|
||||
3. `cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" ..`
|
||||
4. `nmake`
|
||||
|
||||
## Building on MSVC with AddressSanitizer
|
||||
|
@ -160,7 +160,7 @@ Now open the project in CLion. You will be greeted with the _Open Project Wizard
|
|||
|
||||
```
|
||||
-DCMAKE_PREFIX_PATH=C:\Qt\5.15.2\msvc2019_64\lib\cmake\Qt5
|
||||
-DUSE_CONAN=ON
|
||||
-DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake"
|
||||
```
|
||||
|
||||
and the _Build Directory_ to `build`.
|
||||
|
|
|
@ -41,7 +41,8 @@
|
|||
- Dev: Fixed `final-dtor-non-final-class` warnings. (#4296)
|
||||
- Dev: Fixed `ambiguous-reversed-operator` warnings. (#4296)
|
||||
- Dev: Format YAML and JSON files with prettier. (#4304)
|
||||
- Dev: Addded CMake Install Support on Windows. (#4300)
|
||||
- Dev: Added CMake Install Support on Windows. (#4300)
|
||||
- Dev: Changed conan generator to [`CMakeDeps`](https://docs.conan.io/en/latest/reference/conanfile/tools/cmake/cmakedeps.html) and [`CMakeToolchain`](https://docs.conan.io/en/latest/reference/conanfile/tools/cmake/cmaketoolchain.html). See PR for migration notes. (#4335)
|
||||
|
||||
## 2.4.0
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
cmake_minimum_required(VERSION 3.12)
|
||||
cmake_policy(SET CMP0087 NEW)
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
cmake_policy(SET CMP0087 NEW) # evaluates generator expressions in `install(CODE/SCRIPT)`
|
||||
cmake_policy(SET CMP0091 NEW) # select MSVC runtime library through `CMAKE_MSVC_RUNTIME_LIBRARY`
|
||||
include(FeatureSummary)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH
|
||||
|
@ -24,8 +25,6 @@ option(BUILD_TRANSLATIONS "" OFF)
|
|||
option(BUILD_SHARED_LIBS "" OFF)
|
||||
option(CHATTERINO_LTO "Enable LTO for all targets" OFF)
|
||||
|
||||
option(USE_CONAN "Use conan" OFF)
|
||||
|
||||
if(CHATTERINO_LTO)
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT CHATTERINO_ENABLE_LTO OUTPUT IPO_ERROR)
|
||||
|
@ -40,13 +39,6 @@ else()
|
|||
set(MAJOR_QT_VERSION "5")
|
||||
endif()
|
||||
|
||||
if (USE_CONAN OR CONAN_EXPORTED)
|
||||
include(${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo.cmake)
|
||||
conan_basic_setup(TARGETS NO_OUTPUT_DIRS)
|
||||
else ()
|
||||
set(QT_CREATOR_SKIP_CONAN_SETUP ON)
|
||||
endif()
|
||||
|
||||
find_program(CCACHE_PROGRAM ccache)
|
||||
if (CCACHE_PROGRAM)
|
||||
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
|
||||
|
@ -75,8 +67,9 @@ endif ()
|
|||
find_package(Sanitizers)
|
||||
|
||||
# Find boost on the system
|
||||
find_package(Boost REQUIRED)
|
||||
find_package(Boost COMPONENTS random)
|
||||
# `OPTIONAL_COMPONENTS random` is required for vcpkg builds to link.
|
||||
# `OPTIONAL` is required, because conan doesn't set `boost_random_FOUND`.
|
||||
find_package(Boost REQUIRED OPTIONAL_COMPONENTS random)
|
||||
|
||||
# Find OpenSSL on the system
|
||||
find_package(OpenSSL REQUIRED)
|
||||
|
|
|
@ -3,7 +3,8 @@ openssl/1.1.1s
|
|||
boost/1.80.0
|
||||
|
||||
[generators]
|
||||
cmake
|
||||
CMakeDeps
|
||||
CMakeToolchain
|
||||
|
||||
[options]
|
||||
openssl:shared=True
|
||||
|
|
|
@ -809,30 +809,16 @@ if (WinToast_FOUND)
|
|||
WinToast)
|
||||
endif ()
|
||||
|
||||
if (USE_CONAN AND TARGET CONAN_PKG::boost)
|
||||
target_link_libraries(${LIBRARY_PROJECT}
|
||||
PUBLIC
|
||||
CONAN_PKG::boost
|
||||
)
|
||||
else ()
|
||||
target_link_libraries(${LIBRARY_PROJECT}
|
||||
target_link_libraries(${LIBRARY_PROJECT}
|
||||
PUBLIC
|
||||
${Boost_LIBRARIES}
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (USE_CONAN AND TARGET CONAN_PKG::openssl)
|
||||
target_link_libraries(${LIBRARY_PROJECT}
|
||||
PUBLIC
|
||||
CONAN_PKG::openssl
|
||||
)
|
||||
else ()
|
||||
target_link_libraries(${LIBRARY_PROJECT}
|
||||
target_link_libraries(${LIBRARY_PROJECT}
|
||||
PUBLIC
|
||||
OpenSSL::SSL
|
||||
OpenSSL::Crypto
|
||||
)
|
||||
endif ()
|
||||
|
||||
target_include_directories(${LIBRARY_PROJECT} PUBLIC ${RapidJSON_INCLUDE_DIRS})
|
||||
|
||||
|
|
Loading…
Reference in a new issue