Skip to content

Commit

Permalink
Switch conan to new cmake-conan provider
Browse files Browse the repository at this point in the history
  • Loading branch information
herzenschein committed Jun 10, 2024
1 parent fd0240c commit d6838a9
Show file tree
Hide file tree
Showing 4 changed files with 656 additions and 30 deletions.
25 changes: 0 additions & 25 deletions qml6-conan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,6 @@ project(qml6-conan)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR})

# This is needed for the following conan_ macros.
file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/0.18.1/conan.cmake" "${CMAKE_BINARY_DIR}/conan.cmake")
include(${CMAKE_BINARY_DIR}/conan.cmake)

# This is equivalent to what you'd write in a conanfile.py or conanfile.txt.
conan_cmake_configure(
REQUIRES qt/6.3.1
GENERATORS cmake_find_package qt
)

conan_cmake_autodetect(settings)

# This is equivalent to what you'd write with conan install.
# e.g. conan install . --build missing --remote conancenter --options qt:qtshadertools=True qt:qtdeclarative=True
conan_cmake_install(
PATH_OR_REFERENCE .
BUILD missing
REMOTE conancenter
SETTINGS ${settings}
OPTIONS
qt:shared=True
qt:qtshadertools=True
qt:qtdeclarative=True
)

# This way, we can use normal find_package calls.
find_package(Qt6 REQUIRED COMPONENTS
Quick
Expand Down
10 changes: 5 additions & 5 deletions qml6-conan/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ Using Conan requires minimal changes to code, but some preparation before buildi

How to run it:

```
```bash
# Best practice: do all of this in a Python VENV
python3 -m venv .
source bin/active.sh
source bin/activate.sh

pip install conan

cmake -B build
cmake --build build
DESTDIR=appdir cmake --install build
cmake -B build -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider.cmake -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel
cmake --install build --prefix staging # Or anywhere else you'd like, like /usr
```

To build with ninja instead of make for improved compilation times, use `-D CMAKE_GENERATOR=Ninja`.
Expand Down
Loading

0 comments on commit d6838a9

Please sign in to comment.