-
Notifications
You must be signed in to change notification settings - Fork 564
Add sqlite-xamarin (native library) build. #54
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,161 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <PropertyGroup> | ||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
| <ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
| <ProjectGuid>{26781D3A-FF20-4F55-9824-C8A06AA9E484}</ProjectGuid> | ||
| <OutputType>Library</OutputType> | ||
| <RootNamespace>Mono.Data.Sqlite</RootNamespace> | ||
| <MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix> | ||
| <MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix> | ||
| <AndroidResgenClass>Resource</AndroidResgenClass> | ||
| <AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile> | ||
| <AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk> | ||
| <AssemblyName>Mono.Data.Sqlite</AssemblyName> | ||
| <TargetFrameworkVersion>v5.0</TargetFrameworkVersion> | ||
| </PropertyGroup> | ||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
| <DebugSymbols>true</DebugSymbols> | ||
| <DebugType>full</DebugType> | ||
| <Optimize>false</Optimize> | ||
| <OutputPath>..\..\bin\$(Configuration)\lib\xbuild-frameworks\MonoAndroid\v1.0</OutputPath> | ||
| <DefineConstants>DEBUG;TRACE;NET_4_0;NET_4_5;MONO;DISABLE_CAS_USE;SQLITE_STANDARD;MONODROID</DefineConstants> | ||
| <ErrorReport>prompt</ErrorReport> | ||
| <WarningLevel>4</WarningLevel> | ||
| <AndroidLinkMode>None</AndroidLinkMode> | ||
| <ConsolePause>false</ConsolePause> | ||
| <AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
| </PropertyGroup> | ||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
| <Optimize>true</Optimize> | ||
| <OutputPath>..\..\bin\$(Configuration)\lib\xbuild-frameworks\MonoAndroid\v1.0</OutputPath> | ||
| <ErrorReport>prompt</ErrorReport> | ||
| <WarningLevel>4</WarningLevel> | ||
| <AndroidUseSharedRuntime>false</AndroidUseSharedRuntime> | ||
| <ConsolePause>false</ConsolePause> | ||
| <AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
| <DefineConstants>NET_4_0;NET_4_5;MONO;DISABLE_CAS_USE;SQLITE_STANDARD;MONODROID</DefineConstants> | ||
| </PropertyGroup> | ||
| <Import Project="..\..\Configuration.props" /> | ||
| <ItemGroup> | ||
| <Reference Include="System" /> | ||
| <Reference Include="System.Xml" /> | ||
| <Reference Include="System.Core" /> | ||
| <Reference Include="System.Data" /> | ||
| <Reference Include="System.Transactions" /> | ||
| <Reference Include="Mono.Android" /> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <None Include="Mono.Data.Sqlite.dll.config"> | ||
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
| </None> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <Compile Include="$(XamarinAndroidSourcePath)\src\Mono.Android\Android.Runtime\CPUArchitecture.cs"> | ||
| <Link>Android.Runtime\CPUArchitecture.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Assembly\AssemblyInfo.cs"> | ||
| <Link>Assembly\AssemblyInfo.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\MonoPInvokeCallbackAttribute.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\MonoPInvokeCallbackAttribute.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\SQLite3.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\SQLite3.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\SQLite3_UTF16.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\SQLite3_UTF16.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\SQLiteBase.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\SQLiteBase.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\SQLiteCommandBuilder.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\SQLiteCommandBuilder.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\SQLiteCommand.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\SQLiteCommand.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\SQLiteConnection.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\SQLiteConnection.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\LINQ\SQLiteConnection_Linq.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\LINQ\SQLiteConnection_Linq.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\SQLiteConnectionPool.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\SQLiteConnectionPool.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\SQLiteConnectionStringBuilder.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\SQLiteConnectionStringBuilder.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\SQLiteConvert.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\SQLiteConvert.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\SQLiteDataAdapter.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\SQLiteDataAdapter.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\SQLiteDataReader.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\SQLiteDataReader.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\SqliteDataSourceEnumerator.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\SqliteDataSourceEnumerator.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\SQLiteEnlistment.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\SQLiteEnlistment.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\SQLiteException.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\SQLiteException.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\SQLiteFactory.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\SQLiteFactory.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\LINQ\SQLiteFactory_Linq.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\LINQ\SQLiteFactory_Linq.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\SQLiteFunctionAttribute.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\SQLiteFunctionAttribute.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\SQLiteFunction.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\SQLiteFunction.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\SQLiteKeyReader.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\SQLiteKeyReader.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\SQLiteMetaDataCollectionNames.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\SQLiteMetaDataCollectionNames.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\SQLiteParameterCollection.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\SQLiteParameterCollection.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\SQLiteParameter.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\SQLiteParameter.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\SQLiteStatement.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\SQLiteStatement.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\SQLiteTransaction.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\SQLiteTransaction.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\SR.Designer.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\SR.Designer.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\class\Mono.Data.Sqlite\Mono.Data.Sqlite_2.0\UnsafeNativeMethods.cs"> | ||
| <Link>Mono.Data.Sqlite_2.0\UnsafeNativeMethods.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\build\common\Locale.cs"> | ||
| <Link>Locale.cs</Link> | ||
| </Compile> | ||
| <Compile Include="$(MonoSourceDirectory)\mcs\build\common\Consts.cs"> | ||
| <Link>Consts.cs</Link> | ||
| </Compile> | ||
| </ItemGroup> | ||
| <Import Project="$(OutputPath)\..\..\..\xbuild\Xamarin\Android\Xamarin.Android.CSharp.targets" /> | ||
| <ItemGroup> | ||
| <Folder Include="Assembly\" /> | ||
| <Folder Include="Mono.Data.Sqlite\" /> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <_SupportedAbi Include="$(AndroidSupportedAbis)" /> | ||
| <EmbeddedNativeLibrary Include="@(_SuppportedAbi->'..\sqlite-xamarin\src\main\libs\@(_SupportedAbi)\libsqlite3_xamarin.so')" /> | ||
| </ItemGroup> | ||
| </Project> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| <configuration> | ||
| <dllmap dll="sqlite3" target="libsqlite3_xamarin.so" /> | ||
| </configuration> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| .stamp | ||
| build.gradle | ||
| gradle/ | ||
| gradlew | ||
| gradlew.bat | ||
| src/ | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
|
||
| <PropertyGroup> | ||
| <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> | ||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
| <ItemType>GenericProject</ItemType> | ||
| <ProjectGuid>{B8F799C5-D7CE-4E09-9CE6-BAA4173E7EC8}</ProjectGuid> | ||
| </PropertyGroup> | ||
| <PropertyGroup Condition="'$(Configuration)'=='Debug'"> | ||
| <OutputPath>..\..\bin\Debug\</OutputPath> | ||
| </PropertyGroup> | ||
| <PropertyGroup Condition="'$(Configuration)'=='Release'"> | ||
| <OutputPath>..\..\bin\Release\</OutputPath> | ||
| </PropertyGroup> | ||
|
|
||
| <PropertyGroup> | ||
| <BuildDependsOn> | ||
| _CreateProject; | ||
| _NdkBuild; | ||
| </BuildDependsOn> | ||
| </PropertyGroup> | ||
|
|
||
| <Import Project="..\..\Configuration.props" /> | ||
|
|
||
| <!-- Build target and co. --> | ||
|
|
||
| <Target Name="Build" DependsOnTargets="$(BuildDependsOn)" /> | ||
|
|
||
| <Target Name="_CreateProject"> | ||
| <Exec Condition="!Exists('src')" | ||
| Command="$(AndroidSdkDirectory)\tools\android create project -g -n sqlitesample -p . -a MainActivity -t android-10 --package com.xamarin.sqlitesample -v 1.0.0" /> | ||
| <Copy Condition="!Exists('src\stamp')" | ||
| SourceFiles="src-jni\Application.mk;src-jni\Android.mk" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be in
That's also what
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The directory |
||
| DestinationFiles="src\main\jni\Application.mk;src\main\jni\Android.mk" /> | ||
| <Touch Files="src\stamp" AlwaysCreate="true" /> | ||
| </Target> | ||
|
|
||
| <Target Name="_NdkBuild"> | ||
| <Exec Command="$(AndroidNdkDirectory)\ndk-build" | ||
| WorkingDirectory="src\main\jni" /> | ||
|
|
||
| <!-- build outputs are: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If these are the build outputs, then you should add an
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is really no need for that, ndk-build has efficient caching, and invoking ndk-build every time is non-issue.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You will find out why it's not really an issue if you actually run it. It's much faster than running mono build script every time. |
||
| src/main/libs/x86/libsqlite3_xamarin.so | ||
| src/main/libs/armeabi-v7a/libsqlite3_xamarin.so | ||
| src/main/libs/armeabi/libsqlite3_xamarin.so | ||
| src/main/libs/arm64-v8a/libsqlite3_xamarin.so | ||
| src/main/libs/x86_64/libsqlite3_xamarin.so | ||
| --> | ||
| </Target> | ||
|
|
||
| <!-- Clean target --> | ||
|
|
||
| <Target Name="Clean"> | ||
| <Delete | ||
| Files="build.gradle;gradlew;gradlew.bat;local.properties" /> | ||
| <RemoveDir Directories="gradle;src" /> | ||
| </Target> | ||
| </Project> | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # It is based on sqlite/dist/Android.mk with some changes. | ||
|
|
||
| ## | ||
| ## | ||
| ## Build the library | ||
| ## | ||
| ## | ||
|
|
||
| LOCAL_PATH:= $(call my-dir) | ||
|
|
||
| # NOTE the following flags, | ||
| # SQLITE_TEMP_STORE=3 causes all TEMP files to go into RAM. and thats the behavior we want | ||
| # SQLITE_ENABLE_FTS3 enables usage of FTS3 - NOT FTS1 or 2. | ||
| # SQLITE_DEFAULT_AUTOVACUUM=1 causes the databases to be subject to auto-vacuum | ||
| minimal_sqlite_flags := \ | ||
| -DNO_ANDROID_FUNCS=1 \ | ||
| -DHAVE_POSIX_FALLOCATE=0 \ | ||
| -DNDEBUG=1 \ | ||
| -DHAVE_USLEEP=1 \ | ||
| -DSQLITE_HAVE_ISNAN \ | ||
| -DSQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576 \ | ||
| -DSQLITE_THREADSAFE=2 \ | ||
| -DSQLITE_TEMP_STORE=3 \ | ||
| -DSQLITE_POWERSAFE_OVERWRITE=1 \ | ||
| -DSQLITE_DEFAULT_FILE_FORMAT=4 \ | ||
| -DSQLITE_DEFAULT_AUTOVACUUM=1 \ | ||
| -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 \ | ||
| -DSQLITE_ENABLE_FTS3 \ | ||
| -DSQLITE_ENABLE_FTS3_BACKWARDS \ | ||
| -DSQLITE_ENABLE_FTS4 \ | ||
| -DSQLITE_OMIT_BUILTIN_TEST \ | ||
| -DSQLITE_OMIT_COMPILEOPTION_DIAGS \ | ||
| -DSQLITE_OMIT_LOAD_EXTENSION \ | ||
| -DSQLITE_DEFAULT_FILE_PERMISSIONS=0600 | ||
|
|
||
| device_sqlite_flags := $(minimal_sqlite_flags) \ | ||
| -DHAVE_MALLOC_H=1 | ||
|
|
||
| common_src_files := ../../../../../external/sqlite/dist/sqlite3.c | ||
|
|
||
| # the device library | ||
| include $(CLEAR_VARS) | ||
|
|
||
| LOCAL_SRC_FILES := $(common_src_files) | ||
|
|
||
| LOCAL_CFLAGS += $(device_sqlite_flags) | ||
|
|
||
| LOCAL_SHARED_LIBRARIES := libdl | ||
|
|
||
| LOCAL_MODULE:= libsqlite3_xamarin | ||
|
|
||
| LOCAL_C_INCLUDES += $(call include-path-for, system-core)/cutils | ||
|
|
||
| LOCAL_SHARED_LIBRARIES += liblog | ||
|
|
||
| # include android specific methods | ||
| #LOCAL_WHOLE_STATIC_LIBRARIES := libsqlite3_xamarin | ||
|
|
||
| include $(BUILD_SHARED_LIBRARY) | ||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| APP_ABI := armeabi armeabi-v7a arm64-v8a x86 x86_64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move the
<Import/>ofConfiguration.propsto the top of the file, and set<TargetFrameworkVersion/>to$(AndroidFrameworkVersion). This will ensure that when$(AndroidFrameworkVersion)changes in the future (e.g. tov6.1for Android-N, or whatever it will be called), this project won't break.