|
| 1 | +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="GenerateBindings"> |
| 2 | + <PropertyGroup> |
| 3 | + <HeaderFile>./header.txt</HeaderFile> |
| 4 | + <MethodClass>Methods</MethodClass> |
| 5 | + <Namespace>TileDB.Interop</Namespace> |
| 6 | + <LibraryName>tiledb</LibraryName> |
| 7 | + <OutDir>../../sources/TileDB.CSharp/Interop</OutDir> |
| 8 | + <TempDir>./temp</TempDir> |
| 9 | + <InputDir>$(TempDir)/download/include</InputDir> |
| 10 | + <RspFile>$(TempDir)/generate.rsp</RspFile> |
| 11 | + </PropertyGroup> |
| 12 | + |
| 13 | + <ItemGroup> |
| 14 | + <ConfigOption Include="latest-codegen" /> |
| 15 | + <ConfigOption Include="unix-types" /> |
| 16 | + <ConfigOption Include="multi-file" /> |
| 17 | + <ConfigOption Include="generate-helper-types" /> |
| 18 | + <InputFileBefore Include="tiledb/api/c_api/api_external_common.h" /> |
| 19 | + <InputFile Include="tiledb/tiledb_experimental.h" /> |
| 20 | + <InputFile Include="tiledb/tiledb.h" /> |
| 21 | + <RemapHandleType Include="config" /> |
| 22 | + <RemapHandleType Include="config_iter" /> |
| 23 | + <RemapHandleType Include="ctx" /> |
| 24 | + <RemapHandleType Include="error" /> |
| 25 | + <RemapHandleType Include="filter" /> |
| 26 | + <RemapHandleType Include="filter_list" /> |
| 27 | + <Remap Include="@(RemapHandleType->'tiledb_%(Identity)_handle_t=tiledb_%(Identity)_t')" /> |
| 28 | + <Remap Include="tiledb_experimental_query_status_details_t=tiledb_query_status_details_t" /> |
| 29 | + <ExcludeDump Include="attribute" /> |
| 30 | + <ExcludeDump Include="domain" /> |
| 31 | + <ExcludeDump Include="dimension" /> |
| 32 | + <ExcludeDump Include="array_schema" /> |
| 33 | + <ExcludeDump Include="stats" /> |
| 34 | + <ExcludeDump Include="stats_raw" /> |
| 35 | + <ExcludeDump Include="fragment_info" /> |
| 36 | + <ExcludeMethod Include="@(ExcludeDump->'tiledb_%(Identity)_dump')" /> |
| 37 | + <ExcludeMethod Include="tiledb_status" /> |
| 38 | + </ItemGroup> |
| 39 | + |
| 40 | + <Target Name="CleanOutput"> |
| 41 | + <RemoveDir Directories="$(OutDir)" /> |
| 42 | + </Target> |
| 43 | + <Target Name="Clean" |
| 44 | + DependsOnTargets="CleanOutput"> |
| 45 | + <RemoveDir Directories="$(TempDir)" /> |
| 46 | + </Target> |
| 47 | + |
| 48 | + <Target Name="Restore"> |
| 49 | + <Exec Command="dotnet tool restore" /> |
| 50 | + </Target> |
| 51 | + |
| 52 | + <Target Name="DownloadHeaders"> |
| 53 | + <Error |
| 54 | + Condition="'$(Version)' == '' AND '$(VersionTag)' == ''" |
| 55 | + Text="Version and VersionTag must be specified." /> |
| 56 | + |
| 57 | + <PropertyGroup> |
| 58 | + <DownloadUrl>https://github.com/TileDB-Inc/TileDB/releases/download/$(Version)/TileDB-windows-x86_64-$(Version)-$(VersionTag).zip</DownloadUrl> |
| 59 | + <ExtractDir>$(TempDir)/download</ExtractDir> |
| 60 | + </PropertyGroup> |
| 61 | + <DownloadFile |
| 62 | + SourceUrl="$(DownloadUrl)" |
| 63 | + DestinationFolder="$(TempDir)"> |
| 64 | + <Output TaskParameter="DownloadedFile" ItemName="DownloadedFile" /> |
| 65 | + </DownloadFile> |
| 66 | + <MakeDir Directories="$(ExtractDir)" /> |
| 67 | + <Unzip SourceFiles="@(DownloadedFile)" DestinationFolder="$(ExtractDir)" /> |
| 68 | + |
| 69 | + <ItemGroup> |
| 70 | + <ApiExternalHeaders Include="$(ExtractDir)/include/tiledb/api/c_api/**/*_api_external.h" /> |
| 71 | + </ItemGroup> |
| 72 | + </Target> |
| 73 | + |
| 74 | + <Target Name="GenerateRspFile" |
| 75 | + DependsOnTargets="CleanOutput"> |
| 76 | + <ItemGroup> |
| 77 | + <PInvokeGeneratorArg Remove="@(PInvokeGeneratorArg)" /> |
| 78 | + <PInvokeGeneratorArg Include="--config;@(ConfigOption)" /> |
| 79 | + <PInvokeGeneratorArg Include="--methodClassName;$(MethodClass)" /> |
| 80 | + <PInvokeGeneratorArg Include="--namespace;$(Namespace)" /> |
| 81 | + <PInvokeGeneratorArg Include="--file" /> |
| 82 | + <PInvokeGeneratorArg Condition="'@(InputFileBefore)' != ''" Include="@(InputFileBefore)" /> |
| 83 | + <PInvokeGeneratorArg Condition="'@(ApiExternalHeaders)' != ''" Include="@(ApiExternalHeaders->'%(FullPath)')" /> |
| 84 | + <PInvokeGeneratorArg Include="@(InputFile)" /> |
| 85 | + <PInvokeGeneratorArg Include="--output;$(OutDir)" /> |
| 86 | + <PInvokeGeneratorArg Include="--headerFile;$(HeaderFile)" /> |
| 87 | + <PInvokeGeneratorArg Include="--exclude;@(ExcludeMethod)" /> |
| 88 | + <PInvokeGeneratorArg Include="--remap;@(Remap)" /> |
| 89 | + <PInvokeGeneratorArg Include="-l$(LibraryName)" /> |
| 90 | + <PInvokeGeneratorArg Include="-F;$(InputDir)" /> |
| 91 | + <PInvokeGeneratorArg Include="-I;$(InputDir)" /> |
| 92 | + </ItemGroup> |
| 93 | + |
| 94 | + <WriteLinesToFile |
| 95 | + File="$(RspFile)" |
| 96 | + Lines="@(PInvokeGeneratorArg)" |
| 97 | + Overwrite="true" |
| 98 | + WriteOnlyWhenDifferent="true" /> |
| 99 | + </Target> |
| 100 | + |
| 101 | + <Target Name="GenerateBindings" |
| 102 | + DependsOnTargets="DownloadHeaders;GenerateRspFile"> |
| 103 | + <Exec Command="dotnet tool run ClangSharpPInvokeGenerator @"$(RspFile)"" /> |
| 104 | + </Target> |
| 105 | +</Project> |
0 commit comments