Skip to content

Commit 17e3eb2

Browse files
committed
Upgrade to Conan 2.0 (5)
1 parent f7aca9a commit 17e3eb2

37 files changed

+65
-92
lines changed

.github/workflows/conan.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@ jobs:
2121

2222
- name: Create conan package
2323
run: |
24-
cd conan
25-
conan create . --build=missing --profile profiles/msvc2022
24+
conan create conan/ --build=missing --profile:all=./conan/profiles/msvc2022
2625
2726
- name: Test package components
2827
shell: pwsh
2928
run: |
3029
foreach ($folder in (Get-ChildItem -Path ./conan/tests -Directory | Foreach-Object {$_.Name})) {
3130
echo "Running ${folder}"
32-
& script\test_conan.bat "${folder}" --profile "$pwd/conan/profiles/msvc2022"
31+
& script\test_conan.bat "${folder}" --profile:all="$pwd/conan/profiles/msvc2022"
3332
if ($LASTEXITCODE -ne 0) {
3433
exit(1)
3534
}

conan/conanfile.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from conans import ConanFile
1+
from conan import ConanFile
22
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
3-
from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, replace_in_file, rm, rmdir
4-
from conans import tools
3+
from conan.tools.files import copy, rmdir
4+
from conan.tools.build import check_min_cppstd
55

66
import os
77

@@ -24,27 +24,28 @@ class Cocpp19Conan(ConanFile):
2424
"shared": False,
2525
"fPIC": True
2626
}
27-
requires = [("gtest/1.11.0", "private")]
27+
test_requires = "gtest/1.11.0"
2828
generators = "CMakeDeps"
2929

3030
def layout(self):
3131
self.folders.root = ".."
3232
cmake_layout(self)
3333

3434
def export_sources(self):
35-
self.copy("CMakeLists.txt", src="..")
36-
self.copy("CoCpp19Config.cmake.in", src="..")
37-
self.copy("LICENSE", src="..")
38-
self.copy("src/*", src="..", excludes="*.qbs")
39-
self.copy("third_party/CMakeLists.txt", src="..")
40-
self.copy("third_party/googletest.cmake", src="..")
35+
folder = os.path.join(self.recipe_folder, "..")
36+
copy(self, "CMakeLists.txt", folder, self.export_sources_folder)
37+
copy(self, "CoCpp19Config.cmake.in", folder, self.export_sources_folder)
38+
copy(self, "LICENSE", folder, self.export_sources_folder)
39+
copy(self, "src/*", folder, self.export_sources_folder, excludes="*.qbs")
40+
copy(self, "third_party/CMakeLists.txt", folder, self.export_sources_folder)
41+
copy(self, "third_party/googletest.cmake", folder, self.export_sources_folder)
4142

4243
def config_options(self):
4344
if self.settings.os == "Windows":
4445
del self.options.fPIC
4546

4647
def validate(self):
47-
tools.check_min_cppstd(self, "20")
48+
check_min_cppstd(self, "20")
4849

4950
def generate(self):
5051
tc = CMakeToolchain(self)
@@ -56,7 +57,7 @@ def build(self):
5657
cmake.build()
5758

5859
def package(self):
59-
self.copy("LICENSE")
60+
copy(self, "LICENSE", self.source_folder, self.package_folder)
6061
cmake = CMake(self)
6162
cmake.install()
6263
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
@@ -65,6 +66,7 @@ def package(self):
6566
def package_info(self):
6667
self.cpp_info.set_property("cmake_find_mode", "both")
6768
self.cpp_info.set_property("cmake_file_name", "CoCpp19")
69+
self.cpp_info.set_property("cmake_target_name", "CoCpp19")
6870

6971
components = [
7072
{"name": "array19"},
@@ -90,8 +92,8 @@ def package_info(self):
9092
if "libs" in comp:
9193
self.cpp_info.components[name].libs = comp["libs"]
9294

93-
self.cpp_info.names["cmake_find_package"] = "CoCpp19"
94-
self.cpp_info.names["cmake_find_package_multi"] = "CoCpp19"
95+
# self.cpp_info.names["cmake_find_package"] = "CoCpp19"
96+
# self.cpp_info.names["cmake_find_package_multi"] = "CoCpp19"
9597

9698
def test(self):
9799
cmake = CMake(self)

conan/profiles/clang15-libcxx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
[settings]
22
os=Linux
3-
os_build=Linux
43
arch=x86_64
5-
arch_build=x86_64
64
compiler=clang
75
compiler.libcxx=libc++
86
compiler.version=15

conan/profiles/clang15-libstdcpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
[settings]
22
os=Linux
3-
os_build=Linux
43
arch=x86_64
5-
arch_build=x86_64
64
compiler=clang
75
compiler.libcxx=libstdc++11
86
compiler.version=15

conan/profiles/clang18-libstdcpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[settings]
2+
os=Linux
3+
arch=x86_64
4+
compiler=clang
5+
compiler.libcxx=libstdc++11
6+
compiler.version=18
7+
compiler.cppstd=20
8+
build_type=Release
9+
10+
[options]
11+
*:shared=False

conan/profiles/gcc12

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
[settings]
22
os=Linux
3-
os_build=Linux
43
arch=x86_64
5-
arch_build=x86_64
64
compiler=gcc
75
compiler.libcxx=libstdc++11
86
compiler.version=12

conan/profiles/msvc2022

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
[settings]
22
os=Windows
3-
os_build=Windows
43
arch=x86_64
5-
arch_build=x86_64
6-
compiler=Visual Studio
7-
compiler.version=17
4+
compiler=msvc
5+
compiler.version=194
86
compiler.cppstd=20
9-
compiler.runtime=MD
7+
compiler.runtime=dynamic
108
build_type=Release
119

1210
[options]
1311
*:shared=False
12+
13+
[conf]
14+
tools.cmake.cmaketoolchain:generator=Ninja Multi-Config

conan/tests/array19/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ cmake_minimum_required(VERSION 3.15)
22
project(conan-array19)
33
set(CMAKE_CXX_STANDARD 20)
44

5-
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
6-
conan_basic_setup()
7-
85
set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR} ${CMAKE_MODULE_PATH})
96
find_package(GTest REQUIRED)
107
find_package(CoCpp19 COMPONENTS array19 REQUIRED)

conan/tests/array19/conanfile.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ co-cpp19/1.0
33
gtest/1.11.0
44

55
[generators]
6-
cmake
76
CMakeDeps
7+
CMakeToolchain

conan/tests/coro19/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ cmake_minimum_required(VERSION 3.15)
22
project(conan-coro19)
33
set(CMAKE_CXX_STANDARD 20)
44

5-
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
6-
conan_basic_setup()
7-
85
set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR} ${CMAKE_MODULE_PATH})
96
find_package(GTest REQUIRED)
107
find_package(CoCpp19 COMPONENTS coro19 REQUIRED)

0 commit comments

Comments
 (0)