Last active
June 11, 2019 14:06
-
-
Save uilianries/5532fcafcef88dad1ea4fd6e74b5670e to your computer and use it in GitHub Desktop.
Conan tools.patch cant create files #5320
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
From 07c11b22182c88cc9941f52017203a2c679201b0 Mon Sep 17 00:00:00 2001 | |
From: Uilian Ries <uilianries@gmail.com> | |
Date: Tue, 11 Jun 2019 11:01:18 -0300 | |
Subject: [PATCH 2/2] patch | |
diff --git a/0001-add-patch.patch b/0001-add-patch.patch | |
new file mode 100644 | |
index 0000000..54180a4 | |
--- /dev/null | |
+++ b/0001-add-patch.patch | |
@@ -0,0 +1,17 @@ | |
+diff --git a/hello.cpp b/hello.cpp | |
+new file mode 100644 | |
+index 0000000..9888e50 | |
+--- /dev/null | |
++++ b/hello.cpp | |
+@@ -0,0 +1,10 @@ | |
++#include <iostream> | |
++#include "hello.h" | |
++ | |
++void hello(){ | |
++ #ifdef NDEBUG | |
++ std::cout << "Hello World Release!" <<std::endl; | |
++ #else | |
++ std::cout << "Hello World Debug!" <<std::endl; | |
++ #endif | |
++} | |
+\ No newline at end of file | |
-- | |
2.21.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
cmake_minimum_required(VERSION 2.8) | |
project(MyHello CXX) | |
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | |
conan_basic_setup() | |
add_library(hello hello.cpp) |
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
conan create . uilianries/testing | |
[HOOK - conan-center.py] pre_export(): [GLOBAL CPPSTD DEPRECATED] OK | |
[HOOK - conan-center.py] pre_export(): [REFERENCE LOWERCASE] OK | |
[HOOK - conan-center.py] pre_export(): [RECIPE METADATA] OK | |
[HOOK - conan-center.py] pre_export(): [HEADER ONLY] OK | |
[HOOK - conan-center.py] pre_export(): [NO COPY SOURCE] OK | |
[HOOK - conan-center.py] pre_export(): WARN: [FPIC OPTION] This recipe does not include an 'fPIC' option. Make sure you are using the right casing | |
[HOOK - conan-center.py] pre_export(): [FPIC OPTION] OK | |
[HOOK - conan-center.py] pre_export(): [FPIC MANAGEMENT] 'fPIC' option not found | |
[HOOK - conan-center.py] pre_export(): [FPIC MANAGEMENT] OK | |
[HOOK - conan-center.py] pre_export(): [VERSION RANGES] OK | |
[HOOK - conan-center.py] pre_export(): [RECIPE FOLDER SIZE] total_size_kb: 27.68359375KB | |
[HOOK - conan-center.py] pre_export(): [RECIPE FOLDER SIZE] OK | |
Exporting package recipe | |
foo/0.1@uilianries/testing exports_sources: Copied 1 '.txt' file: CMakeLists.txt | |
foo/0.1@uilianries/testing exports_sources: Copied 1 '.h' file: hello.h | |
foo/0.1@uilianries/testing exports_sources: Copied 1 '.cpp' file: hello.cpp | |
foo/0.1@uilianries/testing exports_sources: Copied 1 '.patch' file: 0001-add-patch.patch | |
foo/0.1@uilianries/testing: The stored package has not changed | |
Configuration: | |
[settings] | |
arch=x86_64 | |
arch_build=x86_64 | |
build_type=Release | |
compiler=gcc | |
compiler.libcxx=libstdc++11 | |
compiler.version=8 | |
os=Linux | |
os_build=Linux | |
[options] | |
[build_requires] | |
[env] | |
foo/0.1@uilianries/testing: Forced build from source | |
Installing package: foo/0.1@uilianries/testing | |
Requirements | |
foo/0.1@uilianries/testing from local cache - Cache | |
Packages | |
foo/0.1@uilianries/testing:b80d46004713aa37d6a90b42e2a326a056a237b5 - Build | |
foo/0.1@uilianries/testing: Copying sources to build folder | |
foo/0.1@uilianries/testing: Building your package in /home/uilian/.conan/data/foo/0.1/uilianries/testing/build/b80d46004713aa37d6a90b42e2a326a056a237b5 | |
foo/0.1@uilianries/testing: Generator cmake created conanbuildinfo.cmake | |
foo/0.1@uilianries/testing: Calling build() | |
WARN: patches/0001-add-patch.patch: error: absolute paths are not allowed - file no.1 | |
WARN: patches/0001-add-patch.patch: stripping absolute path from source name 'b'/dev/null'' | |
-- The CXX compiler identification is GNU 8.3.0 | |
-- Check for working CXX compiler: /usr/bin/c++ | |
-- Check for working CXX compiler: /usr/bin/c++ -- works | |
-- Detecting CXX compiler ABI info | |
-- Detecting CXX compiler ABI info - done | |
-- Detecting CXX compile features | |
-- Detecting CXX compile features - done | |
-- Conan: called by CMake conan helper | |
-- Conan: called inside local cache | |
-- Conan: Adjusting output directories | |
-- Conan: Using cmake global configuration | |
-- Conan: Adjusting default RPATHs Conan policies | |
-- Conan: Adjusting language standard | |
-- Conan: Compiler GCC>=5, checking major version 8 | |
-- Conan: Checking correct version: 8 | |
-- Conan: C++ stdlib: libstdc++11 | |
-- Configuring done | |
-- Generating done | |
CMake Warning: | |
Manually-specified variables were not used by the project: | |
CMAKE_EXPORT_NO_PACKAGE_REGISTRY | |
CMAKE_INSTALL_BINDIR | |
CMAKE_INSTALL_DATAROOTDIR | |
CMAKE_INSTALL_INCLUDEDIR | |
CMAKE_INSTALL_LIBDIR | |
CMAKE_INSTALL_LIBEXECDIR | |
CMAKE_INSTALL_OLDINCLUDEDIR | |
CMAKE_INSTALL_SBINDIR | |
-- Build files have been written to: /home/uilian/.conan/data/foo/0.1/uilianries/testing/build/b80d46004713aa37d6a90b42e2a326a056a237b5 | |
Scanning dependencies of target hello | |
[ 50%] Building CXX object CMakeFiles/hello.dir/hello.cpp.o | |
[100%] Linking CXX static library lib/libhello.a | |
[100%] Built target hello | |
foo/0.1@uilianries/testing: Package 'b80d46004713aa37d6a90b42e2a326a056a237b5' built | |
foo/0.1@uilianries/testing: Build folder /home/uilian/.conan/data/foo/0.1/uilianries/testing/build/b80d46004713aa37d6a90b42e2a326a056a237b5 | |
foo/0.1@uilianries/testing: Generated conaninfo.txt | |
foo/0.1@uilianries/testing: Generated conanbuildinfo.txt | |
foo/0.1@uilianries/testing: Generating the package | |
foo/0.1@uilianries/testing: Package folder /home/uilian/.conan/data/foo/0.1/uilianries/testing/package/b80d46004713aa37d6a90b42e2a326a056a237b5 | |
foo/0.1@uilianries/testing: Calling package() | |
foo/0.1@uilianries/testing package(): Packaged 1 '.h' file: hello.h | |
foo/0.1@uilianries/testing package(): Packaged 1 '.a' file: libhello.a | |
foo/0.1@uilianries/testing: Package 'b80d46004713aa37d6a90b42e2a326a056a237b5' created | |
[HOOK - conan-center.py] post_package(): ERROR: [PACKAGE LICENSE] No 'licenses' folder found in package: /home/uilian/.conan/data/foo/0.1/uilianries/testing/package/b80d46004713aa37d6a90b42e2a326a056a237b5 | |
[HOOK - conan-center.py] post_package(): [DEFAULT PACKAGE LAYOUT] OK | |
[HOOK - conan-center.py] post_package(): [MATCHING CONFIGURATION] OK | |
[HOOK - conan-center.py] post_package(): [SHARED ARTIFACTS] OK | |
[HOOK - conan-center.py] post_package(): [CMAKE MODULES/PC-FILES] OK | |
[HOOK - conan-center.py] post_package(): [PDB FILES NOT ALLOWED] OK | |
[HOOK - conan-center.py] post_package(): [LIBTOOL FILES PRESENCE] OK | |
foo/0.1@uilianries/testing: Created package revision d7d8dbeac6120026d5c90bf64135152e |
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
from conans import ConanFile, CMake, tools | |
class FooConan(ConanFile): | |
name = "foo" | |
version = "0.1" | |
license = "<Put the package license here>" | |
author = "<Put your name here> <And your email here>" | |
url = "<Package recipe repository url here, for issues about the package>" | |
description = "<Description of Foo here>" | |
topics = ("<Put some tag here>", "<here>", "<and here>") | |
settings = "os", "compiler", "build_type", "arch" | |
options = {"shared": [True, False]} | |
default_options = "shared=False" | |
generators = "cmake" | |
exports_sources = "*" | |
def build(self): | |
tools.patch(patch_file="0001-add-hello.patch", strip=1) | |
cmake = CMake(self) | |
cmake.configure() | |
cmake.build() | |
# Explicit way: | |
# self.run('cmake %s/hello %s' | |
# % (self.source_folder, cmake.command_line)) | |
# self.run("cmake --build . %s" % cmake.build_config) | |
def package(self): | |
self.copy("*.h", dst="include") | |
self.copy("*.lib", dst="lib", keep_path=False) | |
self.copy("*.dll", dst="bin", keep_path=False) | |
self.copy("*.dylib*", dst="lib", keep_path=False) | |
self.copy("*.so", dst="lib", keep_path=False) | |
self.copy("*.a", dst="lib", keep_path=False) | |
def package_info(self): | |
self.cpp_info.libs = ["hello"] |
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
#pragma once | |
#ifdef WIN32 | |
#define HELLO_EXPORT __declspec(dllexport) | |
#else | |
#define HELLO_EXPORT | |
#endif | |
HELLO_EXPORT void hello(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Python patch is not able to apply 0001-add-patch, but you can apply manually by
git apply