Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/compile osx #171

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,5 @@ pip-log.txt
/*.Log
*.sdsettings
*.orig
paket.exe
AssemblyVersionInfo.cs
6 changes: 6 additions & 0 deletions .semver
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
:major: 0
:minor: 0
:patch: 0
:special: ''
:metadata: ''
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM centos:latest
MAINTAINER Henrik Feldt <[email protected]>

ENV BUILD_PREFIX /tmp/build
ENV APP_PREFIX /app
ENV LISTEN_PORT=8083

RUN mkdir -p $BUILD_PREFIX

WORKDIR $BUILD_PREFIX

# common packages across builds:
RUN yum install -y epel-release yum-utils && \
rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" && \
yum-config-manager --add-repo http://download.mono-project.com/repo/centos/ && \
yum install -y mono-complete
RUN yum install -y python-setuptools hostname inotify-tools yum-utils ruby-devel \
gcc gcc-c++ rpm-build redhat-rpm-config make readline-devel \
tar openssl-devel zlib-devel libffi-devel sqlite-devel

# requirement for liblept:
RUN yum install -y libpng12-devel libjpeg-turbo-devel libwebp-devel

RUN gem install bundler

COPY . $BUILD_PREFIX

RUN bundle
RUN bundle exec rake

ENTRYPOINT ["/bin/bash"]
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source 'https://rubygems.org'
gem 'albacore', '~> 2.3.22'
20 changes: 20 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
GEM
remote: https://rubygems.org/
specs:
albacore (2.3.22)
map (~> 6.5)
nokogiri (~> 1.5)
rake (~> 10)
semver2 (~> 3.4)
map (6.5.5)
mini_portile (0.6.2)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
rake (10.4.2)
semver2 (3.4.2)

PLATFORMS
ruby

DEPENDENCIES
albacore (~> 2.3.22)
83 changes: 83 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
require 'bundler/setup'

require 'albacore'
# require 'albacore/tasks/release'
require 'albacore/tasks/versionizer'
require 'albacore/ext/teamcity'

Configuration = ENV['CONFIGURATION'] || 'Release45'

Albacore::Tasks::Versionizer.new :versioning

desc 'create assembly infos'
asmver :assembly_info do |a|
a.file_path = './src/AssemblyVersionInfo.cs'
a.namespace = 'Tesseract'
a.attributes assembly_version: ENV['LONG_VERSION'],
assembly_file_version: ENV['LONG_VERSION'],
assembly_informational_version: ENV['BUILD_VERSION']
end

desc 'Perform fast build (warn: doesn\'t d/l deps)'
build :quick_compile do |b|
b.prop 'Configuration', Configuration
b.logging = 'detailed'
b.sln = 'src/Tesseract.sln'
end

task :paket_bootstrap do
system 'tools/paket.bootstrapper.exe', clr_command: true unless File.exists? 'tools/paket.exe'
end

desc 'restore all nugets as per the packages.config files'
task :restore => :paket_bootstrap do
system 'tools/paket.exe', 'restore', clr_command: true
end

desc 'Perform full build'
build :compile => [:versioning, :restore, :assembly_info] do |b|
b.prop 'Configuration', Configuration
b.sln = 'src/Tesseract.sln'
end

directory 'build/pkg'

desc 'package nugets - finds all projects and package them'
nugets_pack :create_nugets => ['build/pkg', :versioning, :compile] do |p|
p.configuration = Configuration
p.files = FileList['src/**/*.{csproj,fsproj,nuspec}'].
exclude(/Tests/)
p.out = 'build/pkg'
p.exe = 'packages/NuGet.CommandLine/tools/NuGet.exe'
p.with_metadata do |m|
# m.id = 'MyProj'
m.title = 'Tesseract'
m.description = 'OCR library wrapper for .Net'
m.authors = 'John Doe, Foretag AB'
m.project_url = 'http://example.com'
m.tags = ''
m.version = ENV['NUGET_VERSION']
end
end

namespace :tests do
task :unit do
system "packages/NUnit.Runners/tools/nunit-console.exe",
%w|src/Tesseract.Tests/bin/Release/Net45/Tesseract.Tests.dll|,
clr_command: true
end
end

task :tests => :'tests:unit'

task :default => [:compile, :tests, :create_nugets]

#task :ensure_nuget_key do
# raise 'missing env NUGET_KEY value' unless ENV['NUGET_KEY']
#end

