Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New package: libq #22828

Merged
merged 29 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2d364fa
Add libq package
metalMajor Feb 9, 2024
c0ff54b
check minimum cppstd
metalMajor Feb 20, 2024
466d2b3
remove unused import
metalMajor Feb 20, 2024
1ab71a5
Merge branch 'master' into package/libq
metalMajor Feb 20, 2024
3399439
Bases the package file on cmake_package template.
metalMajor Feb 26, 2024
bbafb8c
Merge branch 'package/libq' of git@github.com:metalMajor/conan-center…
metalMajor Feb 26, 2024
13acf9a
add test package from template
metalMajor Feb 27, 2024
0d06baf
Fixes to the recipe
AbrilRBS May 4, 2024
991b70e
Unvendor libq - Still does not work
AbrilRBS May 4, 2024
aba7aa7
Fix static lib package_info
AbrilRBS May 4, 2024
4d58026
Merge branch 'package/libq' of git@github.com:metalMajor/conan-center…
metalMajor Oct 24, 2024
ca3f32f
Fix to package_info libs
metalMajor Oct 24, 2024
4dae208
fix package_info libs names
metalMajor Oct 24, 2024
4948151
fails on gcc 7.5 it seems
metalMajor Oct 25, 2024
b9dcf64
make exception for static
metalMajor Oct 25, 2024
4a9cb42
use system_libs as suggested by the compile output on windows
metalMajor Nov 14, 2024
b452880
add both libs and system_libs
metalMajor Nov 14, 2024
70d3fbd
another try for windows
metalMajor Nov 14, 2024
c12c9a4
only allow shared on msvc as test
metalMajor Nov 14, 2024
dccd428
skip windows as test
metalMajor Nov 14, 2024
78c8f41
implement suggested code review changes
metalMajor Nov 14, 2024
0545f74
fix linter warnings
metalMajor Nov 14, 2024
2a23fcd
fix apple install name
metalMajor Nov 14, 2024
8f42030
Update recipes/libq/all/conandata.yml
metalMajor Nov 14, 2024
634a938
update to conan2 version style
metalMajor Nov 14, 2024
c226148
Fix compilation in Windows and Macos
AbrilRBS Nov 14, 2024
b08331a
Add missing patch file
AbrilRBS Nov 14, 2024
71394e9
Use static-library for Windows.
uilianries Nov 15, 2024
471c8e9
Remove unused imports
uilianries Nov 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions recipes/libq/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
sources:
"0.0.0.cci.20180504":
url: "https://github.com/grantila/q/archive/0117848bb3e6f0b130b546bc5851caf5f95f8b7e.zip"
sha256: "f5e51c1abbbec8e6da2155740917d7f1f60628745363ebd4e2aadfd7ef2ff682"
patches:
"0.0.0.cci.20180504":
- patch_file: "patches/0001-cmake-remove-hardcoded-flags.patch"
patch_description: "Remove hardcoded flags from CMakeLists.txt"
patch_type: "conan"
90 changes: 90 additions & 0 deletions recipes/libq/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import os

from conan import ConanFile
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.files import copy, get, rm, rmdir, export_conandata_patches, apply_conandata_patches
from conan.tools.microsoft import is_msvc
from conan.tools.apple import fix_apple_shared_install_name

required_conan_version = ">=2.1"

class libqConan(ConanFile):
name = "libq"
description = "A platform-independent promise library for C++, implementing asynchronous continuations."
license = "Apache-2.0"
topics = ("async", "promises")
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/grantila/q"
AbrilRBS marked this conversation as resolved.
Show resolved Hide resolved
settings = "os", "compiler", "build_type", "arch"
package_type = "library"
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
}

implements = ["auto_shared_fpic"]

def layout(self):
cmake_layout(self, src_folder="src")

def export_sources(self):
export_conandata_patches(self)

def configure(self):
if self.settings.os == "Windows":
self.package_type = "static-library"
del self.options.shared
if self.options.get_safe("shared"):
self.options.rm_safe("fPIC")

def validate(self):
check_min_cppstd(self, 11)

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
apply_conandata_patches(self)

def generate(self):
tc = CMakeToolchain(self)
tc.variables["q_BUILD_TESTS"] = False
tc.variables["q_BUILD_APPS"] = False
tc.generate()

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def package(self):
copy(self, "LICENSE.txt", self.source_folder, os.path.join(self.package_folder, "licenses"))
cmake = CMake(self)
cmake.install()
fix_apple_shared_install_name(self)

rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
rmdir(self, os.path.join(self.package_folder, "share"))
rm(self, "*.la", os.path.join(self.package_folder, "lib"))
rm(self, "*.pdb", os.path.join(self.package_folder, "lib"))
rm(self, "*.pdb", os.path.join(self.package_folder, "bin"))

def package_info(self):
suffix = ""
if is_msvc(self) and self.settings.build_type == "Debug":
suffix = "d"
self.cpp_info.libs = ["q" + suffix]
self.cpp_info.set_property("cmake_file_name", "libq")
self.cpp_info.set_property("cmake_target_name", "libq::libq")

if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs.append("m")
self.cpp_info.system_libs.append("pthread")
self.cpp_info.system_libs.append("dl")

if is_msvc(self):
self.cpp_info.cxxflags.append("/bigobj")
22 changes: 22 additions & 0 deletions recipes/libq/all/patches/0001-cmake-remove-hardcoded-flags.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/cmake/compilersetup.cmake b/cmake/compilersetup.cmake
index e550442..8ee19f7 100644
--- a/cmake/compilersetup.cmake
+++ b/cmake/compilersetup.cmake
@@ -15,7 +15,6 @@ set( CMAKE_CXX_EXTENSIONS OFF )
if ( CMAKE_CXX_COMPILER_ID MATCHES "GNU" )

if ( CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9 )
- set( CMAKE_CXX_FLAGS "-std=c++11 -Wall -pipe -pthread" )
endif ( )

if ( NOT CMAKE_CXX_FLAGS )
@@ -82,9 +81,6 @@ elseif ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
set( CMAKE_DEBUG_POSTFIX "d" )
add_definitions( "/bigobj" )

- set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd" )
- set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT" )
-
else ( )

q_warning( "untested compiler: ${CMAKE_CXX_COMPILER}" )
9 changes: 9 additions & 0 deletions recipes/libq/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.15)

project(test_package LANGUAGES CXX) # if the project uses c++

find_package(libq REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE libq::libq)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
27 changes: 27 additions & 0 deletions recipes/libq/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import cmake_layout, CMake
import os


# It will become the standard on Conan 2.x
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
test_type = "explicit"

def requirements(self):
self.requires(self.tested_reference_str)

def layout(self):
cmake_layout(self)

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindir, "test_package")
self.run(bin_path, env="conanrun")
11 changes: 11 additions & 0 deletions recipes/libq/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <cstdlib>
#include <q/lib.hpp>
#include <iostream>


int main(void) {
q::initialize();
std::cout << "q initialized correctly" << std::endl;
q::uninitialize();
return EXIT_SUCCESS;
}
3 changes: 3 additions & 0 deletions recipes/libq/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"0.0.0.cci.20180504":
folder: all