diff --git a/conanfile.py b/conanfile.py new file mode 100644 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,29 @@ +from conans import ConanFile, CMake, tools + +class KarchiveConan(ConanFile): + name = "KArchive" + version = "5.37.0-git" + license = "lgpl2" + url = "" + settings = "os", "compiler", "build_type", "arch" + options = {"shared": [True, False]} + default_options = "shared=True" + generators = "cmake" + exports_sources = "*" + + def build(self): + cmake = CMake(self) + + # change the library install dir to just "lib" as that's what Conan expects in its packages + args = ['-DCMAKE_INSTALL_PREFIX="%s"' % self.package_folder, + '-DKDE_INSTALL_LIBDIR=lib'] + self.run('cmake %s %s %s' % (self.source_folder, cmake.command_line, " ".join(args))) + self.run("cmake --build . --target install %s" % cmake.build_config) + + def package(self): + # ideally nothing here, cmake with install takes care of it + pass + + def package_info(self): + self.cpp_info.libs = ["KF5Archive"] + self.cpp_info.includedirs = ['include/KF5', 'include/KF5/KArchive'] diff --git a/test_package/CMakeLists.txt b/test_package/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/test_package/CMakeLists.txt @@ -0,0 +1,13 @@ +project(PackageTest CXX) +cmake_minimum_required(VERSION 2.8.12) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +find_package(Qt5 5.6 CONFIG REQUIRED + Core +) + +add_executable(example example.cpp) +target_link_libraries(example ${CONAN_LIBS} + Qt5::Core) diff --git a/test_package/conanfile.py b/test_package/conanfile.py new file mode 100644 --- /dev/null +++ b/test_package/conanfile.py @@ -0,0 +1,20 @@ +from conans import ConanFile, CMake +import os + +class KarchiveTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + + def build(self): + cmake = CMake(self) + # Current dir is "test_package/build/" and CMakeLists.txt is in "test_package" + cmake.configure(source_dir=self.conanfile_directory, build_dir="./") + cmake.build() + + def imports(self): + self.copy("*.dll", dst="bin", src="bin") + self.copy("*.dylib*", dst="bin", src="lib") + + def test(self): + os.chdir("bin") + self.run(".%sexample" % os.sep) diff --git a/test_package/example.cpp b/test_package/example.cpp new file mode 100644 --- /dev/null +++ b/test_package/example.cpp @@ -0,0 +1,7 @@ +#include +#include "kzip.h" + +int main() { + KZip a("somefile"); + return 0; +}