support for msvc, third party lib

This commit is contained in:
qiuzhongya 2022-08-25 15:43:02 +08:00
parent 4376f7d93b
commit 9c41875220
4 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,14 @@
set(REQ_URL "https://github.com/tronkko/dirent/archive/refs/tags/1.23.2.zip")
set(MD5 "43514791ab73ef5ac7c490afc7c3bab2")
if(MSVC)
mindspore_add_pkg(dirent
VER 1.23.2
HEAD_ONLY ./include
RELEASE on
URL ${REQ_URL}
MD5 ${MD5}
include_directories(${dirent_INC})
endif()

View File

@ -31,12 +31,14 @@ else()
endif()
set(pybind11_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(pybind11_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(pybind11_patch ${CMAKE_SOURCE_DIR}/third_party/patch/pybind11/pybind11.patch001)
if(PYTHON_VERSION MATCHES "3.9")
mindspore_add_pkg(pybind11
VER 2.6.1
URL ${REQ_URL}
MD5 ${MD5}
PATCHES ${pybind11_patch}
CMAKE_OPTION -DPYBIND11_TEST=OFF -DPYBIND11_LTO_CXX_FLAGS=FALSE
)
elseif(PYTHON_VERSION MATCHES "3.8")

View File

@ -47,6 +47,10 @@ if(ENABLE_CPU)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/mkl_dnn.cmake)
endif()
if(MSVC)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/dirent.cmake)
endif()
if(ENABLE_GPU)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/cub.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/fast_transformers.cmake)

View File

@ -0,0 +1,13 @@
diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h
index 3bffbb28..4a6a9809 100644
--- a/include/pybind11/pybind11.h
+++ b/include/pybind11/pybind11.h
@@ -21,6 +21,7 @@
# pragma warning disable 1875 // offsetof applied to non-POD (Plain Old Data) types is nonstandard
# pragma warning disable 2196 // warning #2196: routine is both "inline" and "noinline"
#elif defined(_MSC_VER)
+#include <corecrt.h>
# pragma warning(push)
# pragma warning(disable: 4100) // warning C4100: Unreferenced formal parameter
# pragma warning(disable: 4127) // warning C4127: Conditional expression is constant