mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
master the use of docker. maybe
This commit is contained in:
parent
41c297b9ab
commit
962ff6cf61
91
.dockerignore
Normal file
91
.dockerignore
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
# Python (Bytecode)
|
||||||
|
*.pyc
|
||||||
|
|
||||||
|
# ninja files
|
||||||
|
*.ninja
|
||||||
|
|
||||||
|
# Visual Studio
|
||||||
|
*.props
|
||||||
|
*.user
|
||||||
|
.vs/
|
||||||
|
Debug/
|
||||||
|
Release/
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
*.pyproj
|
||||||
|
*.vcxproj
|
||||||
|
*.vcxproj.filters
|
||||||
|
*.tlog
|
||||||
|
*.lastbuildstate
|
||||||
|
*.idb
|
||||||
|
*.sln
|
||||||
|
*.gitattributes
|
||||||
|
|
||||||
|
# VSCode
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
# CMake
|
||||||
|
build/
|
||||||
|
build-sol2/
|
||||||
|
CMakeCache.txt
|
||||||
|
CMakeFiles/
|
||||||
|
|
||||||
|
# Compiler outputs
|
||||||
|
obj/*
|
||||||
|
bin/*
|
||||||
|
main.exe
|
||||||
|
main.o
|
||||||
|
lua53.dll
|
||||||
|
lua-5.3.4.dll
|
||||||
|
main.ilk
|
||||||
|
main.pdb
|
||||||
|
|
||||||
|
# Dropbox interference
|
||||||
|
.dropbox*
|
||||||
|
|
||||||
|
# QtCreator
|
||||||
|
*.creator.user.*
|
||||||
|
*.config
|
||||||
|
*.creator
|
||||||
|
*.files
|
||||||
|
*.includes
|
||||||
|
|
||||||
|
# Scratchpad Files
|
||||||
|
m.lua
|
||||||
|
catch_mock.hpp
|
||||||
|
main_aux.cpp
|
||||||
|
main.hpp
|
||||||
|
main2.cpp
|
||||||
|
main.cpp
|
||||||
|
|
||||||
|
# Local Lua Testbeds
|
||||||
|
lua-5.3.4-cxx/
|
||||||
|
lua-5.3.4/
|
||||||
|
lua-5.3.2/
|
||||||
|
lua-5.3.1/
|
||||||
|
lua-5.3.0/
|
||||||
|
lua-5.2.4/
|
||||||
|
lua-5.2.2/
|
||||||
|
lua-5.2.3/
|
||||||
|
lua-5.1.5/
|
||||||
|
LuaJIT-2.1.0/
|
||||||
|
luajit-2.0.5/
|
||||||
|
luajit-2.0.3/
|
||||||
|
include/
|
||||||
|
liblua.a
|
||||||
|
lib/liblua5.2.a
|
||||||
|
|
||||||
|
# Docs Artefacts
|
||||||
|
docs/build/
|
||||||
|
|
||||||
|
# Sublime Text
|
||||||
|
*.sublime-workspace
|
||||||
|
*.sublime-project
|
||||||
|
|
||||||
|
|
||||||
|
# Windows Crap
|
||||||
|
desktop.ini
|
||||||
|
*.db
|
||||||
|
|
||||||
|
# Miscellaneous
|
||||||
|
external/
|
54
.gitignore
vendored
54
.gitignore
vendored
|
@ -11,6 +11,8 @@
|
||||||
Debug/
|
Debug/
|
||||||
Release/
|
Release/
|
||||||
x64/
|
x64/
|
||||||
|
x86/
|
||||||
|
*.pyproj
|
||||||
*.vcxproj
|
*.vcxproj
|
||||||
*.vcxproj.filters
|
*.vcxproj.filters
|
||||||
*.tlog
|
*.tlog
|
||||||
|
@ -24,12 +26,19 @@ x64/
|
||||||
|
|
||||||
# CMake
|
# CMake
|
||||||
build/
|
build/
|
||||||
|
build-sol2/
|
||||||
CMakeCache.txt
|
CMakeCache.txt
|
||||||
CMakeFiles/
|
CMakeFiles/
|
||||||
|
|
||||||
# Compiler outputs
|
# Compiler outputs
|
||||||
obj/*
|
obj/*
|
||||||
bin/*
|
bin/*
|
||||||
|
main.exe
|
||||||
|
main.o
|
||||||
|
lua53.dll
|
||||||
|
lua-5.3.4.dll
|
||||||
|
main.ilk
|
||||||
|
main.pdb
|
||||||
|
|
||||||
# Dropbox interference
|
# Dropbox interference
|
||||||
.dropbox*
|
.dropbox*
|
||||||
|
@ -42,10 +51,17 @@ bin/*
|
||||||
*.includes
|
*.includes
|
||||||
|
|
||||||
# Scratchpad Files
|
# Scratchpad Files
|
||||||
|
m.lua
|
||||||
|
main.lua
|
||||||
|
catch_mock.hpp
|
||||||
|
main_aux.cpp
|
||||||
|
main.hpp
|
||||||
main2.cpp
|
main2.cpp
|
||||||
main.cpp
|
main.cpp
|
||||||
|
|
||||||
# Local Lua Testbeds
|
# Local Lua Testbeds
|
||||||
|
lua-5.3.4-cxx/
|
||||||
|
lua-5.3.4/
|
||||||
lua-5.3.2/
|
lua-5.3.2/
|
||||||
lua-5.3.1/
|
lua-5.3.1/
|
||||||
lua-5.3.0/
|
lua-5.3.0/
|
||||||
|
@ -53,40 +69,24 @@ lua-5.2.4/
|
||||||
lua-5.2.2/
|
lua-5.2.2/
|
||||||
lua-5.2.3/
|
lua-5.2.3/
|
||||||
lua-5.1.5/
|
lua-5.1.5/
|
||||||
|
LuaJIT-2.1.0/
|
||||||
luajit-2.0.5/
|
luajit-2.0.5/
|
||||||
luajit-2.0.3/
|
luajit-2.0.3/
|
||||||
include/
|
include/
|
||||||
liblua.a
|
liblua.a
|
||||||
lib/liblua5.2.a
|
lib/liblua5.2.a
|
||||||
|
|
||||||
|
# Docs Artefacts
|
||||||
|
docs/build/
|
||||||
|
|
||||||
|
# Sublime Text
|
||||||
|
*.sublime-workspace
|
||||||
|
*.sublime-project
|
||||||
|
|
||||||
|
|
||||||
# Windows Crap
|
# Windows Crap
|
||||||
desktop.ini
|
desktop.ini
|
||||||
*.sublime-workspace
|
|
||||||
docs/build/
|
|
||||||
*.sublime-project
|
|
||||||
m.lua
|
|
||||||
single/sol.hpp
|
|
||||||
*.db
|
*.db
|
||||||
lua53.dll
|
|
||||||
main.exe
|
# Miscellaneous
|
||||||
main.o
|
|
||||||
lua-5.3.4/
|
|
||||||
main.lua
|
|
||||||
LuaJIT-2.1.0/
|
|
||||||
lua-5.3.4-cxx/
|
|
||||||
lua-5.3.4.vcxproj-cxx.filters
|
|
||||||
sol.pyproj
|
|
||||||
lua-5.3.4.dll
|
|
||||||
main.ilk
|
|
||||||
main.pdb
|
|
||||||
lua-5.3.4-cxx/
|
|
||||||
lua-5.3.4/
|
|
||||||
temp.bad_runtime.lua
|
|
||||||
temp.bad_syntax.lua
|
|
||||||
temp.good.lua
|
|
||||||
catch_mock.hpp
|
|
||||||
main_aux.cpp
|
|
||||||
main.hpp
|
|
||||||
tmp_thingy_user.lua
|
|
||||||
tmp_thingy.lua
|
|
||||||
external/
|
external/
|
||||||
|
|
27
.travis.yml
27
.travis.yml
|
@ -23,48 +23,61 @@
|
||||||
sudo: required
|
sudo: required
|
||||||
language: cpp
|
language: cpp
|
||||||
|
|
||||||
|
git:
|
||||||
|
depth: 5
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- sudo apt install -y git zsh
|
- sudo apt install -y git
|
||||||
- sudo curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
|
|
||||||
- sudo chmod +x /usr/local/bin/docker-compose
|
|
||||||
- sudo usermod -aG docker ${USER}
|
|
||||||
- sudo docker-compose --version
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- sudo docker-compose build
|
- 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-compose run -e "LUA_VERSION=$LUA_VERSION" -e "LLVM_VERSION=$LLVM_VERSION" -e "GCC_VERSION=$GCC_VERSION" test
|
- 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 rm $(sudo docker ps -a -q)
|
||||||
|
- sudo docker rmi $(sudo docker image ls -q)
|
||||||
|
|
||||||
env:
|
env:
|
||||||
# GCC 4.9.x, 5.x, 6.x, 7.x
|
# GCC 4.9.x, 5.x, 6.x, 7.x
|
||||||
- LUA_VERSION=5.3.4
|
- LUA_VERSION=5.3.4
|
||||||
GCC_VERSION=4.9
|
GCC_VERSION=4.9
|
||||||
|
CI=true
|
||||||
- LUA_VERSION=5.3.4
|
- LUA_VERSION=5.3.4
|
||||||
GCC_VERSION=5
|
GCC_VERSION=5
|
||||||
|
CI=true
|
||||||
- LUA_VERSION=5.3.4
|
- LUA_VERSION=5.3.4
|
||||||
GCC_VERSION=6
|
GCC_VERSION=6
|
||||||
|
CI=true
|
||||||
- LUA_VERSION=5.3.4
|
- LUA_VERSION=5.3.4
|
||||||
GCC_VERSION=7
|
GCC_VERSION=7
|
||||||
|
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
|
||||||
- LUA_VERSION=5.3.4
|
- LUA_VERSION=5.3.4
|
||||||
LLVM_VERSION=3.7.1
|
LLVM_VERSION=3.7.1
|
||||||
|
CI=true
|
||||||
- LUA_VERSION=5.3.4
|
- LUA_VERSION=5.3.4
|
||||||
LLVM_VERSION=3.8.1
|
LLVM_VERSION=3.8.1
|
||||||
|
CI=true
|
||||||
- LUA_VERSION=5.3.4
|
- LUA_VERSION=5.3.4
|
||||||
LLVM_VERSION=3.9.0
|
LLVM_VERSION=3.9.0
|
||||||
|
CI=true
|
||||||
- LUA_VERSION=5.3.4
|
- LUA_VERSION=5.3.4
|
||||||
LLVM_VERSION=4.0.1
|
LLVM_VERSION=4.0.1
|
||||||
|
CI=true
|
||||||
- LUA_VERSION=5.3.4
|
- LUA_VERSION=5.3.4
|
||||||
LLVM_VERSION=5.0.1
|
LLVM_VERSION=5.0.1
|
||||||
|
CI=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
|
||||||
- LUA_VERSION=5.1.5
|
- LUA_VERSION=5.1.5
|
||||||
GCC_VERSION=7
|
GCC_VERSION=7
|
||||||
|
CI=true
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
|
|
|
@ -199,10 +199,13 @@ if (TESTS OR TESTS_SINGLE OR EXAMPLES OR TESTS_EXAMPLES)
|
||||||
endif()
|
endif()
|
||||||
find_package(Threads)
|
find_package(Threads)
|
||||||
# Find way to get Lua: build if requested, or attempt to build if no matching version is found
|
# Find way to get Lua: build if requested, or attempt to build if no matching version is found
|
||||||
string(TOLOWER ${LUA_VERSION} NORMALIZED_LUA_VERSION)
|
|
||||||
if (BUILD_LUA OR BUILD_LUAJIT)
|
if (BUILD_LUA OR BUILD_LUAJIT)
|
||||||
include(LuaBuild)
|
include(LuaBuild)
|
||||||
elseif (NORMALIZED_LUA_VERSION MATCHES "5.1")
|
elseif (NOT LUA_VERSION)
|
||||||
|
# can't do anything
|
||||||
|
else()
|
||||||
|
string(TOLOWER ${LUA_VERSION} NORMALIZED_LUA_VERSION)
|
||||||
|
if (NORMALIZED_LUA_VERSION MATCHES "5.1")
|
||||||
find_package(Lua 5.1 EXACT REQUIRED)
|
find_package(Lua 5.1 EXACT REQUIRED)
|
||||||
elseif(NORMALIZED_LUA_VERSION MATCHES "5.2")
|
elseif(NORMALIZED_LUA_VERSION MATCHES "5.2")
|
||||||
find_package(Lua 5.2 EXACT REQUIRED)
|
find_package(Lua 5.2 EXACT REQUIRED)
|
||||||
|
@ -213,6 +216,7 @@ if (TESTS OR TESTS_SINGLE OR EXAMPLES OR TESTS_EXAMPLES)
|
||||||
else()
|
else()
|
||||||
include(LuaBuild)
|
include(LuaBuild)
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if (NOT LUA_FOUND)
|
if (NOT LUA_FOUND)
|
||||||
message(FATAL_ERROR "Lua ${LUA_VERSION} not found and could not be targeted for building.")
|
message(FATAL_ERROR "Lua ${LUA_VERSION} not found and could not be targeted for building.")
|
||||||
|
|
28
Dockerfile
28
Dockerfile
|
@ -22,25 +22,31 @@
|
||||||
|
|
||||||
# Start from the ubuntu:xenial image
|
# Start from the ubuntu:xenial image
|
||||||
FROM ubuntu:xenial
|
FROM ubuntu:xenial
|
||||||
# Everything from our current directory (repo toplevel in travis-ci)
|
|
||||||
# should be copied into our container at the top-level sol2 directory
|
|
||||||
ADD . /sol2
|
|
||||||
#VOLUME /sol2
|
|
||||||
# We want our working directory to be the toplevel
|
# We want our working directory to be the toplevel
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
|
# Everything from our current directory (repo toplevel in travis-ci)
|
||||||
|
# should be copied into our container at the top-level sol2 directory
|
||||||
|
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 update
|
RUN apt-get update
|
||||||
RUN apt -y install sudo zsh
|
RUN apt-get -y install sudo zsh
|
||||||
RUN apt -y dist-upgrade
|
RUN apt-get -y dist-upgrade
|
||||||
RUN mkdir -p build-sol2/Debug build-sol2/Release
|
RUN mkdir -p /build-sol2/Debug /build-sol2/Release
|
||||||
RUN chmod +x /sol2/scripts/preparation.linux.sh
|
RUN chmod +x /sol2/scripts/preparation.linux.sh /sol2/scripts/run.linux.sh
|
||||||
RUN ["/usr/bin/env", "zsh", "-c", "-x", "./sol2/scripts/preparation.linux.sh"]
|
RUN ["/usr/bin/env", "zsh", "-e", "/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
|
||||||
CMD ["/usr/bin/env", "zsh", "-c", "-x", "chmod +x /sol2/scripts/run.linux.sh && ./sol2/scripts/run.linux.sh"]
|
ENTRYPOINT ["/usr/bin/env", "zsh", "-x", "-e", "/sol2/scripts/run.linux.sh"]
|
||||||
|
|
|
@ -304,6 +304,9 @@ target_compile_definitions(${liblua}
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
target_compile_options(${liblua}
|
target_compile_options(${liblua}
|
||||||
PRIVATE /W1)
|
PRIVATE /W1)
|
||||||
|
else()
|
||||||
|
target_compile_options(${liblua}
|
||||||
|
PRIVATE -w -Wno-implicit-fallthrough)
|
||||||
endif()
|
endif()
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
#target_compile_definitions(${liblua}
|
#target_compile_definitions(${liblua}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# # # # sol2
|
# # # # sol2
|
||||||
# The MIT License (MIT)
|
# The MIT License (MIT)
|
||||||
#
|
#
|
||||||
|
@ -20,14 +22,9 @@
|
||||||
# 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.
|
||||||
|
|
||||||
version: "3"
|
export LLVM_ARCHIVE_PATH=~/clang+llvm.tar.xz
|
||||||
|
export CLANG_PREFIX=$HOME/clang-$LLVM_VERSION
|
||||||
services:
|
export PATH=$LLVM_ARCHIVE_PATH:$PATH
|
||||||
test:
|
export LD_LIBRARY_PATH=$CLANG_PREFIX/lib:$LD_LIBRARY_PATH
|
||||||
build: .
|
export CPPFLAGS="-I $CLANG_PREFIX/include/c++/v1"
|
||||||
volumes:
|
export CXXFLAGS=-lc++
|
||||||
- .:/sol2
|
|
||||||
environment:
|
|
||||||
- LUA_VERSION
|
|
||||||
- GCC_VERSION
|
|
||||||
- LLVM_VERSION
|
|
|
@ -23,29 +23,7 @@
|
||||||
# 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.
|
||||||
|
|
||||||
# # Initial and necessary installations
|
# # Initial and necessary installations
|
||||||
sudo apt -y install build-essential zsh ninja-build libreadline6 libreadline6-dev python3 zsh wget curl libcurl3 openssl libexpat1 libexpat1-dev cmake git
|
sudo apt-get -y install ninja-build libreadline6 libreadline6-dev python3 wget curl libcurl3 cmake git
|
||||||
|
|
||||||
# # CMake Installation (from script)
|
|
||||||
# This is only necessary if we need cmake of a better version than what's available on the system
|
|
||||||
#CMAKE_VERSION_MAJOR_MINOR=3.10
|
|
||||||
#CMAKE_VERSION_BUILD=1
|
|
||||||
#CMAKE_VERSION=$CMAKE_VERSION_MAJOR_MINOR.$CMAKE_VERSION_BUILD
|
|
||||||
#wget https://cmake.org/files/v$CMAKE_VERSION_MAJOR_MINOR/cmake-$CMAKE_VERSION-Linux-x86_64.sh
|
|
||||||
#sudo bash cmake-$CMAKE_VERSION-Linux-x86_64.sh --prefix=/usr/local --exclude-subdir --skip-license
|
|
||||||
|
|
||||||
# # CMake Installation (from source)
|
|
||||||
#mkdir -p cmake-tmp
|
|
||||||
#cd cmake-tmp
|
|
||||||
#wget https://cmake.org/files/v$CMAKE_VERSION_MAJOR_MINOR/cmake-$CMAKE_VERSION.tar.gz
|
|
||||||
#tar -xzvf cmake-$CMAKE_VERSION.tar.gz
|
|
||||||
#cd cmake-$CMAKE_VERSION/
|
|
||||||
#./bootstrap --system-libs
|
|
||||||
#make
|
|
||||||
#sudo make install
|
|
||||||
# cd ..
|
|
||||||
# refresh the shell, then print the CMake version to make
|
|
||||||
# sure we've got what we need (need to be 3.6 or better: Ubuntu 16.04 rolls 3.5.1 or somethnig)
|
|
||||||
#exec bash
|
|
||||||
|
|
||||||
# # LLVM and GCC updates
|
# # LLVM and GCC updates
|
||||||
# Grab LLVM or GCC
|
# Grab LLVM or GCC
|
||||||
|
@ -54,31 +32,26 @@ sudo apt -y install build-essential zsh ninja-build libreadline6 libreadline6-de
|
||||||
if [ "$LLVM_VERSION" ]
|
if [ "$LLVM_VERSION" ]
|
||||||
then
|
then
|
||||||
# get and use LLVM
|
# get and use LLVM
|
||||||
echo "========== detected LLVM_VERSION, attempting to install llvm version $LLVM_VERSION =========="
|
source /sol2/scripts/preparation.linux.llvm.sh
|
||||||
wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-16.04.tar.xz -O $LLVM_ARCHIVE_PATH
|
|
||||||
mkdir ~/clang-$LLVM_VERSION
|
|
||||||
tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1
|
|
||||||
export PATH=~/clang+llvm/bin:$PATH
|
|
||||||
export CC=clang
|
export CC=clang
|
||||||
export CXX=clang++
|
export CXX=clang++
|
||||||
|
wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-16.04.tar.xz -O $LLVM_ARCHIVE_PATH
|
||||||
|
mkdir -p $CLANG_PREFIX
|
||||||
|
tar xf $LLVM_ARCHIVE_PATH -C $CLANG_PREFIX --strip-components 1
|
||||||
elif [ "$GCC_VERSION" ]
|
elif [ "$GCC_VERSION" ]
|
||||||
then
|
then
|
||||||
# get and use GCC version that we desire
|
# get and use GCC version that we desire
|
||||||
echo "========== detected GCC_VERSION, attempting to install gcc version $GCC_VERSION =========="
|
sudo apt-get -y install software-properties-common python-software-properties
|
||||||
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||||
sudo apt update
|
sudo apt-get -y update
|
||||||
sudo apt dist-upgrade
|
sudo apt-get -y dist-upgrade
|
||||||
sudo apt install gcc-$GCC_VERSION g++-$GCC_VERSION
|
sudo 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
|
sudo 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
|
sudo update-alternatives --config gcc
|
||||||
export CC=gcc
|
export CC=gcc-$GCC_VERSION
|
||||||
export CXX=g++
|
export CXX=g++-$GCC_VERSION
|
||||||
else
|
else
|
||||||
export CC=gcc
|
sudo apt-get -y install build-essential
|
||||||
export CXX=g++
|
export CC=cc
|
||||||
|
export CXX=c++
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# show the tool and compiler versions we're using
|
|
||||||
cmake --version
|
|
||||||
$CC --version
|
|
||||||
$CXX --version
|
|
||||||
|
|
|
@ -1,22 +1,62 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# # # # 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.
|
||||||
|
|
||||||
|
# This script runs the actual project
|
||||||
|
|
||||||
if [ "$LLVM_VERSION" ]
|
if [ "$LLVM_VERSION" ]
|
||||||
then
|
then
|
||||||
build_type=-DCMAKE_CXX_COMPILER\=clang++ -DCMAKE_C_COMPILER\=clang;
|
source /sol2/scripts/preparation.linux.llvm.sh
|
||||||
|
export CC=clang
|
||||||
|
export CXX=clang++
|
||||||
elif [ "$GCC_VERSION" ]
|
elif [ "$GCC_VERSION" ]
|
||||||
then
|
then
|
||||||
build_type=-DCMAKE_CXX_COMPILER\=g++ -DCMAKE_C_COMPILER\=gcc;
|
export CC=gcc-$GCC_VERSION
|
||||||
|
export CXX=g++-$GCC_VERSION
|
||||||
else
|
else
|
||||||
build_type=-DCMAKE_CXX_COMPILER\=g++ -DCMAKE_C_COMPILER\=gcc;
|
export CC=cc
|
||||||
|
export CXX=c++
|
||||||
fi
|
fi
|
||||||
|
export build_type_cxx=-DCMAKE_CXX_COMPILER\=${CXX}
|
||||||
|
export build_type_cc=-DCMAKE_C_COMPILER\=${CC}
|
||||||
|
|
||||||
cd build-sol2
|
# show the tool and compiler versions we're using
|
||||||
cd Debug
|
cmake --version
|
||||||
cmake ../../sol2 -G Ninja -DCMAKE_BUILD_TYPE=Debug $build_type -DLUA_VERSION="${LUA_VERSION}" -DBUILD_LUA=ON -DBUILD_LUA_AS_DLL=OFF -DTESTS=ON -DEXAMPLES=ON -DSINGLE=ON -DTESTS_EXAMPLES=ON -DTESTS_SINGLE=ON
|
$CC --version
|
||||||
|
$CXX --version
|
||||||
|
echo build_type_cc : "${build_type_cc}"
|
||||||
|
echo build_type_cxx: "${build_type_cxx}"
|
||||||
|
|
||||||
|
top_level=${PWD}
|
||||||
|
|
||||||
|
cd /build-sol2/Debug
|
||||||
|
cmake ../../sol2 -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 -C Debug
|
||||||
cd ..
|
cd ${top_level}
|
||||||
|
|
||||||
cd Release
|
cd /build-sol2/Release
|
||||||
cmake ../../sol2 -G Ninja -DCMAKE_BUILD_TYPE=Release $build_type -DLUA_VERSION="${LUA_VERSION}" -DBUILD_LUA=ON -DBUILD_LUA_AS_DLL=OFF -DTESTS=ON -DEXAMPLES=ON -DSINGLE=ON -DTESTS_EXAMPLES=ON -DTESTS_SINGLE=ON
|
cmake ../../sol2 -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 -C Release
|
||||||
cd ..
|
cd ${top_level}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user