Added conan

This commit is contained in:
Edgar 2018-09-03 09:52:52 +02:00
parent e86fcb8827
commit f421d30f30
7 changed files with 196 additions and 0 deletions

41
.travis.yml Normal file
View File

@ -0,0 +1,41 @@
env:
global:
- CONAN_REFERENCE: "MofileReader/0.1.2"
- CONAN_USERNAME: "anotherfoxguy"
- CONAN_LOGIN_USERNAME: "anotherfoxguy"
- CONAN_CHANNEL: "MofileReader"
- CONAN_UPLOAD: "https://api.bintray.com/conan/anotherfoxguy/ror-dependencies"
linux: &linux
os: linux
sudo: required
language: python
python: "3.6"
services:
- docker
osx: &osx
os: osx
language: generic
matrix:
include:
- <<: *linux
env: CONAN_GCC_VERSIONS=4.9 CONAN_DOCKER_IMAGE=lasote/conangcc49
- <<: *linux
env: CONAN_GCC_VERSIONS=5 CONAN_DOCKER_IMAGE=lasote/conangcc5
- <<: *linux
env: CONAN_GCC_VERSIONS=6 CONAN_DOCKER_IMAGE=lasote/conangcc6
- <<: *linux
env: CONAN_GCC_VERSIONS=7 CONAN_DOCKER_IMAGE=lasote/conangcc7
install:
- chmod +x .travis/install.sh
- ./.travis/install.sh
script:
- chmod +x .travis/run.sh
- ./.travis/run.sh

25
.travis/install.sh Normal file
View File

@ -0,0 +1,25 @@
#!/bin/bash
set -e
set -x
if [[ "$(uname -s)" == 'Darwin' ]]; then
brew update || brew update
brew outdated pyenv || brew upgrade pyenv
brew install pyenv-virtualenv
brew install cmake || true
if which pyenv > /dev/null; then
eval "$(pyenv init -)"
fi
pyenv install 2.7.10
pyenv virtualenv 2.7.10 conan
pyenv rehash
pyenv activate conan
fi
pip install conan --upgrade
pip install conan_package_tools
conan user

13
.travis/run.sh Normal file
View File

@ -0,0 +1,13 @@
#!/bin/bash
set -e
set -x
if [[ "$(uname -s)" == 'Darwin' ]]; then
if which pyenv > /dev/null; then
eval "$(pyenv init -)"
fi
pyenv activate conan
fi
python build.py

54
CMakeLists.txt Normal file
View File

@ -0,0 +1,54 @@
#-------------------------------------------------------
# moFileReader Main Build Script
#
# Defined Variables:
# - COMPILE_DLL
# - ON : Compiles the code as a shared Library
# - OFF : Compiles the code as a static Library
# - BUILD_DEBUG
# - ON : Compiles Debug-Information into the output
# - OFF : Optimizes the compilation with O2.
#
# Run cmake with -DVARNAME=ON/OFF to benefit from those
# possible settings.
#-------------------------------------------------------
cmake_minimum_required(VERSION 2.6)
project(moFileReader)
# Set Output Directories.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ../bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ../lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ../lib)
# The main include directory
include_directories(BEFORE ../include)
# executable build directory
add_subdirectory(bin)
# Let the user choose between static lib and dll
# To use it, call cmake -DCOMPILE_DLL=ON
option(COMPILE_DLL "Set this to ON if you want to compile the library as an DLL. When this is OFF, a static library is created (default)." OFF)
# Dependency
link_directories(../lib)
if ( NOT COMPILE_DLL )
# Static build
add_library(moFileReader.static STATIC ../src/moFileReader.cpp ../src/mo.cpp)
else ( COMPILE_DLL )
# DLL
add_definitions(-D_USRDLL -DMOFILE_EXPORTS)
add_library(moFileReader SHARED ../src/moFileReader.cpp ../src/mo.cpp)
endif ()

24
appveyor.yml Normal file
View File

@ -0,0 +1,24 @@
build: false
image: Visual Studio 2017
environment:
PYTHON: "C:\\Python27"
PYTHON_VERSION: "2.7.8"
PYTHON_ARCH: "32"
CONAN_REFERENCE: "MofileReader/0.1.2"
CONAN_USERNAME: "anotherfoxguy"
CONAN_LOGIN_USERNAME: "anotherfoxguy"
CONAN_CHANNEL: "MofileReader"
CONAN_UPLOAD: "https://api.bintray.com/conan/anotherfoxguy/ror-dependencies"
CONAN_VISUAL_VERSIONS: 15
install:
- set PATH=%PATH%;%PYTHON%/Scripts/
- pip.exe install conan --upgrade
- pip.exe install conan_package_tools
- conan user # It creates the conan data directory
test_script:
- python build.py

7
build.py Normal file
View File

@ -0,0 +1,7 @@
from conan.packager import ConanMultiPackager
if __name__ == "__main__":
builder = ConanMultiPackager()
builder.add_common_builds()
builder.run()

32
conanfile.py Normal file
View File

@ -0,0 +1,32 @@
from conans import ConanFile, CMake, tools
import os
class MofilereaderConan(ConanFile):
name = "MofileReader"
version = "0.1.2"
license = "MIT"
url = "https://github.com/AnotherFoxGuy/conan-MofileReader/"
description = "This API lets you read .mo-Files and use their content just as you would do with GNUs gettext."
settings = "os", "compiler", "build_type", "arch"
#options = {"shared": [True, False]}
#default_options = "shared=False"
generators = "cmake"
def source(self):
self.run("git clone https://bitbucket.org/scorcher24/mofilereader.git .")
def build(self):
cmake = CMake(self)
cmake.configure(source_folder="build")
cmake.build()
def package(self):
self.copy("*.h", dst="include", src="include")
self.copy("*.lib", dst="lib", src=os.path.join("..", "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 = ["MofileReader"]