-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#18652) wineditline: migrate to Conan v2
* wineditline: migrate to Conan v2 * wineditline: simplify patching * Use upstream CMakeLists Signed-off-by: Uilian Ries <[email protected]> --------- Signed-off-by: Uilian Ries <[email protected]> Co-authored-by: Uilian Ries <[email protected]>
- Loading branch information
1 parent
635672d
commit c8e4d78
Showing
9 changed files
with
80 additions
and
110 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
sources: | ||
"2.206": | ||
sha256: "2d255c417244e963261dc6171684265f405df030e90ba6e6690a99284d645161" | ||
url: https://sourceforge.net/projects/mingweditline/files/wineditline-2.206.zip/download | ||
patches: | ||
"2.206": | ||
- patch_file: patches/0001-fix-cmakelists.patch | ||
base_path: source_subfolder | ||
url: "https://sourceforge.net/projects/mingweditline/files/wineditline-2.206.zip" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,63 @@ | ||
import functools | ||
import os | ||
|
||
from conans import ConanFile, CMake, tools | ||
from conans.errors import ConanInvalidConfiguration | ||
from conan import ConanFile | ||
from conan.errors import ConanInvalidConfiguration | ||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout | ||
from conan.tools.files import copy, get | ||
|
||
required_conan_version = ">=1.43.0" | ||
required_conan_version = ">=1.53.0" | ||
|
||
|
||
class WineditlineConan(ConanFile): | ||
name = "wineditline" | ||
description = ( | ||
"A BSD-licensed EditLine API implementation for the native " | ||
"Windows Console" | ||
) | ||
description = "A BSD-licensed EditLine API implementation for the native Windows Console" | ||
license = "BSD-3-Clause" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "http://mingweditline.sourceforge.net/" | ||
topics = ("readline", "editline", "windows") | ||
license = "BSD-3-Clause" | ||
generators = ("cmake",) | ||
settings = ("os", "arch", "compiler", "build_type") | ||
|
||
package_type = "library" | ||
settings = "os", "arch", "compiler", "build_type" | ||
options = { | ||
"shared": [True, False], | ||
} | ||
default_options = { | ||
"shared": False, | ||
} | ||
exports_sources = ("patches/*", "CMakeLists.txt") | ||
provides = "editline" | ||
|
||
@property | ||
def _target_name(self): | ||
return "edit" if self.options.shared else "edit_static" | ||
|
||
def configure(self): | ||
self.settings.rm_safe("compiler.libcxx") | ||
self.settings.rm_safe("compiler.cppstd") | ||
|
||
def layout(self): | ||
cmake_layout(self, src_folder="src") | ||
|
||
def validate(self): | ||
if self.settings.os != "Windows": | ||
message = "wineditline is supported only on Windows." | ||
raise ConanInvalidConfiguration(message) | ||
|
||
@property | ||
def _source_subfolder(self): | ||
return "source_subfolder" | ||
raise ConanInvalidConfiguration(f"{self.ref} is supported only on Windows.") | ||
|
||
def source(self): | ||
root = self._source_subfolder | ||
get_args = self.conan_data["sources"][self.version] | ||
tools.get(**get_args, destination=root, strip_root=True) | ||
get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||
|
||
def configure(self): | ||
del self.settings.compiler.libcxx | ||
del self.settings.compiler.cppstd | ||
def generate(self): | ||
tc = CMakeToolchain(self) | ||
tc.generate() | ||
|
||
@functools.lru_cache(1) | ||
def _configure_cmake(self): | ||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
return cmake | ||
|
||
def build(self): | ||
for patch in self.conan_data["patches"][self.version]: | ||
tools.patch(**patch) | ||
self._configure_cmake().build() | ||
cmake.build(target=self._target_name) | ||
|
||
def package(self): | ||
self.copy("COPYING", "licenses", self._source_subfolder) | ||
self._configure_cmake().install() | ||
copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) | ||
copy(self, "*.h", dst=os.path.join(self.package_folder, "include", "editline"), src=os.path.join(self.source_folder, "src", "editline")) | ||
copy(self, "*.lib", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) | ||
copy(self, "*.dll", dst=os.path.join(self.package_folder, "bin"), src=self.build_folder, keep_path=False) | ||
|
||
def package_info(self): | ||
self.cpp_info.libs = ["edit"] | ||
self.cpp_info.libs = [self._target_name] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout, CMake | ||
import os | ||
|
||
from conans import ConanFile, CMake, tools | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = ("os", "compiler", "build_type", "arch") | ||
generators = ("cmake", "cmake_find_package_multi") | ||
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 not tools.cross_building(self): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindir, "test_package") | ||
self.run(bin_path, env="conanrun") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,7 @@ | ||
#include <editline/readline.h> | ||
#include <stddef.h> | ||
|
||
int main(int argc, char const* argv[]) | ||
{ | ||
(void)argc; | ||
(void)argv; | ||
|
||
free_history_entry(NULL); | ||
|
||
return 0; | ||
int main() { | ||
free_history_entry(NULL); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(test_package) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ | ||
${CMAKE_CURRENT_BINARY_DIR}/test_package/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import os | ||
|
||
from conans import ConanFile, CMake, tools | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = ("os", "compiler", "build_type", "arch") | ||
generators = ("cmake", "cmake_find_package_multi") | ||
|
||
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", "test_package") | ||
self.run(bin_path, run_environment=True) |