#Albacore::Tasks::Release.new :release,
# pkg_dir: 'build/pkg',
# depend_on: [:create_nugets, :ensure_nuget_key],
# nuget_exe: 'packages/NuGet.CommandLine/tools/NuGet.exe',
# api_key: ENV['NUGET_KEY']
52 changes: 36 additions & 16 deletions Samples/Tesseract.ConsoleDemo/Tesseract.ConsoleDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<TargetFrameworkProfile />
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down Expand Up @@ -47,11 +46,6 @@
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="Tesseract, Version=2.3.0.0, Culture=neutral, PublicKeyToken=ebeb3d86bef60cbe, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Tesseract.2.3.0.0\lib\net40\Tesseract.dll</HintPath>
<IlMerge>True</IlMerge>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="FormattedConsoleLogger.cs" />
Expand All @@ -60,7 +54,7 @@
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="paket.references" />
<None Include="phototest.tif">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down Expand Up @@ -95,30 +89,56 @@
<ItemGroup>
<Content Include="x64\liblept168.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<Paket>True</Paket>
</Content>
<Content Include="x64\libtesseract302.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<Paket>True</Paket>
</Content>
<Content Include="x86\liblept168.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<Paket>True</Paket>
</Content>
<Content Include="x86\libtesseract302.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<Paket>True</Paket>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<Target Name="MergeAssemblies" AfterTargets="AfterBuild">
<CreateItem Include="@(ReferencePath)" Condition="'%(CopyLocal)'=='true' and '%(ReferencePath.IlMerge)'=='true'">
<Output TaskParameter="Include" ItemName="IlmergeAssemblies" />
</CreateItem>
<Message Text="MERGING: @(IlmergeAssemblies->'%(Filename)')" Importance="High" />
<Exec Command="&quot;$(SolutionDir)packages\ILMerge.2.14.1208\tools\Ilmerge.exe&quot; /lib:&quot;$(MSBuildBinPath)&quot; /targetplatform:v4 /out:&quot;@(MainAssembly)&quot; &quot;@(IntermediateAssembly)&quot; @(IlmergeAssemblies->'&quot;%(FullPath)&quot;', ' ')" />
<Message Text="MERGING: @(IlmergeAssemblies-&gt;'%(Filename)')" Importance="High" />
<Exec Command="&quot;$(SolutionDir)packages\ILMerge.2.14.1208\tools\Ilmerge.exe&quot; /lib:&quot;$(MSBuildBinPath)&quot; /targetplatform:v4 /out:&quot;@(MainAssembly)&quot; &quot;@(IntermediateAssembly)&quot; @(IlmergeAssemblies-&gt;'&quot;%(FullPath)&quot;', ' ')" />
</Target>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And $(TargetFrameworkVersion) == 'v4.5'">
<ItemGroup>
<Reference Include="Tesseract">
<HintPath>..\..\packages\Tesseract\lib\net45\Tesseract.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.0')">
<ItemGroup>
<Reference Include="Tesseract">
<HintPath>..\..\packages\Tesseract\lib\net40\Tesseract.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid') Or ($(TargetFrameworkIdentifier) == 'MonoTouch')">
<ItemGroup>
<Reference Include="Tesseract">
<HintPath>..\..\packages\Tesseract\lib\net451\Tesseract.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
</Project>
11 changes: 10 additions & 1 deletion Samples/Tesseract.ConsoleDemo/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,13 @@
initializeData="c:\log\tesseract.consoledemo.log" />-->
</sharedListeners>
</system.diagnostics>
</configuration>
<runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.3.13283" newVersion="2.6.3.13283" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Tesseract" publicKeyToken="ebeb3d86bef60cbe" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.3.0.0" newVersion="2.3.0.0" />
</dependentAssembly>
</assemblyBinding></runtime></configuration>
5 changes: 0 additions & 5 deletions Samples/Tesseract.ConsoleDemo/packages.config

This file was deleted.

2 changes: 2 additions & 0 deletions Samples/Tesseract.ConsoleDemo/paket.references
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ILMerge
Tesseract
14 changes: 6 additions & 8 deletions Samples/Tesseract.Samples.sln
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2013 for Web
VisualStudioVersion = 12.0.30501.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{CD9E5073-918B-44ED-AA8E-6E64FA36B261}"
ProjectSection(SolutionItems) = preProject
..\paket.dependencies = ..\paket.dependencies
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Web Examples", "Web Examples", "{47D551BB-CFCE-41AF-A16F-D9BD3F2A5C84}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tesseract.WebDemo", "Tesseract.WebDemo\Tesseract.WebDemo.csproj", "{7650CFED-6660-4354-9D78-1C54CDF12542}"
Expand All @@ -11,13 +16,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Console Examples", "Console
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tesseract.ConsoleDemo", "Tesseract.ConsoleDemo\Tesseract.ConsoleDemo.csproj", "{E168ED88-0452-4918-9D81-611CFA353A0F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{FAD8EC9B-A5DD-4CF1-A48D-0007E83446F6}"
ProjectSection(SolutionItems) = preProject
.nuget\NuGet.Config = .nuget\NuGet.Config
.nuget\NuGet.exe = .nuget\NuGet.exe
.nuget\NuGet.targets = .nuget\NuGet.targets
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
Loading