1if(BUILD_LITE) 2 if(MSVC) 3 set(flatbuffers_CXXFLAGS "${CMAKE_CXX_FLAGS}") 4 set(flatbuffers_CFLAGS "${CMAKE_C_FLAGS}") 5 set(flatbuffers_LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}") 6 else() 7 set(glog_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2 ${SECURE_CXX_FLAGS} -Dgoogle=mindspore_private") 8 set(glog_CFLAGS "-D_FORTIFY_SOURCE=2 -O2 ${SECURE_C_FLAGS}") 9 set(glog_LDFLAGS "${SECURE_SHARED_LINKER_FLAGS}") 10 endif() 11 set(glog_patch "") 12 set(glog_lib glog) 13else() 14 set(glog_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2 ${SECURE_CXX_FLAGS} -Dgoogle=mindspore_private") 15 set(glog_CFLAGS "-D_FORTIFY_SOURCE=2 -O2") 16 set(glog_patch ${CMAKE_SOURCE_DIR}/third_party/patch/glog/glog.patch001) 17 set(glog_lib mindspore_glog) 18endif() 19 20if(NOT ENABLE_GLIBCXX) 21 set(glog_CXXFLAGS "${glog_CXXFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0") 22endif() 23 24if(ENABLE_GITEE) 25 set(REQ_URL "https://gitee.com/mirrors/glog/repository/archive/v0.4.0.tar.gz") 26 set(MD5 "1e63d5e35a607bade6380a61ae61bceb") 27else() 28 set(REQ_URL "https://github.com/google/glog/archive/v0.4.0.tar.gz") 29 set(MD5 "0daea8785e6df922d7887755c3d100d0") 30endif() 31 32set(glog_option -DBUILD_TESTING=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=ON -DWITH_GFLAGS=OFF 33 -DCMAKE_BUILD_TYPE=Release) 34 35if(WIN32 AND NOT MSVC) 36 execute_process(COMMAND "${CMAKE_C_COMPILER}" -dumpmachine 37 OUTPUT_VARIABLE i686_or_x86_64 38 ) 39 if(i686_or_x86_64 MATCHES "^i686-") 40 set(glog_option ${glog_option} -DHAVE_DBGHELP=ON) 41 endif() 42endif() 43 44mindspore_add_pkg(glog 45 VER 0.4.0 46 LIBS ${glog_lib} 47 URL ${REQ_URL} 48 MD5 ${MD5} 49 PATCHES ${glog_patch} 50 CMAKE_OPTION ${glog_option}) 51include_directories(${glog_INC}) 52add_library(mindspore::glog ALIAS glog::${glog_lib}) 53