-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/uwp
- Loading branch information
Showing
28 changed files
with
477 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[submodule "dlib"] | ||
path = src/dlib | ||
url = https://github.com/davisking/dlib | ||
[submodule "src/ios-cmake"] | ||
path = src/ios-cmake | ||
url = https://github.com/leetal/ios-cmake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
FROM ubuntu:16.04 | ||
LABEL maintainer "Takuya Takeuchi <[email protected]>" | ||
|
||
# ENVS | ||
ENV ANDROID_HOME /opt/android-sdk-linux | ||
ENV PATH ${PATH}:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools:${PATH}:${ANDROID_HOME}/tools | ||
ENV ANDROID_NDK /opt/android-ndk-linux | ||
ENV ANDROID_NDK_HOME /opt/android-ndk-linux | ||
ENV ANDROID_NDK_VERSION r20 | ||
# https://developer.android.com/studio/index.html | ||
ENV ANDROID_SDK_URL https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip | ||
ENV ANDROID_SDK_VERSION 28 | ||
ENV ANDROID_SDK_VERSION_BUILDTOOLS 28.0.3 | ||
ENV ANDROID_NDK_URL https://dl.google.com/android/repository/android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip | ||
ENV OPENJDK_MAJOR_VERSION 8 | ||
|
||
# install openjdk8 | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
curl \ | ||
tar \ | ||
ca-certificates \ | ||
openjdk-8-jdk \ | ||
ca-certificates-java | ||
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64 | ||
RUN export JAVA_HOME | ||
|
||
# install android sdk and ndk | ||
RUN cd /opt && mkdir -p /opt/android-sdk-linux && mkdir -p ~/.android && touch ~/.android/repositories.cfg | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
unzip \ | ||
wget \ | ||
apt-transport-https | ||
|
||
RUN cd /opt/android-sdk-linux \ | ||
&& wget -q --output-document=sdk-tools.zip ${ANDROID_SDK_URL} \ | ||
&& unzip sdk-tools.zip \ | ||
&& rm -f sdk-tools.zip | ||
# ENV SDKMANAGER_OPTS "--add-modules java.se.ee" | ||
RUN echo y | sdkmanager "build-tools;${ANDROID_SDK_VERSION_BUILDTOOLS}" "platforms;android-${ANDROID_SDK_VERSION}" \ | ||
&& echo y | sdkmanager "extras;android;m2repository" "extras;google;m2repository" "extras;google;google_play_services" \ | ||
&& echo y | sdkmanager "cmake;3.6.4111459" | ||
RUN cd /opt \ | ||
&& wget -q --output-document=android-ndk.zip ${ANDROID_NDK_URL} \ | ||
&& unzip android-ndk.zip \ | ||
&& rm -f android-ndk.zip \ | ||
&& mv android-ndk-${ANDROID_NDK_VERSION} android-ndk-linux | ||
|
||
# install latest cmake | ||
ENV CMAKE_FILE cmake-3.14.5-Linux-x86_64.tar.gz | ||
ENV CMAKE_URL https://github.com/Kitware/CMake/releases/download/v3.14.5/${CMAKE_FILE} | ||
ENV CMAKE_URL_FILE ${CMAKE_FILE} | ||
RUN wget ${CMAKE_URL} \ | ||
&& tar -xzf ${CMAKE_FILE} \ | ||
&& rm ${CMAKE_FILE} \ | ||
&& mv ${CMAKE_FILE%.tar.gz} /opt/cmake \ | ||
&& ln -s /opt/cmake/bin/* /usr/bin | ||
|
||
# install latest ninja | ||
ENV NINJA_FILE ninja-linux.zip | ||
ENV NINJA_URL https://github.com/ninja-build/ninja/releases/download/v1.9.0/${NINJA_FILE} | ||
RUN wget https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-linux.zip \ | ||
&& unzip ${NINJA_FILE} \ | ||
&& rm ${NINJA_FILE} \ | ||
&& mkdir -p /opt/ninja \ | ||
&& mv ninja /opt/ninja \ | ||
&& ln -s /opt/ninja/* /usr/bin | ||
|
||
# Install powershell core | ||
RUN wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb | ||
RUN dpkg -i packages-microsoft-prod.deb && rm packages-microsoft-prod.deb | ||
RUN apt-get update && apt-get install -y \ | ||
powershell \ | ||
&& apt-get clean && rm -rf /var/lib/apt/lists/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
Param() | ||
|
||
# import class and function | ||
$ScriptPath = $PSScriptRoot | ||
$DlibDotNetRoot = Split-Path $ScriptPath -Parent | ||
$NugetPath = Join-Path $DlibDotNetRoot "nuget" | ` | ||
Join-Path -ChildPath "BuildUtils.ps1" | ||
import-module $NugetPath -function * | ||
|
||
$OperatingSystem="linux" | ||
$Distribution="ubuntu" | ||
$DistributionVersion="16" | ||
$AndroidVersion="28.0.3-r20-jdk8" | ||
$AndroidNativeApiLevel="23" | ||
|
||
# Store current directory | ||
$Current = Get-Location | ||
$DlibDotNetRoot = (Split-Path (Get-Location) -Parent) | ||
$DlibDotNetSourceRoot = Join-Path $DlibDotNetRoot src | ||
$DockerDir = Join-Path $Current docker | ||
|
||
Set-Location -Path $DockerDir | ||
|
||
$DockerFileDir = Join-Path $DockerDir build | ` | ||
Join-Path -ChildPath $Distribution | ` | ||
Join-Path -ChildPath $DistributionVersion | ||
|
||
$BuildSourceHash = [Config]::GetBinaryLibraryLinuxHash() | ||
|
||
# https://docs.microsoft.com/ja-jp/xamarin/cross-platform/cpp/ | ||
# arm64-v8a | ||
# armeabi-v7a | ||
# x86 | ||
# x86_64 | ||
$BuildTargets = @() | ||
$BuildTargets += New-Object PSObject -Property @{Target = "android"; Architecture = 64; RID = "arm64-v8a" } | ||
$BuildTargets += New-Object PSObject -Property @{Target = "android"; Architecture = 32; RID = "armeabi-v7a" } | ||
$BuildTargets += New-Object PSObject -Property @{Target = "android"; Architecture = 32; RID = "x86" } | ||
$BuildTargets += New-Object PSObject -Property @{Target = "android"; Architecture = 64; RID = "x86_64" } | ||
|
||
$dockername = "dlibdotnet/build/$Distribution/$DistributionVersion/android/$AndroidVersion" | ||
$imagename = "dlibdotnet/devel/$Distribution/$DistributionVersion/android/$AndroidVersion" | ||
|
||
Write-Host "Start 'docker build -t $dockername $DockerFileDir --build-arg IMAGE_NAME=""$imagename""'" -ForegroundColor Green | ||
docker build --force-rm=true -t $dockername $DockerFileDir --build-arg IMAGE_NAME="$imagename" | ||
|
||
if ($lastexitcode -ne 0) | ||
{ | ||
Set-Location -Path $Current | ||
exit -1 | ||
} | ||
|
||
foreach($BuildTarget in $BuildTargets) | ||
{ | ||
$target = $BuildTarget.Target | ||
$architecture = $BuildTarget.Architecture | ||
$rid = $BuildTarget.RID | ||
|
||
$setting = | ||
@{ | ||
'ANDROID_ABI' = $rid; | ||
'ANDROID_NATIVE_API_LEVEL' = $AndroidNativeApiLevel | ||
} | ||
|
||
# Build binary | ||
foreach ($key in $BuildSourceHash.keys) | ||
{ | ||
$option = [Config]::Base64Encode((ConvertTo-Json -Compress $setting)) | ||
$Config = [Config]::new("Release", $target, $architecture, $option) | ||
$libraryDir = Join-Path "artifacts" $Config.GetArtifactDirectoryName() | ||
$build = $Config.GetBuildDirectoryName($OperatingSystem) | ||
Write-Host "Start 'docker run --rm -v ""$($DlibDotNetRoot):/opt/data/DlibDotNet"" -e LOCAL_UID=$(id -u $env:USER) -e LOCAL_GID=$(id -g $env:USER) -t $dockername'" -ForegroundColor Green | ||
docker run --rm ` | ||
-v "$($DlibDotNetRoot):/opt/data/DlibDotNet" ` | ||
-e "LOCAL_UID=$(id -u $env:USER)" ` | ||
-e "LOCAL_GID=$(id -g $env:USER)" ` | ||
-t "$dockername" $key $target $architecture $option | ||
|
||
if ($lastexitcode -ne 0) | ||
{ | ||
Set-Location -Path $Current | ||
exit -1 | ||
} | ||
} | ||
|
||
# Copy output binary | ||
foreach ($key in $BuildSourceHash.keys) | ||
{ | ||
$srcDir = Join-Path $DlibDotNetSourceRoot $key | ||
$dll = $BuildSourceHash[$key] | ||
$dstDir = Join-Path $Current $libraryDir | ||
|
||
CopyToArtifact -srcDir $srcDir -build $build -libraryName $dll -dstDir $dstDir -rid $rid | ||
} | ||
} | ||
|
||
# Move to Root directory | ||
Set-Location -Path $Current |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
Param() | ||
|
||
# import class and function | ||
$ScriptPath = $PSScriptRoot | ||
$DlibDotNetRoot = Split-Path $ScriptPath -Parent | ||
$NugetPath = Join-Path $DlibDotNetRoot "nuget" | ` | ||
Join-Path -ChildPath "BuildUtils.ps1" | ||
import-module $NugetPath -function * | ||
|
||
$OperatingSystem="ios" | ||
|
||
# Store current directory | ||
$Current = Get-Location | ||
$DlibDotNetRoot = (Split-Path (Get-Location) -Parent) | ||
$DlibDotNetSourceRoot = Join-Path $DlibDotNetRoot src | ||
|
||
$BuildSourceHash = [Config]::GetBinaryLibraryIOSHash() | ||
|
||
$BuildTargets = @() | ||
$BuildTargets += New-Object PSObject -Property @{Target = "ios"; Architecture = 64; RID = "$OperatingSystem-x64"; CUDA = 0 } | ||
|
||
foreach($BuildTarget in $BuildTargets) | ||
{ | ||
$target = $BuildTarget.Target | ||
$architecture = $BuildTarget.Architecture | ||
$rid = $BuildTarget.RID | ||
|
||
$Config = [Config]::new("Release", $target, $architecture, $option) | ||
$libraryDir = Join-Path "artifacts" $Config.GetArtifactDirectoryName() | ||
$build = $Config.GetBuildDirectoryName("") | ||
|
||
foreach ($key in $BuildSourceHash.keys) | ||
{ | ||
$srcDir = Join-Path $DlibDotNetSourceRoot $key | ||
|
||
# Move to build target directory | ||
Set-Location -Path $srcDir | ||
|
||
$arc = $Config.GetArchitectureName() | ||
Write-Host "Build $key [$arc] for $target" -ForegroundColor Green | ||
Build -Config $Config | ||
|
||
if ($lastexitcode -ne 0) | ||
{ | ||
Set-Location -Path $Current | ||
exit -1 | ||
} | ||
} | ||
|
||
# Copy output binary | ||
foreach ($key in $BuildSourceHash.keys) | ||
{ | ||
$srcDir = Join-Path $DlibDotNetSourceRoot $key | ||
$dll = $BuildSourceHash[$key] | ||
$dstDir = Join-Path $Current $libraryDir | ||
|
||
CopyToArtifact -configuration "Release-iphoneos" -srcDir $srcDir -build $build -libraryName $dll -dstDir $dstDir -rid $rid | ||
} | ||
} | ||
|
||
# Move to Root directory | ||
Set-Location -Path $Current |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.