Moved some linkerOpts from build.sh and build.gradle to .def,
where it does not involve any complex intelligence.
This commit is contained in:
committed by
alexander-gorshenev
parent
5effdcb1d2
commit
33993236de
@@ -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.
|
||||
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
headers = git2.h time.h
|
||||
linkerOpts = -lgit2
|
||||
headerFilter = git2/** time.h
|
||||
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
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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'
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user