mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2026-02-13 05:40:02 +08:00
conan.io packaging
This commit is contained in:
parent
51663df1ba
commit
c3254a5831
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
build/
|
||||||
|
conanbuildinfo.cmake
|
||||||
|
*.pyc
|
||||||
@ -15,7 +15,7 @@ before_install:
|
|||||||
- export CXX="g++-$GCC_VER" CC="gcc-$GCC_VER" GCOV="gcov-$GCC_VER"
|
- export CXX="g++-$GCC_VER" CC="gcc-$GCC_VER" GCOV="gcov-$GCC_VER"
|
||||||
- if [ "$GCC_VER" = "5" ]; then export COVERAGE=1 CPPCHECK=1; fi
|
- if [ "$GCC_VER" = "5" ]; then export COVERAGE=1 CPPCHECK=1; fi
|
||||||
- if [ ${COVERAGE} = 1 ]; then export FUZZY_CMD="-D RUN_FUZZY_TESTS:BOOL=TRUE"; fi
|
- if [ ${COVERAGE} = 1 ]; then export FUZZY_CMD="-D RUN_FUZZY_TESTS:BOOL=TRUE"; fi
|
||||||
- sudo pip install cpp-coveralls
|
- sudo pip install cpp-coveralls conan
|
||||||
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
||||||
- sudo apt-get update
|
- sudo apt-get update
|
||||||
- sudo apt-get install -qq g++-$GCC_VER
|
- sudo apt-get install -qq g++-$GCC_VER
|
||||||
@ -25,6 +25,7 @@ script:
|
|||||||
- if [ ${COVERITY_SCAN_BRANCH} != 1 ]; then make -j2 ; fi
|
- if [ ${COVERITY_SCAN_BRANCH} != 1 ]; then make -j2 ; fi
|
||||||
- make test
|
- make test
|
||||||
- if [ ${COVERAGE} = 1 ]; then bash <(curl -s https://raw.githubusercontent.com/codecov/codecov-bash/master/codecov) -x $GCOV -a "-s `pwd`" ; fi
|
- if [ ${COVERAGE} = 1 ]; then bash <(curl -s https://raw.githubusercontent.com/codecov/codecov-bash/master/codecov) -x $GCOV -a "-s `pwd`" ; fi
|
||||||
|
- conan test_package --build=outdated
|
||||||
|
|
||||||
after_script:
|
after_script:
|
||||||
- if [ ${CPPCHECK} = 1 ]; then contrib/codeanalysis/runcppcheck.sh ; fi
|
- if [ ${CPPCHECK} = 1 ]; then contrib/codeanalysis/runcppcheck.sh ; fi
|
||||||
|
|||||||
36
conanfile.py
Normal file
36
conanfile.py
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
from conans import ConanFile
|
||||||
|
from conans.tools import download, untargz
|
||||||
|
import os
|
||||||
|
|
||||||
|
class Settings:
|
||||||
|
username = os.getenv('CONAN_CHAISCRIPT_USERNAME', 'Manu343726')
|
||||||
|
channel = os.getenv('CONAN_CHAISCRIPT_CHANNEL', 'testing')
|
||||||
|
version = os.getenv('CONAN_CHAISCRIPT_VERSION', '5.8.5')
|
||||||
|
|
||||||
|
class ChaiScript(ConanFile):
|
||||||
|
settings = 'os'
|
||||||
|
name = 'ChaiScript'
|
||||||
|
url = 'http://chaiscript.com/'
|
||||||
|
license = 'BSD'
|
||||||
|
username = Settings.username
|
||||||
|
channel = Settings.channel
|
||||||
|
version = Settings.version
|
||||||
|
exports = '*.hpp', '*.chai'
|
||||||
|
generators = 'cmake'
|
||||||
|
|
||||||
|
def source(self):
|
||||||
|
name = '{}-{}'.format(self.name, self.version)
|
||||||
|
tar = name + '.tar.gz'
|
||||||
|
url = 'https://github.com/ChaiScript/ChaiScript/archive/v{}.tar.gz'.format(self.version)
|
||||||
|
download(url, tar)
|
||||||
|
untargz(tar)
|
||||||
|
|
||||||
|
def package(self):
|
||||||
|
includedir = os.path.join('include', 'chaiscript')
|
||||||
|
src_includedir = os.path.join('{}-{}'.format(self.name, self.version), includedir)
|
||||||
|
self.copy('*.hpp', src=src_includedir, dst=includedir)
|
||||||
|
self.copy('*.chai', src=src_includedir, dst=includedir)
|
||||||
|
|
||||||
|
def package_info(self):
|
||||||
|
if self.settings.os == 'Linux':
|
||||||
|
self.cpp_info.libs = ['dl', 'pthread']
|
||||||
@ -12,6 +12,8 @@ Develop Status: [](http://www.conan.io/source/ChaiScript/5.8.5/Manu343726/testing)
|
||||||
|
|
||||||
ChaiScript
|
ChaiScript
|
||||||
|
|
||||||
http://www.chaiscript.com
|
http://www.chaiscript.com
|
||||||
|
|||||||
14
test_package/CMakeLists.txt
Normal file
14
test_package/CMakeLists.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
project(chaiscript_test_package)
|
||||||
|
cmake_minimum_required(VERSION 2.8)
|
||||||
|
|
||||||
|
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||||
|
include(${CONAN_CMAKE-UTILS_ROOT}/conan.cmake)
|
||||||
|
conan_basic_setup()
|
||||||
|
|
||||||
|
add_conan_library(chaiscript)
|
||||||
|
|
||||||
|
add_executable(example example.cpp)
|
||||||
|
if(NOT MSVC)
|
||||||
|
target_compile_options(example PRIVATE -std=c++14)
|
||||||
|
endif()
|
||||||
|
target_link_libraries(example PRIVATE chaiscript-conan)
|
||||||
25
test_package/conanfile.py
Normal file
25
test_package/conanfile.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
from conans import ConanFile, CMake
|
||||||
|
from conans.tools import download, untargz
|
||||||
|
import os
|
||||||
|
|
||||||
|
class Settings:
|
||||||
|
username = os.getenv('CONAN_CHAISCRIPT_USERNAME', 'Manu343726')
|
||||||
|
channel = os.getenv('CONAN_CHAISCRIPT_CHANNEL', 'testing')
|
||||||
|
version = os.getenv('CONAN_CHAISCRIPT_VERSION', '5.8.5')
|
||||||
|
|
||||||
|
class ChaiScriptTest(ConanFile):
|
||||||
|
settings = 'os', 'compiler', 'build_type', 'arch'
|
||||||
|
requires = (
|
||||||
|
'cmake-utils/0.0.0@Manu343726/testing',
|
||||||
|
'ChaiScript/{}@{}/{}'.format(Settings.version, Settings.username, Settings.channel)
|
||||||
|
)
|
||||||
|
generators = 'cmake'
|
||||||
|
|
||||||
|
def build(self):
|
||||||
|
cmake = CMake(self.settings)
|
||||||
|
self.run('cmake {} {}'.format(self.conanfile_directory, cmake.command_line))
|
||||||
|
self.run('cmake --build . {}'.format(cmake.build_config))
|
||||||
|
|
||||||
|
def test(self):
|
||||||
|
self.run(os.path.join('.', 'bin', 'example'))
|
||||||
|
|
||||||
15
test_package/example.cpp
Normal file
15
test_package/example.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include <chaiscript/chaiscript.hpp>
|
||||||
|
#include <chaiscript/chaiscript_stdlib.hpp>
|
||||||
|
|
||||||
|
double function(int i, double j)
|
||||||
|
{
|
||||||
|
return i * j;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
chaiscript::ChaiScript chai(chaiscript::Std_Lib::library());
|
||||||
|
chai.add(chaiscript::fun(&function), "function");
|
||||||
|
|
||||||
|
double d = chai.eval<double>("function(3, 4.75);");
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user