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

added recipe for extra-cmake-modules #3211

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions recipes/extra-cmake-modules/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"5.75.0":
boussaffawalid marked this conversation as resolved.
Show resolved Hide resolved
url: "https://download.kde.org/stable/frameworks/5.75/extra-cmake-modules-5.75.0.zip"
sha256: "dc937fd2018eb8285c1b07d4b5de104c60959404c4979883f6bdb0a4d40cf98e"
56 changes: 56 additions & 0 deletions recipes/extra-cmake-modules/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import os
from conans import ConanFile, CMake, tools

class ExtracmakemodulesConan(ConanFile):
name = "extra-cmake-modules"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the name be namespaced?
e.g. kde-extra-cmake-modules

extra-cmake-modules sounds generic.

This is just a question, let's hear the opinion of the others.

Copy link
Member

@uilianries uilianries Oct 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra-cmake-modules sounds generic.

Indeed, I didn't know about this project, but when searching, it's well referenced to KDE, both Debian packages and Qt points to KDE page. Also, Conda offers extra-cmake-modules by the same name. So I think extra-cmake-modules is okay, as there is no other popular project using the same name or similar.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KDE does prefix almost everything with a k. What a shame that they haven't done here the same and leave us with this unfortunate choice 😄

The package got into many Linux distros with the unchanged name. I guess we can leave it at that

https://pkgs.org/download/extra-cmake-modules

license = ("MIT", "BSD-2-Clause", "BSD-3-Clause")
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://api.kde.org/ecm/"
topics = ("conan", "cmake", "toolchain", "build-settings")
description = "KDE's CMake modules"
generators = "cmake"
no_copy_source = False

_cmake = None

@property
def _source_subfolder(self):
return "source_subfolder"

def source(self):
tools.get(**self.conan_data["sources"][self.version])
os.rename("extra-cmake-modules-{}".format(self.version), self._source_subfolder)

def _configure_cmake(self):
if self._cmake:
return self._cmake

# KB-H016: do not install Find*.cmake
tools.replace_path_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"),
"install(FILES ${installFindModuleFiles} DESTINATION ${FIND_MODULES_INSTALL_DIR})", "")

self._cmake = CMake(self)
self._cmake.definitions["BUILD_HTML_DOCS"] = False
self._cmake.definitions["BUILD_QTHELP_DOCS"] = False
self._cmake.definitions["BUILD_MAN_DOCS"] = False
self._cmake.definitions["SHARE_INSTALL_DIR"] = os.path.join(self.package_folder, "res")
self._cmake.configure(source_folder=os.path.join(self.source_folder, self._source_subfolder))
return self._cmake

def build(self):
cmake = self._configure_cmake()
cmake.build()

def package(self):
cmake = self._configure_cmake()
cmake.install()
self.copy("testhelper.h", src=os.path.join(self.source_folder, self._source_subfolder, "tests/ECMAddTests"), dst="res/tests")
self.copy("*", src=os.path.join(self.source_folder, self._source_subfolder, "LICENSES"), dst="licenses")

def package_info(self):
self.cpp_info.resdirs = ["res"]
self.cpp_info.builddirs = ["res/ECM/cmake", "res/ECM/kde-modules", "res/ECM/modules", "res/ECM/test-modules", "res/ECM/toolchain"]

def package_id(self):
self.info.header_only()

21 changes: 21 additions & 0 deletions recipes/extra-cmake-modules/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
cmake_minimum_required(VERSION 3.1)
project(test_package CXX)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)


find_package(ECM REQUIRED NO_MODULE)
list(APPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
include(ECMGenerateHeaders)

add_library(MyLib INTERFACE)
target_include_directories(MyLib INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}")
ecm_generate_headers(
MyLib_FORWARDING_HEADERS
HEADER_NAMES Foo
REQUIRED_HEADERS MyLib_HEADERS
)

add_executable(example example.cpp)
target_link_libraries(example MyLib)
17 changes: 17 additions & 0 deletions recipes/extra-cmake-modules/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from conans import ConanFile, CMake, tools
import os

class ExtraCMakeModulesTestConan(ConanFile):
settings = "os", "compiler", "arch", "build_type"
generators = "cmake"

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

def test(self):
if not tools.cross_building(self):
bin_path = os.path.join("bin", "example")
self.run(bin_path, run_environment=True)

6 changes: 6 additions & 0 deletions recipes/extra-cmake-modules/all/test_package/example.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <Foo> // This header should be created by ECM

int main()
{
return success();
}
5 changes: 5 additions & 0 deletions recipes/extra-cmake-modules/all/test_package/foo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
int success()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this supposed to be merged?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, there is no C++ interface to test with, dummy example is okay

{
return 0;
}

3 changes: 3 additions & 0 deletions recipes/extra-cmake-modules/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"5.75.0":
folder: "all"