Try to always use the dedicated library built for the docker image by the LLVM team, otherwise everything goes to hell....

This commit is contained in:
ThePhD 2018-01-10 08:40:37 -05:00
parent 8cf7f49ec7
commit 71963f9678
9 changed files with 134 additions and 48 deletions

View File

@ -55,7 +55,7 @@ if (MSVC)
add_definitions(/DUNICODE /D_UNICODE /D_SILENCE_CXX17_UNCAUGHT_EXCEPTION_DEPRECATION_WARNING /D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING /D_CRT_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_DEPRECATE) add_definitions(/DUNICODE /D_UNICODE /D_SILENCE_CXX17_UNCAUGHT_EXCEPTION_DEPRECATION_WARNING /D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING /D_CRT_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_DEPRECATE)
# Warning level, exceptions # Warning level, exceptions
add_compile_options(/W4 /EHsc) add_compile_options(/W4 /EHsc)
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang") if (NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(/MP) add_compile_options(/MP)
endif() endif()
else() else()
@ -67,7 +67,7 @@ else()
endif() endif()
if (CI) if (CI)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
include_directories("$ENV{CLANG_PREFIX}/include/c++/v1") include_directories("$ENV{CLANG_PREFIX}/include/c++/v1")
endif() endif()
endif() endif()
@ -103,17 +103,14 @@ option(CI "Enable build of tests" OFF)
option(TESTS "Enable build of tests" OFF) option(TESTS "Enable build of tests" OFF)
option(EXAMPLES "Enable build of examples" OFF) option(EXAMPLES "Enable build of examples" OFF)
option(SINGLE "Enable build of single header files" ON) option(SINGLE "Enable build of single header files" ON)
# Single tests will only be turned on if both SINGLE and TESTS are defined option(DOCS "Enable build of documentation" OFF)
# Single tests and examples tests will only be turned on if both SINGLE and TESTS are defined
CMAKE_DEPENDENT_OPTION(TESTS_SINGLE "Enable build of tests using the generated single headers" ON CMAKE_DEPENDENT_OPTION(TESTS_SINGLE "Enable build of tests using the generated single headers" ON
"SINGLE;TESTS" OFF) "SINGLE;TESTS" OFF)
CMAKE_DEPENDENT_OPTION(EXAMPLES_SINGLE "Enable build of examples using the generated single headers" OFF CMAKE_DEPENDENT_OPTION(EXAMPLES_SINGLE "Enable build of examples using the generated single headers" OFF
"SINGLE;EXAMPLES" OFF) "SINGLE;EXAMPLES" OFF)
if (TESTS AND EXAMPLES) CMAKE_DEPENDENT_OPTION(TESTS_EXAMPLES "Enable build of examples as tests" ON
option(TESTS_EXAMPLES "Enable build of examples as tests" ON) "TESTS;EXAMPLES" OFF)
else()
option(TESTS_EXAMPLES "Enable build of examples as tests" OFF)
endif()
option(DOCS "Enable build of documentation" OFF)
# # # sol2 Library # # # sol2 Library
@ -172,12 +169,13 @@ if (PYTHONINTERP_FOUND)
DEPENDS ${SOL2_HEADER_SOURCES}) DEPENDS ${SOL2_HEADER_SOURCES})
add_custom_target(sol2_single_header add_custom_target(sol2_single_header
DEPENDS "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/include/single/sol/sol.hpp" "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/include/single/sol/sol_forward.hpp") DEPENDS "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/include/single/sol/sol.hpp" "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/include/single/sol/sol_forward.hpp")
set_target_properties(sol2_single_header add_library(sol2_single INTERFACE)
set_target_properties(sol2_single
PROPERTIES PROPERTIES
INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/include/single/sol" INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/include/single/sol")
INTERFACE_INCLUDE_DIRECOTIRES "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/include/single/sol") add_dependencies(sol2_single sol2_single_header)
install(FILES "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/include/single/sol/sol.hpp" "${CMAKE_BINARY_DIR}/include/${CMAKE_CFG_INTDIR}/single/sol/sol_forward.hpp" install(FILES "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/include/single/sol/sol.hpp" "${CMAKE_BINARY_DIR}/include/${CMAKE_CFG_INTDIR}/single/sol/sol_forward.hpp"
DESTINATION include/sol) DESTINATION include/sol/single/sol)
endif() endif()
if (DOCS) if (DOCS)
set(SOL2_DOCS_FOUND TRUE) set(SOL2_DOCS_FOUND TRUE)

