* Fix cmake detection in msys * Fix toolchain file on windows * Make android 64 bit work * Fix libnd4j build script on msys * Update build script for windows/linux * Encoding issue for ci * Update pom.xml * Update pom.xml * Update pom.xml * Remove mingw * Ensure android x86 builds are inline with arm builds * Update toolchains and env variables for x86 * Move profile for build program up to parent * Fix blas vendor and add comment * Update cuda presets version * Set default value and move properties back to child pom * Change program from hard coded to use the script as the program * Update pom.xml * Update pom.xml * Static lib fix * Update static lib output * Get rid of old comments * Update static for buidingmaster
parent
9c77bfa85f
commit
0cf4a45573
|
@ -79,10 +79,11 @@ if(NOT SD_CUDA)
|
|||
if ("${OPENBLAS_PATH}" STREQUAL "")
|
||||
#we don't want OpenBLAS on Apple
|
||||
if (NOT APPLE)
|
||||
# note: this is not a typo
|
||||
set(BLA_VENDOR "OpenBLAS")
|
||||
endif()
|
||||
|
||||
# look around for system blas instead
|
||||
# look around for system blas instead, see: https://cmake.org/cmake/help/latest/module/FindBLAS.html
|
||||
find_package(BLAS REQUIRED)
|
||||
if (BLAS_FOUND)
|
||||
message("Found external BLAS implementation: ${BLAS_LIBRARIES} ")
|
||||
|
@ -91,6 +92,7 @@ if(NOT SD_CUDA)
|
|||
else()
|
||||
# if we have externally provided OPENBLAS_PATH - let's use it
|
||||
set(HAVE_OPENBLAS 1)
|
||||
message("Setting openblas")
|
||||
include_directories(${OPENBLAS_PATH}/include/)
|
||||
link_directories(${OPENBLAS_PATH} ${OPENBLAS_PATH}/lib/)
|
||||
set(OPENBLAS_LIBRARIES openblas)
|
||||
|
|
|
@ -49,7 +49,7 @@ if (SD_IOS_BUILD)
|
|||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSD_IOS_BUILD=true")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
if(WIN32 AND NOT ANDROID)
|
||||
get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,-mbig-obj")
|
||||
|
@ -231,7 +231,11 @@ if(SD_CUDA)
|
|||
${LOOPS_SOURCES} ${ARRAY_SOURCES} ${TYPES_SOURCES}
|
||||
${MEMORY_SOURCES} ${GRAPH_SOURCES} ${CUSTOMOPS_SOURCES} ${INDEXING_SOURCES} ${EXCEPTIONS_SOURCES} ${OPS_SOURCES} ${PERF_SOURCES} ${CUSTOMOPS_CUDNN_SOURCES} ${CUSTOMOPS_MKLDNN_SOURCES})
|
||||
|
||||
# Don't output dynamic linked lib when a static lib build is specified unless the tests are built
|
||||
if(NOT SD_STATIC_LIB OR SD_BUILD_TESTS)
|
||||
add_library(${SD_LIBRARY_NAME} SHARED $<TARGET_OBJECTS:nd4jobj>)
|
||||
endif()
|
||||
|
||||
|
||||
if (WIN32)
|
||||
message("MSVC runtime for library: ${MSVC_RT_LIB}")
|
||||
|
@ -327,8 +331,10 @@ elseif(SD_CPU)
|
|||
add_library(${SD_LIBRARY_NAME}static STATIC $<TARGET_OBJECTS:nd4jobj>)
|
||||
endif()
|
||||
|
||||
if(SD_BUILD_TESTS OR NOT SD_STATIC_LIB)
|
||||
add_library(${SD_LIBRARY_NAME} SHARED $<TARGET_OBJECTS:nd4jobj>)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# we're including {MKLDNN} here in case of building from sources. in future that'll replace {MKLDNN_LIBRARIES}. same applies to BLAS
|
||||
if (NOT BLAS_LIBRARIES)
|
||||
|
|
|
@ -21,6 +21,33 @@ set -eu
|
|||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
cd "$DIR"
|
||||
|
||||
setwindows_msys() {
|
||||
if [[ $KERNEL == *"windows"* ]]; then
|
||||
export CMAKE_COMMAND="$CMAKE_COMMAND -G \"MSYS Makefiles\""
|
||||
fi
|
||||
}
|
||||
|
||||
setandroid_defaults() {
|
||||
if [[ -z ${ANDROID_NDK:-} ]]; then
|
||||
export ANDROID_NDK=$HOME/Android/android-ndk/
|
||||
echo "No ANDROID_NDK variable set. Setting to default of $ANDROID_NDK"
|
||||
else
|
||||
echo "USING ANDROID NDK $ANDROID_NDK"
|
||||
fi
|
||||
|
||||
if [[ -z ${ANDROID_VERSION:-} ]]; then
|
||||
export ANDROID_VERSION=21
|
||||
echo "No ANDROID_VERSION variable set. Setting to default of $ANDROID_VERSION"
|
||||
else
|
||||
echo "USING ANDROID VERSION $ANDROID_VERSION"
|
||||
# android needs static linking
|
||||
|
||||
fi
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
export CMAKE_COMMAND="cmake"
|
||||
if which cmake3 &> /dev/null; then
|
||||
export CMAKE_COMMAND="cmake3"
|
||||
|
@ -57,7 +84,7 @@ VERBOSE_ARG="VERBOSE=1"
|
|||
HELPER=
|
||||
CHECK_VECTORIZATION="OFF"
|
||||
NAME=
|
||||
while [[ $# > 0 ]]
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
key="$1"
|
||||
value="${2:-}"
|
||||
|
@ -141,7 +168,7 @@ case $key in
|
|||
# unknown option
|
||||
;;
|
||||
esac
|
||||
if [[ $# > 0 ]]; then
|
||||
if [[ $# -gt 0 ]]; then
|
||||
shift # past argument or value
|
||||
fi
|
||||
done
|
||||
|
@ -154,6 +181,8 @@ if [ "$(uname)" == "Darwin" ]; then
|
|||
elif [ "$(expr substr $(uname -s) 1 5)" == "MINGW" ] || [ "$(expr substr $(uname -s) 1 4)" == "MSYS" ]; then
|
||||
HOST="windows"
|
||||
KERNEL="windows-x86_64"
|
||||
# need to set build path separator, it ends up being wrong on msys2
|
||||
BUILD_PATH_SEPARATOR=";"
|
||||
echo "Running windows"
|
||||
elif [ "$(uname -m)" == "ppc64le" ]; then
|
||||
if [ -z "$ARCH" ]; then
|
||||
|
@ -166,9 +195,9 @@ if [ -z "$OS" ]; then
|
|||
OS="$HOST"
|
||||
fi
|
||||
|
||||
if [[ -z ${ANDROID_NDK:-} ]]; then
|
||||
export ANDROID_NDK=$HOME/Android/android-ndk/
|
||||
fi
|
||||
|
||||
|
||||
echo "RUNNING BUILD FOR OS $OS"
|
||||
|
||||
case "$OS" in
|
||||
linux-armhf)
|
||||
|
@ -190,44 +219,67 @@ case "$OS" in
|
|||
if [ -z "$ARCH" ]; then
|
||||
ARCH="armv7-a"
|
||||
fi
|
||||
|
||||
setandroid_defaults
|
||||
|
||||
|
||||
export ANDROID_BIN="$ANDROID_NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/$KERNEL/"
|
||||
export ANDROID_CPP="$ANDROID_NDK/sources/cxx-stl/llvm-libc++/"
|
||||
export ANDROID_CC="$ANDROID_NDK/toolchains/llvm/prebuilt/$KERNEL/bin/clang"
|
||||
export ANDROID_ROOT="$ANDROID_NDK/platforms/android-21/arch-arm/"
|
||||
export ANDROID_ROOT="$ANDROID_NDK/platforms/android-$ANDROID_VERSION/arch-arm/"
|
||||
export CMAKE_COMMAND="$CMAKE_COMMAND -DCMAKE_TOOLCHAIN_FILE=cmake/android-arm.cmake -DSD_ANDROID_BUILD=true"
|
||||
setwindows_msys
|
||||
;;
|
||||
|
||||
android-arm64)
|
||||
if [ -z "$ARCH" ]; then
|
||||
ARCH="armv8-a"
|
||||
fi
|
||||
|
||||
setandroid_defaults
|
||||
|
||||
echo "BUILDING ANDROID ARM with KERNEL $KERNEL"
|
||||
export ANDROID_BIN="$ANDROID_NDK/toolchains/aarch64-linux-android-4.9/prebuilt/$KERNEL/"
|
||||
export ANDROID_CPP="$ANDROID_NDK/sources/cxx-stl/llvm-libc++/"
|
||||
export ANDROID_CC="$ANDROID_NDK/toolchains/llvm/prebuilt/$KERNEL/bin/clang"
|
||||
export ANDROID_ROOT="$ANDROID_NDK/platforms/android-21/arch-arm64/"
|
||||
export ANDROID_ROOT="$ANDROID_NDK/platforms/android-$ANDROID_VERSION/arch-arm64/"
|
||||
export CMAKE_COMMAND="$CMAKE_COMMAND -DCMAKE_TOOLCHAIN_FILE=cmake/android-arm64.cmake -DSD_ANDROID_BUILD=true"
|
||||
setwindows_msys
|
||||
;;
|
||||
|
||||
android-x86)
|
||||
if [ -z "$ARCH" ]; then
|
||||
ARCH="i686"
|
||||
fi
|
||||
export ANDROID_BIN="$ANDROID_NDK/toolchains/x86-4.9/prebuilt/$KERNEL/"
|
||||
echo "BUILDING ANDROID x86"
|
||||
|
||||
setandroid_defaults
|
||||
|
||||
|
||||
export ANDROID_BIN="$ANDROID_NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/$KERNEL/"
|
||||
export ANDROID_CPP="$ANDROID_NDK/sources/cxx-stl/llvm-libc++/"
|
||||
export ANDROID_CC="$ANDROID_NDK/toolchains/llvm/prebuilt/$KERNEL/bin/clang"
|
||||
export ANDROID_ROOT="$ANDROID_NDK/platforms/android-21/arch-x86/"
|
||||
export ANDROID_ROOT="$ANDROID_NDK/platforms/android-$ANDROID_VERSION/arch-x86/"
|
||||
export CMAKE_COMMAND="$CMAKE_COMMAND -DCMAKE_TOOLCHAIN_FILE=cmake/android-x86.cmake -DSD_ANDROID_BUILD=true"
|
||||
setwindows_msys
|
||||
;;
|
||||
|
||||
android-x86_64)
|
||||
|
||||
if [ -z "$ARCH" ]; then
|
||||
ARCH="x86-64"
|
||||
fi
|
||||
export ANDROID_BIN="$ANDROID_NDK/toolchains/x86_64-4.9/prebuilt/$KERNEL/"
|
||||
echo "BUILDING ANDROID x86_64"
|
||||
|
||||
setandroid_defaults
|
||||
|
||||
|
||||
export ANDROID_BIN="$ANDROID_NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/$KERNEL/"
|
||||
export ANDROID_CPP="$ANDROID_NDK/sources/cxx-stl/llvm-libc++/"
|
||||
export ANDROID_CC="$ANDROID_NDK/toolchains/llvm/prebuilt/$KERNEL/bin/clang"
|
||||
export ANDROID_ROOT="$ANDROID_NDK/platforms/android-21/arch-x86_64/"
|
||||
export ANDROID_ROOT="$ANDROID_NDK/platforms/android-$ANDROID_VERSION/arch-x86_64/"
|
||||
export CMAKE_COMMAND="$CMAKE_COMMAND -DCMAKE_TOOLCHAIN_FILE=cmake/android-x86_64.cmake -DSD_ANDROID_BUILD=true"
|
||||
setwindows_msys
|
||||
;;
|
||||
|
||||
ios-x86_64)
|
||||
|
@ -312,6 +364,7 @@ case "$OS" in
|
|||
PARALLEL="true"
|
||||
VERBOSE_ARG="-v"
|
||||
else
|
||||
echo "SETTING UP WINDOWS"
|
||||
export CMAKE_COMMAND="cmake -G \"MSYS Makefiles\""
|
||||
export MAKE_COMMAND="make"
|
||||
export CC=/mingw64/bin/gcc
|
||||
|
@ -400,9 +453,9 @@ if [ -z "$NAME" ]; then
|
|||
fi
|
||||
|
||||
if [ "$LIBTYPE" == "dynamic" ]; then
|
||||
SHARED_LIBS_ARG="-DSD_SHARED_LIB=OFF"
|
||||
SHARED_LIBS_ARG="-DSD_SHARED_LIB=ON -DSD_STATIC_LIB=OFF"
|
||||
else
|
||||
SHARED_LIBS_ARG="-DSD_SHARED_LIB=ON"
|
||||
SHARED_LIBS_ARG="-DSD_SHARED_LIB=OFF -DSD_STATIC_LIB=ON"
|
||||
fi
|
||||
|
||||
if [ "$BUILD" == "release" ]; then
|
||||
|
@ -464,11 +517,14 @@ if [ "$CHIP" == "cuda" ] && [ -n "$CHIP_VERSION" ]; then
|
|||
esac
|
||||
fi
|
||||
|
||||
|
||||
[[ -z ${OPENBLAS_PATH:-} ]] && OPENBLAS_PATH=""
|
||||
OPENBLAS_PATH="${OPENBLAS_PATH//\\//}"
|
||||
|
||||
if [[ -n "${BUILD_PATH:-}" ]]; then
|
||||
PREVIFS="$IFS"
|
||||
IFS="$BUILD_PATH_SEPARATOR"
|
||||
echo "BUILD PATH BUILD_PATH_SEPARATOR IS $BUILD_PATH_SEPARATOR"
|
||||
for P in $BUILD_PATH; do
|
||||
if [[ -f "$P/include/openblas_config.h" ]]; then
|
||||
OPENBLAS_PATH="$P"
|
||||
|
@ -485,6 +541,7 @@ fi
|
|||
# replace any backslash with a slash
|
||||
OPENBLAS_PATH="${OPENBLAS_PATH//\\//}"
|
||||
|
||||
|
||||
mkbuilddir() {
|
||||
if [ "$CLEAN" == "true" ]; then
|
||||
echo "Removing blasbuild"
|
||||
|
@ -537,7 +594,7 @@ echo CHECK_VECTORIZATION = "$CHECK_VECTORIZATION"
|
|||
echo HELPERS = "$HELPERS"
|
||||
mkbuilddir
|
||||
pwd
|
||||
eval $CMAKE_COMMAND "$BLAS_ARG" "$ARCH_ARG" "$NAME_ARG" -DSD_CHECK_VECTORIZATION="${CHECK_VECTORIZATION}" $HELPERS "$SHARED_LIBS_ARG" "$MINIFIER_ARG" "$OPERATIONS_ARG" "$BUILD_TYPE" "$PACKAGING_ARG" "$EXPERIMENTAL_ARG" "$TESTS_ARG" "$CUDA_COMPUTE" -DOPENBLAS_PATH="$OPENBLAS_PATH" -DDEV=FALSE -DCMAKE_NEED_RESPONSE=YES -DMKL_MULTI_THREADED=TRUE ../..
|
||||
eval "$CMAKE_COMMAND" "$BLAS_ARG" "$ARCH_ARG" "$NAME_ARG" -DSD_CHECK_VECTORIZATION="${CHECK_VECTORIZATION}" "$HELPERS" "$SHARED_LIBS_ARG" "$MINIFIER_ARG" "$OPERATIONS_ARG" "$BUILD_TYPE" "$PACKAGING_ARG" "$EXPERIMENTAL_ARG" "$TESTS_ARG" "$CUDA_COMPUTE" -DOPENBLAS_PATH="$OPENBLAS_PATH" -DDEV=FALSE -DCMAKE_NEED_RESPONSE=YES -DMKL_MULTI_THREADED=TRUE ../..
|
||||
|
||||
if [ "$PARALLEL" == "true" ]; then
|
||||
MAKE_ARGUMENTS="$MAKE_ARGUMENTS -j $MAKEJ"
|
||||
|
@ -551,9 +608,10 @@ if [ "$CHECK_VECTORIZATION" == "ON" ]; then
|
|||
if [ "$MAKE_COMMAND" == "make" ]; then
|
||||
MAKE_ARGUMENTS="$MAKE_ARGUMENTS --output-sync=target"
|
||||
fi
|
||||
|
||||
exec 3>&1
|
||||
eval $MAKE_COMMAND $MAKE_ARGUMENTS 2>&1 >&3 3>&- | python3 ../../auto_vectorization/auto_vect.py && cd ../../..
|
||||
eval "$MAKE_COMMAND" "$MAKE_ARGUMENTS" 2>&1 >&3 3>&- | python3 ../../auto_vectorization/auto_vect.py && cd ../../..
|
||||
exec 3>&-
|
||||
else
|
||||
eval $MAKE_COMMAND $MAKE_ARGUMENTS && cd ../../..
|
||||
eval "$MAKE_COMMAND" "$MAKE_ARGUMENTS" && cd ../../..
|
||||
fi
|
|
@ -1,27 +1,22 @@
|
|||
# CMake toolchain to build for Android 5.0 or newer. Sample usage:
|
||||
#
|
||||
# ANDROID_BIN="/path/to/android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/" \
|
||||
# ANDROID_CPP="/path/to/android-ndk/sources/cxx-stl/llvm-libc++/" \
|
||||
# ANDROID_CC="/path/to/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang" \
|
||||
# ANDROID_ROOT="/path/to/android-ndk/platforms/android-21/arch-arm/" \
|
||||
# cmake -DCMAKE_TOOLCHAIN_FILE=android-arm.cmake -DCMAKE_INSTALL_PREFIX=..
|
||||
#
|
||||
# If you really need to use libnd4j on a CPU with no FPU, replace "libs/armeabi-v7a" by "libs/armeabi" and
|
||||
# "-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16" with "-march=armv5te -mtune=xscale -msoft-float"
|
||||
set(CMAKE_SYSTEM_NAME Android)
|
||||
set(CMAKE_ANDROID_ARCH_ABI arm64-v8a)
|
||||
set(CMAKE_ANDROID_NDK "$ENV{ANDROID_NDK}")
|
||||
set(CMAKE_ANDROID_STL_TYPE c++_shared)
|
||||
set(CMAKE_SYSTEM_VERSION "$ENV{ANDROID_VERSION}")
|
||||
set(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION clang)
|
||||
|
||||
set(CMAKE_SYSTEM_NAME UnixPaths)
|
||||
set(CMAKE_SYSTEM_PROCESSOR arm)
|
||||
set(ANDROID TRUE)
|
||||
if (WIN32)
|
||||
set(CMAKE_C_COMPILER "$ENV{ANDROID_CC}.exe")
|
||||
set(CMAKE_CXX_COMPILER "$ENV{ANDROID_CC}++.exe")
|
||||
else()
|
||||
set(CMAKE_C_COMPILER "$ENV{ANDROID_CC}")
|
||||
set(CMAKE_CXX_COMPILER "$ENV{ANDROID_CC}++")
|
||||
endif (WIN32)
|
||||
|
||||
set(CMAKE_C_COMPILER "$ENV{ANDROID_CC}")
|
||||
set(CMAKE_CXX_COMPILER "$ENV{ANDROID_CC}++")
|
||||
|
||||
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -target armv7-none-linux-androideabi -Wl,--fix-cortex-a8 -Wl,--no-undefined -z text -o <TARGET> <LINK_LIBRARIES> -gcc-toolchain $ENV{ANDROID_BIN} --sysroot=$ENV{ANDROID_ROOT} -lm -lc")
|
||||
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -target armv7-none-linux-androideabi -Wl,--fix-cortex-a8 -Wl,--no-undefined -z text -o <TARGET> <LINK_LIBRARIES> -gcc-toolchain $ENV{ANDROID_BIN} --sysroot=$ENV{ANDROID_ROOT} -L$ENV{ANDROID_CPP}/libs/armeabi-v7a/ -nostdlib++ -lc++_static -lc++abi -landroid_support -lm -lc")
|
||||
|
||||
set(CMAKE_C_CREATE_SHARED_LIBRARY "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_C_FLAG><TARGET_SONAME> -target armv7-none-linux-androideabi -Wl,--fix-cortex-a8 -Wl,--no-undefined -z text -o <TARGET> <OBJECTS> <LINK_LIBRARIES> -gcc-toolchain $ENV{ANDROID_BIN} --sysroot=$ENV{ANDROID_ROOT} -lm -lc")
|
||||
set(CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME> -target armv7-none-linux-androideabi -Wl,--fix-cortex-a8 -Wl,--no-undefined -z text -o <TARGET> <OBJECTS> <LINK_LIBRARIES> -gcc-toolchain $ENV{ANDROID_BIN} --sysroot=$ENV{ANDROID_ROOT} -L$ENV{ANDROID_CPP}/libs/armeabi-v7a/ -nostdlib++ -lc++_static -lc++abi -landroid_support -lm -lc")
|
||||
add_definitions(-D__ANDROID_API__=$ENV{ANDROID_VERSION} -DANDROID -fPIC -ffunction-sections -funwind-tables -fstack-protector-strong -target aarch64-none-linux-android -march=armv8-a)
|
||||
|
||||
add_definitions(-D__ANDROID_API__=21 -DANDROID -fPIC -ffunction-sections -funwind-tables -fstack-protector-strong -target armv7-none-linux-androideabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16)
|
||||
|
||||
include_directories("$ENV{ANDROID_CPP}/include/" "$ENV{ANDROID_CPP}/../llvm-libc++abi/include/" "$ENV{ANDROID_NDK}/sources/android/support/include/" "$ENV{ANDROID_CPP}/libs/armeabi-v7a/include/" "$ENV{ANDROID_NDK}/sysroot/usr/include/" "$ENV{ANDROID_NDK}/sysroot/usr/include/arm-linux-androideabi/" "$ENV{ANDROID_ROOT}/usr/include/")
|
||||
|
|
|
@ -1,24 +1,22 @@
|
|||
# CMake toolchain to build for Android 5.0 or newer. Sample usage:
|
||||
#
|
||||
# ANDROID_BIN="/path/to/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/" \
|
||||
# ANDROID_CPP="/path/to/android-ndk/sources/cxx-stl/llvm-libc++/" \
|
||||
# ANDROID_CC="/path/to/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang" \
|
||||
# ANDROID_ROOT="/path/to/android-ndk/platforms/android-21/arch-arm64/" \
|
||||
# cmake -DCMAKE_TOOLCHAIN_FILE=android-arm64.cmake -DCMAKE_INSTALL_PREFIX=..
|
||||
set(CMAKE_SYSTEM_NAME Android)
|
||||
set(CMAKE_ANDROID_ARCH_ABI arm64-v8a)
|
||||
set(CMAKE_ANDROID_NDK "$ENV{ANDROID_NDK}")
|
||||
set(CMAKE_ANDROID_STL_TYPE c++_shared)
|
||||
set(CMAKE_SYSTEM_VERSION "$ENV{ANDROID_VERSION}")
|
||||
set(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION clang)
|
||||
|
||||
set(CMAKE_SYSTEM_NAME UnixPaths)
|
||||
set(CMAKE_SYSTEM_PROCESSOR arm64)
|
||||
set(ANDROID TRUE)
|
||||
if (WIN32)
|
||||
set(CMAKE_C_COMPILER "$ENV{ANDROID_CC}.exe")
|
||||
set(CMAKE_CXX_COMPILER "$ENV{ANDROID_CC}++.exe")
|
||||
else()
|
||||
set(CMAKE_C_COMPILER "$ENV{ANDROID_CC}")
|
||||
set(CMAKE_CXX_COMPILER "$ENV{ANDROID_CC}++")
|
||||
endif (WIN32)
|
||||
|
||||
set(CMAKE_C_COMPILER "$ENV{ANDROID_CC}")
|
||||
set(CMAKE_CXX_COMPILER "$ENV{ANDROID_CC}++")
|
||||
|
||||
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -target aarch64-none-linux-android -Wl,--no-undefined -z text -o <TARGET> <LINK_LIBRARIES> -gcc-toolchain $ENV{ANDROID_BIN} --sysroot=$ENV{ANDROID_ROOT} -lm -lc")
|
||||
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -target aarch64-none-linux-android -Wl,--no-undefined -z text -o <TARGET> <LINK_LIBRARIES> -gcc-toolchain $ENV{ANDROID_BIN} --sysroot=$ENV{ANDROID_ROOT} -L$ENV{ANDROID_CPP}/libs/arm64-v8a/ -nostdlib++ -lc++_static -lc++abi -lm -lc")
|
||||
|
||||
set(CMAKE_C_CREATE_SHARED_LIBRARY "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_C_FLAG><TARGET_SONAME> -target aarch64-none-linux-android -Wl,--no-undefined -z text -o <TARGET> <OBJECTS> <LINK_LIBRARIES> -gcc-toolchain $ENV{ANDROID_BIN} --sysroot=$ENV{ANDROID_ROOT} -lm -lc")
|
||||
set(CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME> -target aarch64-none-linux-android -Wl,--no-undefined -z text -o <TARGET> <OBJECTS> <LINK_LIBRARIES> -gcc-toolchain $ENV{ANDROID_BIN} --sysroot=$ENV{ANDROID_ROOT} -L$ENV{ANDROID_CPP}/libs/arm64-v8a/ -nostdlib++ -lc++_static -lc++abi -lm -lc")
|
||||
add_definitions(-D__ANDROID_API__=$ENV{ANDROID_VERSION} -DANDROID -fPIC -ffunction-sections -funwind-tables -fstack-protector-strong -target aarch64-none-linux-android -march=armv8-a)
|
||||
|
||||
add_definitions(-D__ANDROID_API__=21 -DANDROID -fPIC -ffunction-sections -funwind-tables -fstack-protector-strong -target aarch64-none-linux-android -march=armv8-a)
|
||||
|
||||
include_directories("$ENV{ANDROID_CPP}/include/" "$ENV{ANDROID_CPP}/../llvm-libc++abi/include/" "$ENV{ANDROID_NDK}/sources/android/support/include/" "$ENV{ANDROID_CPP}/libs/arm64-v8a/include/" "$ENV{ANDROID_NDK}/sysroot/usr/include/" "$ENV{ANDROID_NDK}/sysroot/usr/include/aarch64-linux-android/" "$ENV{ANDROID_ROOT}/usr/include/")
|
||||
|
|
|
@ -1,24 +1,22 @@
|
|||
# CMake toolchain to build for Android 5.0 or newer. Sample usage:
|
||||
#
|
||||
# ANDROID_BIN="/path/to/android-ndk/toolchains/x86-4.9/prebuilt/linux-x86_64/" \
|
||||
# ANDROID_CPP="/path/to/android-ndk/sources/cxx-stl/llvm-libc++/" \
|
||||
# ANDROID_CC="/path/to/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang" \
|
||||
# ANDROID_ROOT="/path/to/android-ndk/platforms/android-21/arch-x86/" \
|
||||
# cmake -DCMAKE_TOOLCHAIN_FILE=android-x86.cmake -DCMAKE_INSTALL_PREFIX=..
|
||||
set(CMAKE_SYSTEM_NAME Android)
|
||||
set(CMAKE_ANDROID_ARCH_ABI x86)
|
||||
set(CMAKE_ANDROID_NDK "$ENV{ANDROID_NDK}")
|
||||
set(CMAKE_ANDROID_STL_TYPE c++_shared)
|
||||
set(CMAKE_SYSTEM_VERSION "$ENV{ANDROID_VERSION}")
|
||||
set(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION clang)
|
||||
|
||||
set(CMAKE_SYSTEM_NAME UnixPaths)
|
||||
set(CMAKE_SYSTEM_PROCESSOR atom)
|
||||
set(ANDROID TRUE)
|
||||
if (WIN32)
|
||||
set(CMAKE_C_COMPILER "$ENV{ANDROID_CC}.exe")
|
||||
set(CMAKE_CXX_COMPILER "$ENV{ANDROID_CC}++.exe")
|
||||
else()
|
||||
set(CMAKE_C_COMPILER "$ENV{ANDROID_CC}")
|
||||
set(CMAKE_CXX_COMPILER "$ENV{ANDROID_CC}++")
|
||||
endif (WIN32)
|
||||
|
||||
set(CMAKE_C_COMPILER "$ENV{ANDROID_CC}")
|
||||
set(CMAKE_CXX_COMPILER "$ENV{ANDROID_CC}++")
|
||||
|
||||
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -target i686-none-linux-android -Wl,--no-undefined -z text -o <TARGET> <LINK_LIBRARIES> -gcc-toolchain $ENV{ANDROID_BIN} --sysroot=$ENV{ANDROID_ROOT} -lm -lc")
|
||||
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -target i686-none-linux-android -Wl,--no-undefined -z text -o <TARGET> <LINK_LIBRARIES> -gcc-toolchain $ENV{ANDROID_BIN} --sysroot=$ENV{ANDROID_ROOT} -L$ENV{ANDROID_CPP}/libs/x86/ -nostdlib++ -lc++_static -lc++abi -landroid_support -lm -lc")
|
||||
|
||||
set(CMAKE_C_CREATE_SHARED_LIBRARY "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_C_FLAG><TARGET_SONAME> -target i686-none-linux-android -Wl,--no-undefined -z text -o <TARGET> <OBJECTS> <LINK_LIBRARIES> -gcc-toolchain $ENV{ANDROID_BIN} --sysroot=$ENV{ANDROID_ROOT} -lm -lc")
|
||||
set(CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME> -target i686-none-linux-android -Wl,--no-undefined -z text -o <TARGET> <OBJECTS> <LINK_LIBRARIES> -gcc-toolchain $ENV{ANDROID_BIN} --sysroot=$ENV{ANDROID_ROOT} -L$ENV{ANDROID_CPP}/libs/x86/ -nostdlib++ -lc++_static -lc++abi -landroid_support -lm -lc")
|
||||
add_definitions(-D__ANDROID_API__=$ENV{ANDROID_VERSION} -DANDROID -fPIC -ffunction-sections -funwind-tables -fstack-protector-strong -target x86-none-linux-android)
|
||||
|
||||
add_definitions(-D__ANDROID_API__=21 -DANDROID -fPIC -ffunction-sections -funwind-tables -fstack-protector-strong -target i686-none-linux-android -march=i686 -mtune=atom -mssse3 -mfpmath=sse)
|
||||
|
||||
include_directories("$ENV{ANDROID_CPP}/include/" "$ENV{ANDROID_CPP}/../llvm-libc++abi/include/" "$ENV{ANDROID_NDK}/sources/android/support/include/" "$ENV{ANDROID_CPP}/libs/x86/include/" "$ENV{ANDROID_NDK}/sysroot/usr/include/" "$ENV{ANDROID_NDK}/sysroot/usr/include/i686-linux-android/" "$ENV{ANDROID_ROOT}/usr/include/")
|
||||
|
|
|
@ -1,24 +1,21 @@
|
|||
# CMake toolchain to build for Android 5.0 or newer. Sample usage:
|
||||
#
|
||||
# ANDROID_BIN="/path/to/android-ndk/toolchains/x86_64-4.9/prebuilt/linux-x86_64/" \
|
||||
# ANDROID_CPP="/path/to/android-ndk/sources/cxx-stl/llvm-libc++/" \
|
||||
# ANDROID_CC="/path/to/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang" \
|
||||
# ANDROID_ROOT="/path/to/android-ndk/platforms/android-21/arch-x86_64/" \
|
||||
# cmake -DCMAKE_TOOLCHAIN_FILE=android-x86_64.cmake -DCMAKE_INSTALL_PREFIX=..
|
||||
|
||||
set(CMAKE_SYSTEM_NAME UnixPaths)
|
||||
set(CMAKE_SYSTEM_PROCESSOR atom64)
|
||||
set(CMAKE_SYSTEM_NAME Android)
|
||||
set(CMAKE_ANDROID_ARCH_ABI x86_64)
|
||||
set(CMAKE_ANDROID_NDK "$ENV{ANDROID_NDK}")
|
||||
set(CMAKE_ANDROID_STL_TYPE c++_shared)
|
||||
set(CMAKE_SYSTEM_VERSION "$ENV{ANDROID_VERSION}")
|
||||
set(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION clang)
|
||||
|
||||
set(ANDROID TRUE)
|
||||
if (WIN32)
|
||||
set(CMAKE_C_COMPILER "$ENV{ANDROID_CC}.exe")
|
||||
set(CMAKE_CXX_COMPILER "$ENV{ANDROID_CC}++.exe")
|
||||
else()
|
||||
set(CMAKE_C_COMPILER "$ENV{ANDROID_CC}")
|
||||
set(CMAKE_CXX_COMPILER "$ENV{ANDROID_CC}++")
|
||||
endif (WIN32)
|
||||
|
||||
set(CMAKE_C_COMPILER "$ENV{ANDROID_CC}")
|
||||
set(CMAKE_CXX_COMPILER "$ENV{ANDROID_CC}++")
|
||||
|
||||
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -target x86_64-none-linux-android -Wl,--no-undefined -z text -o <TARGET> <LINK_LIBRARIES> -gcc-toolchain $ENV{ANDROID_BIN} --sysroot=$ENV{ANDROID_ROOT} -lm -lc")
|
||||
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -target x86_64-none-linux-android -Wl,--no-undefined -z text -o <TARGET> <LINK_LIBRARIES> -gcc-toolchain $ENV{ANDROID_BIN} --sysroot=$ENV{ANDROID_ROOT} -L$ENV{ANDROID_CPP}/libs/x86_64/ -nostdlib++ -lc++_static -lc++abi -lm -lc")
|
||||
|
||||
set(CMAKE_C_CREATE_SHARED_LIBRARY "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_C_FLAG><TARGET_SONAME> -target x86_64-none-linux-android -Wl,--no-undefined -z text -o <TARGET> <OBJECTS> <LINK_LIBRARIES> -gcc-toolchain $ENV{ANDROID_BIN} --sysroot=$ENV{ANDROID_ROOT} -lm -lc")
|
||||
set(CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME> -target x86_64-none-linux-android -Wl,--no-undefined -z text -o <TARGET> <OBJECTS> <LINK_LIBRARIES> -gcc-toolchain $ENV{ANDROID_BIN} --sysroot=$ENV{ANDROID_ROOT} -L$ENV{ANDROID_CPP}/libs/x86_64/ -nostdlib++ -lc++_static -lc++abi -lm -lc")
|
||||
|
||||
add_definitions(-D__ANDROID_API__=21 -DANDROID -fPIC -ffunction-sections -funwind-tables -fstack-protector-strong -target x86_64-none-linux-android -march=x86-64 -mtune=atom)
|
||||
|
||||
include_directories("$ENV{ANDROID_CPP}/include/" "$ENV{ANDROID_CPP}/../llvm-libc++abi/include/" "$ENV{ANDROID_NDK}/sources/android/support/include/" "$ENV{ANDROID_CPP}/libs/x86_64/include/" "$ENV{ANDROID_NDK}/sysroot/usr/include/" "$ENV{ANDROID_NDK}/sysroot/usr/include/x86_64-linux-android/" "$ENV{ANDROID_ROOT}/usr/include/")
|
||||
add_definitions(-D__ANDROID_API__=$ENV{ANDROID_VERSION} -DANDROID -fPIC -ffunction-sections -funwind-tables -fstack-protector-strong -target x86_64-none-linux-android)
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
<libnd4j.classifier>${libnd4j.platform}</libnd4j.classifier>
|
||||
<libnd4j.buildthreads></libnd4j.buildthreads>
|
||||
<libnd4j.helper></libnd4j.helper>
|
||||
<libnd4j.buildprogram>bash</libnd4j.buildprogram>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
|
@ -150,8 +151,8 @@
|
|||
<configuration>
|
||||
<skip>${libnd4j.cpu.compile.skip}</skip>
|
||||
<buildCommand>
|
||||
<program>bash</program>
|
||||
<argument>${project.basedir}/buildnativeoperations.sh</argument>
|
||||
<program>${libnd4j.buildprogram}</program>
|
||||
<argument>buildnativeoperations.sh</argument>
|
||||
<argument>--build-type</argument>
|
||||
<argument>${libnd4j.build}</argument>
|
||||
<argument>--chip</argument>
|
||||
|
@ -183,7 +184,7 @@
|
|||
<skip>${libnd4j.test.skip}</skip>
|
||||
<workingDirectory>${basedir}/tests_cpu</workingDirectory>
|
||||
<buildCommand>
|
||||
<program>bash</program>
|
||||
<program>sh</program>
|
||||
<argument>run_tests.sh</argument>
|
||||
<argument>--chip</argument>
|
||||
<argument>${libnd4j.chip}</argument>
|
||||
|
@ -233,9 +234,35 @@
|
|||
</build>
|
||||
|
||||
<profiles>
|
||||
|
||||
<!-- Build on windows can use sh rather than bash due to WSL clashing with msys2 -->
|
||||
<profile>
|
||||
<id>build-windows</id>
|
||||
<activation>
|
||||
<os>
|
||||
<family>Windows</family>
|
||||
</os>
|
||||
</activation>
|
||||
<properties>
|
||||
<libnd4j.buildprogram>sh</libnd4j.buildprogram>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
<!-- Default build program should be bash on non windows platforms -->
|
||||
<profile>
|
||||
<id>build-unix</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<libnd4j.buildprogram>bash</libnd4j.buildprogram>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
|
||||
<!-- Use -Dlibnd4j.singlethread to use single threaded build (multi-threaded by default) -->
|
||||
<profile>
|
||||
<id>libnd4-single-thread</id>
|
||||
<id>libnd4j-single-thread</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>libnd4j.singlethread</name>
|
||||
|
@ -310,8 +337,8 @@
|
|||
<configuration>
|
||||
<skip>${libnd4j.cuda.compile.skip}</skip>
|
||||
<buildCommand>
|
||||
<program>bash</program>
|
||||
<argument>${project.basedir}/buildnativeoperations.sh
|
||||
<program>${libnd4j.buildprogram}</program>
|
||||
<argument>buildnativeoperations.sh
|
||||
</argument>
|
||||
<argument>--build-type</argument>
|
||||
<argument>${libnd4j.build}</argument>
|
||||
|
@ -389,6 +416,9 @@
|
|||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
|
||||
|
||||
|
||||
<!-- Profiles to set the default libnd4j.helper property, example: mkdnn -->
|
||||
<profile>
|
||||
<id>libnd4j-helper-avx2</id>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
mvn clean install -Djavacpp.platform=android-arm64 -Dmaven.test.skip=true -Djavacpp.platform.compiler=$ANDROID_NDK/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++
|
|
@ -30,11 +30,6 @@
|
|||
|
||||
|
||||
<dependencies>
|
||||
<!--dependency>
|
||||
<groupId>org.nd4j</groupId>
|
||||
<artifactId>nd4j-buffer</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency-->
|
||||
<dependency>
|
||||
<groupId>org.nd4j</groupId>
|
||||
<artifactId>nd4j-api</artifactId>
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<!-- CUDA version is linked with the artifact name so cannot move to parent pom.xml -->
|
||||
<cuda.version>10.2</cuda.version>
|
||||
<cudnn.version>7.6</cudnn.version>
|
||||
<javacpp-presets.cuda.version>1.5.2</javacpp-presets.cuda.version>
|
||||
<javacpp-presets.cuda.version>${javacpp-presets.version}</javacpp-presets.cuda.version>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -51,16 +51,6 @@
|
|||
<classifier>${dependency.platform}</classifier>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.nd4j</groupId>
|
||||
<artifactId>libnd4j</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
<classifier>${javacpp.platform}${javacpp.platform.extension}</classifier>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>org.nd4j</groupId>
|
||||
<artifactId>nd4j-native-api</artifactId>
|
||||
|
@ -165,8 +155,8 @@
|
|||
<linkResources>
|
||||
<linkResource>/${javacpp.platform.library.path}/</linkResource>
|
||||
<linkResource>/${javacpp.platform.library.path}/lib/</linkResource>
|
||||
<linkResource>/org/bytedeco/openblas/${javacpp.platform}/</linkResource>
|
||||
<linkResource>/org/bytedeco/openblas/${javacpp.platform}/lib/</linkResource>
|
||||
<!-- <linkResource>/org/bytedeco/openblas/${javacpp.platform}/</linkResource>
|
||||
<linkResource>/org/bytedeco/openblas/${javacpp.platform}/lib/</linkResource>-->
|
||||
</linkResources>
|
||||
</configuration>
|
||||
<executions>
|
||||
|
@ -297,23 +287,6 @@
|
|||
<javacpp.platform.extension>-avx512</javacpp.platform.extension>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>mingw</id>
|
||||
<activation>
|
||||
<os><family>windows</family></os>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.bytedeco</groupId>
|
||||
<artifactId>javacpp</artifactId>
|
||||
<configuration>
|
||||
<properties>${javacpp.platform}-mingw</properties>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>libnd4j-assembly</id>
|
||||
|
|
|
@ -56,9 +56,7 @@
|
|||
|
||||
|
||||
<build>
|
||||
<!--
|
||||
<testSourceDirectory>../nd4j-tests/src/test/java</testSourceDirectory>
|
||||
-->
|
||||
|
||||
<plugins>
|
||||
<!-- Skip execution of Javadoc since some versions run out of memory -->
|
||||
<plugin>
|
||||
|
|
Loading…
Reference in New Issue