提交 30561d72 编写于 作者: M Megvii Engine Team

fix(windows): fix dll install on windows

GitOrigin-RevId: 49029071c864460d5d5340e2c7689061c2043ad4
上级 d9c4ef59
......@@ -99,26 +99,32 @@ endif()
# MegEngine/megbrain ROOT_DIR/CMakeLists.txt, just depends lite_static or lite_shared
# TODO: need refine lite_static_all_in_one depend objects, but now cmake do not support
# define a add_library which OBJECTS args is a set or list or string
if(MGE_ENABLE_CPUINFO AND MGE_WITH_OPENCL)
add_library(
lite_static_all_in_one STATIC
$<TARGET_OBJECTS:flatbuffers> $<TARGET_OBJECTS:cpuinfo> $<TARGET_OBJECTS:clog>
$<TARGET_OBJECTS:OpenCL> $<TARGET_OBJECTS:lite_static>)
elseif(MGE_ENABLE_CPUINFO AND NOT MGE_WITH_OPENCL)
add_library(
lite_static_all_in_one STATIC
$<TARGET_OBJECTS:flatbuffers> $<TARGET_OBJECTS:cpuinfo> $<TARGET_OBJECTS:clog>
$<TARGET_OBJECTS:lite_static>)
elseif(NOT MGE_ENABLE_CPUINFO AND MGE_WITH_OPENCL)
add_library(
lite_static_all_in_one STATIC
$<TARGET_OBJECTS:flatbuffers> $<TARGET_OBJECTS:OpenCL>
$<TARGET_OBJECTS:lite_static>)
if(NOT WIN32)
if(MGE_ENABLE_CPUINFO AND MGE_WITH_OPENCL)
add_library(
lite_static_all_in_one STATIC
$<TARGET_OBJECTS:flatbuffers> $<TARGET_OBJECTS:cpuinfo> $<TARGET_OBJECTS:clog>
$<TARGET_OBJECTS:OpenCL> $<TARGET_OBJECTS:lite_static>)
elseif(MGE_ENABLE_CPUINFO AND NOT MGE_WITH_OPENCL)
add_library(
lite_static_all_in_one STATIC
$<TARGET_OBJECTS:flatbuffers> $<TARGET_OBJECTS:cpuinfo> $<TARGET_OBJECTS:clog>
$<TARGET_OBJECTS:lite_static>)
elseif(NOT MGE_ENABLE_CPUINFO AND MGE_WITH_OPENCL)
add_library(
lite_static_all_in_one STATIC
$<TARGET_OBJECTS:flatbuffers> $<TARGET_OBJECTS:OpenCL>
$<TARGET_OBJECTS:lite_static>)
else()
add_library(lite_static_all_in_one STATIC $<TARGET_OBJECTS:flatbuffers>
$<TARGET_OBJECTS:lite_static>)
endif()
else()
add_library(lite_static_all_in_one STATIC $<TARGET_OBJECTS:flatbuffers>
$<TARGET_OBJECTS:lite_static>)
message(
WARNING "do not support lite_static_all_in_one on Windows, please use lite_shared")
endif()
if(LITE_BUILD_WITH_MGE)
if(LITE_BUILD_WITH_MGE AND NOT WIN32)
target_link_libraries(lite_static_all_in_one PRIVATE megbrain megdnn ${MGE_CUDA_LIBS})
endif()
......@@ -157,15 +163,19 @@ install(
install(
TARGETS lite_shared
RUNTIME DESTINATION lite/lib/${MGE_ARCH}
LIBRARY DESTINATION lite/lib/${MGE_ARCH}
FRAMEWORK DESTINATION lite/lib/${MGE_ARCH}
ARCHIVE DESTINATION lite/lib/${MGE_ARCH})
install(
TARGETS lite_static_all_in_one
LIBRARY DESTINATION lite/lib/${MGE_ARCH}
FRAMEWORK DESTINATION lite/lib/${MGE_ARCH}
ARCHIVE DESTINATION lite/lib/${MGE_ARCH})
if(NOT WIN32)
install(
TARGETS lite_static_all_in_one
LIBRARY DESTINATION lite/lib/${MGE_ARCH}
FRAMEWORK DESTINATION lite/lib/${MGE_ARCH}
ARCHIVE DESTINATION lite/lib/${MGE_ARCH})
endif()
install(FILES ${PROJECT_SOURCE_DIR}/lite/include/lite/common_enum_c.h
DESTINATION ${CMAKE_INSTALL_PREFIX}/lite/include/lite-c)
......
......@@ -109,7 +109,7 @@ std::shared_ptr<Tensor> lite::example::parse_npy(
}
void lite::example::set_cpu_affinity(const std::vector<int>& cpuset) {
#if defined(__APPLE__) || defined(WIN32)
#if defined(__APPLE__) || defined(WIN32) || defined(_WIN32)
#pragma message("set_cpu_affinity not enabled on apple and windows platform")
#else
cpu_set_t mask;
......
......@@ -19,7 +19,7 @@ class CheckAllocator : public lite::Allocator {
public:
//! allocate memory of size in the given device with the given align
void* allocate(LiteDeviceType, int, size_t size, size_t align) override {
#ifdef WIN32
#if defined(WIN32) || defined(_WIN32)
return _aligned_malloc(size, align);
#elif defined(__ANDROID__) || defined(ANDROID)
return memalign(align, size);
......@@ -35,7 +35,7 @@ public:
//! free the memory pointed by ptr in the given device
void free(LiteDeviceType, int, void* ptr) override {
#ifdef WIN32
#if defined(WIN32) || defined(_WIN32)
_aligned_free(ptr);
#else
::free(ptr);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册