diff --git a/samples/concurrent/build.sh b/samples/concurrent/build.sh index 40f9840a6d6..d613837f37b 100755 --- a/samples/concurrent/build.sh +++ b/samples/concurrent/build.sh @@ -13,8 +13,6 @@ fi var=CFLAGS_${TARGET} CFLAGS=${!var} -var=LINKER_ARGS_${TARGET} -LINKER_ARGS=${!var} var=COMPILER_ARGS_${TARGET} COMPILER_ARGS=${!var} # add -opt for an optimized build. diff --git a/samples/gitchurn/build.gradle b/samples/gitchurn/build.gradle index 56c831c9465..863c1c930c2 100644 --- a/samples/gitchurn/build.gradle +++ b/samples/gitchurn/build.gradle @@ -9,6 +9,5 @@ konanInterop { konanArtifacts { GitChurn { useInterop 'libgit2' - linkerOpts "-L/opt/local/lib -L/usr/lib/x86_64-linux-gnu -L/usr/local/lib -lgit2" } -} \ No newline at end of file +} diff --git a/samples/gitchurn/build.sh b/samples/gitchurn/build.sh index c96ebb44174..100676f2c92 100755 --- a/samples/gitchurn/build.sh +++ b/samples/gitchurn/build.sh @@ -5,8 +5,6 @@ PATH=$DIR/../../dist/bin:$DIR/../../bin:$PATH CFLAGS_macbook="-I/opt/local/include -compilerOpts -I/usr/local/include" CFLAGS_linux=-I/usr/include -LINKER_ARGS_macbook="-L/usr/local/lib -L/opt/local/lib -lgit2" -LINKER_ARGS_linux="-L/usr/lib/x86_64-linux-gnu -lgit2" if [ x$TARGET == x ]; then case "$OSTYPE" in @@ -29,7 +27,7 @@ mkdir -p $DIR/build/bin/ cinterop -compilerOpts $CFLAGS -def $DIR/src/main/c_interop/libgit2.def -target $TARGET \ -o $DIR/build/c_interop/libgit2 || exit 1 -konanc -target $TARGET $DIR/src/main/kotlin -library $DIR/build/c_interop/libgit2 -linkerOpts "$LINKER_ARGS" \ +konanc -target $TARGET $DIR/src/main/kotlin -library $DIR/build/c_interop/libgit2 \ -o $DIR/build/bin/GitChurn || exit 1 echo "Artifact path is $DIR/build/bin/GitChurn.kexe" diff --git a/samples/gitchurn/src/main/c_interop/libgit2.def b/samples/gitchurn/src/main/c_interop/libgit2.def index 2bec48d14c7..47d55ac681b 100644 --- a/samples/gitchurn/src/main/c_interop/libgit2.def +++ b/samples/gitchurn/src/main/c_interop/libgit2.def @@ -1,3 +1,4 @@ headers = git2.h time.h -linkerOpts = -lgit2 -headerFilter = git2/** time.h \ No newline at end of file +linkerOpts.osx = -L/opt/local/lib -L/usr/local/lib -lgit2 +linkerOpts.linux = -L/usr/lib/x86_64-linux-gnu -lgit2 +headerFilter = git2/** time.h diff --git a/samples/gtk/build.gradle b/samples/gtk/build.gradle index 6f9523b8a6e..16584f13243 100644 --- a/samples/gtk/build.gradle +++ b/samples/gtk/build.gradle @@ -13,6 +13,5 @@ konanInterop { konanArtifacts { Gtk3Demo { useInterop 'gtk3' - linkerOpts "-L/opt/local/lib -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu -lglib-2.0 -lgdk-3 -lgtk-3 -lgio-2.0 -lgobject-2.0" } } diff --git a/samples/gtk/build.sh b/samples/gtk/build.sh index d41294cb7eb..5871be3014b 100755 --- a/samples/gtk/build.sh +++ b/samples/gtk/build.sh @@ -6,8 +6,6 @@ PATH=$DIR/../../dist/bin:$DIR/../../bin:$PATH IPREFIX_macbook=-I/opt/local/include #IPREFIX_macbook=-I/usr/local/include IPREFIX_linux=-I/usr/include -LINKER_ARGS_macbook="-L/opt/local/lib -L/usr/local/lib -lglib-2.0 -lgdk-3.0 -lgtk-3 -lgio-2.0 -lgobject-2.0" -LINKER_ARGS_linux="-L/usr/lib/x86_64-linux-gnu -lglib-2.0 -lgdk-3 -lgtk-3 -lgio-2.0 -lgobject-2.0" if [ x$TARGET == x ]; then case "$OSTYPE" in @@ -33,7 +31,7 @@ cinterop -J-Xmx8g -copt $IPREFIX/atk-1.0 -compilerOpts $IPREFIX/gdk-pixbuf-2.0 - -copt $IPREFIX/gtk-3.0 -copt $IPREFIX/glib-2.0 -def $DIR/src/main/c_interop/gtk3.def \ -target $TARGET -o $DIR/build/c_interop/gtk3 || exit 1 -konanc -target $TARGET $DIR/src/main/kotlin -library $DIR/build/c_interop/gtk3 -linkerOpts "$LINKER_ARGS" \ +konanc -target $TARGET $DIR/src/main/kotlin -library $DIR/build/c_interop/gtk3 \ -o $DIR/build/bin/Gtk3Demo || exit 1 echo "Artifact path is $DIR/build/bin/Gtk3Demo.kexe" diff --git a/samples/gtk/src/main/c_interop/gtk3.def b/samples/gtk/src/main/c_interop/gtk3.def index b2fcf9ffc51..23d145287d1 100644 --- a/samples/gtk/src/main/c_interop/gtk3.def +++ b/samples/gtk/src/main/c_interop/gtk3.def @@ -1,2 +1,4 @@ headers = gtk/gtk.h headerFilter = gtk/* gobject/* gio/* +linkerOpts.osx = -L/opt/local/lib -L/usr/local/lib -lglib-2.0 -lgdk-3.0 -lgtk-3 -lgio-2.0 -lgobject-2.0 +linkerOpts.linux = -L/usr/lib/x86_64-linux-gnu -lglib-2.0 -lgdk-3 -lgtk-3 -lgio-2.0 -lgobject-2.0 diff --git a/samples/libcurl/build.gradle b/samples/libcurl/build.gradle index 21880dc7d95..6c61b82e420 100644 --- a/samples/libcurl/build.gradle +++ b/samples/libcurl/build.gradle @@ -9,6 +9,5 @@ konanInterop { konanArtifacts { Curl { useInterop 'libcurl' - linkerOpts "-L/opt/local/lib -L/usr/lib/x86_64-linux-gnu -L/usr/local/opt/curl/lib -lcurl" } } diff --git a/samples/libcurl/build.sh b/samples/libcurl/build.sh index 579c587c26c..a931ab993ed 100755 --- a/samples/libcurl/build.sh +++ b/samples/libcurl/build.sh @@ -5,8 +5,6 @@ PATH=$DIR/../../dist/bin:$DIR/../../bin:$PATH CFLAGS_macbook=-I/opt/local/include CFLAGS_linux="-I /usr/include -I /usr/include/x86_64-linux-gnu" -LINKER_ARGS_macbook="-L/opt/local/lib -lcurl" -LINKER_ARGS_linux="-L/usr/lib/x86_64-linux-gnu -lcurl" if [ x$TARGET == x ]; then case "$OSTYPE" in @@ -18,8 +16,6 @@ fi var=CFLAGS_${TARGET} CFLAGS=${!var} -var=LINKER_ARGS_${TARGET} -LINKER_ARGS=${!var} var=COMPILER_ARGS_${TARGET} COMPILER_ARGS=${!var} # add -opt for an optimized build. @@ -29,7 +25,7 @@ mkdir -p $DIR/build/bin/ cinterop -compilerOpts "$CFLAGS" -compilerOpts -I$DIR -compilerOpts -I/usr/include -def $DIR/src/main/c_interop/libcurl.def -target $TARGET \ -o $DIR/build/c_interop/libcurl || exit 1 -konanc -target $TARGET $DIR/src/main/kotlin -library $DIR/build/c_interop/libcurl -linkerOpts "$LINKER_ARGS" \ +konanc -target $TARGET $DIR/src/main/kotlin -library $DIR/build/c_interop/libcurl \ -o $DIR/build/bin/Curl || exit 1 echo "Artifact path is $DIR/build/bin/Curl.kexe" diff --git a/samples/libcurl/src/main/c_interop/libcurl.def b/samples/libcurl/src/main/c_interop/libcurl.def index 3aac5c17df2..6d469e2f8b0 100644 --- a/samples/libcurl/src/main/c_interop/libcurl.def +++ b/samples/libcurl/src/main/c_interop/libcurl.def @@ -1,2 +1,4 @@ headers = curl/curl.h headerFilter = curl/* +linkerOpts.osx = -L/opt/local/lib -L/usr/local/opt/curl/lib -lcurl +linkerOpts.linux = -L/usr/lib/x86_64-linux-gnu -lcurl diff --git a/samples/opengl/build.gradle b/samples/opengl/build.gradle index 9150132e845..1a9a21179bd 100644 --- a/samples/opengl/build.gradle +++ b/samples/opengl/build.gradle @@ -8,13 +8,11 @@ konanInterop { konanArtifacts { OpenGlTeapotMacbook { useInterop 'opengl' - linkerOpts "-framework OpenGL -framework GLUT" target "macbook" } OpenGlTeapotLinux { useInterop 'opengl' - linkerOpts "-L/usr/lib/x86_64-linux-gnu -lglut -lGL -lGLU" target "linux" } -} \ No newline at end of file +} diff --git a/samples/opengl/build.sh b/samples/opengl/build.sh index 8c21c88f224..f15dedb0688 100755 --- a/samples/opengl/build.sh +++ b/samples/opengl/build.sh @@ -3,9 +3,6 @@ DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd ) PATH=$DIR/../../dist/bin:$DIR/../../bin:$PATH -LINKER_ARGS_macbook="-framework OpenGL -framework GLUT" -LINKER_ARGS_linux="-L/usr/lib/x86_64-linux-gnu -lglut -lGL -lGLU" - if [ x$TARGET == x ]; then case "$OSTYPE" in darwin*) TARGET=macbook ;; @@ -16,8 +13,6 @@ fi var=CFLAGS_${TARGET} CFLAGS=${!var} -var=LINKER_ARGS_${TARGET} -LINKER_ARGS=${!var} var=COMPILER_ARGS_${TARGET} COMPILER_ARGS=${!var} # add -opt for an optimized build. @@ -28,6 +23,6 @@ cinterop -def $DIR/src/main/c_interop/opengl.def -target $TARGET \ -o $DIR/build/c_interop/opengl || exit 1 konanc -target $TARGET $DIR/src/main/kotlin/OpenGlTeapot.kt -library $DIR/build/c_interop/opengl \ - -linkerOpts "$LINKER_ARGS" -o $DIR/build/bin/OpenGlTeapot || exit 1 + -o $DIR/build/bin/OpenGlTeapot || exit 1 echo "Artifact path is $DIR/build/bin/OpenGlTeapot.kexe" diff --git a/samples/opengl/src/main/c_interop/opengl.def b/samples/opengl/src/main/c_interop/opengl.def index be7d4b77b21..71f4ec05a86 100644 --- a/samples/opengl/src/main/c_interop/opengl.def +++ b/samples/opengl/src/main/c_interop/opengl.def @@ -3,3 +3,5 @@ headers.linux = GL/glut.h compilerOpts.osx = -framework OpenGL -framework GLUT compilerOpts.linux = -I/usr/include excludeDependentModules.osx = true +linkerOpts.osx = -framework OpenGL -framework GLUT +linkerOpts.linux = -L/usr/lib/x86_64-linux-gnu -lglut -lGL -lGLU diff --git a/samples/socket/build.sh b/samples/socket/build.sh index a1eea426734..d5f61ba5505 100755 --- a/samples/socket/build.sh +++ b/samples/socket/build.sh @@ -13,8 +13,6 @@ fi var=CFLAGS_${TARGET} CFLAGS=${!var} -var=LINKER_ARGS_${TARGET} -LINKER_ARGS=${!var} var=COMPILER_ARGS_${TARGET} COMPILER_ARGS=${!var} # add -opt for an optimized build. diff --git a/samples/tensorflow/build.gradle b/samples/tensorflow/build.gradle index 83dc15255b3..7b7079c956a 100644 --- a/samples/tensorflow/build.gradle +++ b/samples/tensorflow/build.gradle @@ -1,15 +1,26 @@ apply plugin: 'konan' +def tensorflowHome = "${System.getProperty("user.home")}/.konan/third-party/tensorflow" + konanInterop { tensorflow { - includeDirs "${System.getProperty("user.home")}/.konan/third-party/tensorflow/include" + includeDirs "${tensorflowHome}/include" } } konanArtifacts { Tensorflow { useInterop "tensorflow" - linkerOpts "-L${System.getProperty("user.home")}/.konan/third-party/tensorflow/lib -ltensorflow" + linkerOpts "-L${tensorflowHome}/lib -ltensorflow" + } +} + +run.dependsOn 'warning' + +task warning { + doLast { + println "Note: You may need to specify LD_LIBRARY_PATH or DYLD_LIBRARY_PATH env variables to $tensorflowHome/lib if the TensorFlow dynamic library cannot be found." + } } @@ -20,4 +31,4 @@ task downloadTensorflow(type: Exec) { genTensorflowInteropStubs { dependsOn 'downloadTensorflow' -} \ No newline at end of file +}