Skip to content

Commit

Permalink
qt-advanced-docking-system: bump Qt to v6, fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
valgur committed Nov 9, 2023
1 parent c5798fe commit e7d2c76
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
18 changes: 14 additions & 4 deletions recipes/qt-advanced-docking-system/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.env import VirtualBuildEnv
from conan.tools.env import VirtualBuildEnv, VirtualRunEnv
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir
from conan.tools.microsoft import is_msvc
from conan.tools.scm import Version

required_conan_version = ">=1.56.0 <2 || >=2.0.6"
Expand Down Expand Up @@ -37,7 +38,10 @@ class QtADS(ConanFile):

@property
def _min_cppstd(self):
return 14
if Version(self.dependencies["qt"].ref.version) >= 6:
return 17
else:
return 14

@property
def _compilers_minimum_version(self):
Expand All @@ -46,7 +50,7 @@ def _compilers_minimum_version(self):
"msvc": "191",
"gcc": "5",
"clang": "5",
"apple-clang": "5.1",
"apple-clang": "5",
}

def export_sources(self):
Expand All @@ -64,7 +68,7 @@ def layout(self):
cmake_layout(self, src_folder="src")

def requirements(self):
self.requires("qt/5.15.11", transitive_headers=True, transitive_libs=True)
self.requires("qt/6.6.0", transitive_headers=True, transitive_libs=True)
self.requires("libpng/1.6.40")

def validate(self):
Expand All @@ -86,6 +90,8 @@ def source(self):
def generate(self):
env = VirtualBuildEnv(self)
env.generate()
env = VirtualRunEnv(self)
env.generate(scope="build")
tc = CMakeToolchain(self)
tc.cache_variables["ADS_VERSION"] = self.version
tc.variables["BUILD_EXAMPLES"] = "OFF"
Expand Down Expand Up @@ -121,3 +127,7 @@ def package_info(self):
else:
self.cpp_info.defines.append("ADS_STATIC")
self.cpp_info.libs = ["qtadvanceddocking_static"]

if is_msvc(self) and Version(self.dependencies["qt"].ref.version) >= 6:
# Qt 6 requires C++17 and a valid __cplusplus value
self.cpp_info.cxxflags.append("/Zc:__cplusplus")
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
cmake_minimum_required(VERSION 3.15)
project(test_package CXX)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(qt-advanced-docking-system REQUIRED CONFIG)

add_executable(example example.cpp)
target_link_libraries(example qt-advanced-docking-system::qt-advanced-docking-system)
target_compile_features(example PRIVATE cxx_std_17)

0 comments on commit e7d2c76

Please sign in to comment.