View File

@ -49,7 +49,7 @@ VOLUME /root/sol2
# # containers is more or less identical up to this point # # containers is more or less identical up to this point
# Command line arguments, with default values # Command line arguments, with default values
ARG CI=true ARG CI=true
ARG GCC_VERSION=7 ARG GCC_VERSION
ARG LLVM_VERSION ARG LLVM_VERSION
# Potential environment variables # Potential environment variables

View File

@ -50,12 +50,9 @@ function (MAKE_EXAMPLE example_source_file is_single)
PROPERTIES PROPERTIES
OUTPUT_NAME "${example_output_name}") OUTPUT_NAME "${example_output_name}")
if (is_single) if (is_single)
target_include_directories(${example_name} target_link_libraries(${example_name} sol2_single)
PRIVATE "${CMAKE_BINARY_DIR}/include/single/sol" "${LUA_INCLUDE_DIR}")
add_dependencies(${example_name} sol2_single_header)
else() else()
target_include_directories(${example_name} target_link_libraries(${example_name} sol2)
PRIVATE "${CMAKE_SOURCE_DIR}" "${LUA_INCLUDE_DIR}")
endif() endif()
target_compile_features(${example_name} target_compile_features(${example_name}
PRIVATE ${CXX_FEATURES}) PRIVATE ${CXX_FEATURES})

View File

@ -26,10 +26,10 @@
CI=true CI=true
declare -a gcc_versions declare -a gcc_versions
gcc_versions=( gcc_versions=(
7
6
5
4.9 4.9
5
6
7
) )
declare -r gcc_versions declare -r gcc_versions
@ -51,21 +51,26 @@ else
docker_username=${DOCKER_USERNAME}/ docker_username=${DOCKER_USERNAME}/
fi fi
echo "====== ======= ======= ======= ======"
echo "====== Pushing All Docker Images ======"
echo "====== ======= ======= ======= ======"
for i in $gcc_versions; do for i in $gcc_versions; do
GCC_VERSION=$i GCC_VERSION=$i
unset LLVM_VERSION unset LLVM_VERSION
docker build --tag ${docker_username}sol2:gcc-${GCC_VERSION}_llvm-${LLVM_VERSION} --build-arg GCC_VERSION=${GCC_VERSION} --build-arg LLVM_VERSION=${LLVM_VERSION} --build-arg CI=${CI} "${SOL2_DIR}" echo "====== Pushing Docker Image: ${docker_username}sol2:gcc-${GCC_VERSION}_llvm-${LLVM_VERSION} ======="
docker push ${docker_username}sol2:gcc-${GCC_VERSION}_llvm-${LLVM_VERSION} docker push ${docker_username}sol2:gcc-${GCC_VERSION}_llvm-${LLVM_VERSION}
done done
for i in $llvm_versions; do for i in $llvm_versions; do
LLVM_VERSION=$i LLVM_VERSION=$i
unset GCC_VERSION unset GCC_VERSION
docker build --tag ${docker_username}sol2:gcc-${GCC_VERSION}_llvm-${LLVM_VERSION} --build-arg GCC_VERSION=${GCC_VERSION} --build-arg LLVM_VERSION=${LLVM_VERSION} --build-arg CI=${CI} "${SOL2_DIR}" echo "====== Pushing Docker Image: ${docker_username}sol2:gcc-${GCC_VERSION}_llvm-${LLVM_VERSION} ======="
docker push ${docker_username}sol2:gcc-${GCC_VERSION}_llvm-${LLVM_VERSION} docker push ${docker_username}sol2:gcc-${GCC_VERSION}_llvm-${LLVM_VERSION}
done done
unset LLVM_VERSION unset LLVM_VERSION
unset GCC_VERSION unset GCC_VERSION
docker build --tag ${docker_username}sol2:gcc-${GCC_VERSION}_llvm-${LLVM_VERSION} --build-arg GCC_VERSION=${GCC_VERSION} --build-arg LLVM_VERSION=${LLVM_VERSION} --build-arg CI=${CI} "${SOL2_DIR}" echo "====== Pushing Docker Image: ${docker_username}sol2:gcc-${GCC_VERSION}_llvm-${LLVM_VERSION} ======="
docker push ${docker_username}sol2:gcc-${GCC_VERSION}_llvm-${LLVM_VERSION} docker push ${docker_username}sol2:gcc-${GCC_VERSION}_llvm-${LLVM_VERSION}

