[samples] Allow using KONAN_DATA_DIR in samples
This commit is contained in:
@@ -22,6 +22,7 @@ repositories {
|
||||
|
||||
konanArtifacts {
|
||||
program('Curl') {
|
||||
dependsOn ':libcurl:publish'
|
||||
dependencies {
|
||||
artifactCurl 'org.jetbrains.kotlin.native:libcurl:1.0'
|
||||
}
|
||||
|
||||
+1
-1
@@ -6,5 +6,5 @@ else
|
||||
PATH="$KONAN_HOME/bin:$PATH"
|
||||
fi
|
||||
|
||||
KONAN_USER_DIR="$HOME/.konan"
|
||||
KONAN_USER_DIR=${KONAN_DATA_DIR:-"$HOME/.konan"}
|
||||
KONAN_DEPS="$KONAN_USER_DIR/dependencies"
|
||||
|
||||
@@ -13,7 +13,8 @@ showing how a TensorFlow client in Kotlin/Native could look like.
|
||||
./downloadTensorflow.sh
|
||||
|
||||
will install [TensorFlow for C](https://www.tensorflow.org/versions/r1.1/install/install_c) into
|
||||
`$HOME/.konan/third-party/tensorflow` (if not yet done).
|
||||
`$HOME/.konan/third-party/tensorflow` (if not yet done). One may override the location of
|
||||
`third-party/tensorflow` by setting the `KONAN_DATA_DIR` environment variable.
|
||||
|
||||
To build use `../gradlew build` or `./build.sh`.
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@ apply plugin: 'konan'
|
||||
|
||||
konan.targets = ['macbook', 'linux']
|
||||
|
||||
def tensorflowHome = "${System.getProperty("user.home")}/.konan/third-party/tensorflow"
|
||||
def konanUserDir = System.getenv("KONAN_DATA_DIR") ?: "${System.getProperty("user.home")}/.konan"
|
||||
def tensorflowHome = "$konanUserDir/third-party/tensorflow"
|
||||
|
||||
task downloadTensorflow(type: Exec) {
|
||||
workingDir getProjectDir()
|
||||
|
||||
@@ -6,7 +6,8 @@ source "$DIR/../konan.sh"
|
||||
|
||||
$DIR/downloadTensorflow.sh
|
||||
|
||||
TF_TARGET_DIRECTORY="$HOME/.konan/third-party/tensorflow"
|
||||
# KONAN_USER_DIR is set by konan.sh
|
||||
TF_TARGET_DIRECTORY="$KONAN_USER_DIR/third-party/tensorflow"
|
||||
TF_TYPE="cpu" # Change to "gpu" for GPU support
|
||||
|
||||
if [ x$TARGET == x ]; then
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
TF_TARGET_DIRECTORY="$HOME/.konan/third-party/tensorflow"
|
||||
KONAN_USER_DIR=${KONAN_DATA_DIR:-"$HOME/.konan"}
|
||||
TF_TARGET_DIRECTORY="$KONAN_USER_DIR/third-party/tensorflow"
|
||||
TF_TYPE="cpu" # Change to "gpu" for GPU support
|
||||
|
||||
if [ x$TARGET == x ]; then
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
@echo off
|
||||
setlocal
|
||||
set DIR=.
|
||||
set "PATH=..\..\dist\bin;..\..\bin;%HOME%\.konan\dependencies\msys2-mingw-w64-x86_64-gcc-7.2.0-clang-llvm-5.0.0-windows-x86-64\bin;%PATH%"
|
||||
if "%KONAN_DATA_DIR%"=="" (set KONAN_DATA_DIR="%HOME%\.konan")
|
||||
set "PATH=..\..\dist\bin;..\..\bin;%KONAN_DATA_DIR%\dependencies\msys2-mingw-w64-x86_64-gcc-7.2.0-clang-llvm-5.0.0-windows-x86-64\bin;%PATH%"
|
||||
if "%TARGET%" == "" set TARGET=mingw
|
||||
rem Requires default mingw64 install path yet.
|
||||
set MINGW=\msys64\mingw64
|
||||
|
||||
@@ -2,6 +2,8 @@ apply plugin: 'konan'
|
||||
|
||||
konan.targets = ['macbook', 'linux', 'raspberrypi']
|
||||
|
||||
def konanUserDir = System.getenv("KONAN_DATA_DIR") ?: "${System.getProperty("user.home")}/.konan"
|
||||
|
||||
konanArtifacts {
|
||||
|
||||
interop ('sdl') {
|
||||
@@ -20,7 +22,7 @@ konanArtifacts {
|
||||
}
|
||||
|
||||
target 'raspberrypi', {
|
||||
includeDirs "${System.getProperty("user.home")}/.konan/dependencies/target-sysroot-1-raspberrypi/usr/include/SDL2"
|
||||
includeDirs "$konanUserDir/dependencies/target-sysroot-1-raspberrypi/usr/include/SDL2"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@ DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
|
||||
source "$DIR/../konan.sh"
|
||||
|
||||
DEPS="$HOME/.konan/dependencies"
|
||||
# KONAN_DEPS is set in konan.sh
|
||||
DEPS="$KONAN_DEPS"
|
||||
|
||||
CFLAGS_macbook=-I$HOME/Library/Frameworks/SDL2.framework/Headers
|
||||
LINKER_ARGS_macbook="-F $HOME/Library/Frameworks -framework SDL2"
|
||||
|
||||
@@ -23,7 +23,8 @@ Now
|
||||
|
||||
./downloadTorch.sh
|
||||
|
||||
will install it into `$HOME/.konan/third-party/torch` (if not yet done).
|
||||
will install it into `$HOME/.konan/third-party/torch` (if not yet done). One may override the location of
|
||||
`third-party/torch` by setting the `KONAN_DATA_DIR` environment variable.
|
||||
|
||||
To build use `../gradlew build` or `./build.sh`.
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@ apply plugin: 'konan'
|
||||
|
||||
konan.targets = ['macbook', 'linux']
|
||||
|
||||
def torchHome = "${System.getProperty("user.home")}/.konan/third-party/torch"
|
||||
def konanUserDir = System.getenv("KONAN_DATA_DIR") ?: "${System.getProperty("user.home")}/.konan"
|
||||
def torchHome = "$konanUserDir/third-party/torch"
|
||||
|
||||
task downloadTorch(type: Exec) {
|
||||
workingDir getProjectDir()
|
||||
|
||||
@@ -6,7 +6,7 @@ source "$DIR/../konan.sh"
|
||||
|
||||
$DIR/downloadTorch.sh
|
||||
|
||||
TH_TARGET_DIRECTORY="$HOME/.konan/third-party/torch"
|
||||
TH_TARGET_DIRECTORY="$KONAN_USER_DIR/third-party/torch"
|
||||
|
||||
if [ x$TARGET == x ]; then
|
||||
case "$OSTYPE" in
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
TH_TARGET_DIRECTORY=~/.konan/third-party/torch
|
||||
KONAN_USER_DIR=${KONAN_DATA_DIR:-"$HOME/.konan"}
|
||||
TH_TARGET_DIRECTORY="$KONAN_USER_DIR/third-party/torch"
|
||||
NO_CUDA=true # set to false for GPU support
|
||||
|
||||
if [ ! -d $TH_TARGET_DIRECTORY/include/THNN ]; then
|
||||
|
||||
@@ -6,8 +6,8 @@ set ZEPHYR_BASE=%userprofile%\zephyr
|
||||
set TOOLCHAIN=gcc-arm-none-eabi-7-2017-q4-major-win32
|
||||
|
||||
set DIR=%~dp0
|
||||
set KONAN_USER_DIR=%userprofile%/.konan
|
||||
set KONAN_DEPS=%KONAN_USER_DIR%/dependencies
|
||||
if "%KONAN_DATA_DIR%"=="" (set KONAN_DATA_DIR="%HOME%\.konan")
|
||||
set KONAN_DEPS=%KONAN_DATA_DIR%/dependencies
|
||||
set GCC_ARM=%KONAN_DEPS%/%TOOLCHAIN%
|
||||
set ZEPHYR_TOOLCHAIN_VARIANT=gccarmemb
|
||||
set GCCARMEMB_TOOLCHAIN_PATH=%GCC_ARM%
|
||||
|
||||
Reference in New Issue
Block a user