Skip to content

Commit 89e7a58

Browse files
author
Sebastian Hahn
committed
Feature: Add conan file for each library
* Add include guards such that each library is included at most once * Use c++20 as default for each library
1 parent 66b314f commit 89e7a58

26 files changed

Lines changed: 387 additions & 0 deletions

File tree

src/array19.lib/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
2+
include_guard(GLOBAL)
23

34
add_library(array19 INTERFACE)
5+
set(CMAKE_CXX_STANDARD 20)
46

57
target_include_directories(array19 INTERFACE
68
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/>

src/array19.lib/conanfile.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from conans import ConanFile
2+
3+
class Array19Conan(ConanFile):
4+
name = "array19"
5+
version = "1.0"
6+
7+
# Optional metadata
8+
license = "MIT License"
9+
author = "Hicknhack Software"
10+
url = "https://github.com/basicpp17/co-cpp19"
11+
description = "C++17/20 Library with the fastest runtime and compile times"
12+
topics = ("algorithm", "container", "common", "utility")
13+
14+
def export_sources(self):
15+
self.copy("CMakeLists.txt")
16+
self.copy("*", src="array19", dst="array19")
17+
18+
def package(self):
19+
self.copy("*.h", dst="include")
20+

src/coro19.lib/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
22

3+
set(CMAKE_CXX_STANDARD 20)
34
add_library(coro19 STATIC)
45

56
target_include_directories(coro19 PUBLIC

src/coro19.lib/conanfile.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
from conans import ConanFile, CMake
2+
from conan.tools.cmake import CMakeToolchain
3+
import os
4+
5+
class Coro19Conan(ConanFile):
6+
name = "coro19"
7+
version = "1.0"
8+
9+
# Optional metadata
10+
license = "MIT License"
11+
author = "Hicknhack Software"
12+
url = "https://github.com/basicpp17/co-cpp19"
13+
description = "C++17/20 Library with the fastest runtime and compile times"
14+
topics = ("algorithm", "container", "common", "utility")
15+
generators = "cmake_find_package", "cmake"
16+
# Binary configuration
17+
settings = "os", "compiler", "build_type", "arch"
18+
options = {"shared": [True, False], "fPIC": [True, False]}
19+
default_options = {"shared": False, "fPIC": True}
20+
21+
def export_sources(self):
22+
self.copy("CMakeLists.txt")
23+
self.copy("*", src="coro19", dst="coro19")
24+
25+
def config_options(self):
26+
if self.settings.os == "Windows":
27+
del self.options.fPIC
28+
29+
def generate(self):
30+
tc = CMakeToolchain(self)
31+
tc.generate()
32+
33+
def build(self):
34+
cmake = CMake(self)
35+
cmake.configure()
36+
cmake.build()
37+
38+
def package(self):
39+
self.copy("*.h", dst="include")
40+
self.copy("*.lib", dst="lib", keep_path=False)
41+
self.copy("*.dll", dst="bin", keep_path=False)
42+
self.copy("*.so", dst="lib", keep_path=False)
43+
self.copy("*.dylib", dst="lib", keep_path=False)
44+
self.copy("*.a", dst="lib", keep_path=False)
45+
46+
def package_info(self):
47+
postfix = "d" if self.settings.build_type == "Debug" else ""
48+
self.cpp_info.libs = ["coro19" + postfix]

src/enum19.lib/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
2+
include_guard(GLOBAL)
23

34
add_library(enum19 INTERFACE)
5+
set(CMAKE_CXX_STANDARD 20)
46

57
target_include_directories(enum19 INTERFACE
68
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/>
79
)
10+
add_subdirectory(../array19.lib arrayBuild)
11+
add_subdirectory(../meta19.lib metaBuild)
12+
add_subdirectory(../string19.lib stringBuild)
813
target_link_libraries(enum19 INTERFACE array19 meta19 string19)
914

1015
if(${co-cpp19-enable-tests})

src/enum19.lib/conanfile.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from conans import ConanFile
2+
3+
class Enum19Conan(ConanFile):
4+
name = "enum19"
5+
version = "1.0"
6+
7+
# Optional metadata
8+
license = "MIT License"
9+
author = "Hicknhack Software"
10+
url = "https://github.com/basicpp17/co-cpp19"
11+
description = "C++17/20 Library with the fastest runtime and compile times"
12+
topics = ("algorithm", "container", "common", "utility")
13+
14+
def export_sources(self):
15+
self.copy("CMakeLists.txt")
16+
self.copy("*", src="enum19", dst="enum19")
17+
18+
def package(self):
19+
self.copy("*.h", dst="include")
20+
21+
def requirements(self):
22+
self.requires("string19/1.0")
23+
self.requires("array19/1.0")
24+
self.requires("meta19/1.0")

src/lookup19.lib/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
2+
include_guard(GLOBAL)
23

34
add_library(lookup19 INTERFACE)
5+
set(CMAKE_CXX_STANDARD 20)
46

57
target_include_directories(lookup19 INTERFACE
68
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/>
79
)
10+
11+
add_subdirectory(../array19.lib arrayBuild)
812
target_link_libraries(lookup19 INTERFACE array19)
913

1014
if(${co-cpp19-enable-tests})

src/lookup19.lib/conanfile.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from conans import ConanFile
2+
3+
4+
class Lookup19Conan(ConanFile):
5+
name = "lookup19"
6+
version = "1.0"
7+
8+
# Optional metadata
9+
license = "MIT License"
10+
author = "Hicknhack Software"
11+
url = "https://github.com/basicpp17/co-cpp19"
12+
description = "C++17/20 Library with the fastest runtime and compile times"
13+
topics = ("algorithm", "container", "common", "utility")
14+
15+
def export_sources(self):
16+
self.copy("CMakeLists.txt")
17+
self.copy("*", src="lookup19", dst="lookup19")
18+
19+
def package(self):
20+
self.copy("*.h", dst="include")
21+
22+
def requirements(self):
23+
self.requires("array19/1.0")

src/meta19.lib/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
2+
include_guard(GLOBAL)
23

34
add_library(meta19 INTERFACE)
5+
set(CMAKE_CXX_STANDARD 20)
46

57
target_include_directories(meta19 INTERFACE
68
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/>
79
)
10+
11+
add_subdirectory(../array19.lib arrayBuild)
12+
813
target_link_libraries(meta19 INTERFACE array19)
914

1015
if(${co-cpp19-enable-tests})

src/meta19.lib/conanfile.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from conans import ConanFile
2+
3+
class Meta19Conan(ConanFile):
4+
name = "meta19"
5+
version = "1.0"
6+
7+
# Optional metadata
8+
license = "MIT License"
9+
author = "Hicknhack Software"
10+
url = "https://github.com/basicpp17/co-cpp19"
11+
description = "C++17/20 Library with the fastest runtime and compile times"
12+
topics = ("algorithm", "container", "common", "utility")
13+
14+
def export_sources(self):
15+
self.copy("CMakeLists.txt")
16+
self.copy("*", src="meta19", dst="meta19")
17+
18+
def package(self):
19+
self.copy("*.h", dst="include")
20+
21+
def requirements(self):
22+
self.requires("array19/1.0")

0 commit comments

Comments
 (0)