View File

@ -47,18 +47,16 @@ then
revision=$version_nums[3] revision=$version_nums[3]
download_llvm=true download_llvm=true
download_version=16.04 download_version=16.04
apt_version=${major}.${minor}
#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
if [ ${major} -le 3 ] if [ ${major} -le 5 ] && [ ${major} -ge 4 ];
then
if [ ${major} -eq 3 ] && [ ${minor} -le 8 ] && [ ${minor} -ge 5 ];
then then
download_llvm=false download_llvm=false
download_version=16.04 elif [ ${major} -eq 3 ]
apt-get -y install clang-3.${minor} then
export CC=clang-3.${minor} download_llvm=false
export CXX=clang++-3.${minor} if [ ${minor} -lt 5 ]
elif [ ${minor} -le 4 ]
then then
download_llvm=true download_llvm=true
download_version=14.04 download_version=14.04
@ -83,6 +81,10 @@ then
rm -f "${LLVM_ARCHIVE_PATH}" rm -f "${LLVM_ARCHIVE_PATH}"
export CC=clang-${major}.${minor} export CC=clang-${major}.${minor}
export CXX=clang++-${major}.${minor} export CXX=clang++-${major}.${minor}
else
apt-get -y install clang-${apt_version}
export CC=clang-${apt_version}
export CXX=clang++-${apt_version}
fi fi
elif [ "${GCC_VERSION}" ] elif [ "${GCC_VERSION}" ]
then then

76
scripts/push.linux.sh Normal file
View File

@ -0,0 +1,76 @@
#!/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.
CI=true
declare -a gcc_versions
gcc_versions=(
4.9
5
6
7
)
declare -r gcc_versions
declare -a llvm_versions
llvm_versions=(
3.6.2
3.7.1
3.8.1
3.9.1
4.0.1
5.0.1
)
declare -r llvm_versions
if [ -z "${DOCKER_USERNAME}" ]
then
docker_username=
else
docker_username=${DOCKER_USERNAME}/
fi
echo "====== ======= ======= ======= ======"
echo "====== Pushing All Docker Images ======"
echo "====== ======= ======= ======= ======"
for i in $gcc_versions; do
GCC_VERSION=$i
unset LLVM_VERSION
echo "====== Pushing Docker Image: ${docker_username}sol2:gcc-${GCC_VERSION}_llvm-${LLVM_VERSION} ======="
docker push ${docker_username}sol2:gcc-${GCC_VERSION}_llvm-${LLVM_VERSION}
done
for i in $llvm_versions; do
LLVM_VERSION=$i
unset GCC_VERSION
echo "====== Pushing Docker Image: ${docker_username}sol2:gcc-${GCC_VERSION}_llvm-${LLVM_VERSION} ======="
docker push ${docker_username}sol2:gcc-${GCC_VERSION}_llvm-${LLVM_VERSION}
done
unset LLVM_VERSION
unset GCC_VERSION
echo "====== Pushing Docker Image: ${docker_username}sol2:gcc-${GCC_VERSION}_llvm-${LLVM_VERSION} ======="
docker push ${docker_username}sol2:gcc-${GCC_VERSION}_llvm-${LLVM_VERSION}

View File

