exclude memory tracker for android/ios/macos platforms (#8005)
Signed-off-by: raver119 <raver119@gmail.com>master
parent
0c48e55f91
commit
85e212fece
|
@ -29,6 +29,21 @@ if(APPLE)
|
|||
link_directories(/lib)
|
||||
endif()
|
||||
|
||||
if (APPLE_BUILD)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DAPPLE_BUILD=true")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DAPPLE_BUILD=true")
|
||||
endif()
|
||||
|
||||
if (ANDROID_BUILD)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DANDROID_BUILD=true")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DANDROID_BUILD=true")
|
||||
endif()
|
||||
|
||||
if (IOS_BUILD)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DIOS_BUILD=true")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DIOS_BUILD=true")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
|
|
|
@ -183,7 +183,7 @@ case "$OS" in
|
|||
export ANDROID_CPP="$ANDROID_NDK/sources/cxx-stl/llvm-libc++/"
|
||||
export ANDROID_LLVM="$ANDROID_NDK/toolchains/llvm/prebuilt/$KERNEL/"
|
||||
export ANDROID_ROOT="$ANDROID_NDK/platforms/android-14/arch-arm/"
|
||||
export CMAKE_COMMAND="$CMAKE_COMMAND -DCMAKE_TOOLCHAIN_FILE=cmake/android-arm.cmake"
|
||||
export CMAKE_COMMAND="$CMAKE_COMMAND -DCMAKE_TOOLCHAIN_FILE=cmake/android-arm.cmake -DANDROID_BUILD=true"
|
||||
;;
|
||||
|
||||
android-arm64)
|
||||
|
@ -194,7 +194,7 @@ case "$OS" in
|
|||
export ANDROID_CPP="$ANDROID_NDK/sources/cxx-stl/llvm-libc++/"
|
||||
export ANDROID_LLVM="$ANDROID_NDK/toolchains/llvm/prebuilt/$KERNEL/"
|
||||
export ANDROID_ROOT="$ANDROID_NDK/platforms/android-21/arch-arm64/"
|
||||
export CMAKE_COMMAND="$CMAKE_COMMAND -DCMAKE_TOOLCHAIN_FILE=cmake/android-arm64.cmake"
|
||||
export CMAKE_COMMAND="$CMAKE_COMMAND -DCMAKE_TOOLCHAIN_FILE=cmake/android-arm64.cmake -DANDROID_BUILD=true"
|
||||
;;
|
||||
|
||||
android-x86)
|
||||
|
@ -205,7 +205,7 @@ case "$OS" in
|
|||
export ANDROID_CPP="$ANDROID_NDK/sources/cxx-stl/llvm-libc++/"
|
||||
export ANDROID_LLVM="$ANDROID_NDK/toolchains/llvm/prebuilt/$KERNEL/"
|
||||
export ANDROID_ROOT="$ANDROID_NDK/platforms/android-14/arch-x86/"
|
||||
export CMAKE_COMMAND="$CMAKE_COMMAND -DCMAKE_TOOLCHAIN_FILE=cmake/android-x86.cmake"
|
||||
export CMAKE_COMMAND="$CMAKE_COMMAND -DCMAKE_TOOLCHAIN_FILE=cmake/android-x86.cmake -DANDROID_BUILD=true"
|
||||
;;
|
||||
|
||||
android-x86_64)
|
||||
|
@ -216,7 +216,7 @@ case "$OS" in
|
|||
export ANDROID_CPP="$ANDROID_NDK/sources/cxx-stl/llvm-libc++/"
|
||||
export ANDROID_LLVM="$ANDROID_NDK/toolchains/llvm/prebuilt/$KERNEL/"
|
||||
export ANDROID_ROOT="$ANDROID_NDK/platforms/android-21/arch-x86_64/"
|
||||
export CMAKE_COMMAND="$CMAKE_COMMAND -DCMAKE_TOOLCHAIN_FILE=cmake/android-x86_64.cmake"
|
||||
export CMAKE_COMMAND="$CMAKE_COMMAND -DCMAKE_TOOLCHAIN_FILE=cmake/android-x86_64.cmake -DANDROID_BUILD=true"
|
||||
;;
|
||||
|
||||
ios-x86_64)
|
||||
|
@ -229,7 +229,7 @@ case "$OS" in
|
|||
fi
|
||||
XCODE_PATH="$(xcode-select --print-path)"
|
||||
export IOS_SDK="$XCODE_PATH/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator$IOS_VERSION.sdk"
|
||||
export CMAKE_COMMAND="$CMAKE_COMMAND -DCMAKE_TOOLCHAIN_FILE=cmake/ios-x86_64.cmake --debug-trycompile"
|
||||
export CMAKE_COMMAND="$CMAKE_COMMAND -DCMAKE_TOOLCHAIN_FILE=cmake/ios-x86_64.cmake --debug-trycompile -DIOS_BUILD=true"
|
||||
;;
|
||||
|
||||
ios-x86)
|
||||
|
@ -242,7 +242,7 @@ case "$OS" in
|
|||
fi
|
||||
XCODE_PATH="$(xcode-select --print-path)"
|
||||
export IOS_SDK="$XCODE_PATH/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator$IOS_VERSION.sdk"
|
||||
export CMAKE_COMMAND="$CMAKE_COMMAND -DCMAKE_TOOLCHAIN_FILE=cmake/ios-x86.cmake --debug-trycompile"
|
||||
export CMAKE_COMMAND="$CMAKE_COMMAND -DCMAKE_TOOLCHAIN_FILE=cmake/ios-x86.cmake --debug-trycompile -DIOS_BUILD=true"
|
||||
;;
|
||||
|
||||
ios-arm64)
|
||||
|
@ -255,7 +255,7 @@ case "$OS" in
|
|||
fi
|
||||
XCODE_PATH="$(xcode-select --print-path)"
|
||||
export IOS_SDK="$XCODE_PATH/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS$IOS_VERSION.sdk"
|
||||
export CMAKE_COMMAND="$CMAKE_COMMAND -DCMAKE_TOOLCHAIN_FILE=cmake/ios-arm64.cmake --debug-trycompile"
|
||||
export CMAKE_COMMAND="$CMAKE_COMMAND -DCMAKE_TOOLCHAIN_FILE=cmake/ios-arm64.cmake --debug-trycompile -DIOS_BUILD=true"
|
||||
;;
|
||||
|
||||
ios-arm)
|
||||
|
@ -268,7 +268,7 @@ case "$OS" in
|
|||
fi
|
||||
XCODE_PATH="$(xcode-select --print-path)"
|
||||
export IOS_SDK="$XCODE_PATH/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS$IOS_VERSION.sdk"
|
||||
export CMAKE_COMMAND="$CMAKE_COMMAND -DCMAKE_TOOLCHAIN_FILE=cmake/ios-arm.cmake --debug-trycompile"
|
||||
export CMAKE_COMMAND="$CMAKE_COMMAND -DCMAKE_TOOLCHAIN_FILE=cmake/ios-arm.cmake --debug-trycompile -DIOS_BUILD=true"
|
||||
;;
|
||||
|
||||
ios-armv7)
|
||||
|
@ -278,7 +278,7 @@ case "$OS" in
|
|||
LIBTYPE="static"
|
||||
ARCH="armv7"
|
||||
export IOS_SDK="/Applications/Xcode.app/Contents/Developer/Platforms/${iPhoneOS}.platform/Developer/SDKs/${iPhoneOS}${IOS_VERSION}.sdk"
|
||||
export CMAKE_COMMAND="$CMAKE_COMMAND -DCMAKE_TOOLCHAIN_FILE=cmake/ios-armv7.cmake --debug-trycompile"
|
||||
export CMAKE_COMMAND="$CMAKE_COMMAND -DCMAKE_TOOLCHAIN_FILE=cmake/ios-armv7.cmake --debug-trycompile -DIOS_BUILD=true"
|
||||
;;
|
||||
|
||||
linux*)
|
||||
|
@ -295,7 +295,7 @@ case "$OS" in
|
|||
export CXX="$(ls -1 /usr/local/bin/g++-? | head -n 1)"
|
||||
PARALLEL="true"
|
||||
fi
|
||||
export CMAKE_COMMAND="$CMAKE_COMMAND -DCMAKE_MACOSX_RPATH=ON"
|
||||
export CMAKE_COMMAND="$CMAKE_COMMAND -DCMAKE_MACOSX_RPATH=ON -DAPPLE_BUILD=true"
|
||||
;;
|
||||
|
||||
windows*)
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(__GNUC__) && !defined(__MINGW64__)
|
||||
#if defined(__GNUC__) && !defined(__MINGW64__) && !defined(ANDROID_BUILD) && !defined(IOS_BUILD) && !defined(APPLE_BUILD)
|
||||
|
||||
#include <unistd.h>
|
||||
#include <execinfo.h>
|
||||
|
@ -47,7 +47,7 @@ namespace nd4j {
|
|||
return _INSTANCE;
|
||||
}
|
||||
|
||||
#if defined(__GNUC__) && !defined(__MINGW64__)
|
||||
#if defined(__GNUC__) && !defined(__MINGW64__) && !defined(ANDROID_BUILD) && !defined(IOS_BUILD) && !defined(APPLE_BUILD)
|
||||
std::string demangle(char *message) {
|
||||
char *mangled_name = 0, *offset_begin = 0, *offset_end = 0;
|
||||
|
||||
|
@ -95,7 +95,7 @@ namespace nd4j {
|
|||
#endif
|
||||
|
||||
void MemoryTracker::countIn(MemoryType type, Nd4jPointer ptr, Nd4jLong numBytes) {
|
||||
#if defined(__GNUC__) && !defined(__MINGW64__)
|
||||
#if defined(__GNUC__) && !defined(__MINGW64__) && !defined(ANDROID_BUILD) && !defined(IOS_BUILD) && !defined(APPLE_BUILD)
|
||||
if (Environment::getInstance()->isDetectingLeaks()) {
|
||||
auto lptr = reinterpret_cast<Nd4jLong>(ptr);
|
||||
|
||||
|
@ -129,7 +129,7 @@ namespace nd4j {
|
|||
}
|
||||
|
||||
void MemoryTracker::countOut(Nd4jPointer ptr) {
|
||||
#if defined(__GNUC__) && !defined(__MINGW64__)
|
||||
#if defined(__GNUC__) && !defined(__MINGW64__) && !defined(ANDROID_BUILD) && !defined(IOS_BUILD) && !defined(APPLE_BUILD)
|
||||
if (Environment::getInstance()->isDetectingLeaks()) {
|
||||
auto lptr = reinterpret_cast<Nd4jLong>(ptr);
|
||||
|
||||
|
|
Loading…
Reference in New Issue