-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Automatically build dylib on macOS #22147
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
base: main
Are you sure you want to change the base?
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 | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,8 +5,13 @@ | |||||||||||||||||||||||||||||||||||||||||
| <AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||||||||||||||||||||||||||||||||||||||||||
| <UseMicroComGeneratorRoslyn>true</UseMicroComGeneratorRoslyn> | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| <BuildAvaloniaNativeXcodeProject Condition="'$(BuildAvaloniaNativeXcodeProject)' == ''">$([MSBuild]::IsOSPlatform(OSX))</BuildAvaloniaNativeXcodeProject> | ||||||||||||||||||||||||||||||||||||||||||
| <AvaloniaNativeSourceDir>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)../../native/Avalonia.Native))</AvaloniaNativeSourceDir> | ||||||||||||||||||||||||||||||||||||||||||
| <AvaloniaNativeXcodeProject>$(AvaloniaNativeSourceDir)/src/OSX/Avalonia.Native.OSX.xcodeproj</AvaloniaNativeXcodeProject> | ||||||||||||||||||||||||||||||||||||||||||
| <AvaloniaNativeBuildDir>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)../../Build/Products/$(Configuration)))</AvaloniaNativeBuildDir> | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| <!-- Include libAvaloniaNative.dylib, only if we are on macOS host or dylib was manually copied --> | ||||||||||||||||||||||||||||||||||||||||||
| <AvaloniaNativeDylibPath>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)../../Build/Products/Release/libAvalonia.Native.OSX.dylib))</AvaloniaNativeDylibPath> | ||||||||||||||||||||||||||||||||||||||||||
| <AvaloniaNativeDylibPath>$(AvaloniaNativeBuildDir)/libAvalonia.Native.OSX.dylib</AvaloniaNativeDylibPath> | ||||||||||||||||||||||||||||||||||||||||||
| <IncludeAvaloniaDylib Condition="'$(IncludeAvaloniaDylib)' == '' AND Exists($(AvaloniaNativeDylibPath))">true</IncludeAvaloniaDylib> | ||||||||||||||||||||||||||||||||||||||||||
| <IncludeAvaloniaDylib Condition="'$(IncludeAvaloniaDylib)' == ''">$([MSBuild]::IsOSPlatform(OSX))</IncludeAvaloniaDylib> | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -24,6 +29,30 @@ | |||||||||||||||||||||||||||||||||||||||||
| </Content> | ||||||||||||||||||||||||||||||||||||||||||
| </ItemGroup> | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| <!-- On macOS, build the underlying Xcode project whenever one of its sources changed --> | ||||||||||||||||||||||||||||||||||||||||||
| <ItemGroup Condition="'$(BuildAvaloniaNativeXcodeProject)' == 'true'"> | ||||||||||||||||||||||||||||||||||||||||||
| <AvaloniaNativeSource Include="$(AvaloniaNativeSourceDir)/**/*.mm;$(AvaloniaNativeSourceDir)/**/*.h" /> | ||||||||||||||||||||||||||||||||||||||||||
|
Member
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. Conciser blanket |
||||||||||||||||||||||||||||||||||||||||||
| <AvaloniaNativeSource Include="$(AvaloniaNativeXcodeProject)/**/*" Exclude="$(AvaloniaNativeXcodeProject)/**/xcuserdata/**/*" /> | ||||||||||||||||||||||||||||||||||||||||||
| </ItemGroup> | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| <Target Name="CompileAvaloniaNativeXcodeProject" | ||||||||||||||||||||||||||||||||||||||||||
| Condition="'$(BuildAvaloniaNativeXcodeProject)' == 'true'" | ||||||||||||||||||||||||||||||||||||||||||
| BeforeTargets="DispatchToInnerBuilds;BeforeBuild" | ||||||||||||||||||||||||||||||||||||||||||
| Inputs="@(AvaloniaNativeSource)" | ||||||||||||||||||||||||||||||||||||||||||
|
Member
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. Please, use "inputs cache file" approach (see Avalonia/packages/Avalonia/AvaloniaBuildTasks.targets Lines 86 to 105 in b709c58
|
||||||||||||||||||||||||||||||||||||||||||
| Outputs="$(AvaloniaNativeDylibPath)"> | ||||||||||||||||||||||||||||||||||||||||||
| <Message Importance="high" Text="Building native library $([System.IO.Path]::GetFileName($(AvaloniaNativeDylibPath)))" /> | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+38
to
+43
Member
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. We should be able to reuse the same task for Keeping xcodeproj/CONFIGURATION_BUILD_DIR paths defined in one place (this csproj). You might need to extract this target to be executable without |
||||||||||||||||||||||||||||||||||||||||||
| <!-- TODO: Don't ignore xcode warnings, fix them instead --> | ||||||||||||||||||||||||||||||||||||||||||
| <Exec Command="xcodebuild -quiet -project "$(AvaloniaNativeXcodeProject)" -configuration $(Configuration) CONFIGURATION_BUILD_DIR="$(AvaloniaNativeBuildDir)" GCC_WARN_INHIBIT_ALL_WARNINGS=YES ONLY_ACTIVE_ARCH=NO" | ||||||||||||||||||||||||||||||||||||||||||
|
Member
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. This doesn't re-generate native headers. Nuke target does. |
||||||||||||||||||||||||||||||||||||||||||
| ConsoleToMSBuild="true" | ||||||||||||||||||||||||||||||||||||||||||
| IgnoreExitCode="false" | ||||||||||||||||||||||||||||||||||||||||||
| IgnoreStandardErrorWarningFormat="false" | ||||||||||||||||||||||||||||||||||||||||||
| StandardOutputImportance="low" | ||||||||||||||||||||||||||||||||||||||||||
| StandardErrorImportance="low" | ||||||||||||||||||||||||||||||||||||||||||
| EchoOff="true" /> | ||||||||||||||||||||||||||||||||||||||||||
| <!-- Make sure the dylib is newer than its inputs, so the incremental check above doesn't run xcodebuild again --> | ||||||||||||||||||||||||||||||||||||||||||
| <Touch Files="$(AvaloniaNativeDylibPath)" Condition="Exists($(AvaloniaNativeDylibPath))" /> | ||||||||||||||||||||||||||||||||||||||||||
| </Target> | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| <ItemGroup> | ||||||||||||||||||||||||||||||||||||||||||
| <ProjectReference Include="..\..\packages\Avalonia\Avalonia.csproj" /> | ||||||||||||||||||||||||||||||||||||||||||
| <ProjectReference Include="..\Avalonia.Dialogs\Avalonia.Dialogs.csproj" /> | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
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.
this seems to be pointing to
/buildwhich contains our .targets/.props, am I reading this right?