@ -64,6 +64,12 @@ namespace sol {
} }
}; };
struct state_deleter {
void operator()(lua_State* L) const {
lua_close(L);
}
};
template <typename T, typename Dx, typename... Args> template <typename T, typename Dx, typename... Args>
inline std::unique_ptr<T, Dx> make_unique_deleter(Args&&... args) { inline std::unique_ptr<T, Dx> make_unique_deleter(Args&&... args) {
return std::unique_ptr<T, Dx>(new T(std::forward<Args>(args)...)); return std::unique_ptr<T, Dx>(new T(std::forward<Args>(args)...));

View File

@ -65,13 +65,13 @@ namespace sol {
} }
} // namespace detail } // namespace detail
class state : private std::unique_ptr<lua_State, void (*)(lua_State*)>, public state_view { class state : private std::unique_ptr<lua_State, detail::state_deleter>, public state_view {
private: private:
typedef std::unique_ptr<lua_State, void (*)(lua_State*)> unique_base; typedef std::unique_ptr<lua_State, detail::state_deleter> unique_base;
public: public:
state(lua_CFunction panic = detail::default_at_panic) state(lua_CFunction panic = detail::default_at_panic)
: unique_base(luaL_newstate(), lua_close), state_view(unique_base::get()) { : unique_base(luaL_newstate()), state_view(unique_base::get()) {
set_panic(panic); set_panic(panic);
lua_CFunction f = c_call<decltype(&detail::default_traceback_error_handler), &detail::default_traceback_error_handler>; lua_CFunction f = c_call<decltype(&detail::default_traceback_error_handler), &detail::default_traceback_error_handler>;
protected_function::set_default_handler(object(lua_state(), in_place, f)); protected_function::set_default_handler(object(lua_state(), in_place, f));
@ -80,7 +80,7 @@ namespace sol {
} }
state(lua_CFunction panic, lua_Alloc alfunc, void* alpointer = nullptr) state(lua_CFunction panic, lua_Alloc alfunc, void* alpointer = nullptr)
: unique_base(lua_newstate(alfunc, alpointer), lua_close), state_view(unique_base::get()) { : unique_base(lua_newstate(alfunc, alpointer)), state_view(unique_base::get()) {
set_panic(panic); set_panic(panic);
lua_CFunction f = c_call<decltype(&detail::default_traceback_error_handler), &detail::default_traceback_error_handler>; lua_CFunction f = c_call<decltype(&detail::default_traceback_error_handler), &detail::default_traceback_error_handler>;
protected_function::set_default_handler(object(lua_state(), in_place, f)); protected_function::set_default_handler(object(lua_state(), in_place, f));

View File

@ -39,16 +39,18 @@ function(CREATE_TEST test_target_name test_name is_single)
PROPERTIES PROPERTIES
OUTPUT_NAME ${test_name}) OUTPUT_NAME ${test_name})
if (is_single) if (is_single)
add_dependencies(${test_target_name} sol2_single_header) target_link_libraries(${test_target_name} sol2_single)
target_include_directories(${test_target_name}
PRIVATE "${CMAKE_BINARY_DIR}/include/single/sol" "${LUA_INCLUDE_DIR}" "${CMAKE_BINARY_DIR}/vendor/Catch/include/")
else() else()
target_include_directories(${test_target_name} target_link_libraries(${test_target_name} sol2)
PRIVATE "${CMAKE_SOURCE_DIR}" "${LUA_INCLUDE_DIR}" "${CMAKE_BINARY_DIR}/vendor/Catch/include/")
endif() endif()
target_include_directories(${test_target_name}
PRIVATE "${LUA_INCLUDE_DIR}" "${CMAKE_BINARY_DIR}/vendor/Catch/include/")
if (MSVC) if (MSVC)
if (NOT CMAKE_COMPILER_ID MATCHES "Clang")
target_compile_options(${test_target_name} target_compile_options(${test_target_name}
PRIVATE /bigobj) PRIVATE /bigobj)
endif()
else() else()
target_compile_options(${test_target_name} target_compile_options(${test_target_name}
PRIVATE -Wno-noexcept-type -ftemplate-depth=1024 -pthread) PRIVATE -Wno-noexcept-type -ftemplate-depth=1024 -pthread)