forked from ghaerr/agg-2.6
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
111 additions
and
100 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
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,78 @@ | ||
import os | ||
from conan import ConanFile | ||
from conan.tools.scm import Git | ||
from conan.tools.files import load, update_conandata, copy | ||
from conan.tools.layout import basic_layout | ||
|
||
class AggConan(ConanFile): | ||
name = "agg" | ||
license = "MIT" | ||
author = "Maxim Shemanarev <[email protected]>" | ||
url = "http://github.com/cppfw/" + name | ||
description = "Anti-grain geometry, vector graphics library in C++" | ||
topics = ("C++", "cross-platform") | ||
settings = "os", "compiler", "build_type", "arch" | ||
package_type = "library" | ||
options = {"shared": [True, False], "fPIC": [True, False]} | ||
default_options = {"shared": False, "fPIC": True} | ||
generators = "AutotoolsDeps" # this will set CXXFLAGS etc. env vars | ||
|
||
def requirements(self): | ||
# self.requires("utki/[>=1.1.202]@cppfw/main", transitive_headers=True) | ||
|
||
def build_requirements(self): | ||
# self.requires("tst/[>=0.3.29]@cppfw/main", visible=False) | ||
|
||
def config_options(self): | ||
if self.settings.os == "Windows": | ||
del self.options.fPIC | ||
|
||
# save commit and remote URL to conandata.yml for packaging | ||
def export(self): | ||
git = Git(self) | ||
scm_url = git.get_remote_url() | ||
# NOTE: Git.get_commit() doesn't work properly, | ||
# it gets latest commit of the folder in which conanfile.py resides. | ||
# So, we use "git rev-parse HEAD" instead as it gets the actual HEAD | ||
# commit regardless of the current working directory within the repo. | ||
scm_commit = git.run("rev-parse HEAD") # get current commit | ||
update_conandata(self, {"sources": {"commit": scm_commit, "url": scm_url}}) | ||
|
||
def source(self): | ||
git = Git(self) | ||
sources = self.conan_data["sources"] | ||
# shallow fetch commit | ||
git.fetch_commit(url=sources["url"], commit=sources['commit']) | ||
# shallow clone submodules | ||
git.run("submodule update --init --remote --depth 1") | ||
|
||
def build(self): | ||
self.run("make lint=off") | ||
self.run("make lint=off test") | ||
|
||
def package(self): | ||
src_dir = os.path.join(self.build_folder, "src") | ||
src_rel_dir = os.path.join(self.build_folder, "src/out/rel") | ||
dst_include_dir = os.path.join(self.package_folder, "include") | ||
dst_lib_dir = os.path.join(self.package_folder, "lib") | ||
dst_bin_dir = os.path.join(self.package_folder, "bin") | ||
|
||
copy(conanfile=self, pattern="*.h", dst=dst_include_dir, src=src_dir, keep_path=True) | ||
copy(conanfile=self, pattern="*.hpp", dst=dst_include_dir, src=src_dir, keep_path=True) | ||
|
||
if self.options.shared: | ||
copy(conanfile=self, pattern="*" + self.name + ".lib", dst=dst_lib_dir, src="", keep_path=False) | ||
copy(conanfile=self, pattern="*.dll", dst=dst_bin_dir, src=src_rel_dir, keep_path=False) | ||
copy(conanfile=self, pattern="*.so", dst=dst_lib_dir, src=src_rel_dir, keep_path=False) | ||
copy(conanfile=self, pattern="*.so.*", dst=dst_lib_dir, src=src_rel_dir, keep_path=False) | ||
copy(conanfile=self, pattern="*.dylib", dst=dst_lib_dir, src=src_rel_dir, keep_path=False) | ||
else: | ||
copy(conanfile=self, pattern="*" + self.name + ".lib", dst=dst_lib_dir, src="", keep_path=False) | ||
copy(conanfile=self, pattern="*.a", dst=dst_lib_dir, src=src_rel_dir, keep_path=False) | ||
|
||
def package_info(self): | ||
self.cpp_info.libs = ["antigrain"] | ||
|
||
def package_id(self): | ||
# change package id only when minor or major version changes, i.e. when ABI breaks | ||
self.info.requires.minor_mode() |
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,18 +1,9 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
cmake_minimum_required(VERSION 3.15) | ||
project(PackageTest CXX) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") | ||
|
||
# set(CMAKE_VERBOSE_MAKEFILE on) | ||
|
||
add_executable(example example.cpp) | ||
target_link_libraries(example ${CONAN_LIBS}) | ||
find_package(agg CONFIG REQUIRED) | ||
|
||
# CTest is a testing tool that can be used to test your project. | ||
# enable_testing() | ||
# add_test(NAME example | ||
# WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin | ||
# COMMAND example) | ||
add_executable(example example.cpp) | ||
target_link_libraries(example agg::agg) |
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,25 +1,22 @@ | ||
import os | ||
|
||
from conans import ConanFile, CMake, tools | ||
from conan import ConanFile, tools | ||
from conan.tools.cmake import CMake, cmake_layout | ||
|
||
class TestConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "CMakeToolchain", "CMakeDeps" | ||
|
||
class UtkiTestConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake" | ||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
# Current dir is "test_package/build/<build_id>" and CMakeLists.txt is | ||
# in "test_package" | ||
cmake.configure() | ||
cmake.build() | ||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def imports(self): | ||
self.copy("*.dll", dst="bin", src="bin") | ||
self.copy("*.dylib*", dst="bin", src="lib") | ||
self.copy('*.so*', dst='bin', src='lib') | ||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
os.chdir("bin") | ||
self.run(".%sexample" % os.sep, run_environment=True) # run_environment sets LD_LIBRARY_PATH etc. to find dependency libs | ||
def test(self): | ||
self.run(".%sexample" % os.sep, env="conanrun") # env sets LD_LIBRARY_PATH etc. to find dependency libs |