-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
6406032
commit 4cf6899
Showing
4 changed files
with
95 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,51 @@ | ||
from conans import ConanFile, CMake, tools | ||
|
||
|
||
class LennahSSGConan(ConanFile): | ||
name = "LennahSSG" | ||
version = "1.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 LennahSSG here>" | ||
topics = ("<Put some tag here>", "<here>", "<and here>") | ||
settings = "os", "compiler", "build_type", "arch" | ||
options = {"shared": [True, False], "fPIC": [True, False]} | ||
default_options = {"shared": False, "fPIC": True} | ||
generators = "cmake" | ||
|
||
def config_options(self): | ||
if self.settings.os == "Windows": | ||
del self.options.fPIC | ||
|
||
def source(self): | ||
self.run("git clone https://github.com/conan-io/hello.git") | ||
# This small hack might be useful to guarantee proper /MT /MD linkage | ||
# in MSVC if the packaged project doesn't have variables to set it | ||
# properly | ||
tools.replace_in_file("hello/CMakeLists.txt", "PROJECT(HelloWorld)", | ||
'''PROJECT(HelloWorld) | ||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup()''') | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure(source_folder="hello") | ||
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", src="hello") | ||
self.copy("*hello.lib", dst="lib", keep_path=False) | ||
self.copy("*.dll", dst="bin", keep_path=False) | ||
self.copy("*.so", dst="lib", keep_path=False) | ||
self.copy("*.dylib", 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(PackageTest CXX) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
add_executable(example example.cpp) | ||
target_link_libraries(example ${CONAN_LIBS}) | ||
|
||
# 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) |
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 @@ | ||
import os | ||
|
||
from conans import ConanFile, CMake, tools | ||
|
||
|
||
class LennahSSGTestConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake" | ||
|
||
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 imports(self): | ||
self.copy("*.dll", dst="bin", src="bin") | ||
self.copy("*.dylib*", dst="bin", src="lib") | ||
self.copy('*.so*', dst='bin', src='lib') | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
os.chdir("bin") | ||
self.run(".%sexample" % os.sep) |
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,5 @@ | ||
#include "hello.h" | ||
|
||
int main() { | ||
hello(); | ||
} |