-
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.
* Add wineditline/2.206 * Use `conan_basic_setup(TARGETS)` in test_package * Leave the fetched source untouched The archive that contains the source also comes with prebuilt binaries. I deleted these thinking it'd be a waste to leave in the source. Co-authored-by: friendlyanon <friendlyanon@users.noreply.github.com>
- Loading branch information
1 parent
aa023f3
commit e7a0155
Showing
7 changed files
with
148 additions
and
0 deletions.
There are no files selected for viewing
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,25 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
|
||
project(wineditline_wrapper C) | ||
|
||
include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") | ||
conan_basic_setup() | ||
|
||
set(src source_subfolder/src) | ||
|
||
add_library(edit "${src}/editline.c" "${src}/fn_complete.c" "${src}/history.c") | ||
if(BUILD_SHARED_LIBS) | ||
target_sources(edit PRIVATE "${src}/libedit.def") | ||
endif() | ||
|
||
target_include_directories(edit PRIVATE "${src}") | ||
|
||
include(GNUInstallDirs) | ||
|
||
install( | ||
TARGETS edit | ||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" | ||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" | ||
) | ||
|
||
install(DIRECTORY "${src}/editline" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") |
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,4 @@ | ||
sources: | ||
"2.206": | ||
sha256: "2d255c417244e963261dc6171684265f405df030e90ba6e6690a99284d645161" | ||
url: https://sourceforge.net/projects/mingweditline/files/wineditline-2.206.zip/download |
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,76 @@ | ||
import functools | ||
import os | ||
|
||
from conans import ConanFile, CMake, tools | ||
from conans.errors import ConanInvalidConfiguration | ||
|
||
required_conan_version = ">=1.43.0" | ||
|
||
|
||
class WineditlineConan(ConanFile): | ||
name = "wineditline" | ||
description = ( | ||
"A BSD-licensed EditLine API implementation for the native " | ||
"Windows Console" | ||
) | ||
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") | ||
options = { | ||
"shared": [True, False], | ||
} | ||
default_options = { | ||
"shared": False, | ||
} | ||
|
||
exports_sources = ("CMakeLists.txt",) | ||
|
||
@property | ||
def _source_subfolder(self): | ||
return "source_subfolder" | ||
|
||
def validate(self): | ||
if self.settings.os != "Windows": | ||
message = "wineditline is supported only on Windows." | ||
raise ConanInvalidConfiguration(message) | ||
|
||
def source(self): | ||
root = self._source_subfolder | ||
get_args = self.conan_data["sources"][self.version] | ||
tools.get(**get_args, destination=root, strip_root=True) | ||
|
||
def configure(self): | ||
del self.settings.compiler.libcxx | ||
del self.settings.compiler.cppstd | ||
|
||
@functools.lru_cache(1) | ||
def _configure_cmake(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
return cmake | ||
|
||
def build(self): | ||
cmake = self._configure_cmake() | ||
cmake.build() | ||
|
||
def package(self): | ||
self.copy("COPYING", "licenses", self._source_subfolder) | ||
cmake = self._configure_cmake() | ||
cmake.install() | ||
|
||
def package_info(self): | ||
name = self.name | ||
info = self.cpp_info | ||
|
||
info.set_property("cmake_file_name", name) | ||
info.set_property("cmake_target_name", f"{name}::{name}") | ||
|
||
info.names.update({ | ||
"cmake_find_package": name, | ||
"cmake_find_package_multi": name, | ||
}) | ||
|
||
info.libs = ["edit"] |
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,10 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package C) | ||
|
||
find_package(wineditline REQUIRED CONFIG) | ||
|
||
include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") | ||
conan_basic_setup(TARGETS) | ||
|
||
add_executable(test_package test_package.c) | ||
target_link_libraries(test_package PRIVATE wineditline::wineditline) |
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) |
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,12 @@ | ||
#include <editline/readline.h> | ||
#include <stddef.h> | ||
|
||
int main(int argc, char const* argv[]) | ||
{ | ||
(void)argc; | ||
(void)argv; | ||
|
||
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,3 @@ | ||
versions: | ||
"2.206": | ||
folder: all |