Samples: libcurl for Windows with dynamic linking (#2348)
This commit is contained in:
@@ -38,13 +38,13 @@ task buildSh(type: Exec) {
|
|||||||
|
|
||||||
task buildSamplesWithPlatformLibs() {
|
task buildSamplesWithPlatformLibs() {
|
||||||
dependsOn ':csvparser:assemble'
|
dependsOn ':csvparser:assemble'
|
||||||
|
dependsOn ':curl:assemble'
|
||||||
dependsOn ':echoServer:assemble'
|
dependsOn ':echoServer:assemble'
|
||||||
dependsOn ':globalState:assemble'
|
dependsOn ':globalState:assemble'
|
||||||
dependsOn ':html5Canvas:assemble'
|
dependsOn ':html5Canvas:assemble'
|
||||||
dependsOn ':workers:assemble'
|
dependsOn ':workers:assemble'
|
||||||
|
|
||||||
if (MPPTools.isMacos() || MPPTools.isLinux()) {
|
if (MPPTools.isMacos() || MPPTools.isLinux()) {
|
||||||
dependsOn ':curl:assemble'
|
|
||||||
dependsOn ':nonBlockingEchoServer:assemble'
|
dependsOn ':nonBlockingEchoServer:assemble'
|
||||||
dependsOn ':tensorflow:assemble'
|
dependsOn ':tensorflow:assemble'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,13 +9,18 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Determine host preset.
|
// Determine host preset.
|
||||||
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64, kotlin.presets.linuxX64])
|
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64, kotlin.presets.linuxX64, kotlin.presets.mingwX64])
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
targets {
|
||||||
fromPreset(hostPreset, 'curl') {
|
fromPreset(hostPreset, 'curl') {
|
||||||
compilations.main.outputKinds 'EXECUTABLE'
|
compilations.main.outputKinds 'EXECUTABLE'
|
||||||
compilations.main.entryPoint 'sample.curl.main'
|
compilations.main.entryPoint 'sample.curl.main'
|
||||||
|
|
||||||
|
if (presets.mingwX64 == hostPreset) {
|
||||||
|
// Add lib path to `libcurl` and its dependencies:
|
||||||
|
compilations.main.linkerOpts "-L${MPPTools.mingwPath()}/lib"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,6 +34,9 @@ kotlin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MPPTools.createRunTask(project, 'runProgram', kotlin.targets.curl) {
|
MPPTools.createRunTask(project, 'runProgram', kotlin.targets.curl) {
|
||||||
|
if (kotlin.presets.mingwX64 == hostPreset) {
|
||||||
|
environment 'PATH': "${MPPTools.mingwPath()}/bin"
|
||||||
|
}
|
||||||
args 'https://www.jetbrains.com/'
|
args 'https://www.jetbrains.com/'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
# Curl interop library
|
# Curl interop library
|
||||||
|
|
||||||
This example shows how to build and publish an interop library to communicate with the libcurl,
|
This example shows how to build and publish an interop library to communicate with the libcurl,
|
||||||
HTTP/HTTPS/FTP/etc client library. Debian-like distros may need to `apt-get install libcurl4-openssl-dev`.
|
HTTP/HTTPS/FTP/etc client library.
|
||||||
|
|
||||||
|
Install libcurl development files. For Mac - `brew install curl`. For Debian-like Linux - use `apt-get install libcurl4-openssl-dev` or `apt-get install libcurl4-gnutls-dev`.
|
||||||
|
For Windows - `pacman -S mingw-w64-x86_64-curl` in MinGW64 console, if you do
|
||||||
|
not have MSYS2-MinGW64 installed - install it first as described in http://www.msys2.org
|
||||||
|
|
||||||
To build use `../gradlew assemble`.
|
To build use `../gradlew assemble`.
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ task cleanLocalRepo(type: Delete) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Determine host preset.
|
// Determine host preset.
|
||||||
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64, kotlin.presets.linuxX64])
|
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64, kotlin.presets.linuxX64, kotlin.presets.mingwX64])
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
targets {
|
||||||
@@ -35,6 +35,9 @@ kotlin {
|
|||||||
case presets.linuxX64:
|
case presets.linuxX64:
|
||||||
includeDirs.headerFilterOnly '/usr/include', '/usr/include/x86_64-linux-gnu'
|
includeDirs.headerFilterOnly '/usr/include', '/usr/include/x86_64-linux-gnu'
|
||||||
break
|
break
|
||||||
|
case presets.mingwX64:
|
||||||
|
includeDirs.headerFilterOnly "${MPPTools.mingwPath()}/include"
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,3 +2,4 @@ headers = curl/curl.h
|
|||||||
headerFilter = curl/*
|
headerFilter = curl/*
|
||||||
linkerOpts.osx = -L/opt/local/lib -L/usr/local/opt/curl/lib -lcurl
|
linkerOpts.osx = -L/opt/local/lib -L/usr/local/opt/curl/lib -lcurl
|
||||||
linkerOpts.linux = -L/usr/lib64 -L/usr/lib/x86_64-linux-gnu -lcurl
|
linkerOpts.linux = -L/usr/lib64 -L/usr/lib/x86_64-linux-gnu -lcurl
|
||||||
|
linkerOpts.mingw = -lcurl
|
||||||
|
|||||||
@@ -21,19 +21,19 @@ enableFeaturePreview('GRADLE_METADATA')
|
|||||||
*/
|
*/
|
||||||
if (MPPTools.isMacos() || MPPTools.isLinux() || MPPTools.isWindows()) {
|
if (MPPTools.isMacos() || MPPTools.isLinux() || MPPTools.isWindows()) {
|
||||||
include ':csvparser'
|
include ':csvparser'
|
||||||
|
include ':curl'
|
||||||
include ':echoServer'
|
include ':echoServer'
|
||||||
include ':globalState'
|
include ':globalState'
|
||||||
include ':html5Canvas'
|
include ':html5Canvas'
|
||||||
|
include ':libcurl'
|
||||||
include ':tetris'
|
include ':tetris'
|
||||||
include ':videoplayer'
|
include ':videoplayer'
|
||||||
include ':workers'
|
include ':workers'
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MPPTools.isMacos() || MPPTools.isLinux()) {
|
if (MPPTools.isMacos() || MPPTools.isLinux()) {
|
||||||
include ':curl'
|
|
||||||
include ':gitchurn'
|
include ':gitchurn'
|
||||||
include ':gtk'
|
include ':gtk'
|
||||||
include ':libcurl'
|
|
||||||
include ':nonBlockingEchoServer'
|
include ':nonBlockingEchoServer'
|
||||||
include ':tensorflow'
|
include ':tensorflow'
|
||||||
include ':torch'
|
include ':torch'
|
||||||
|
|||||||
Reference in New Issue
Block a user