mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
[ci skip] Prepare travis and docker for pulling images: just need to build images...
This commit is contained in:
parent
1b94182c8d
commit
44e87cedda
61
.travis.yml
61
.travis.yml
|
@ -24,7 +24,7 @@ sudo: required
|
||||||
language: cpp
|
language: cpp
|
||||||
|
|
||||||
git:
|
git:
|
||||||
depth: 5
|
depth: 2
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
|
@ -33,8 +33,8 @@ before_install:
|
||||||
- sudo apt install -y git
|
- sudo apt install -y git
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- sudo docker image build --tag sol2:ci --build-arg "CI=${CI}" --build-arg "LUA_VERSION=${LUA_VERSION}" --build-arg "GCC_VERSION=${GCC_VERSION}" --build-arg "LLVM_VERSION=${LLVM_VERSION}" .
|
- sudo docker image pull ThePhD/sol2:gcc-${GCC_VERSION}_llvm-${LLVM_VERSION}
|
||||||
- sudo docker run --name "sol2.test" --tty --env "CI=${CI}" --env "LUA_VERSION=${LUA_VERSION}" --env "GCC_VERSION=${GCC_VERSION}" --env "LLVM_VERSION=${LLVM_VERSION}" sol2:ci
|
- sudo docker run --rm --name "sol2.test" --tty --env "CI=${CI}" --env "LUA_VERSION=${LUA_VERSION}" --env "GCC_VERSION=${GCC_VERSION}" --env "LLVM_VERSION=${LLVM_VERSION}" sol2:gcc-${GCC_VERSION}_llvm-${LLVM_VERSION}
|
||||||
- sudo docker rm $(sudo docker ps -a -q)
|
- sudo docker rm $(sudo docker ps -a -q)
|
||||||
- sudo docker rmi $(sudo docker image ls -q)
|
- sudo docker rmi $(sudo docker image ls -q)
|
||||||
|
|
||||||
|
@ -43,45 +43,62 @@ env:
|
||||||
- LUA_VERSION=5.3.4
|
- LUA_VERSION=5.3.4
|
||||||
GCC_VERSION=4.9
|
GCC_VERSION=4.9
|
||||||
CI=true
|
CI=true
|
||||||
|
|
||||||
- LUA_VERSION=5.3.4
|
- LUA_VERSION=5.3.4
|
||||||
GCC_VERSION=5
|
GCC_VERSION=5
|
||||||
CI=true
|
CI=true
|
||||||
|
|
||||||
- LUA_VERSION=5.3.4
|
- LUA_VERSION=5.3.4
|
||||||
GCC_VERSION=6
|
GCC_VERSION=6
|
||||||
CI=true
|
CI=true
|
||||||
- LUA_VERSION=5.3.4
|
- LUA_VERSION=5.3.4
|
||||||
GCC_VERSION=7
|
GCC_VERSION=7
|
||||||
CI=true
|
CI=true
|
||||||
|
|
||||||
# LLVM 3.6.x -> 5.0.x
|
# LLVM 3.6.x -> 5.0.x
|
||||||
#- LUA_VERSION=5.3.4
|
- LUA_VERSION=5.3.4
|
||||||
# LLVM_VERSION=3.6.2
|
LLVM_VERSION=3.6.2
|
||||||
# CI=true
|
CI=true
|
||||||
#- LUA_VERSION=5.3.4
|
ALLOW_FAILURE=true
|
||||||
# LLVM_VERSION=3.7.1
|
|
||||||
# CI=true
|
- LUA_VERSION=5.3.4
|
||||||
#- LUA_VERSION=5.3.4
|
LLVM_VERSION=3.7.1
|
||||||
# LLVM_VERSION=3.8.1
|
CI=true
|
||||||
# CI=true
|
ALLOW_FAILURE=true
|
||||||
#- LUA_VERSION=5.3.4
|
|
||||||
# LLVM_VERSION=3.9.0
|
- LUA_VERSION=5.3.4
|
||||||
# CI=true
|
LLVM_VERSION=3.8.1
|
||||||
#- LUA_VERSION=5.3.4
|
CI=true
|
||||||
# LLVM_VERSION=4.0.1
|
ALLOW_FAILURE=true
|
||||||
# CI=true
|
|
||||||
#- LUA_VERSION=5.3.4
|
- LUA_VERSION=5.3.4
|
||||||
# LLVM_VERSION=5.0.1
|
LLVM_VERSION=3.9.0
|
||||||
# CI=true
|
CI=true
|
||||||
|
ALLOW_FAILURE=true
|
||||||
|
|
||||||
|
- LUA_VERSION=5.3.4
|
||||||
|
LLVM_VERSION=4.0.1
|
||||||
|
CI=true
|
||||||
|
ALLOW_FAILURE=true
|
||||||
|
|
||||||
|
- LUA_VERSION=5.3.4
|
||||||
|
LLVM_VERSION=5.0.1
|
||||||
|
CI=true
|
||||||
|
ALLOW_FAILURE=true
|
||||||
|
|
||||||
# Lua Versions 5.2.4, 5.1.5, and maybe LuaJIT (as well as x86)
|
# Lua Versions 5.2.4, 5.1.5, and maybe LuaJIT (as well as x86)
|
||||||
- LUA_VERSION=5.2.4
|
- LUA_VERSION=5.2.4
|
||||||
GCC_VERSION=7
|
GCC_VERSION=7
|
||||||
CI=true
|
CI=true
|
||||||
|
|
||||||
- LUA_VERSION=5.1.5
|
- LUA_VERSION=5.1.5
|
||||||
GCC_VERSION=7
|
GCC_VERSION=7
|
||||||
CI=true
|
CI=true
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
|
allow_failures:
|
||||||
|
- env: ALLOW_FAILURE=true
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
webhooks:
|
webhooks:
|
||||||
|
|
51
Dockerfile
51
Dockerfile
|
@ -22,31 +22,44 @@
|
||||||
|
|
||||||
# Start from the ubuntu:xenial image
|
# Start from the ubuntu:xenial image
|
||||||
FROM ubuntu:xenial
|
FROM ubuntu:xenial
|
||||||
# We want our working directory to be the toplevel
|
# owner
|
||||||
WORKDIR /
|
LABEL maintainer="phdofthehouse@gmail.com"
|
||||||
# Everything from our current directory (repo toplevel in travis-ci)
|
# We want our working directory to be the home directory
|
||||||
# should be copied into our container at the top-level sol2 directory
|
WORKDIR /root
|
||||||
ADD . sol2
|
|
||||||
ARG CI=true
|
|
||||||
ARG LUA_VERSION=5.3.4
|
|
||||||
ARG GCC_VERSION
|
|
||||||
ARG LLVM_VERSION
|
|
||||||
#VOLUME /sol2
|
|
||||||
# Potential environment variables
|
|
||||||
ENV LUA_VERSION=${LUA_VERSION} GCC_VERSION=${GCC_VERSION} LLVM_VERSION=${LLVM_VERSION} CI=${CI}
|
|
||||||
# RUN is how you write to the image you've pulled down
|
# RUN is how you write to the image you've pulled down
|
||||||
# RUN actions are "committed" to the image, and everything will
|
# RUN actions are "committed" to the image, and everything will
|
||||||
# start from the base after all run commands are executed
|
# start from the base after all run commands are executed
|
||||||
RUN apt-get update
|
RUN apt-get update && apt-get install -y \
|
||||||
RUN apt-get -y install sudo zsh
|
zsh
|
||||||
RUN apt-get -y dist-upgrade
|
|
||||||
RUN mkdir -p /build-sol2/Debug /build-sol2/Release
|
# Scripts should be added directly to the docker image to get us started
|
||||||
RUN chmod +x /sol2/scripts/preparation.linux.sh /sol2/scripts/run.linux.sh
|
# We can mount the whole sol2 directory later as a volume
|
||||||
RUN ["/usr/bin/env", "zsh", "-e", "/sol2/scripts/preparation.linux.sh"]
|
ADD scripts/ /root/sol2-scripts
|
||||||
|
|
||||||
|
RUN mkdir -p /root/build-sol2/Debug /root/build-sol2/Release
|
||||||
|
RUN chmod +x /root/sol2-scripts/preparation.linux.sh /root/sol2-scripts/run.linux.sh
|
||||||
|
|
||||||
|
VOLUME /root/sol2
|
||||||
|
#ADD . /root/sol2
|
||||||
|
|
||||||
|
# # Above this is more or less static parts: the rest is non-static
|
||||||
|
# # This is ordered like this so making multiple of these
|
||||||
|
# # containers is more or less identical up to this point
|
||||||
|
# Command line arguments, with default values
|
||||||
|
ARG CI=true
|
||||||
|
ARG GCC_VERSION=7
|
||||||
|
ARG LLVM_VERSION
|
||||||
|
|
||||||
|
# Potential environment variables
|
||||||
|
ENV GCC_VERSION=${GCC_VERSION} LLVM_VERSION=${LLVM_VERSION} CI=${CI} SOL2_DIR=/root/sol2
|
||||||
|
|
||||||
|
RUN ["/usr/bin/env", "zsh", "-e", "/root/sol2-scripts/preparation.linux.sh"]
|
||||||
|
|
||||||
# CMD/ENTRYPOINT is different from RUN
|
# CMD/ENTRYPOINT is different from RUN
|
||||||
# these are done on a per-instantiation and essentially describe
|
# these are done on a per-instantiation and essentially describe
|
||||||
# the DEFAULT behavior of this container when its started, not what state it
|
# the DEFAULT behavior of this container when its started, not what state it
|
||||||
# gets "saved" in...
|
# gets "saved" in...
|
||||||
# it only runs the last CMD/ENTRYPOINT as the default behavior:
|
# it only runs the last CMD/ENTRYPOINT as the default behavior:
|
||||||
# multiple CMDs will not be respected
|
# multiple CMDs will not be respected
|
||||||
ENTRYPOINT ["/usr/bin/env", "zsh", "-x", "-e", "/sol2/scripts/run.linux.sh"]
|
ENTRYPOINT ["/usr/bin/env", "zsh", "-x", "-e", "/root/sol2-scripts/run.linux.sh"]
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
#!/usr/bin/env zsh
|
|
||||||
|
|
||||||
# # # # sol2
|
|
||||||
# The MIT License (MIT)
|
|
||||||
#
|
|
||||||
# Copyright (c) 2013-2017 Rapptz, ThePhD, and contributors
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
# this software and associated documentation files (the "Software"), to deal in
|
|
||||||
# the Software without restriction, including without limitation the rights to
|
|
||||||
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
||||||
# the Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
# subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in all
|
|
||||||
# copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
||||||
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
||||||
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
||||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
top_level_dir="$(pwd)"
|
|
||||||
export LLVM_ARCHIVE_PATH=${top_level_dir}/clang+llvm.tar.xz
|
|
||||||
export CLANG_PREFIX=${top_level_dir}/clang-$LLVM_VERSION
|
|
||||||
export PATH=$CLANG_PREFIX/bin:$PATH
|
|
||||||
export LD_LIBRARY_PATH=$CLANG_PREFIX/lib:$LD_LIBRARY_PATH
|
|
|
@ -22,82 +22,92 @@
|
||||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
# https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
|
top_level_dir="$(pwd)"
|
||||||
get_script_dir () {
|
|
||||||
if [ -n "`$SHELL -c 'echo $ZSH_VERSION'`" ]
|
|
||||||
then
|
|
||||||
SOURCE="${(%):-%x}"
|
|
||||||
elif [ -n "`$SHELL -c 'echo $BASH_VERSION'`" ]
|
|
||||||
then
|
|
||||||
SOURCE="${BASH_SOURCE[0]}"
|
|
||||||
else
|
|
||||||
SOURCE="${0}"
|
|
||||||
fi
|
|
||||||
# While $SOURCE is a symlink, resolve it
|
|
||||||
while [ -h "$SOURCE" ]; do
|
|
||||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
|
||||||
SOURCE="$( readlink "$SOURCE" )"
|
|
||||||
# If $SOURCE was a relative symlink (so no "/" as prefix, need to resolve it relative to the symlink base directory
|
|
||||||
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
|
|
||||||
done
|
|
||||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
|
||||||
echo "$DIR"
|
|
||||||
}
|
|
||||||
|
|
||||||
scripts_dir="$(get_script_dir)"
|
|
||||||
sol2_dir="${scripts_dir}/.."
|
|
||||||
|
|
||||||
mkdir -p build-sol2
|
mkdir -p build-sol2
|
||||||
cd build-sol2
|
cd build-sol2
|
||||||
|
|
||||||
top_level_dir="$(pwd)"
|
build_dir="$(pwd)"
|
||||||
|
|
||||||
|
echo "#\!/usr/bin/env zsh\n\n" > "sol2.compiler.vars"
|
||||||
|
|
||||||
# # Initial and necessary installations
|
# # Initial and necessary installations
|
||||||
sudo apt-get -y install ninja-build libreadline6 libreadline6-dev python3 wget curl libcurl3 cmake git
|
apt-get -y install ninja-build libreadline6 libreadline6-dev python3 wget curl libcurl3 cmake git
|
||||||
|
|
||||||
# # LLVM and GCC updates
|
# # LLVM and GCC updates
|
||||||
# Grab LLVM or GCC
|
# Grab LLVM or GCC
|
||||||
# if we need it
|
# if we need it
|
||||||
# defining both is probably an expotentially terrible idea
|
# defining both is probably an expotentially terrible idea
|
||||||
if [ "$LLVM_VERSION" ]
|
if [ "${LLVM_VERSION}" ]
|
||||||
then
|
then
|
||||||
# get and use LLVM
|
# get and use LLVM
|
||||||
source ${scripts_dir}/preparation.linux.llvm.sh
|
|
||||||
export CC=clang
|
|
||||||
export CXX=clang++
|
|
||||||
version_nums=(${=LLVM_VERSION//./ })
|
version_nums=(${=LLVM_VERSION//./ })
|
||||||
major=$version_nums[1]
|
major=$version_nums[1]
|
||||||
minor=$version_nums[2]
|
minor=$version_nums[2]
|
||||||
revision=$version_nums[3]
|
revision=$version_nums[3]
|
||||||
|
download_llvm=true
|
||||||
|
download_version=16.04
|
||||||
#sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
#sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||||
#sudo apt-get -y update
|
#sudo apt-get -y update
|
||||||
sudo apt-get -y install xz-utils
|
if [ $major -le 3 ]
|
||||||
if [ $major -lt 4 ] && [ $minor -lt 8 ];
|
|
||||||
then
|
then
|
||||||
sudo apt-get -y install libstdc++6
|
if [ $minor -le 8 ] && [ $minor -ge 5 ];
|
||||||
wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH
|
then
|
||||||
else
|
download_llvm=false
|
||||||
sudo apt-get -y install clang clang++
|
download_version=16.04
|
||||||
wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-16.04.tar.xz -O $LLVM_ARCHIVE_PATH
|
apt-get -y install clang-3.${minor}
|
||||||
|
export CC=clang-3.${minor}
|
||||||
|
export CXX=clang++-3.${minor}
|
||||||
|
elif [ $minor -le 4 ]
|
||||||
|
then
|
||||||
|
download_llvm=true
|
||||||
|
download_version=14.04
|
||||||
fi
|
fi
|
||||||
mkdir -p $CLANG_PREFIX
|
fi
|
||||||
tar xf "$LLVM_ARCHIVE_PATH" -C "$CLANG_PREFIX" --strip-components 1
|
if [ ${download_llvm} = true ]
|
||||||
elif [ "$GCC_VERSION" ]
|
then
|
||||||
|
export LLVM_ARCHIVE_PATH=${build_dir}/clang+llvm.tar.xz
|
||||||
|
export CLANG_PREFIX=${build_dir}/clang-$LLVM_VERSION
|
||||||
|
export PATH=$CLANG_PREFIX/bin:$PATH
|
||||||
|
export LD_LIBRARY_PATH=$CLANG_PREFIX/lib:$LD_LIBRARY_PATH
|
||||||
|
echo "export LLVM_ARCHIVE_PATH=${build_dir}/clang+llvm.tar.xz\nexport CLANG_PREFIX=${build_dir}/clang-$LLVM_VERSION\nexport PATH=$CLANG_PREFIX/bin:$PATH\nexport LD_LIBRARY_PATH=$CLANG_PREFIX/lib:$LD_LIBRARY_PATH\n" >> "sol2.compiler.vars"
|
||||||
|
|
||||||
|
apt-get -y install xz-utils clang
|
||||||
|
wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-${download_version}.tar.xz -O ${LLVM_ARCHIVE_PATH}
|
||||||
|
mkdir -p "${CLANG_PREFIX}"
|
||||||
|
tar xf "${LLVM_ARCHIVE_PATH}" -C "${CLANG_PREFIX}" --strip-components 1
|
||||||
|
# make sure a clang(++) of major/minor exists
|
||||||
|
# use || true to ignore potential failures
|
||||||
|
ln -s "clang-${major}.${minor}" "${CLANG_PREFIX}/bin/clang-${major}.${minor}" || true
|
||||||
|
ln -s "clang-${major}.${minor}" "${CLANG_PREFIX}/bin/clang++-${major}.${minor}" || true
|
||||||
|
export CC=clang-${major}.${minor}
|
||||||
|
export CXX=clang++-${major}.${minor}
|
||||||
|
fi
|
||||||
|
elif [ "${GCC_VERSION}" ]
|
||||||
then
|
then
|
||||||
# get and use GCC version that we desire
|
# get and use GCC version that we desire
|
||||||
sudo apt-get -y install software-properties-common python-software-properties
|
apt-get -y install software-properties-common python-software-properties
|
||||||
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||||
sudo apt-get -y update
|
apt-get -y update
|
||||||
sudo apt-get -y dist-upgrade
|
apt-get -y dist-upgrade
|
||||||
sudo apt-get -y install gcc-$GCC_VERSION g++-$GCC_VERSION
|
apt-get -y install gcc-$GCC_VERSION g++-$GCC_VERSION
|
||||||
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-$GCC_VERSION 60 --slave /usr/bin/g++ g++ /usr/bin/g++-$GCC_VERSION
|
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-$GCC_VERSION 60 --slave /usr/bin/g++ g++ /usr/bin/g++-$GCC_VERSION
|
||||||
sudo update-alternatives --config gcc
|
update-alternatives --config gcc
|
||||||
export CC=gcc-$GCC_VERSION
|
export CC=gcc-$GCC_VERSION
|
||||||
export CXX=g++-$GCC_VERSION
|
export CXX=g++-$GCC_VERSION
|
||||||
else
|
else
|
||||||
sudo apt-get -y install build-essential
|
apt-get -y install build-essential
|
||||||
export CC=cc
|
export CC=cc
|
||||||
export CXX=c++
|
export CXX=c++
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd ..
|
# show the tool and compiler versions we're using
|
||||||
|
echo "=== Compiler and tool variables ==="
|
||||||
|
ninja --version
|
||||||
|
cmake --version
|
||||||
|
$CC --version
|
||||||
|
$CXX --version
|
||||||
|
|
||||||
|
echo "export CC=$CC\nexport CXX=$CXX\n" >> "sol2.compiler.vars"
|
||||||
|
|
||||||
|
cd "${top_level_dir}"
|
||||||
|
|
|
@ -22,71 +22,55 @@
|
||||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
# Things we need
|
if [ -z "${SOL2_DIR}"]
|
||||||
# https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
|
|
||||||
get_script_dir () {
|
|
||||||
if [ -n "`$SHELL -c 'echo $ZSH_VERSION'`" ]
|
|
||||||
then
|
then
|
||||||
SOURCE="${(%):-%x}"
|
if [ ${CI} = true ]
|
||||||
elif [ -n "`$SHELL -c 'echo $BASH_VERSION'`" ]
|
|
||||||
then
|
then
|
||||||
SOURCE="${BASH_SOURCE[0]}"
|
export SOL2_DIR=~/sol2
|
||||||
else
|
else
|
||||||
SOURCE="${0}"
|
export SOL2_DIR=../..
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
# While $SOURCE is a symlink, resolve it
|
|
||||||
while [ -h "$SOURCE" ]; do
|
|
||||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
|
||||||
SOURCE="$( readlink "$SOURCE" )"
|
|
||||||
# If $SOURCE was a relative symlink (so no "/" as prefix, need to resolve it relative to the symlink base directory
|
|
||||||
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
|
|
||||||
done
|
|
||||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
|
||||||
echo "$DIR"
|
|
||||||
}
|
|
||||||
|
|
||||||
scripts_dir="$(get_script_dir)"
|
if [ -z "${LUA_VERSION}"]
|
||||||
sol2_dir="${scripts_dir}/.."
|
then
|
||||||
|
export LUA_VERSION=5.3.4
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir -p build-sol2
|
mkdir -p build-sol2
|
||||||
cd build-sol2
|
cd build-sol2
|
||||||
|
|
||||||
|
build_dir=$(pwd)
|
||||||
|
|
||||||
|
if [ -f "sol2.compiler.vars" ]
|
||||||
|
then
|
||||||
|
source ./sol2.compiler.vars
|
||||||
|
fi
|
||||||
|
|
||||||
# This script runs the actual project
|
# This script runs the actual project
|
||||||
mkdir -p Debug Release
|
mkdir -p Debug Release
|
||||||
|
|
||||||
if [ "$LLVM_VERSION" ]
|
|
||||||
then
|
|
||||||
source ${scripts_dir}/preparation.linux.llvm.sh
|
|
||||||
export CC=clang
|
|
||||||
export CXX=clang++
|
|
||||||
elif [ "$GCC_VERSION" ]
|
|
||||||
then
|
|
||||||
export CC=gcc-$GCC_VERSION
|
|
||||||
export CXX=g++-$GCC_VERSION
|
|
||||||
else
|
|
||||||
export CC=cc
|
|
||||||
export CXX=c++
|
|
||||||
fi
|
|
||||||
export build_type_cxx=-DCMAKE_CXX_COMPILER\=${CXX}
|
|
||||||
export build_type_cc=-DCMAKE_C_COMPILER\=${CC}
|
export build_type_cc=-DCMAKE_C_COMPILER\=${CC}
|
||||||
|
export build_type_cxx=-DCMAKE_CXX_COMPILER\=${CXX}
|
||||||
|
|
||||||
# show the tool and compiler versions we're using
|
# show the tool and compiler versions we're using
|
||||||
|
echo "=== Compiler and tool variables ==="
|
||||||
|
ninja --version
|
||||||
cmake --version
|
cmake --version
|
||||||
$CC --version
|
${CC} --version
|
||||||
$CXX --version
|
${CXX} --version
|
||||||
echo build_type_cc : "${build_type_cc}"
|
echo build_type_cc : "${build_type_cc}"
|
||||||
echo build_type_cxx: "${build_type_cxx}"
|
echo build_type_cxx: "${build_type_cxx}"
|
||||||
|
|
||||||
top_level=${PWD}
|
|
||||||
|
|
||||||
cd Debug
|
cd Debug
|
||||||
cmake ${sol2_dir} -G Ninja -DCMAKE_BUILD_TYPE=Debug ${build_type_cc} ${build_type_cxx} -DLUA_VERSION="${LUA_VERSION}" -DBUILD_LUA=ON -DBUILD_LUA_AS_DLL=OFF -DTESTS=ON -DEXAMPLES=ON -DSINGLE=ON -DTESTS_EXAMPLES=ON -DTESTS_SINGLE=ON -DCI=ON
|
cmake ${SOL2_DIR} -G Ninja -DCMAKE_BUILD_TYPE=Debug ${build_type_cc} ${build_type_cxx} -DLUA_VERSION="${LUA_VERSION}" -DBUILD_LUA=ON -DBUILD_LUA_AS_DLL=OFF -DTESTS=ON -DEXAMPLES=ON -DSINGLE=ON -DTESTS_EXAMPLES=ON -DTESTS_SINGLE=ON -DCI=ON
|
||||||
cmake --build . --config Debug
|
cmake --build . --config Debug
|
||||||
ctest -C Debug
|
ctest --build-config Debug --output-on-failure
|
||||||
cd ${top_level}
|
cd ..
|
||||||
|
|
||||||
cd Release
|
cd Release
|
||||||
cmake ${sol2_dir} -G Ninja -DCMAKE_BUILD_TYPE=Release ${build_type_cc} ${build_type_cxx} -DLUA_VERSION="${LUA_VERSION}" -DBUILD_LUA=ON -DBUILD_LUA_AS_DLL=OFF -DTESTS=ON -DEXAMPLES=ON -DSINGLE=ON -DTESTS_EXAMPLES=ON -DTESTS_SINGLE=ON -DCI=ON
|
cmake ${SOL2_DIR} -G Ninja -DCMAKE_BUILD_TYPE=Release ${build_type_cc} ${build_type_cxx} -DLUA_VERSION="${LUA_VERSION}" -DBUILD_LUA=ON -DBUILD_LUA_AS_DLL=OFF -DTESTS=ON -DEXAMPLES=ON -DSINGLE=ON -DTESTS_EXAMPLES=ON -DTESTS_SINGLE=ON -DCI=ON
|
||||||
cmake --build . --config Release
|
cmake --build . --config Release
|
||||||
ctest -C Release
|
ctest --build-config Release --output-on-failure
|
||||||
cd ${top_level}
|
cd ..
|
||||||
|
|
|
@ -85,7 +85,7 @@ namespace sol {
|
||||||
template <typename... Args, typename... Ret>
|
template <typename... Args, typename... Ret>
|
||||||
static std::function<Signature> get_std_func(types<Ret...>, types<Args...>, lua_State* L, int index) {
|
static std::function<Signature> get_std_func(types<Ret...>, types<Args...>, lua_State* L, int index) {
|
||||||
unsafe_function f(L, index);
|
unsafe_function f(L, index);
|
||||||
auto fx = [ f = std::move(f), L, index ](Args && ... args) -> meta::return_type_t<Ret...> {
|
auto fx = [ f = std::move(f) ](Args && ... args) -> meta::return_type_t<Ret...> {
|
||||||
return f.call<Ret...>(std::forward<Args>(args)...);
|
return f.call<Ret...>(std::forward<Args>(args)...);
|
||||||
};
|
};
|
||||||
return std::move(fx);
|
return std::move(fx);
|
||||||
|
|
|
@ -440,7 +440,7 @@ TEST_CASE("tables/function variables", "Check if tables and function calls work
|
||||||
int breakit = 50;
|
int breakit = 50;
|
||||||
lua.get<sol::table>("os").set_function("fun",
|
lua.get<sol::table>("os").set_function("fun",
|
||||||
[&breakit]() {
|
[&breakit]() {
|
||||||
INFO("stateful lambda()");
|
INFO("stateful lambda() with breakit:" << breakit);
|
||||||
return "test";
|
return "test";
|
||||||
});
|
});
|
||||||
REQUIRE_NOTHROW(run_script(lua));
|
REQUIRE_NOTHROW(run_script(lua));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user