Merge branch 'vk-bugfixes'

This commit is contained in:
Vojtech Kral 2019-11-01 10:55:45 +01:00
commit b0ce4644b4
5 changed files with 23 additions and 18 deletions

View File

@ -191,6 +191,7 @@ if (NOT MSVC AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMP
add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=address")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lasan")

2
deps/CMakeLists.txt vendored
View File

@ -72,7 +72,7 @@ elseif (APPLE)
message(FATAL_ERROR "Could not determine OS X SDK version. Please use -DCMAKE_OSX_DEPLOYMENT_TARGET=<version>")
endif ()
message("OS X Deployment Target (inferred from default): ${DEP_OSX_TARGET}")
message("OS X Deployment Target (inferred from SDK): ${DEP_OSX_TARGET}")
endif ()
include("deps-macos.cmake")

19
deps/deps-macos.cmake vendored
View File

@ -6,7 +6,7 @@ set(DEP_WERRORS_SDK "-Werror=partial-availability -Werror=unguarded-availability
set(DEP_CMAKE_OPTS
"-DCMAKE_POSITION_INDEPENDENT_CODE=ON"
"-DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}"
"-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
"-DCMAKE_OSX_DEPLOYMENT_TARGET=${DEP_OSX_TARGET}"
"-DCMAKE_CXX_FLAGS=${DEP_WERRORS_SDK}"
"-DCMAKE_C_FLAGS=${DEP_WERRORS_SDK}"
)
@ -14,28 +14,27 @@ set(DEP_CMAKE_OPTS
include("deps-unix-common.cmake")
set(DEP_BOOST_OSX_TARGET "")
if (CMAKE_OSX_DEPLOYMENT_TARGET)
set(DEP_BOOST_OSX_TARGET "-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif ()
ExternalProject_Add(dep_boost
EXCLUDE_FROM_ALL 1
URL "https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz"
URL_HASH SHA256=bd0df411efd9a585e5a2212275f8762079fed8842264954675a4fddc46cfcf60
URL "https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.gz"
URL_HASH SHA256=96b34f7468f26a141f6020efb813f1a2f3dfb9797ecf76a7d7cbd843cc95f5bd
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ./bootstrap.sh
--with-toolset=clang
--with-libraries=system,iostreams,filesystem,thread,log,locale,regex
"--prefix=${DESTDIR}/usr/local"
BUILD_COMMAND ./b2
-j ${NPROC}
--reconfigure
toolset=clang
link=static
variant=release
threading=multi
boost.locale.icu=off
"cflags=-fPIC ${DEP_BOOST_OSX_TARGET}"
"cxxflags=-fPIC ${DEP_BOOST_OSX_TARGET}"
"cflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET}"
"cxxflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET}"
"mflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET}"
"mmflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET}"
install
INSTALL_COMMAND "" # b2 does that already
)

View File

@ -2,7 +2,7 @@
# Building PrusaSlicer on UNIX/Linux
PrusaSlicer uses the CMake build system and requires several dependencies.
The dependencies can be listed in `deps/deps-linux.cmake`, although they don't necessarily need to be as recent
The dependencies can be listed in `deps/deps-linux.cmake` and `deps/deps-unix-common.cmake`, although they don't necessarily need to be as recent
as the versions listed - generally versions available on conservative Linux distros such as Debian stable or CentOS should suffice.
Perl is not required any more.

View File

@ -424,14 +424,19 @@ int copy_file(const std::string &from, const std::string &to)
static const auto perms = boost::filesystem::owner_read | boost::filesystem::owner_write | boost::filesystem::group_read | boost::filesystem::others_read; // aka 644
// Make sure the file has correct permission both before and after we copy over it.
try {
if (boost::filesystem::exists(target))
boost::filesystem::permissions(target, perms);
boost::filesystem::copy_file(source, target, boost::filesystem::copy_option::overwrite_if_exists);
boost::filesystem::permissions(target, perms);
} catch (std::exception & /* ex */) {
// NOTE: error_code variants are used here to supress expception throwing.
// Error code of permission() calls is ignored on purpose - if they fail,
// the copy_file() function will fail appropriately and we don't want the permission()
// calls to cause needless failures on permissionless filesystems (ie. FATs on SD cards etc.)
// or when the target file doesn't exist.
boost::system::error_code ec;
boost::filesystem::permissions(target, perms, ec);
boost::filesystem::copy_file(source, target, boost::filesystem::copy_option::overwrite_if_exists, ec);
if (ec) {
return -1;
}
boost::filesystem::permissions(target, perms, ec);
return 0;
}