mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
unless the LLVM and MINGW builds once again
This commit is contained in:
parent
ea7ce21220
commit
70b2fa0b41
|
@ -53,8 +53,11 @@ set(CXX_FEATURES
|
||||||
# # # General project flags
|
# # # General project flags
|
||||||
if (MSVC)
|
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, compile-multiple-files
|
# Warning level, exceptions
|
||||||
add_compile_options(/W4 /EHsc /MP)
|
add_compile_options(/W4 /EHsc)
|
||||||
|
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
|
add_compile_options(/MP)
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
add_compile_options(-Wno-unknown-warning -Wno-unknown-warning-option -Wall -Wextra -Wpedantic -pedantic -pedantic-errors)
|
add_compile_options(-Wno-unknown-warning -Wno-unknown-warning-option -Wall -Wextra -Wpedantic -pedantic -pedantic-errors)
|
||||||
endif()
|
endif()
|
||||||
|
|
17
appveyor.yml
17
appveyor.yml
|
@ -45,8 +45,8 @@ platform:
|
||||||
environment:
|
environment:
|
||||||
matrix:
|
matrix:
|
||||||
# apparently, I can't quite make LLVM work right now...
|
# apparently, I can't quite make LLVM work right now...
|
||||||
#- LUA_VERSION: 5.3.4
|
- LUA_VERSION: 5.3.4
|
||||||
# LLVM_VERSION: 4.0.0
|
LLVM_VERSION: 4.0.0
|
||||||
- LUA_VERSION: 5.3.4
|
- LUA_VERSION: 5.3.4
|
||||||
MINGW_VERSION: 6.3.0
|
MINGW_VERSION: 6.3.0
|
||||||
- LUA_VERSION: 5.3.4
|
- LUA_VERSION: 5.3.4
|
||||||
|
@ -57,8 +57,6 @@ environment:
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
allow_failures:
|
allow_failures:
|
||||||
# oldest compiler is allowed to fail here due to esoteric bugs
|
|
||||||
- MINGW_VERSION: 5.3.0
|
|
||||||
# 32-bit builds are temperamental with exceptions
|
# 32-bit builds are temperamental with exceptions
|
||||||
- platform: x86
|
- platform: x86
|
||||||
exclude:
|
exclude:
|
||||||
|
@ -67,16 +65,14 @@ matrix:
|
||||||
MINGW_VERSION: 6.3.0
|
MINGW_VERSION: 6.3.0
|
||||||
- image: Visual Studio 2017
|
- image: Visual Studio 2017
|
||||||
MINGW_VERSION: 5.3.0
|
MINGW_VERSION: 5.3.0
|
||||||
# LLVM exists in all images, so we only need Visual Studio 2017
|
# LLVM exists in all images, and we only want the x64 versions
|
||||||
- image: Visual Studio 2015
|
- platform: x86
|
||||||
LLVM_VERSION: 4.0.0
|
LLVM_VERSION: 4.0.0
|
||||||
# Get rid of x86 builds
|
# Get rid of x86 builds
|
||||||
- platform: x86
|
- platform: x86
|
||||||
LUA_VERSION: 5.2.4
|
LUA_VERSION: 5.2.4
|
||||||
- platform: x86
|
- platform: x86
|
||||||
LUA_VERSION: 5.1.5
|
LUA_VERSION: 5.1.5
|
||||||
- platform: x86
|
|
||||||
MINGW_VERSION: 5.3.0
|
|
||||||
# Get rid of redundant Visual Studio 2015 builds
|
# Get rid of redundant Visual Studio 2015 builds
|
||||||
- image: Visual Studio 2015
|
- image: Visual Studio 2015
|
||||||
LUA_VERSION: 5.1.5
|
LUA_VERSION: 5.1.5
|
||||||
|
@ -100,8 +96,8 @@ init:
|
||||||
- set python_path=C:\Python36
|
- set python_path=C:\Python36
|
||||||
- set mingw_path=
|
- set mingw_path=
|
||||||
- set llvm_path=
|
- set llvm_path=
|
||||||
- if "%MINGW_VERSION%"=="5.3.0" (set mingw_path=C:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\mingw64\bin)
|
- if "%MINGW_VERSION%"=="5.3.0" (set mingw_path=C:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\mingw32\bin)
|
||||||
- if "%MINGW_VERSION%"=="6.3.0" (if "%PLATFORM%"=="x64" (set mingw_path=C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin) else ( set mingw_path=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw64\bin))
|
- if "%MINGW_VERSION%"=="6.3.0" (if "%PLATFORM%"=="x64" (set mingw_path=C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin) else ( set mingw_path=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin))
|
||||||
- if "%LLVM_VERSION%"=="4.0.0" (set llvm_path=C:\Program Files\LLVM\bin)
|
- if "%LLVM_VERSION%"=="4.0.0" (set llvm_path=C:\Program Files\LLVM\bin)
|
||||||
- if "%PLATFORM%"=="x64" (set python_path=C:\Python36-x64)
|
- if "%PLATFORM%"=="x64" (set python_path=C:\Python36-x64)
|
||||||
- set PATH=%python_path%;%PATH%
|
- set PATH=%python_path%;%PATH%
|
||||||
|
@ -137,6 +133,7 @@ init:
|
||||||
# toolsets for Ninja or Makefiles as far as cmake is concerned, so
|
# toolsets for Ninja or Makefiles as far as cmake is concerned, so
|
||||||
# the --config / -C switches on builds do nothing...!
|
# the --config / -C switches on builds do nothing...!
|
||||||
before_build:
|
before_build:
|
||||||
|
- if DEFINED LLVM_VERSION (call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" && cd C:\projects\sol2)
|
||||||
- md build-sol2
|
- md build-sol2
|
||||||
- cd build-sol2
|
- cd build-sol2
|
||||||
- cmake .. -G "%CMAKE_GENERATOR%" %build_type% %build_compiler% -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 .. -G "%CMAKE_GENERATOR%" %build_type% %build_compiler% -DLUA_VERSION="%LUA_VERSION%" -DBUILD_LUA=ON -DBUILD_LUA_AS_DLL=OFF -DTESTS=ON -DEXAMPLES=ON -DSINGLE=ON -DTESTS_EXAMPLES=ON -DTESTS_SINGLE=ON
|
||||||
|
|
|
@ -49,7 +49,7 @@ int main(int, char**) {
|
||||||
// Our recursive function
|
// Our recursive function
|
||||||
// We use some lambda techniques and pass the function itself itself so we can recurse,
|
// We use some lambda techniques and pass the function itself itself so we can recurse,
|
||||||
// but a regular function would work too!
|
// but a regular function would work too!
|
||||||
auto fx = [&lua, &things](auto& f, auto& tbl) -> void {
|
auto fx = [&things](auto& f, auto& tbl) -> void {
|
||||||
// You can iterate through a table: it has
|
// You can iterate through a table: it has
|
||||||
// begin() and end()
|
// begin() and end()
|
||||||
// like standard containers
|
// like standard containers
|
||||||
|
|
|
@ -21,7 +21,6 @@ int main() {
|
||||||
|
|
||||||
int direct_value = lua["test"]["direct"];
|
int direct_value = lua["test"]["direct"];
|
||||||
c_assert(direct_value == 2);
|
c_assert(direct_value == 2);
|
||||||
// direct_value == 2
|
|
||||||
|
|
||||||
int number = lua["test"]["number"];
|
int number = lua["test"]["number"];
|
||||||
c_assert(number == 25);
|
c_assert(number == 25);
|
||||||
|
@ -30,18 +29,20 @@ int main() {
|
||||||
|
|
||||||
test::number = 542;
|
test::number = 542;
|
||||||
|
|
||||||
c_assert(lua["test"]["number"] == 25);
|
|
||||||
// number is its own memory: was passed by value
|
// number is its own memory: was passed by value
|
||||||
// So does not change
|
// So does not change
|
||||||
|
int number_again = lua["test"]["number"];
|
||||||
|
c_assert(number_again == 25);
|
||||||
|
|
||||||
c_assert(lua["test"]["ref_number"] == 542);
|
|
||||||
// ref_number is just test::number
|
// ref_number is just test::number
|
||||||
// passed through std::ref
|
// passed through std::ref
|
||||||
// so, it holds a reference
|
// so, it holds a reference
|
||||||
// which can be updated
|
// which can be updated
|
||||||
|
int ref_number_again = lua["test"]["number"];
|
||||||
|
c_assert(ref_number_again == 542);
|
||||||
// be careful about referencing local variables,
|
// be careful about referencing local variables,
|
||||||
// if they go out of scope but are still reference
|
// if they go out of scope but are still reference
|
||||||
// you'll suffer dangling reference bugs!
|
// you'll suffer dangling reference bugs!
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user