This commit is contained in:
gongdaguo 2021-11-18 16:28:42 +08:00
parent 50f4f96c77
commit a7461c2156
4 changed files with 58 additions and 1 deletions

View File

@ -8,7 +8,7 @@ if(BUILD_LITE)
set(glog_CFLAGS "-D_FORTIFY_SOURCE=2 -O2 ${SECURE_C_FLAGS}")
set(glog_LDFLAGS "${SECURE_SHARED_LINKER_FLAGS}")
endif()
set(glog_patch "")
set(glog_patch ${CMAKE_SOURCE_DIR}/../../third_party/patch/glog/glog_lite.patch001)
set(glog_lib glog)
else()
set(glog_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2 ${SECURE_CXX_FLAGS} -Dgoogle=mindspore_private")

View File

@ -3,6 +3,7 @@ project(Lite)
set(BUILD_LITE "on")
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/check_requirements_lite.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/secure_option.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/compile_link_option.cmake)

View File

@ -0,0 +1,13 @@
## packages used both on windows and linux
if(DEFINED ENV{MS_PATCH_PATH})
find_program(Patch_EXECUTABLE patch PATHS $ENV{MS_PATCH_PATH})
set(Patch_FOUND ${Patch_EXECUTABLE})
else()
find_package(Patch)
endif()
if(NOT Patch_FOUND)
message(FATAL_ERROR "Patch not found, "
"please set environment variable MS_PATCH_PATH to path where Patch is located, "
"usually found in GIT_PATH/usr/bin on Windows")
endif()
message(PATCH_EXECUTABLE = ${Patch_EXECUTABLE})

View File

@ -0,0 +1,43 @@
diff -Npur glog/CMakeLists.txt glog-patch/CMakeLists.txt
--- glog/CMakeLists.txt 2019-03-22 10:51:46.000000000 +0800
+++ glog-patch/CMakeLists.txt 2021-04-01 10:32:25.753140500 +0800
@@ -64,7 +64,6 @@ check_include_file (dlfcn.h HAVE_DLFCN_H
check_include_file (execinfo.h HAVE_EXECINFO_H)
check_include_file (glob.h HAVE_GLOB_H)
check_include_file (inttypes.h HAVE_INTTYPES_H)
-check_include_file (libunwind.h HAVE_LIBUNWIND_H)
check_include_file (memory.h HAVE_MEMORY_H)
check_include_file (pwd.h HAVE_PWD_H)
check_include_file (stdint.h HAVE_STDINT_H)
@@ -80,7 +79,6 @@ check_include_file (syscall.h HAVE_SYSCA
check_include_file (syslog.h HAVE_SYSLOG_H)
check_include_file (ucontext.h HAVE_UCONTEXT_H)
check_include_file (unistd.h HAVE_UNISTD_H)
-check_include_file (unwind.h HAVE_UNWIND_H)
check_include_file (pwd.h HAVE_PWD_H)
check_include_file_cxx ("ext/hash_map" HAVE_EXT_HASH_MAP)
@@ -116,12 +114,8 @@ check_cxx_compiler_flag (-Wunnamed-type-
# snprintf as an inline function
check_symbol_exists (snprintf stdio.h HAVE_SNPRINTF)
-check_library_exists (unwind get_static_proc_name "" HAVE_LIB_UNWIND)
check_library_exists (dbghelp UnDecorateSymbolName "" HAVE_DBGHELP)
-find_library (UNWIND_LIBRARY NAMES unwind DOC "unwind library")
-mark_as_advanced (UNWIND_LIBRARY)
-
check_c_source_compiles ("
#include <stdlib.h>
static void foo(void) __attribute__ ((unused));
@@ -470,10 +464,6 @@ add_library (glog
add_library(glog::glog ALIAS glog)
set_target_properties (glog PROPERTIES POSITION_INDEPENDENT_CODE ON)
-
-if (UNWIND_LIBRARY)
- target_link_libraries (glog PUBLIC ${UNWIND_LIBRARY})
-endif (UNWIND_LIBRARY)
if (HAVE_DBGHELP)
target_link_libraries (glog PUBLIC dbghelp)