Can build with (original llvm) clang-cl on windows
This commit is contained in:
parent
ec9117cc06
commit
7d25d8c677
@ -52,8 +52,14 @@ if (SLIC3R_GUI)
|
||||
add_definitions(-DSLIC3R_GUI)
|
||||
endif ()
|
||||
|
||||
if (MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL Clang)
|
||||
set(IS_CLANG_CL TRUE)
|
||||
else ()
|
||||
set(IS_CLANG_CL FALSE)
|
||||
endif ()
|
||||
|
||||
if (MSVC)
|
||||
if (SLIC3R_MSVC_COMPILE_PARALLEL)
|
||||
if (SLIC3R_MSVC_COMPILE_PARALLEL AND NOT IS_CLANG_CL)
|
||||
add_compile_options(/MP)
|
||||
endif ()
|
||||
# /bigobj (Increase Number of Sections in .Obj file)
|
||||
@ -148,7 +154,7 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUXX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fext-numeric-literals" )
|
||||
endif()
|
||||
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
if (NOT MSVC AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang"))
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" )
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reorder" )
|
||||
|
||||
@ -168,7 +174,6 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATC
|
||||
add_compile_options(-Wno-unknown-pragmas)
|
||||
endif()
|
||||
|
||||
|
||||
if (SLIC3R_ASAN)
|
||||
add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
|
||||
|
@ -105,6 +105,9 @@ function(add_precompiled_header _target _input)
|
||||
cmake_parse_arguments(_PCH "FORCEINCLUDE" "SOURCE_CXX;SOURCE_C" "" ${ARGN})
|
||||
|
||||
get_filename_component(_input_we ${_input} NAME_WE)
|
||||
get_filename_component(_input_full ${_input} ABSOLUTE)
|
||||
file(TO_NATIVE_PATH "${_input_full}" _input_fullpath)
|
||||
|
||||
if(NOT _PCH_SOURCE_CXX)
|
||||
set(_PCH_SOURCE_CXX "${_input_we}.cpp")
|
||||
endif()
|
||||
@ -138,16 +141,16 @@ function(add_precompiled_header _target _input)
|
||||
set_source_files_properties("${_source}" PROPERTIES OBJECT_OUTPUTS "${_pch_c_pch}")
|
||||
else()
|
||||
if(_source MATCHES \\.\(cpp|cxx|cc\)$)
|
||||
set(_pch_compile_flags "${_pch_compile_flags} \"/Fp${_pch_cxx_pch}\" \"/Yu${_input}\"")
|
||||
set(_pch_compile_flags "${_pch_compile_flags} \"/Fp${_pch_cxx_pch}\" \"/Yu${_input_fullpath}\"")
|
||||
set(_pch_source_cxx_needed TRUE)
|
||||
set_source_files_properties("${_source}" PROPERTIES OBJECT_DEPENDS "${_pch_cxx_pch}")
|
||||
else()
|
||||
set(_pch_compile_flags "${_pch_compile_flags} \"/Fp${_pch_c_pch}\" \"/Yu${_input}\"")
|
||||
set(_pch_compile_flags "${_pch_compile_flags} \"/Fp${_pch_c_pch}\" \"/Yu${_input_fullpath}\"")
|
||||
set(_pch_source_c_needed TRUE)
|
||||
set_source_files_properties("${_source}" PROPERTIES OBJECT_DEPENDS "${_pch_c_pch}")
|
||||
endif()
|
||||
if(_PCH_FORCEINCLUDE)
|
||||
set(_pch_compile_flags "${_pch_compile_flags} /FI${_input}")
|
||||
set(_pch_compile_flags "${_pch_compile_flags} /FI${_input_fullpath}")
|
||||
endif(_PCH_FORCEINCLUDE)
|
||||
endif()
|
||||
|
||||
|
4
deps/deps-windows.cmake
vendored
4
deps/deps-windows.cmake
vendored
@ -19,6 +19,10 @@ else ()
|
||||
message(FATAL_ERROR "Unsupported MSVC version")
|
||||
endif ()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL Clang)
|
||||
set(DEP_BOOST_TOOLSET "clang-win")
|
||||
endif ()
|
||||
|
||||
if (${DEPS_BITS} EQUAL 32)
|
||||
set(DEP_MSVC_GEN "Visual Studio ${DEP_VS_VER}")
|
||||
set(DEP_PLATFORM "Win32")
|
||||
|
@ -63,10 +63,15 @@ extern "C" {
|
||||
#define STDOUT_FILENO 1
|
||||
#define STDERR_FILENO 2
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <stdint.h>
|
||||
struct timezone;
|
||||
struct timeval;
|
||||
#else
|
||||
#ifndef __cplusplus
|
||||
/* should be in some equivalent to <sys/types.h> */
|
||||
typedef __int8 int8_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
@ -74,6 +79,7 @@ typedef unsigned __int16 uint16_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
int usleep(unsigned usec);
|
||||
|
@ -7,6 +7,10 @@
|
||||
#include "../tools/svgtools.hpp"
|
||||
#include <libnest2d/utils/rotcalipers.hpp>
|
||||
|
||||
#if defined(_MSC_VER) && defined(__clang__)
|
||||
#define BOOST_NO_CXX17_HDR_STRING_VIEW
|
||||
#endif
|
||||
|
||||
#include "boost/multiprecision/integer.hpp"
|
||||
#include "boost/rational.hpp"
|
||||
|
||||
|
@ -12,6 +12,11 @@
|
||||
#include <ClipperUtils.hpp>
|
||||
|
||||
#include <boost/geometry/index/rtree.hpp>
|
||||
|
||||
#if defined(_MSC_VER) && defined(__clang__)
|
||||
#define BOOST_NO_CXX17_HDR_STRING_VIEW
|
||||
#endif
|
||||
|
||||
#include <boost/multiprecision/integer.hpp>
|
||||
#include <boost/rational.hpp>
|
||||
|
||||
|
@ -1,6 +1,11 @@
|
||||
#include "MinAreaBoundingBox.hpp"
|
||||
|
||||
#include <libslic3r/ExPolygon.hpp>
|
||||
|
||||
#if defined(_MSC_VER) && defined(__clang__)
|
||||
#define BOOST_NO_CXX17_HDR_STRING_VIEW
|
||||
#endif
|
||||
|
||||
#include <boost/rational.hpp>
|
||||
|
||||
#include <libslic3r/Int128.hpp>
|
||||
|
@ -62,7 +62,7 @@ template<class F> typename F::FN winapi_get_function(const wchar_t *dll, const c
|
||||
static HINSTANCE dll_handle = LoadLibraryExW(dll, nullptr, 0);
|
||||
|
||||
if (dll_handle == nullptr) { return nullptr; }
|
||||
return (F::FN)GetProcAddress(dll_handle, fn_name);
|
||||
return (typename F::FN)GetProcAddress(dll_handle, fn_name);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user