From b532595bb6b93d74671bee44d0cd7e109a8de4cf Mon Sep 17 00:00:00 2001 From: chinboy Date: Thu, 11 Sep 2025 11:29:26 +0800 Subject: [PATCH] Stripping AtomUI.Native --- .github/workflows/release-atomui-native.yml | 243 --- azure-pipelines.yml | 111 -- build/AtomUINativePackageInfo.props | 23 - build/Internal.Using.props | 5 - build/Version.props | 6 +- nativelibs/.gitignore | 4 - nativelibs/.vscode/launch.json | 28 - nativelibs/.vscode/settings.json | 36 - nativelibs/.vscode/tasks.json | 32 - nativelibs/CMakeLists.txt | 90 -- .../modules/AddCustomCommandTarget.cmake | 173 -- nativelibs/cmake/modules/FindGoogleTest.cmake | 125 -- nativelibs/cmake/modules/HandleAppPath.cmake | 53 - .../cmake/modules/HandleRequirePackages.cmake | 42 - .../cmake/modules/ImportThirdparty.cmake | 14 - nativelibs/cmake/modules/MetaInfo.cmake | 43 - nativelibs/cmake/modules/SummaryOutput.cmake | 35 - nativelibs/cmake/modules/TargetUtils.cmake | 386 ----- nativelibs/cmake/modules/TestUtils.cmake | 130 -- nativelibs/cmake/modules/Utils.cmake | 617 ------- nativelibs/include/atomui/CMakeLists.txt | 10 - nativelibs/include/atomui/Compiler.h | 1417 ----------------- nativelibs/include/atomui/Config.h.in | 31 - nativelibs/include/atomui/Global.h | 49 - .../include/atomui/ProcessorDetection.h | 389 ----- nativelibs/include/atomui/SystemDetection.h | 222 --- nativelibs/include/atomui/WindowUtils.h | 30 - .../include/atomui/bridge/WindowUtils.h | 27 - nativelibs/include/atomui/xmake.lua | 8 - nativelibs/src/CMakeLists.txt | 37 - nativelibs/src/Global.cpp | 20 - nativelibs/src/WindowUtils.cpp | 10 - nativelibs/src/bridge/WindowUtils.cpp | 23 - nativelibs/src/linux/WindowUtils.cpp | 186 --- nativelibs/src/macos/WindowUtils.mm | 126 -- nativelibs/src/windows/WindowUtils.cpp | 55 - nativelibs/src/xmake.lua | 31 - nativelibs/tests/unittests/xmake.lua | 8 - nativelibs/xmake.lua | 70 - .../xmake/modules/handle_info_summary.lua | 20 - .../xmake/modules/handle_require_packages.lua | 12 - nativelibs/xmake/modules/header_defines.lua | 31 - nativelibs/xmake/modules/summary_output.lua | 25 - nativelibs/xmake/options.lua | 15 - nativelibs/xmake/toolchains/atomui/check.lua | 147 -- nativelibs/xmake/toolchains/atomui/xmake.lua | 135 -- references/Code Style.md | 22 - references/docfx.json | 46 - references/index.md | 0 references/toc.yml | 2 - scripts/PublishToLocalSources.ps1 | 29 +- .../Buttons/Themes/ButtonThemes.axaml | 2 +- src/AtomUI.Controls/Dialog/Dialog.cs | 97 +- src/AtomUI.Controls/Dialog/DialogHost.cs | 122 +- src/AtomUI.Controls/Dialog/IDialogHost.cs | 1 - .../Dialog/OverlayDialogHost.cs | 5 - .../Dialog/Themes/DialogHostTheme.axaml | 17 + .../Dialog/Themes/DialogThemes.axaml | 1 + .../Window/Themes/WindowTheme.axaml | 83 +- .../Window/Themes/WindowTheme.cs | 7 + .../Window/Themes/WindowThemes.axaml | 8 +- src/AtomUI.Native/AtomUI.Native.csproj | 112 -- src/AtomUI.Native/Interop/WindowUtilsImpl.cs | 36 - src/AtomUI.Native/WindowUtils.cs | 61 - 64 files changed, 257 insertions(+), 5724 deletions(-) delete mode 100644 .github/workflows/release-atomui-native.yml delete mode 100644 azure-pipelines.yml delete mode 100644 build/AtomUINativePackageInfo.props delete mode 100644 build/Internal.Using.props delete mode 100644 nativelibs/.gitignore delete mode 100644 nativelibs/.vscode/launch.json delete mode 100644 nativelibs/.vscode/settings.json delete mode 100644 nativelibs/.vscode/tasks.json delete mode 100644 nativelibs/CMakeLists.txt delete mode 100644 nativelibs/cmake/modules/AddCustomCommandTarget.cmake delete mode 100644 nativelibs/cmake/modules/FindGoogleTest.cmake delete mode 100644 nativelibs/cmake/modules/HandleAppPath.cmake delete mode 100644 nativelibs/cmake/modules/HandleRequirePackages.cmake delete mode 100644 nativelibs/cmake/modules/ImportThirdparty.cmake delete mode 100644 nativelibs/cmake/modules/MetaInfo.cmake delete mode 100644 nativelibs/cmake/modules/SummaryOutput.cmake delete mode 100644 nativelibs/cmake/modules/TargetUtils.cmake delete mode 100644 nativelibs/cmake/modules/TestUtils.cmake delete mode 100644 nativelibs/cmake/modules/Utils.cmake delete mode 100644 nativelibs/include/atomui/CMakeLists.txt delete mode 100644 nativelibs/include/atomui/Compiler.h delete mode 100644 nativelibs/include/atomui/Config.h.in delete mode 100644 nativelibs/include/atomui/Global.h delete mode 100644 nativelibs/include/atomui/ProcessorDetection.h delete mode 100644 nativelibs/include/atomui/SystemDetection.h delete mode 100644 nativelibs/include/atomui/WindowUtils.h delete mode 100644 nativelibs/include/atomui/bridge/WindowUtils.h delete mode 100644 nativelibs/include/atomui/xmake.lua delete mode 100644 nativelibs/src/CMakeLists.txt delete mode 100644 nativelibs/src/Global.cpp delete mode 100644 nativelibs/src/WindowUtils.cpp delete mode 100644 nativelibs/src/bridge/WindowUtils.cpp delete mode 100644 nativelibs/src/linux/WindowUtils.cpp delete mode 100644 nativelibs/src/macos/WindowUtils.mm delete mode 100644 nativelibs/src/windows/WindowUtils.cpp delete mode 100644 nativelibs/src/xmake.lua delete mode 100644 nativelibs/tests/unittests/xmake.lua delete mode 100644 nativelibs/xmake.lua delete mode 100644 nativelibs/xmake/modules/handle_info_summary.lua delete mode 100644 nativelibs/xmake/modules/handle_require_packages.lua delete mode 100644 nativelibs/xmake/modules/header_defines.lua delete mode 100644 nativelibs/xmake/modules/summary_output.lua delete mode 100644 nativelibs/xmake/options.lua delete mode 100644 nativelibs/xmake/toolchains/atomui/check.lua delete mode 100644 nativelibs/xmake/toolchains/atomui/xmake.lua delete mode 100644 references/Code Style.md delete mode 100644 references/docfx.json delete mode 100644 references/index.md delete mode 100644 references/toc.yml create mode 100644 src/AtomUI.Controls/Dialog/Themes/DialogHostTheme.axaml create mode 100644 src/AtomUI.Controls/Window/Themes/WindowTheme.cs delete mode 100644 src/AtomUI.Native/AtomUI.Native.csproj delete mode 100644 src/AtomUI.Native/Interop/WindowUtilsImpl.cs delete mode 100644 src/AtomUI.Native/WindowUtils.cs diff --git a/.github/workflows/release-atomui-native.yml b/.github/workflows/release-atomui-native.yml deleted file mode 100644 index cdab69179..000000000 --- a/.github/workflows/release-atomui-native.yml +++ /dev/null @@ -1,243 +0,0 @@ -name: AtomUI.Native Release Pipeline -on: - workflow_dispatch: - inputs: - TargetBranch: - description: 'Target branch to build' - type: string - default: 'develop' - BuildConfiguration: - description: 'Build configuration' - type: string - default: 'Release' - PublishToNuget: - description: 'Publish to nuget.org' - type: boolean - default: false -env: - SOURCE_DIR: ${{ github.workspace }} - NATIVE_LIB_SRC_DIR: ${{ github.workspace }}/nativelibs - BUILD_DIR: ${{ github.workspace }}/build - BASE_OUTPUT_DIR: ${{ github.workspace }}/output - MAC_OUTPUT_DIR: ${{ github.workspace }}/osx - LINUX_OUTPUT_DIR: ${{ github.workspace }}/linux - WIN_ARM64_OUTPUT_DIR: ${{ github.workspace }}/win_arm64 - LOCAL_NUGET_DIR: ${{ github.workspace }}/nuget -jobs: - BuildAtomUINativeLinux: - name: Build AtomUINative for Linux X86_64 - runs-on: qinware-ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4.2.2 - with: - ref: ${{ inputs.TargetBranch }} - - name: Install dependencies - run: | - sudo apt update - sudo apt install -y build-essential libxcb1-dev libxcb-shape0-dev - wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | \ - gpg --dearmor - | \ - sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null - echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ noble main" | \ - sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null - sudo apt update - sudo apt install -y cmake - cmake --version - sudo apt install clang - clang --version - - name: Build for x86_64 - run: | - cmake -B $BUILD_DIR -S $NATIVE_LIB_SRC_DIR -DCMAKE_INSTALL_PREFIX="$LINUX_OUTPUT_DIR" -DCMAKE_BUILD_TYPE=${{ inputs.BuildConfiguration }} - cmake --build $BUILD_DIR - cmake --install $BUILD_DIR --config ${{ inputs.BuildConfiguration }} - - name: Upload linux x86_64 artifact - id: artifact - uses: actions/upload-artifact@v4.6.2 - with: - name: AtomUINativeLinux - path: ${{ env.LINUX_OUTPUT_DIR }} - BuildAtomUINativeMacOS: - name: Build AtomUINative for macOS - runs-on: macos-latest - steps: - - name: Checkout code - uses: actions/checkout@v4.2.2 - with: - ref: ${{ inputs.TargetBranch }} - - name: Install dependencies - run: | - brew install cmake - brew install ninja - cmake --version - - name: Build for Universal binary - run: | - cmake -B $BUILD_DIR -S $NATIVE_LIB_SRC_DIR -DCMAKE_INSTALL_PREFIX="$MAC_OUTPUT_DIR" -DCMAKE_BUILD_TYPE=${{ inputs.BuildConfiguration }} -G Ninja -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" - cmake --build $BUILD_DIR - cmake --install $BUILD_DIR --config ${{ inputs.BuildConfiguration }} - - name: Upload macOS artifact - id: artifact - uses: actions/upload-artifact@v4.6.2 - with: - name: AtomUINativeMac - path: ${{ env.MAC_OUTPUT_DIR }} - BuildAtomUINativeWindowsArm64: - name: Build AtomUINative for Windows Arm64 - runs-on: windows-11-arm - steps: - - name: Checkout code - uses: actions/checkout@v4.2.2 - with: - ref: ${{ inputs.TargetBranch }} - - name: Setup MSYS2 environment - shell: pwsh - run: | - $systemPath="C:/" - $msysPath = "C:/msys64" - - # Download and install Msys2 for ARM64 - $installerUrl = "https://github.com/msys2/msys2-installer/releases/download/2025-06-22/msys2-base-x86_64-20250622.tar.xz" - $installerPath = "$env:TEMP\msys2-arm64.tar.xz" - - # Download the installer - Invoke-WebRequest -Uri $installerUrl -OutFile $installerPath - - # Extract Msys2 - $tarPath = "$env:TEMP\msys2-arm64.tar" - # Extract using 7-Zip (available on GitHub runners) - & 7z e "$installerPath" -o"$env:TEMP" -y - & 7z x "$tarPath" -o"$systemPath" -y - $bashPath = Join-Path $msysPath "usr\bin\bash.exe" - - # Initialize Msys2 - & $bashPath -lc "pacman-key --init" - & $bashPath -lc "pacman-key --populate msys2" - - # 更新系统 (分两步执行更可靠) - & $bashPath -lc "pacman -Syuu --noconfirm --needed --noprogressbar" - & $bashPath -lc "pacman -Su --noconfirm --needed --noprogressbar" - - $env:MSYSTEM = "CLANGARM64" - $env:MSYSTEM_CARCH = "aarch64" - $env:MSYSTEM_CHOST = "aarch64-w64-mingw32" - $env:MSYSTEM_PREFIX = "/clangarm64" - $env:CHERE_INVOKING = "1" - $env:PATH = "$msysPath/clangarm64/bin;$msysPath/usr/bin;$env:PATH" - - # Update PATH for subsequent steps - Add-Content $env:GITHUB_PATH "$msysPath/clangarm64/bin" - Add-Content $env:GITHUB_PATH "$msysPath/usr/bin" - - Write-Host "Msys2 installed and initialized successfully" - - # Install required packages - & "$bashPath" -lc "pacman -S mingw-w64-clang-aarch64-clang --noconfirm" - & "$bashPath" -lc "pacman -S mingw-w64-clang-aarch64-cmake --noconfirm" - - - name: Build for Windows Arm64 - run: | - New-Item -Path "$env:BUILD_DIR" -ItemType Directory -Force - cmake -B "$env:BUILD_DIR" -S "$env:NATIVE_LIB_SRC_DIR" -DCMAKE_INSTALL_PREFIX="$env:WIN_ARM64_OUTPUT_DIR" -DCMAKE_BUILD_TYPE=${{ inputs.BuildConfiguration }} -G Ninja - cmake --build "$env:BUILD_DIR" - cmake --install "$env:BUILD_DIR" --config ${{ inputs.BuildConfiguration }} - - name: Upload Windows Arm64 artifact - id: artifact - uses: actions/upload-artifact@v4.6.2 - with: - name: AtomUINativeWindowsArm64 - path: ${{ env.WIN_ARM64_OUTPUT_DIR }} - BuildAtomUINuget: - name: Build AtomUI NuGet packages - runs-on: windows-latest - needs: - - BuildAtomUINativeMacOS - - BuildAtomUINativeLinux - - BuildAtomUINativeWindowsArm64 - steps: - - name: Checkout code - uses: actions/checkout@v4.2.2 - with: - ref: ${{ inputs.TargetBranch }} - - name: Download macOS artifact - uses: actions/download-artifact@v4.3.0 - with: - name: AtomUINativeMac - path: ${{ env.MAC_OUTPUT_DIR }} - - name: Download Linux artifact - uses: actions/download-artifact@v4.3.0 - with: - name: AtomUINativeLinux - path: ${{ env.Linux_OUTPUT_DIR }} - - name: Download Windows Arm64 artifact - uses: actions/download-artifact@v4.3.0 - with: - name: AtomUINativeWindowsArm64 - path: ${{ env.WIN_ARM64_OUTPUT_DIR }} - - name: Setup MSYS2 environment - shell: pwsh - run: | - $msysPath = "C:/msys64" - $env:MSYSTEM = "CLANG64" - $env:MSYSTEM_CARCH = "x86_64" - $env:MSYSTEM_CHOST = "x86_64-w64-mingw32" - $env:MSYSTEM_PREFIX = "/clang64" - $env:CHERE_INVOKING = "1" - $env:PATH = "$msysPath/clang64/bin;$msysPath/usr/bin;$env:PATH" - - # Update PATH for subsequent steps - Add-Content $env:GITHUB_PATH "$msysPath/clang64/bin" - Add-Content $env:GITHUB_PATH "$msysPath/usr/bin" - - # Install required packages - & "$msysPath/usr/bin/bash.exe" -lc @" - pacman -Sy --noconfirm - pacman -S mingw-w64-clang-x86_64-cmake --noconfirm - pacman -S mingw-w64-clang-x86_64-clang --noconfirm - "@ - - # Verify installations - cmake --version - clang --version - - name: Build AtomUI Native projects - shell: pwsh - run: | - # Build AtomUI Native project - dotnet build --configuration ${{ inputs.BuildConfiguration }} "./src/AtomUI.Native/AtomUI.Native.csproj" - # Copy native library to runtime directory - $osxNativeLibDir = "$env:SOURCE_DIR/output/Bin/${{ inputs.BuildConfiguration }}/runtimes/osx/native" - New-Item -ItemType Directory -Force -Path $osxNativeLibDir - Copy-Item -Path $env:MAC_OUTPUT_DIR/lib/libAtomUINative.dylib -Destination $osxNativeLibDir - - $linuxNativeLibDir = "$env:SOURCE_DIR/output/Bin/${{ inputs.BuildConfiguration }}/runtimes/linux-x64/native" - New-Item -ItemType Directory -Force -Path $linuxNativeLibDir - Copy-Item -Path $env:LINUX_OUTPUT_DIR/lib/libAtomUINative.so -Destination $linuxNativeLibDir - - $winArm64NativeLibDir = "$env:SOURCE_DIR/output/Bin/${{ inputs.BuildConfiguration }}/runtimes/win-arm64/native" - New-Item -ItemType Directory -Force -Path $winArm64NativeLibDir - Copy-Item -Path $env:WIN_ARM64_OUTPUT_DIR/bin/AtomUINative.dll -Destination $winArm64NativeLibDir - - - name: Create AtomUI Native NuGet packages - shell: pwsh - run: | - dotnet pack --no-build --output $env:BASE_OUTPUT_DIR --configuration ${{ inputs.BuildConfiguration }} "./src/AtomUI.Native/AtomUI.Native.csproj" - - name: Upload NuGet artifacts - uses: actions/upload-artifact@v4.6.2 - with: - name: NuGetPackages - path: ${{ env.BASE_OUTPUT_DIR }}/*.nupkg - - name: Publish to nuget.org - if: ${{ inputs.PublishToNuget == true }} - shell: pwsh - run: | - $packages = Get-ChildItem -Path $env:BASE_OUTPUT_DIR -Filter *.nupkg -Recurse -File - foreach ($pkg in $packages) { - try { - dotnet nuget push $pkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate - if ($LASTEXITCODE -ne 0) { - Write-Warning "pushed nuget package: $($pkg.Name)" - } - } - catch { - Write-Error "push $($pkg.Name) error: $_" - } - } diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 50360c173..000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,111 +0,0 @@ -trigger: none -pr: none - -variables: - SourceDir: $(Build.SourcesDirectory) - NativeLibSrcDir: '$(sourceDir)/nativelibs' - BuildDir: $(Build.BinariesDirectory) - BaseOutputDir: '$(Build.ArtifactStagingDirectory)/output' - MacOutputDir: '$(baseOutputDir)/osx' - WinOutputDir: '$(baseOutputDir)/windows' - Win64Output: '$(winOutputDir)/win-x64' - Win32Output: '$(winOutputDir)/win-x86' -parameters: - - name: IsNightlyBuild - displayName: 'Is it a nightly build:' - type: boolean - default: false - - name: BuildConfiguration - displayName: 'Build configuration:' - type: string - default: "Release" - -stages: - - stage: - jobs: - - job: BuildAtomUINativeMacOS - displayName: "Build AtomUINative for macOS" - pool: - vmImage: 'macOS-latest' - steps: - - pwsh: | - brew install xmake - xmake --version - clang --version - xmake config --project=$(nativeLibSrcDir) --builddir=$(buildDir) -p macosx -a arm64 -m ${{ parameters.BuildConfiguration }} - xmake build - xmake install --installdir=$(macOutputDir) - xmake config --project=$(nativeLibSrcDir) --builddir=$(buildDir) -p macosx -a x86_64 -m ${{ parameters.BuildConfiguration }} - xmake build - xmake install --installdir=$(macOutputDir) - Write-Output "generate universal binary" - New-Item -Path "$(macOutputDir)/lib" -ItemType Directory -Force - lipo -create $(macOutputDir)/arm64/lib/libAtomUINative.dylib $(macOutputDir)/x86_64/lib/libAtomUINative.dylib -output $(macOutputDir)/lib/libAtomUINative.dylib - dir "$(macOutputDir)" -File - lipo -info $(macOutputDir)/lib/libAtomUINative.dylib - Remove-Item -Path "$(macOutputDir)/arm64/lib/libAtomUINative.dylib" - Remove-Item -Path "$(macOutputDir)/x86_64/lib/libAtomUINative.dylib" - displayName: "Build AtomUINative" - - task: PublishPipelineArtifact@1 - inputs: - targetPath: $(macOutputDir) - artifactName: AtomUINativeMac - displayName: "Push libAtomUINative.dylib to pipeline" - - job: BuildAtomUINuget - displayName: "Build AtomUI nupkg" - pool: - vmImage: 'windows-latest' - steps: - - task: DownloadPipelineArtifact@2 - inputs: - artifact: AtomUINativeMac - displayName: "Download libAtomUINative.dylib to pipeline" - - pwsh: | - $msysPath = "C:/msys64" - $env:MSYSTEM = "CLANG64" - $env:MSYSTEM_CARCH = "x86_64" - $env:MSYSTEM_CHOST = "x86_64-w64-mingw32" - $env:MSYSTEM_PREFIX = "/clang64" - $env:CHERE_INVOKING = "1" - $env:PATH = "$msysPath/clang64/bin;$msysPath/usr/bin;$env:PATH" - Write-Host "##vso[task.setvariable variable=MSYSTEM]CLANG64" - Write-Host "##vso[task.setvariable variable=MSYSTEM_CARCH]x86_64" - Write-Host "##vso[task.setvariable variable=MSYSTEM_CHOST]x86_64-w64-mingw32" - Write-Host "##vso[task.setvariable variable=MSYSTEM_PREFIX]/clang64" - Write-Host "##vso[task.prependpath]$msysPath/clang64/bin" - Write-Host "##vso[task.prependpath]$msysPath/usr/bin" - C:/msys64/usr/bin/bash.exe -lc @" - pacman -Sy --noconfirm - pacman -S mingw-w64-clang-x86_64-xmake --noconfirm - pacman -S mingw-w64-clang-x86_64-clang --noconfirm - "@ - xmake --version - clang --version - displayName: "Prepare Build environment" - - pwsh: | - dotnet build --configuration ${{ parameters.BuildConfiguration }} /p:IsNightlyBuild=${{ parameters.IsNightlyBuild }} $(SourceDir)/packages/AtomUI/AtomUI.csproj - $osxNativeLibDir = "$(SourceDir)/output/Bin/Release/runtimes/osx/native" - New-Item -ItemType Directory -Force -Path $osxNativeLibDir - Copy-Item -Path $(Pipeline.Workspace)/lib/libAtomUINative.dylib -Destination $osxNativeLibDir - dotnet build --configuration ${{ parameters.BuildConfiguration }} /p:IsNightlyBuild=${{ parameters.IsNightlyBuild }} $(SourceDir)/packages/AtomUI/AtomUI.csproj - displayName: "Build AtomUI projects" - - pwsh: | - $buildTimestamp = Get-Date -Format 'yyyyMMddHHmm' - dotnet pack --no-build --output $(Build.ArtifactStagingDirectory) --configuration ${{ parameters.BuildConfiguration }} /p:BuildTimestamp=$buildTimestamp /p:IsNightlyBuild=${{ parameters.IsNightlyBuild }} $(SourceDir)/packages/AtomUI/AtomUI.csproj - dotnet pack --no-build --output $(Build.ArtifactStagingDirectory) --configuration ${{ parameters.BuildConfiguration }} /p:BuildTimestamp=$buildTimestamp /p:IsNightlyBuild=${{ parameters.IsNightlyBuild }} $(SourceDir)/src/AtomUI.IconPkg.Generator/AtomUI.IconPkg.Generator.csproj - dotnet pack --no-build --output $(Build.ArtifactStagingDirectory) --configuration ${{ parameters.BuildConfiguration }} /p:BuildTimestamp=$buildTimestamp /p:IsNightlyBuild=${{ parameters.IsNightlyBuild }} $(SourceDir)/src/AtomUI.Generator/AtomUI.Generator.csproj - displayName: "Pack AtomUI Umbrella project" - - task: DotNetCoreCLI@2 - displayName: "Publish AtomUI project" - inputs: - command: "push" - nuGetFeedType: "internal" - packagesToPush: "$(Build.ArtifactStagingDirectory)/*.nupkg" - publishVstsFeed: "$(NuGetFeed)" - - task: PublishBuildArtifacts@1 - displayName: "Publish AtomUI project pipeline" - inputs: - PathtoPublish: "$(Build.ArtifactStagingDirectory)" - ArtifactName: "NuGetPackages" - TargetPath: "nugets" - dependsOn: BuildAtomUINativeMacOS \ No newline at end of file diff --git a/build/AtomUINativePackageInfo.props b/build/AtomUINativePackageInfo.props deleted file mode 100644 index 3100be47d..000000000 --- a/build/AtomUINativePackageInfo.props +++ /dev/null @@ -1,23 +0,0 @@ - - - AtomUINative.dll - libAtomUINative.dylib - libAtomUINative.so - $(AtomUINativeLinuxArtifactName) - $(AtomUINativeMacOSArtifactName) - $(AtomUINativeWindowsArtifactName) - $([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture) - $(CPUArchitecture.ToLower) - win-$(CPUArchitecture) - linux-$(CPUArchitecture) - osx - runtimes/win-x64/native - runtimes/win-arm64/native - runtimes/$(AtomUIWindowsRuntimeDir)/native - runtimes/linux-x64/native - runtimes/osx/native - $(AtomUINativeWindowsDeployPath) - $(AtomUINativeMacOSDeployPath) - $(AtomUINativeLinuxX64DeployPath) - - \ No newline at end of file diff --git a/build/Internal.Using.props b/build/Internal.Using.props deleted file mode 100644 index 8a70f348e..000000000 --- a/build/Internal.Using.props +++ /dev/null @@ -1,5 +0,0 @@ - - - $(DefineConstants);INTERNAL_USING - - \ No newline at end of file diff --git a/build/Version.props b/build/Version.props index 636e807e1..48f53955d 100644 --- a/build/Version.props +++ b/build/Version.props @@ -3,10 +3,6 @@ $(NoWarn);CS7035 11.3.5 1.0.0-alpha.2 - 0.1.1 - - - - $(AtomUIVersion) + 0.1.2 \ No newline at end of file diff --git a/nativelibs/.gitignore b/nativelibs/.gitignore deleted file mode 100644 index 879e3ebaf..000000000 --- a/nativelibs/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.xmake/ -build/ -.vscode/.cache/ -.vscode/compile_commands.json \ No newline at end of file diff --git a/nativelibs/.vscode/launch.json b/nativelibs/.vscode/launch.json deleted file mode 100644 index c7883ff61..000000000 --- a/nativelibs/.vscode/launch.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - "name": "xmake Debug", - "type": "lldb", - "request": "launch", - "args": [], - "cwd": "${workspaceRoot}", - "program": "${workspaceRoot}/build/macosx/arm64/debug/test", - "preLaunchTask": "xmake build debug" - }, - { - "name": "Run via xmake", - "type": "node", - "request": "launch", - "runtimeExecutable": "xmake", - "runtimeArgs": [ - "run", - "test", - "-m", "debug" - ], - "cwd": "${workspaceFolder}", - "console": "integratedTerminal", - "preLaunchTask": "xmake build debug" - } - ] -} \ No newline at end of file diff --git a/nativelibs/.vscode/settings.json b/nativelibs/.vscode/settings.json deleted file mode 100644 index 916a070c9..000000000 --- a/nativelibs/.vscode/settings.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - // 禁用 C/C++ 插件的 IntelliSense(避免冲突) - "C_Cpp.intelliSenseEngine": "disabled", - "C_Cpp.codeAnalysis.runAutomatically": false, - "C_Cpp.formatting": "disabled", - "C_Cpp.autoAddFileAssociations": false, - "C_Cpp.autocompleteAddParentheses": false, - "C_Cpp.autocomplete": "disabled", - "C_Cpp.errorSquiggles": "disabled", - - // clangd 配置 - "clangd.path": "clangd", - "clangd.syncFileEvents": true, - "clangd.arguments": [ - "--compile-commands-dir=.vscode", - "--background-index", - "--clang-tidy", - "--header-insertion=never" - ], - "clangd.fallbackFlags": ["-std=c++20"], // 默认编译标准 - "xmake.buildDirectory": "${workspaceRoot}/build", - "xmake.logLevel": "verbose", - - "editor.semanticHighlighting.enabled": true, - "editor.gotoLocation.alternativeDeclarationCommand": "editor.action.revealDefinition", - "editor.gotoLocation.alternativeDefinitionCommand": "editor.action.revealDefinition", - "editor.gotoLocation.alternativeTypeDefinitionCommand": "editor.action.revealDefinition", - "editor.selectionHighlight": false, - "files.autoSave": "onFocusChange", - "editor.suggest.snippetsPreventQuickSuggestions": false, - "editor.quickSuggestions": { - "other": "on", - "comments": "off", - "strings": "on" - } -} \ No newline at end of file diff --git a/nativelibs/.vscode/tasks.json b/nativelibs/.vscode/tasks.json deleted file mode 100644 index 487ad9d63..000000000 --- a/nativelibs/.vscode/tasks.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "tasks": [ - { - "label": "xmake config debug", - "type": "shell", - "command": "xmake", - "args": [ - "f", - "-v", - "-m", "debug", - "--toolchain=clang" - ], - "group": { - "kind": "none", - "isDefault": false - } - }, - { - "label": "xmake build debug", - "type": "shell", - "command": "xmake", - "args": ["build"], - "group": { - "kind": "build", - "isDefault": false - }, - "problemMatcher": "$gcc", - "dependsOn":["xmake config debug"] - } - ], - "version": "2.0.0" -} \ No newline at end of file diff --git a/nativelibs/CMakeLists.txt b/nativelibs/CMakeLists.txt deleted file mode 100644 index 2ea11f4e3..000000000 --- a/nativelibs/CMakeLists.txt +++ /dev/null @@ -1,90 +0,0 @@ -# This source file is part of the atomui project -# -# Copyright (c) 2017 - 2022 qinware, All rights reserved. -# Copyright (c) 2017 - 2022 chinboy -# -# See https://qinware.com/LICENSE.txt for license information -# -# Created by chinboy on 2025/01/10. - -cmake_minimum_required(VERSION 3.28) -set(CMAKE_DISABLE_IN_SOURCE_BUILD YES) -project(nativelibs) -enable_language(OBJCXX) -enable_language(CXX) -enable_language(C) -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) -set(CMAKE_CXX_VISIBILITY_PRESET hidden) -set(CMAKE_C_STANDARD 11) -set(CMAKE_OSX_DEPLOYMENT_TARGET 11) # 目前先支持到 11 -set_property(GLOBAL PROPERTY JOB_POOLS "${CMAKE_JOB_POOLS}") - -# setup some important path -set(ATOMUI_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") # --src-root -set(ATOMUI_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}") # --prefix -set(ATOMUI_CMAKE_MODULES_DIR "${ATOMUI_SOURCE_DIR}/cmake/modules") -set(ATOMUI_INCLUDE_DIR "${ATOMUI_SOURCE_DIR}/include") -set(ATOMUI_BINARY_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/include") # --includedir -set(ATOMUI_TEST_DIR "${ATOMUI_SOURCE_DIR}/tests") -set(ATOMUI_TEST_BIN_DIR "tests/bin") -set(ATOMUI_SYSTEM_NAME ${CMAKE_HOST_SYSTEM_NAME}) -string(TOLOWER ${ATOMUI_SYSTEM_NAME} ATOMUI_SYSTEM_NORMAL_NAME) - -# Add path for custom CMake modules. -list(APPEND CMAKE_MODULE_PATH - "${CMAKE_CURRENT_SOURCE_DIR}/cmake" - "${ATOMUI_CMAKE_MODULES_DIR}" -) - -include(MetaInfo) -include(FeatureSummary) - -project(${ATOMUI_PACKAGE_NAME} LANGUAGES C CXX - VERSION ${ATOMUI_VERSION_MAJOR}.${ATOMUI_VERSION_MINOR}.${ATOMUI_VERSION_PATCH}) - -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type" FORCE) -endif() - -if (CMAKE_BUILD_TYPE STREQUAL "Debug") - set(ATOMUI_DEBUG_BUILD ON) -endif() - -if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL Linux) - set(LINUX ON) -endif() - -string(TOLOWER ${CMAKE_BUILD_TYPE} ATOMUI_BUILD_TYPE) -if (CMAKE_BUILD_TYPE AND - NOT ATOMUI_BUILD_TYPE MATCHES "^(debug|release|relwithdebinfo|minsizerel)$") - message(FATAL_ERROR "Invalid value for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") -endif() - -option(ATOMUI_WITH_DEBUG_CMAKE "Enabled CMake project debugging functionality (e.g. source file disk checking)" OFF) -option(ATOMUI_BUILD_UNITTESTS "Generate build targets for the atomui library unittests." ON) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -include(Utils) -include(HandleRequirePackages) -include(HandleAppPath) -include(TargetUtils) -include(TestUtils) - -include_directories(${ATOMUI_SOURCE_DIR} - ${ATOMUI_INCLUDE_DIR} - ${ATOMUI_INCLUDE_DIR}/atomui - ${ATOMUI_BINARY_INCLUDE_DIR} - ${ATOMUI_BINARY_INCLUDE_DIR}/atomui - ${CMAKE_CURRENT_BINARY_DIR}) - -if (ATOMUI_BUILD_UNITTESTS) - enable_testing() -endif() - -add_subdirectory(include/atomui) -add_subdirectory(src) - -include(SummaryOutput) \ No newline at end of file diff --git a/nativelibs/cmake/modules/AddCustomCommandTarget.cmake b/nativelibs/cmake/modules/AddCustomCommandTarget.cmake deleted file mode 100644 index ca4453c54..000000000 --- a/nativelibs/cmake/modules/AddCustomCommandTarget.cmake +++ /dev/null @@ -1,173 +0,0 @@ -# This source file is part of the atomui project -# -# Copyright (c) 2017 - 2022 qinware, All rights reserved. -# Copyright (c) 2017 - 2022 chinboy -# -# See https://qinware.com/LICENSE.txt for license information -# -# Created by chinboy on 2025/01/10. - -include(CMakeParseArguments) -include(Utils) - -# Populate the variable 'args' in the parent scope with a keyword -# argument list. We read the variables options, ${k}_keyword, and -# ACCT_${k} from the parent scope, for each ${k} in the list of -# keyword names other than COMMAND accepted by -# add_custom_command_target. -# -# ${k}_keyword must expand to ${k} if ${k} was passed to -# add_custom_command_target, and be empty otherwise. -# -# ACCT_${k} must expand to the list of arguments to -# add_custom_command_target marked by ${k}, and be empty otherwise. -# -function(_make_acct_argument_list) - set(args) - foreach(k ${ARGN}) - if(${k} IN_LIST options) - list(APPEND args ${${k}_keyword}) - else() - list(APPEND args ${${k}_keyword} ${ACCT_${k}}) - endif() - endforeach() - set(args ${args} PARENT_SCOPE) -endfunction() - -# Add a custom command/target pair. Use this instead of -# add_custom_command because it provides proper dependency tracking -# when used with parallel builds and the 'Unix Makefiles' generator. -# See https://www.cmake.org/Bug/view.php?id=10082 -# -# The CMake documentation for add_custom_command quoth, -# -# "Do not list the output in more than one independent target that -# may build in parallel or the two instances of the rule may -# conflict (instead use add_custom_target to drive the command and -# make the other targets depend on that one)." -# -# This function implements the suggested pattern. -# -# add_custom_command_target( -# dependency_out_var_name -# -# COMMAND command1 [ARGS] [args1...] -# [COMMAND command2 [ARGS] [args2...] ...] -# -# OUTPUT output1 [output2 ...] -# [MAIN_DEPENDENCY depend] -# [DEPENDS [depends...]] -# [IMPLICIT_DEPENDS depend1 -# [ depend2] ...] -# [WORKING_DIRECTORY dir] -# [COMMENT comment] [VERBATIM] [APPEND] -# [ALL] -# [SOURCES src1 [src2...]]) -# -# dependency_out_var_name is the name of a variable, to be set in the -# parent scope with the name of a target that all targets using the -# OUTPUT should depend on. For example: -# -# add_custom_command_target( -# TheDependency -# COMMAND echo "int main() {}" ">" z.c -# OUTPUT z.c -# VERBATIM -# DEPENDS z.c.gyb) -# -# add_executable(exe1 z.c) -# add_dependencies(exe1 ${TheDependency}) -# add_executable(exe2 z.c) -# add_dependencies(exe2 ${TheDependency}) -# -# **Note1**: all COMMAND arguments must immediately follow -# dependency_out_var_name or this function will misbehave. -# -# **Note2**: any subdirectories that define targets dependent on -# OUTPUT ${o} should invoke: -# -# set_source_files_properties(${o} PROPERTIES GENERATED true) -# -# All arguments other than ALL, SOURCES, and dependency_out_var_name -# are forwarded to add_custom_command; arguments ALL, SOURCES, and -# WORKING_DIRECTORY are forwarded to add_custom_target. See the -# documentation of those functions for a description of all arguments. -# -# How This Function Works -# -# CMake offers one way to add new build rules: add_custom_command. -# Most people, however, overlook its actual semantics. -# add_custom_command does *not* create a target. The CMake -# documentation declareth, -# -# "A target created in the same directory (CMakeLists.txt file) that -# specifies any output of the custom command as a source file is -# given a rule to generate the file using the command at build -# time." -# -# Therefore, when two targets built in parallel depend on an output of -# the same custom command, they may race to rebuild that output. -# Hilarity ensues. You might not notice this effect depending on the -# generator you use, but it happens with 'Unix Makefiles'. -# -# By injecting a target into the dependency graph between the custom -# command output and any targets that depend on that output, we force -# the output to be built before starting on any of its dependent -# targets. - -function(add_custom_command_target dependency_out_var_name) - # Parse the arguments. We don't look for COMMAND arguments because - # they don't follow the pattern supported by cmake_parse_arguments. - # As a result, they end up in ACCT_UNPARSED_ARGUMENTS and are - # forwarded verbatim. - set(options ALL VERBATIM APPEND IDEMPOTENT EXCLUDE_FROM_ALL) - set(single_value_args - MAIN_DEPENDENCY WORKING_DIRECTORY COMMENT CUSTOM_TARGET_NAME) - set(multi_value_args OUTPUT DEPENDS IMPLICIT_DEPENDS SOURCES) - cmake_parse_arguments( - ACCT # prefix - "${options}" "${single_value_args}" "${multi_value_args}" ${ARGN}) - set(ACCT_COMMANDS ${ACCT_UNPARSED_ARGUMENTS}) - - if("${ACCT_CUSTOM_TARGET_NAME}" STREQUAL "") - # CMake doesn't allow '/' characters in filenames, so replace them with '-' - list(GET ACCT_OUTPUT 0 output_filename) - string(REPLACE "${CMAKE_BINARY_DIR}/" "" target_name "${output_filename}") - string(REPLACE "${CMAKE_SOURCE_DIR}/" "" target_name "${target_name}") - string(REPLACE "${CMAKE_CFG_INTDIR}/" "" target_name "${target_name}") - string(REPLACE "/" "-" target_name "${target_name}") - else() - set(target_name "${ACCT_CUSTOM_TARGET_NAME}") - endif() - - if((NOT ACCT_IDEMPOTENT) OR (ACCT_IDEMPOTENT AND NOT TARGET "${target_name}")) - # For each keyword argument k that was passed to this function, set - # ${k}_keyword to ${k}. That will allow us to use the incantation - # '${${k}_keyword} ${ACCT_${k}}' to forward the arguments on. - foreach(var ${options} ${single_value_args} ${multi_value_args}) - atomui_translate_flag(ACCT_${var} ${var} ${var}_keyword) - endforeach() - - _make_acct_argument_list( - OUTPUT MAIN_DEPENDENCY DEPENDS - IMPLICIT_DEPENDS WORKING_DIRECTORY COMMENT VERBATIM APPEND) - add_custom_command(${ACCT_COMMANDS} ${args}) - - _make_acct_argument_list(ALL WORKING_DIRECTORY SOURCES) - add_custom_target( - "${target_name}" ${args} - DEPENDS ${ACCT_OUTPUT} - COMMENT "${ACCT_OUTPUT}") - set_target_properties( - "${target_name}" PROPERTIES - FOLDER "add_custom_command_target artifacts") - if (ACCT_EXCLUDE_FROM_ALL) - set_target_properties( - "${target_name}" PROPERTIES - EXCLUDE_FROM_ALL TRUE) - endif() - endif() - - # "Return" the name of the custom target - set("${dependency_out_var_name}" "${target_name}" PARENT_SCOPE) -endfunction() \ No newline at end of file diff --git a/nativelibs/cmake/modules/FindGoogleTest.cmake b/nativelibs/cmake/modules/FindGoogleTest.cmake deleted file mode 100644 index 2839a6b89..000000000 --- a/nativelibs/cmake/modules/FindGoogleTest.cmake +++ /dev/null @@ -1,125 +0,0 @@ -# This source file is part of the atomui project -# -# Copyright (c) 2017 - 2022 qinware, All rights reserved. -# Copyright (c) 2017 - 2022 chinboy -# -# See https://qinware.com/LICENSE.txt for license information -# -# Created by chinboy on 2025/01/10. -# -# FindGoogleTest -# ----------------- -# -# Try to locate the GoogleTest source files, and then build them as a -# static library. -# -# The ``GOOGLETEST_DIR`` (CMake or Environment) variable should be used -# to pinpoint the GoogleTest source files. -# -# If found, this will define the following variables: -# -# ``GoogleTest_FOUND`` -# True if the GoogleTest source package has been found. -# -# ``GoogleTest`` -# Target compiled as static library. -# - -find_path(GOOGLE_TEST_INCLUDE_DIR - NAMES gtest/gtest.h - PATH_SUFFIXES googletest/include - HINTS - "${GOOGLETEST_DIR}" ENV GOOGLETEST_DIR - "${PROJECT_SOURCE_DIR}/googletest" - "${PROJECT_SOURCE_DIR}/../googletest" - "${PROJECT_SOURCE_DIR}/../../googletest" - "${PROJECT_SOURCE_DIR}/thirdparty/googletest" -) - -find_path(GOOGLE_TEST_SRC_ALL - NAMES gtest-all.cc - PATH_SUFFIXES googletest/src - HINTS - "${GOOGLETEST_DIR}" ENV GOOGLETEST_DIR - "${PROJECT_SOURCE_DIR}/googletest" - "${PROJECT_SOURCE_DIR}/../googletest" - "${PROJECT_SOURCE_DIR}/../../googletest" - "${PROJECT_SOURCE_DIR}/thirdparty/googletest" -) - -find_path(GOOGLE_MOCK_INCLUDE_DIR - NAMES gmock/gmock.h - PATH_SUFFIXES googlemock/include - HINTS - "${GOOGLETEST_DIR}" ENV GOOGLETEST_DIR - "${PROJECT_SOURCE_DIR}/googletest" - "${PROJECT_SOURCE_DIR}/../googletest" - "${PROJECT_SOURCE_DIR}/../../googletest" - "${PROJECT_SOURCE_DIR}/thirdparty/googletest" -) - -find_path(GOOGLE_MOCK_SRC_ALL - NAMES gmock-all.cc - PATH_SUFFIXES googlemock/src - HINTS - "${GOOGLETEST_DIR}" ENV GOOGLETEST_DIR - "${PROJECT_SOURCE_DIR}/googletest" - "${PROJECT_SOURCE_DIR}/../googletest" - "${PROJECT_SOURCE_DIR}/../../googletest" - "${PROJECT_SOURCE_DIR}/thirdparty/googletest" -) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(GoogleTest - DEFAULT_MSG - GOOGLE_TEST_INCLUDE_DIR GOOGLE_MOCK_INCLUDE_DIR - GOOGLE_TEST_SRC_ALL GOOGLE_MOCK_SRC_ALL -) -find_package(Threads REQUIRED) - -if(GoogleTest_FOUND AND NOT TARGET GoogleTest) - add_library(GoogleTest STATIC - "${GOOGLE_TEST_SRC_ALL}/gtest-all.cc" - "${GOOGLE_MOCK_SRC_ALL}/gmock-all.cc" - ) - target_include_directories(GoogleTest - PUBLIC - "${GOOGLE_TEST_INCLUDE_DIR}" - "${GOOGLE_MOCK_INCLUDE_DIR}" - PRIVATE - "${GOOGLE_TEST_SRC_ALL}/.." - "${GOOGLE_MOCK_SRC_ALL}/.." - ) - target_compile_definitions(GoogleTest - PRIVATE - GTEST_HAS_STD_INITIALIZER_LIST_ - GTEST_LANG_CXX11 - GTEST_HAS_STD_TUPLE_ - GTEST_HAS_STD_TYPE_TRAITS_ - GTEST_HAS_STD_FUNCTION_ - GTEST_HAS_RTTI - GTEST_HAS_STD_BEGIN_AND_END_ - GTEST_HAS_STD_UNIQUE_PTR_ - GTEST_HAS_EXCEPTIONS - GTEST_HAS_STREAM_REDIRECTION - GTEST_HAS_TYPED_TEST - GTEST_HAS_TYPED_TEST_P - GTEST_HAS_PARAM_TEST - GTEST_HAS_DEATH_TEST - ) - set_target_properties(GoogleTest PROPERTIES AUTOMOC OFF AUTOUIC OFF) - set_property(TARGET GoogleTest PROPERTY POSITION_INDEPENDENT_CODE ON) - target_compile_definitions(GoogleTest PUBLIC GOOGLE_TEST_IS_FOUND) - target_link_libraries(GoogleTest Threads::Threads) -endif() - -mark_as_advanced( - GOOGLE_TEST_INCLUDE_DIR - GOOGLE_MOCK_INCLUDE_DIR - GOOGLE_TEST_SRC_ALL - GOOGLE_MOCK_SRC_ALL) - -include(FeatureSummary) -set_package_properties(GoogleTest PROPERTIES - URL "https://github.com/google/googletest" - DESCRIPTION "Google Testing and Mocking Framework") \ No newline at end of file diff --git a/nativelibs/cmake/modules/HandleAppPath.cmake b/nativelibs/cmake/modules/HandleAppPath.cmake deleted file mode 100644 index 2b00e0e7f..000000000 --- a/nativelibs/cmake/modules/HandleAppPath.cmake +++ /dev/null @@ -1,53 +0,0 @@ -# This source file is part of the atomui project -# -# Copyright (c) 2017 - 2022 qinware, All rights reserved. -# Copyright (c) 2017 - 2022 chinboy -# -# See https://qinware.com/LICENSE.txt for license information -# -# Created by chinboy on 2025/01/10. - -if (WIN32) - set(_ATOMUI_APP_PATH "bin") - set(_ATOMUI_APP_TARGET "${ATOMUI_PACKAGE_NAME}") - - set(_ATOMUI_LIBRARY_BASE_PATH "lib") - set(_ATOMUI_LIBRARY_PATH "${_ATOMUI_LIBRARY_BASE_PATH}") - set(_ATOMUI_LIBEXEC_PATH "bin") - set(_ATOMUI_DATA_PATH "share/${ATOMUI_PACKAGE_NAME}") - set(_ATOMUI_BIN_PATH "bin") - set(_ATOMUI_LIBRARY_ARCHIVE_PATH "${_ATOMUI_BIN_PATH}") -else () - include(GNUInstallDirs) - set(_ATOMUI_APP_PATH "${CMAKE_INSTALL_BINDIR}") - set(_ATOMUI_APP_TARGET "${ATOMUI_PACKAGE_NAME}") - set(_ATOMUI_LIBRARY_BASE_PATH "lib") # 暂时写死 - set(_ATOMUI_LIBRARY_PATH "${_ATOMUI_LIBRARY_BASE_PATH}") - set(_ATOMUI_LIBEXEC_PATH "${CMAKE_INSTALL_LIBEXECDIR}") - set(_ATOMUI_DATA_PATH "${CMAKE_INSTALL_DATAROOTDIR}/${ATOMUI_PACKAGE_NAME}") - set(_ATOMUI_BIN_PATH "${CMAKE_INSTALL_BINDIR}") - set(_ATOMUI_LIBRARY_ARCHIVE_PATH "${_ATOMUI_LIBRARY_PATH}") -endif () - -if (APPLE) - set(_RPATH_BASE "@executable_path") - set(_LIB_RPATH "@loader_path") -elseif (WIN32) - set(_RPATH_BASE "") - set(_LIB_RPATH "") -else () - set(_RPATH_BASE "\$ORIGIN") - set(_LIB_RPATH "\$ORIGIN;") -endif () - -set(ATOMUI_APP_PATH "${_ATOMUI_APP_PATH}") # The target path of the ATOMUI application (relative to CMAKE_INSTALL_PREFIX). -set(ATOMUI_APP_TARGET "${_ATOMUI_APP_TARGET}") # The ATOMUI application name. -set(ATOMUI_LIBRARY_BASE_PATH "${_ATOMUI_LIBRARY_BASE_PATH}") # The ATOMUI library base path (relative to CMAKE_INSTALL_PREFIX). -set(ATOMUI_LIBRARY_PATH "${_ATOMUI_LIBRARY_PATH}") # The ATOMUI library path (relative to CMAKE_INSTALL_PREFIX). -set(ATOMUI_LIBRARY_ARCHIVE_PATH "${_ATOMUI_LIBRARY_ARCHIVE_PATH}") # The ATOMUI library archive path (relative to CMAKE_INSTALL_PREFIX). -set(ATOMUI_LIBEXEC_PATH "${_ATOMUI_LIBEXEC_PATH}") # The ATOMUI libexec path (relative to CMAKE_INSTALL_PREFIX). -set(ATOMUI_DATA_PATH "${_ATOMUI_DATA_PATH}") # The ATOMUI data path (relative to CMAKE_INSTALL_PREFIX). -set(ATOMUI_BIN_PATH "${_ATOMUI_BIN_PATH}") # The ATOMUI bin path (relative to CMAKE_INSTALL_PREFIX). - -file(RELATIVE_PATH RELATIVE_LIBEXEC_PATH "/${ATOMUI_BIN_PATH}" "/${ATOMUI_LIBEXEC_PATH}") -file(RELATIVE_PATH RELATIVE_DATA_PATH "/${ATOMUI_BIN_PATH}" "/${ATOMUI_DATA_PATH}") \ No newline at end of file diff --git a/nativelibs/cmake/modules/HandleRequirePackages.cmake b/nativelibs/cmake/modules/HandleRequirePackages.cmake deleted file mode 100644 index f2f502c6d..000000000 --- a/nativelibs/cmake/modules/HandleRequirePackages.cmake +++ /dev/null @@ -1,42 +0,0 @@ -# This source file is part of the atomui project -# -# Copyright (c) 2017 - 2022 qinware, All rights reserved. -# Copyright (c) 2017 - 2022 chinboy -# -# See https://qinware.com/LICENSE.txt for license information -# -# Created by chinboy on 2025/01/10. - -if (APPLE) - find_library(FWCoreFoundation CoreFoundation) - find_library(FWCoreServices CoreServices) - find_library(FWFoundation Foundation) - find_library(FWAppKit AppKit) - find_library(FWIOKit IOKit) - find_library(FWSecurity Security) - find_library(FWSystemConfiguration SystemConfiguration) - find_library(FWWebKit WebKit) -endif() - -if(LINUX) - # 查找必需的 XCB 组件 - find_package(PkgConfig REQUIRED) - pkg_check_modules(XCB REQUIRED IMPORTED_TARGET - xcb - xcb-shape - ) -endif() - -if(WIN32) - # 设置共享库不添加前缀 - set(CMAKE_SHARED_LIBRARY_PREFIX "") - set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") - - # 设置静态库不添加前缀 - set(CMAKE_STATIC_LIBRARY_PREFIX "") - set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib") - - # 可选:确保导入库也保持一致命名 - set(CMAKE_IMPORT_LIBRARY_PREFIX "") - set(CMAKE_IMPORT_LIBRARY_SUFFIX ".lib") -endif() \ No newline at end of file diff --git a/nativelibs/cmake/modules/ImportThirdparty.cmake b/nativelibs/cmake/modules/ImportThirdparty.cmake deleted file mode 100644 index b0c790721..000000000 --- a/nativelibs/cmake/modules/ImportThirdparty.cmake +++ /dev/null @@ -1,14 +0,0 @@ -# This source file is part of the atomui project -# -# Copyright (c) 2017 - 2022 qinware, All rights reserved. -# Copyright (c) 2017 - 2022 chinboy -# -# See https://qinware.com/LICENSE.txt for license information -# -# Created by chinboy on 2025/01/10. - -include(ExternalProject) - -if (ATOMUI_BUILD_UNITTESTS) - find_package(GoogleTest REQUIRED) -endif() \ No newline at end of file diff --git a/nativelibs/cmake/modules/MetaInfo.cmake b/nativelibs/cmake/modules/MetaInfo.cmake deleted file mode 100644 index 32f86ecb1..000000000 --- a/nativelibs/cmake/modules/MetaInfo.cmake +++ /dev/null @@ -1,43 +0,0 @@ -# This source file is part of the atomui project -# -# Copyright (c) 2017 - 2022 qinware, All rights reserved. -# Copyright (c) 2017 - 2022 chinboy -# -# See https://qinware.com/LICENSE.txt for license information -# -# Created by chinboy on 2025/01/10. - -if(NOT DEFINED ATOMUI_VERSION_MAJOR) - set(ATOMUI_VERSION_MAJOR 0) -endif() -if(NOT DEFINED ATOMUI_VERSION_MINOR) - set(ATOMUI_VERSION_MINOR 1) -endif() -if(NOT DEFINED ATOMUI_VERSION_PATCH) - set(ATOMUI_VERSION_PATCH 0) -endif() -if(NOT DEFINED ATOMUI_VERSION_BUILD) - set(ATOMUI_VERSION_BUILD "") -endif() - -if (NOT ATOMUI_PACKAGE_VERSION) - set(ATOMUI_PACKAGE_VERSION "${ATOMUI_VERSION_MAJOR}.${ATOMUI_VERSION_MINOR}.${ATOMUI_VERSION_PATCH}-${ATOMUI_VERSION_BUILD}") -endif() - -if (NOT ATOMUI_VERSION) - set(ATOMUI_VERSION "${ATOMUI_VERSION_MAJOR}.${ATOMUI_VERSION_MINOR}.${ATOMUI_VERSION_PATCH}") -endif() - -set(ATOMUI_VERSION_COMPAT ${ATOMUI_VERSION}) - -math(EXPR ATOMUI_VERSION_ID ${ATOMUI_VERSION_MAJOR}*10000+${ATOMUI_VERSION_MINOR}*100+${ATOMUI_VERSION_PATCH}) - -set(ATOMUI_COMPAT_VERSION ${ATOMUI_VERSION}) -set(ATOMUI_PACKAGE_NAME atomui) -set(ATOMUI_PACKAGE_CASED_NAME AtomUI) -set(ATOMUI_PACKAGE_STRING "${ATOMUI_PACKAGE_NAME} ${ATOMUI_PACKAGE_VERSION}") -set(ATOMUI_PACKAGE_BUGREPORT "https://qinware.com/bugs/") -set(ATOMUI_DISPLAY_NAME "AtomUI") -set(ATOMUI_COPYRIGHT_YEAR "2025") -set(ATOMUI_COMPANY_NAME "Qinware") -set(ATOMUI_COPYRIGHT "Copyright Qinware Technologies Ltd. (c) 2018-2025") \ No newline at end of file diff --git a/nativelibs/cmake/modules/SummaryOutput.cmake b/nativelibs/cmake/modules/SummaryOutput.cmake deleted file mode 100644 index fb82fa38c..000000000 --- a/nativelibs/cmake/modules/SummaryOutput.cmake +++ /dev/null @@ -1,35 +0,0 @@ -# This source file is part of the atomui project -# -# Copyright (c) 2017 - 2022 qinware, All rights reserved. -# Copyright (c) 2017 - 2022 chinboy -# -# See https://qinware.com/LICENSE.txt for license information -# -# Created by chinboy on 2025/01/10. -# -message(STATUS "--------------------------------------------------------------------------------------") -message(STATUS "Thank for using AtomUI project, have a lot of fun!") -message(STATUS "--------------------------------------------------------------------------------------") - -message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") -message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") -message(STATUS "PROJECT_BINARY_DIR: ${PROJECT_BINARY_DIR}") -message(STATUS "PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}") -message(STATUS "CMAKE_ROOT: ${CMAKE_ROOT}") -message(STATUS "CMAKE_SYSTEM: ${CMAKE_SYSTEM}") -message(STATUS "CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}") -message(STATUS "CMAKE_SKIP_RPATH: ${CMAKE_SKIP_RPATH}") -message(STATUS "CMAKE_VERBOSE_MAKEFILE: ${CMAKE_VERBOSE_MAKEFILE}") -message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}") -message(STATUS "CMAKE_C_COMPILER_VERSION: ${CMAKE_C_COMPILER_VERSION}") -message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}") -message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}") -message(STATUS "CMAKE_CXX_COMPILER_VERSION: ${CMAKE_CXX_COMPILER_VERSION}") -message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") -message(STATUS "CMAKE_EXE_LINKER_FLAGS: ${CMAKE_EXE_LINKER_FLAGS}") -message(STATUS "--------------------------------------------------------------------------------------") - -feature_summary(INCLUDE_QUIET_PACKAGES WHAT - PACKAGES_FOUND PACKAGES_NOT_FOUND - ENABLED_FEATURES DISABLED_FEATURES -) \ No newline at end of file diff --git a/nativelibs/cmake/modules/TargetUtils.cmake b/nativelibs/cmake/modules/TargetUtils.cmake deleted file mode 100644 index c6bb788b9..000000000 --- a/nativelibs/cmake/modules/TargetUtils.cmake +++ /dev/null @@ -1,386 +0,0 @@ -# This source file is part of the atomui project -# -# Copyright (c) 2017 - 2022 qinware, All rights reserved. -# Copyright (c) 2017 - 2022 chinboy -# -# See https://qinware.com/LICENSE.txt for license information -# -# Created by chinboy on 2025/01/10. - -include_guard(GLOBAL) - -# If we provide a list of plugins, executables, libraries, then the BUILD__BY_DEFAULT will be set to OFF -# and for every element we set BUILD__ to ON -# e.g. BUILD_PLUGINS=Core;TextEditor will result in BUILD_PLUGINS_BY_DEFAULT=OFF and BUILD_PLUGIN_CORE=ON and BUILD_PLUGIN_TEXTEDITOR ON - -function(atomui_check_default_values_for_list list_type) - set(PLUGINS_single plugin) - set(EXECUTABLES_single executable) - set(LIBRARIES_single library) - set(TESTS_single test) - - if (NOT DEFINED ATOMUI_BUILD_${list_type}) - return() - endif () - - set(ATOMUI_BUILD_${list_type}_BY_DEFAULT OFF CACHE BOOL "" FORCE) - - foreach (element ${ATOMUI_BUILD_${list_type}}) - string(TOUPPER "${${list_type}_single}_${element}" upper_element) - set(ATOMUI_BUILD_${upper_element} ON CACHE BOOL "Build ${${list_type}_single} ${element}.") - endforeach () -endfunction() - -atomui_check_default_values_for_list(EXECUTABLES) -atomui_check_default_values_for_list(LIBRARIES) -atomui_check_default_values_for_list(TESTS) - -function(atomui_library_enabled varName name) - if (NOT (name IN_LIST __ATOMUI_LIBRARIES)) - message(FATAL_ERROR "atomui_library_enabled: Unknown library target \"${name}\"") - endif () - if (TARGET ${name}) - set(${varName} ON PARENT_SCOPE) - else () - set(${varName} OFF PARENT_SCOPE) - endif () -endfunction() - -function(atomui_output_binary_dir varName) - if (ATOMUI_MERGE_BINARY_DIR) - set(${varName} ${ATOMUI_BINARY_DIR} PARENT_SCOPE) - else () - set(${varName} ${PROJECT_BINARY_DIR} PARENT_SCOPE) - endif () -endfunction() - -function(atomui_source_dir varName) - if (ATOMUI_MERGE_BINARY_DIR) - set(${varName} ${ATOMUI_SOURCE_DIR} PARENT_SCOPE) - else () - set(${varName} ${PROJECT_SOURCE_DIR} PARENT_SCOPE) - endif () -endfunction() - -function(atomui_add_library name) - cmake_parse_arguments(_arg "STATIC;OBJECT;FEATURE_INFO" - "DESTINATION;COMPONENT;SOURCES_PREFIX;BUILD_DEFAULT" - "CONDITION;DEPENDS;PUBLIC_DEPENDS;DEFINES;PUBLIC_DEFINES;INCLUDES;PUBLIC_INCLUDES;SOURCES;PROPERTIES" ${ARGN} - ) - - set(default_defines_copy ${DEFAULT_DEFINES}) - - if (${_arg_UNPARSED_ARGUMENTS}) - message(FATAL_ERROR "atomui_add_library had unparsed arguments") - endif () - - atomui_update_cached_list(__ATOMUI_LIBRARIES "${name}") - - atomui_condition_info(_extra_text _arg_CONDITION) - if (NOT _arg_CONDITION) - set(_arg_CONDITION ON) - endif () - - add_feature_info("Library ${name}" ON "${_extra_text}") - - set(library_type SHARED) - if (_arg_STATIC) - set(library_type STATIC) - endif () - if (_arg_OBJECT) - set(library_type OBJECT) - endif () - - add_library(${name} ${library_type}) - add_library(AtomUI::${name} ALIAS ${name}) - - string(TOUPPER "ATOMUI_LIBRARY" EXPORT_SYMBOL) - - if (ATOMUI_WITH_TESTS) - set(TEST_DEFINES WITH_TESTS SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}") - endif () - - if (_arg_STATIC AND UNIX) - # not added by Qt if reduce_relocations is turned off for it - set_target_properties(${name} PROPERTIES POSITION_INDEPENDENT_CODE ON) - endif () - - atomui_extend_target(${name} - SOURCES_PREFIX ${_arg_SOURCES_PREFIX} - SOURCES ${_arg_SOURCES} - INCLUDES ${_arg_INCLUDES} - PUBLIC_INCLUDES ${_arg_PUBLIC_INCLUDES} - DEFINES ${EXPORT_SYMBOL} ${default_defines_copy} ${_arg_DEFINES} ${TEST_DEFINES} - PUBLIC_DEFINES ${_arg_PUBLIC_DEFINES} - DEPENDS ${_arg_DEPENDS} ${IMPLICIT_DEPENDS} - PUBLIC_DEPENDS ${_arg_PUBLIC_DEPENDS} - ) - - # everything is different with SOURCES_PREFIX - if (NOT _arg_SOURCES_PREFIX) - target_include_directories(${name} - PRIVATE - "$" - PUBLIC - "$" - "$" - "$" - ) - endif () - - set(_DESTINATION "${ATOMUI_BIN_PATH}") - if (_arg_DESTINATION) - set(_DESTINATION "${_arg_DESTINATION}") - endif () - - atomui_output_binary_dir(_output_binary_dir) - string(REGEX MATCH "^[0-9]*" ATOMUI_VERSION_MAJOR ${ATOMUI_VERSION}) - - set_target_properties(${name} PROPERTIES - LINK_DEPENDS_NO_SHARED ON - SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}" - MACHO_CURRENT_VERSION ${ATOMUI_VERSION} - MACHO_COMPATIBILITY_VERSION ${ATOMUI_VERSION_COMPAT} - CXX_EXTENSIONS OFF - CXX_VISIBILITY_PRESET hidden - VISIBILITY_INLINES_HIDDEN ON - BUILD_RPATH "${_LIB_RPATH};${CMAKE_BUILD_RPATH}" - INSTALL_RPATH "${_LIB_RPATH};${CMAKE_INSTALL_RPATH}" - RUNTIME_OUTPUT_DIRECTORY "${_output_binary_dir}/${_DESTINATION}" - LIBRARY_OUTPUT_DIRECTORY "${_output_binary_dir}/${ATOMUI_LIBRARY_PATH}" - ARCHIVE_OUTPUT_DIRECTORY "${_output_binary_dir}/${ATOMUI_LIBRARY_ARCHIVE_PATH}" - ${_arg_PROPERTIES} - ) - - unset(NAMELINK_OPTION) - if (library_type STREQUAL "SHARED") - set(NAMELINK_OPTION NAMELINK_SKIP) - endif () - - unset(COMPONENT_OPTION) - if (_arg_COMPONENT) - set(COMPONENT_OPTION "COMPONENT" "${_arg_COMPONENT}") - endif () - - install(TARGETS ${name} - EXPORT ATOMUI - RUNTIME - DESTINATION "${_DESTINATION}" - ${COMPONENT_OPTION} - OPTIONAL - LIBRARY - DESTINATION "${ATOMUI_LIBRARY_PATH}" - ${NAMELINK_OPTION} - ${COMPONENT_OPTION} - OPTIONAL - OBJECTS - DESTINATION "${ATOMUI_LIBRARY_PATH}" - COMPONENT Devel EXCLUDE_FROM_ALL - ARCHIVE - DESTINATION "${ATOMUI_LIBRARY_ARCHIVE_PATH}" - COMPONENT Devel EXCLUDE_FROM_ALL - OPTIONAL - ) - - if (ATOMUI_WITH_SANITIZE) - atomui_enable_sanitize(${SANITIZE_FLAGS}) - endif () - - if (NAMELINK_OPTION) - install(TARGETS ${name} - LIBRARY - DESTINATION "${ATOMUI_LIBRARY_PATH}" - NAMELINK_ONLY - COMPONENT Devel EXCLUDE_FROM_ALL - OPTIONAL - ) - endif () -endfunction() - -function(atomui_extend_library target_name) - atomui_library_enabled(_library_enabled ${target_name}) - if (NOT _library_enabled) - return() - endif () - atomui_extend_target(${target_name} ${ARGN}) -endfunction() - -function(atomui_extend_test target_name) - if (NOT (target_name IN_LIST __ATOMUI_TESTS)) - message(FATAL_ERROR "atomui_extend_test: Unknown test target \"${target_name}\"") - endif () - if (TARGET ${target_name}) - atomui_extend_target(${target_name} ${ARGN}) - endif () -endfunction() - -function(atomui_add_executable name) - cmake_parse_arguments(_arg "" - "DESTINATION;COMPONENT;BUILD_DEFAULT" - "CONDITION;DEPENDS;DEFINES;INCLUDES;SOURCES;PROPERTIES" ${ARGN}) - - if (${_arg_UNPARSED_ARGUMENTS}) - message(FATAL_ERROR "atomui_add_executable had unparsed arguments!") - endif () - set(default_defines_copy ${DEFAULT_DEFINES}) - atomui_update_cached_list(__ATOMUI_EXECUTABLES "${name}") - - if (NOT _arg_CONDITION) - set(_arg_CONDITION ON) - endif () - - string(TOUPPER "ATOMUI_BUILD_EXECUTABLE_${name}" _build_executable_var) - if (DEFINED _arg_BUILD_DEFAULT) - set(_build_executable_default ${_arg_BUILD_DEFAULT}) - else () - set(_build_executable_default ${ATOMUI_BUILD_EXECUTABLES_BY_DEFAULT}) - endif () - if (DEFINED ENV{${_build_executable_var}}) - set(_build_executable_default "$ENV{${_build_executable_var}}") - endif () - set(${_build_executable_var} "${_build_executable_default}" CACHE BOOL "Build executable ${name}.") - - if ((${_arg_CONDITION}) AND ${_build_executable_var}) - set(_executable_enabled ON) - else () - set(_executable_enabled OFF) - endif () - if (NOT _executable_enabled) - return() - endif () - - set(_DESTINATION "${ATOMUI_LIBEXEC_PATH}") - if (_arg_DESTINATION) - set(_DESTINATION "${_arg_DESTINATION}") - endif () - - set(_EXECUTABLE_PATH "${_DESTINATION}") - if (APPLE) - # path of executable might be inside app bundle instead of DESTINATION directly - cmake_parse_arguments(_prop "" "MACOSX_BUNDLE;OUTPUT_NAME" "" "${_arg_PROPERTIES}") - if (_prop_MACOSX_BUNDLE) - set(_BUNDLE_NAME "${name}") - if (_prop_OUTPUT_NAME) - set(_BUNDLE_NAME "${_prop_OUTPUT_NAME}") - endif () - set(_BUNDLE_CONTENTS_PATH "${_DESTINATION}/${_BUNDLE_NAME}.app/Contents") - set(_EXECUTABLE_PATH "${_BUNDLE_CONTENTS_PATH}/MacOS") - set(_EXECUTABLE_FILE_PATH "${_EXECUTABLE_PATH}/${_BUNDLE_NAME}") - set(_BUNDLE_INFO_PLIST "${_BUNDLE_CONTENTS_PATH}/Info.plist") - endif () - endif () - - if (ATOMUI_WITH_TESTS) - set(TEST_DEFINES WITH_TESTS SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}") - endif () - - add_executable("${name}" ${_arg_SOURCES}) - - atomui_extend_target("${name}" - INCLUDES "${CMAKE_BINARY_DIR}/src" ${_arg_INCLUDES} - DEFINES ${default_defines_copy} ${TEST_DEFINES} ${_arg_DEFINES} - DEPENDS ${_arg_DEPENDS} ${IMPLICIT_DEPENDS} - ) - - file(RELATIVE_PATH relative_lib_path "/${_EXECUTABLE_PATH}" "/${ATOMUI_LIBRARY_PATH}") - - set(build_rpath "${_RPATH_BASE}/${relative_lib_path}") - set(install_rpath "${_RPATH_BASE}/${relative_lib_path}") - if (NOT WIN32 AND NOT APPLE) - set(install_rpath "${install_rpath};") - endif () - set(build_rpath "${build_rpath};${CMAKE_BUILD_RPATH}") - set(install_rpath "${install_rpath};${CMAKE_INSTALL_RPATH}") - - atomui_output_binary_dir(_output_binary_dir) - set_target_properties("${name}" PROPERTIES - LINK_DEPENDS_NO_SHARED ON - BUILD_RPATH "${build_rpath}" - INSTALL_RPATH "${install_rpath}" - RUNTIME_OUTPUT_DIRECTORY "${_output_binary_dir}/${_DESTINATION}" - CXX_EXTENSIONS OFF - CXX_VISIBILITY_PRESET hidden - VISIBILITY_INLINES_HIDDEN ON - ${_arg_PROPERTIES} - ) -endfunction() - -function(atomui_extend_executable name) - if (NOT (name IN_LIST __ATOMUI_EXECUTABLES)) - message(FATAL_ERROR "atomui_extend_executable: Unknown executable target \"${name}\"") - endif () - if (TARGET ${name}) - atomui_extend_target(${name} ${ARGN}) - endif () -endfunction() - -function(atomui_copy_to_builddir custom_target_name) - cmake_parse_arguments(_arg "CREATE_SUBDIRS" "DESTINATION" "FILES;DIRECTORIES" ${ARGN}) - set(timestampFiles) - - atomui_output_binary_dir(_output_binary_dir) - set(allFiles ${_arg_FILES}) - - foreach (srcFile ${_arg_FILES}) - string(MAKE_C_IDENTIFIER "${srcFile}" destinationTimestampFilePart) - set(destinationTimestampFileName "${CMAKE_CURRENT_BINARY_DIR}/.${destinationTimestampFilePart}_timestamp") - list(APPEND timestampFiles "${destinationTimestampFileName}") - - if (IS_ABSOLUTE "${srcFile}") - set(srcPath "") - else () - get_filename_component(srcPath "${srcFile}" DIRECTORY) - endif () - - add_custom_command(OUTPUT "${destinationTimestampFileName}" - COMMAND "${CMAKE_COMMAND}" -E make_directory "${_output_binary_dir}/${_arg_DESTINATION}/${srcPath}" - COMMAND "${CMAKE_COMMAND}" -E copy "${srcFile}" "${_output_binary_dir}/${_arg_DESTINATION}/${srcPath}" - COMMAND "${CMAKE_COMMAND}" -E touch "${destinationTimestampFileName}" - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - COMMENT "Copy ${srcFile} into build directory" - DEPENDS "${srcFile}" - VERBATIM - ) - endforeach () - - foreach (srcDirectory ${_arg_DIRECTORIES}) - string(MAKE_C_IDENTIFIER "${srcDirectory}" destinationTimestampFilePart) - set(destinationTimestampFileName "${CMAKE_CURRENT_BINARY_DIR}/.${destinationTimestampFilePart}_timestamp") - list(APPEND timestampFiles "${destinationTimestampFileName}") - set(destinationDirectory "${_output_binary_dir}/${_arg_DESTINATION}") - - if (_arg_CREATE_SUBDIRS) - set(destinationDirectory "${destinationDirectory}/${srcDirectory}") - endif () - - file(GLOB_RECURSE filesToCopy "${srcDirectory}/*") - list(APPEND allFiles ${filesToCopy}) - add_custom_command(OUTPUT "${destinationTimestampFileName}" - COMMAND "${CMAKE_COMMAND}" -E copy_directory "${srcDirectory}" "${destinationDirectory}" - COMMAND "${CMAKE_COMMAND}" -E touch "${destinationTimestampFileName}" - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - COMMENT "Copy ${srcDirectory}/ into build directory" - DEPENDS ${filesToCopy} - VERBATIM - ) - endforeach () - - add_custom_target("${custom_target_name}" ALL DEPENDS ${timestampFiles} - SOURCES ${allFiles}) -endfunction() - -function(atomui_add_public_header header) - if (NOT IS_ABSOLUTE ${header}) - set(header "${CMAKE_CURRENT_SOURCE_DIR}/${header}") - endif () - - atomui_source_dir(atomui_source_dir) - get_filename_component(source_dir ${header} DIRECTORY) - file(RELATIVE_PATH include_dir_relative_path "${atomui_source_dir}" "${source_dir}") - - install( - FILES ${header} - DESTINATION "${IDE_HEADER_INSTALL_PATH}/${include_dir_relative_path}" - COMPONENT Devel EXCLUDE_FROM_ALL - ) -endfunction() \ No newline at end of file diff --git a/nativelibs/cmake/modules/TestUtils.cmake b/nativelibs/cmake/modules/TestUtils.cmake deleted file mode 100644 index dd02fe3fc..000000000 --- a/nativelibs/cmake/modules/TestUtils.cmake +++ /dev/null @@ -1,130 +0,0 @@ -# This source file is part of the atomui project -# -# Copyright (c) 2017 - 2022 qinware, All rights reserved. -# Copyright (c) 2017 - 2022 chinboy -# -# See https://qinware.com/LICENSE.txt for license information -# -# Created by chinboy on 2025/01/10. - -# Generic support for adding a unittest. -function(atomui_add_unittest test_suite test_name) - cmake_parse_arguments(_arg "GTEST;MANUALTEST" "TIMEOUT" - "DEFINES;DEPENDS;INCLUDES;SOURCES;EXPLICIT_MOC;CONDITION;LINK_LIBS" ${ARGN}) - if ($_arg_UNPARSED_ARGUMENTS) - message(FATAL_ERROR "atomui_add_unittest had unparsed arguments!") - endif () - - atomui_update_cached_list(__ATOMUI_TESTS "${test_name}") - set(_link_libs ${ATOMUI_LINK_COMPONENTS}) - if (_arg_LINK_LIBS) - atomui_merge_list(_link_libs _arg_LINK_LIBS) - endif () - - if (NOT _arg_CONDITION) - set(_arg_CONDITION ON) - endif () - - if (NOT _arg_GTEST) - set(_arg_GTEST ON) - endif () - - if (NOT ATOMUI_BUILD_TESTS) - set(EXCLUDE_FROM_ALL ON) - endif () - - foreach (dependency ${_arg_DEPENDS}) - if (NOT TARGET ${dependency} AND NOT _arg_GTEST) - if (ATOMUI_WITH_DEBUG_CMAKE) - message(STATUS "'${dependency}' is not a target") - endif () - return() - endif () - endforeach () - - if (SUPPORTS_VARIADIC_MACROS_FLAG) - list(APPEND ATOMUI_COMPILE_FLAGS "-Wno-variadic-macros") - endif () - - # Some parts of gtest rely on this GNU extension, don't warn on it. - if (SUPPORTS_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS_FLAG) - list(APPEND ATOMUI_COMPILE_FLAGS "-Wno-gnu-zero-variadic-macro-arguments") - endif () - - set(TEST_DEFINES SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}") - - # relax cast requirements for tests - set(default_defines_copy ${DEFAULT_DEFINES}) - file(RELATIVE_PATH _RPATH "/${ATOMUI_BIN_PATH}" "/${ATOMUI_LIBRARY_PATH}") - - atomui_add_executable(${test_name} - DESTINATION ${ATOMUI_TEST_BIN_DIR} - SKIP_INSTALL - SOURCES ${_arg_SOURCES}) - - # The runtime benefits of LTO don't outweight the compile time costs for tests. - if (ATOMUI_ENABLE_LTO) - if ((UNIX OR MINGW) AND LINKER_IS_LLD) - set_property(TARGET ${test_name} APPEND_STRING PROPERTY - LINK_FLAGS " -Wl,--lto-O0") - elseif (LINKER_IS_LLD_LINK) - set_property(TARGET ${test_name} APPEND_STRING PROPERTY - LINK_FLAGS " /opt:lldlto=0") - endif () - endif () - - atomui_extend_target(${test_name} - DEPENDS ${_arg_DEPENDS} ${IMPLICIT_DEPENDS} - INCLUDES ${ATOMUI_BINARY_INCLUDE_DIR} ${ATOMUI_INCLUDE_DIR} ${_arg_INCLUDES} - DEFINES ${_arg_DEFINES} ${TEST_DEFINES} ${default_defines_copy} - ) - - set_target_properties(${test_name} PROPERTIES - LINK_DEPENDS_NO_SHARED ON - CXX_VISIBILITY_PRESET hidden - VISIBILITY_INLINES_HIDDEN ON - BUILD_RPATH "${_RPATH_BASE}/${_RPATH};${CMAKE_BUILD_RPATH}" - INSTALL_RPATH "${_RPATH_BASE}/${_RPATH};${CMAKE_INSTALL_RPATH}" - ) - - # libpthreads overrides some standard library symbols, so main - # executable must be linked with it in order to provide consistent - # API for all shared libaries loaded by this executable. - if (_arg_GTEST) - list(APPEND _link_libs - GoogleTest - # GTest::gtest_main - # GTest::gtest - # GTest::gmock - # GTest::gmock_main - ${ATOMUI_PTHREAD_LIB}) - endif () - - target_link_libraries(${test_name} PRIVATE ${_link_libs}) - if (ATOMUI_COMPILE_FLAGS) - target_compile_options(${test_name} PRIVATE ${ATOMUI_COMPILE_FLAGS}) - endif () - - if (NOT TARGET ${test_suite}) - add_custom_target("${test_suite}") - set_target_properties(${test_suite} PROPERTIES FOLDER "Tests") - endif () - - add_dependencies(${test_suite} ${test_name}) - # 现在直接通过源码编译的方式引入 - # add_dependencies(${test_name} thirdparty_gtest) - get_target_property(test_suite_folder ${test_suite} FOLDER) - if (test_suite_folder) - set_property(TARGET ${test_name} PROPERTY FOLDER "${test_suite_folder}") - endif () - - if (NOT _arg_GTEST AND NOT _arg_MANUALTEST) - add_test(NAME ${test_name} COMMAND ${test_name}) - if (DEFINED _arg_TIMEOUT) - set(timeout_option TIMEOUT ${_arg_TIMEOUT}) - else () - set(timeout_option) - endif () - atomui_finalize_test_setup(${test_name} ${timeout_option}) - endif () -endfunction() \ No newline at end of file diff --git a/nativelibs/cmake/modules/Utils.cmake b/nativelibs/cmake/modules/Utils.cmake deleted file mode 100644 index b9fb464ce..000000000 --- a/nativelibs/cmake/modules/Utils.cmake +++ /dev/null @@ -1,617 +0,0 @@ -# This source file is part of the atomui project -# -# Copyright (c) 2017 - 2022 qinware, All rights reserved. -# Copyright (c) 2017 - 2022 chinboy -# -# See https://qinware.com/LICENSE.txt for license information -# -# Created by chinboy on 2025/01/10. - -include_guard(GLOBAL) -include(CheckCSourceCompiles) -include(CheckCCompilerFlag) -include(CheckCXXCompilerFlag) -include(CheckSymbolExists) - -# handle SCCACHE hack -# SCCACHE does not work with the /Zi option, which makes each compilation write debug info -# into the same .pdb file - even with /FS, which usually makes this work in the first place. -# Replace /Zi with /Z7, which leaves the debug info in the object files until link time. -# This increases memory usage, disk space usage and linking time, so should only be -# enabled if necessary. -# Must be called after project(...). -function(ATOMUI_WIN_HANDLE_sccache_support) - if (MSVC AND WITH_SCCACHE_SUPPORT) - foreach (config DEBUG RELWITHDEBINFO) - foreach (lang C CXX) - set(flags_var "CMAKE_${lang}_FLAGS_${config}") - string(REPLACE "/Zi" "/Z7" ${flags_var} "${${flags_var}}") - set(${flags_var} "${${flags_var}}" PARENT_SCOPE) - endforeach () - endforeach () - endif () -endfunction() - -function(atomui_enable_release_for_debug_configuration) - if (MSVC) - string(REPLACE "/Od" "/O2" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") - string(REPLACE "/Ob0" "/Ob1" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") - string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") - else () - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O2") - endif () - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}" PARENT_SCOPE) -endfunction() - -function(atomui_enable_sanitize _sanitize_flags) - if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=${_sanitize_flags}") - endif () - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}" PARENT_SCOPE) -endfunction() - -function(atomui_update_cached_list name value) - set(_tmp_list "${${name}}") - list(APPEND _tmp_list "${value}") - set("${name}" "${_tmp_list}" CACHE INTERNAL "*** Internal ***") -endfunction() - -function(atomui_set_public_headers target sources) - foreach (source IN LISTS sources) - if (source MATCHES "\.h$|\.hpp$") - atomui_add_public_header(${source}) - endif () - endforeach () -endfunction() - -function(atomui_set_public_includes target includes) - foreach (inc_dir IN LISTS includes) - if (NOT IS_ABSOLUTE ${inc_dir}) - set(inc_dir "${CMAKE_CURRENT_SOURCE_DIR}/${inc_dir}") - endif () - file(RELATIVE_PATH include_dir_relative_path ${PROJECT_SOURCE_DIR} ${inc_dir}) - target_include_directories(${target} PUBLIC - $ - $ - ) - endforeach () -endfunction() - -function(atomui_finalize_test_setup test_name) - cmake_parse_arguments(_arg "" "TIMEOUT" "" ${ARGN}) - if (DEFINED _arg_TIMEOUT) - set(timeout ${_arg_TIMEOUT}) - else () - set(timeout 5) - endif () - # Never translate tests: - set_tests_properties(${name} - PROPERTIES - TIMEOUT ${timeout} - ) - - if (WIN32) - list(APPEND env_path $ENV{PATH}) - list(APPEND env_path ${CMAKE_BINARY_DIR}/${_ATOMUI_PLUGIN_PATH}) - list(APPEND env_path ${CMAKE_BINARY_DIR}/${_ATOMUI_BIN_PATH}) - - string(REPLACE "/" "\\" env_path "${env_path}") - string(REPLACE ";" "\\;" env_path "${env_path}") - - set_tests_properties(${test_name} PROPERTIES ENVIRONMENT "PATH=${env_path}") - endif () -endfunction() - -function(atomui_check_disabled_targets target_name dependent_targets) - foreach (dependency IN LISTS ${dependent_targets}) - foreach (type PLUGIN LIBRARY) - string(TOUPPER "BUILD_${type}_${dependency}" build_target) - if (DEFINED ${build_target} AND NOT ${build_target}) - message(SEND_ERROR "Target ${name} depends on ${dependency} which was disabled via ${build_target} set to ${${build_target}}") - endif () - endforeach () - endforeach () -endfunction() - -function(atomui_add_depends target_name) - cmake_parse_arguments(_arg "" "" "PRIVATE;PUBLIC" ${ARGN}) - if (${_arg_UNPARSED_ARGUMENTS}) - message(FATAL_ERROR "atomui_add_depends had unparsed arguments") - endif () - - atomui_check_disabled_targets(${target_name} _arg_PRIVATE) - atomui_check_disabled_targets(${target_name} _arg_PUBLIC) - - set(depends "${_arg_PRIVATE}") - set(public_depends "${_arg_PUBLIC}") - - get_target_property(target_type ${target_name} TYPE) - if (NOT target_type STREQUAL "OBJECT_LIBRARY") - target_link_libraries(${target_name} PRIVATE ${depends} PUBLIC ${public_depends}) - else () - list(APPEND object_lib_depends ${depends}) - list(APPEND object_public_depends ${public_depends}) - endif () - - foreach (obj_lib IN LISTS object_lib_depends) - target_compile_options(${target_name} PRIVATE $) - target_compile_definitions(${target_name} PRIVATE $) - target_include_directories(${target_name} PRIVATE $) - endforeach () - foreach (obj_lib IN LISTS object_public_depends) - target_compile_options(${target_name} PUBLIC $) - target_compile_definitions(${target_name} PUBLIC $) - target_include_directories(${target_name} PUBLIC $) - endforeach () -endfunction() - -function(atomui_find_dependent_plugins varName) - set(_RESULT ${ARGN}) - - foreach (i ${ARGN}) - get_property(_dep TARGET "${i}Plugin" PROPERTY _arg_DEPENDS) - if (_dep) - atomui_find_dependent_plugins(_REC ${_dep}) - list(APPEND _RESULT ${_REC}) - endif () - endforeach () - - if (_RESULT) - list(REMOVE_DUPLICATES _RESULT) - list(SORT _RESULT) - endif () - - set("${varName}" ${_RESULT} PARENT_SCOPE) -endfunction() - -function(atomui_condition_info varName condition) - if (NOT ${condition}) - set(${varName} "" PARENT_SCOPE) - else () - string(REPLACE ";" " " _contents "${${condition}}") - set(${varName} "with CONDITION ${_contents}" PARENT_SCOPE) - endif () -endfunction() - -function(atomui_extend_target target_name) - cmake_parse_arguments(_arg - "" - "SOURCES_PREFIX;SOURCES_PREFIX_FROM_TARGET;FEATURE_INFO" - "CONDITION;DEPENDS;PUBLIC_DEPENDS;DEFINES;PUBLIC_DEFINES;INCLUDES;PUBLIC_INCLUDES;SOURCES;PROPERTIES" - ${ARGN} - ) - - if (${_arg_UNPARSED_ARGUMENTS}) - message(FATAL_ERROR "atomui_extend_target had unparsed arguments") - endif () - - atomui_condition_info(_extra_text _arg_CONDITION) - if (NOT _arg_CONDITION) - set(_arg_CONDITION ON) - endif () - if (${_arg_CONDITION}) - set(_feature_enabled ON) - else () - set(_feature_enabled OFF) - endif () - if (_arg_FEATURE_INFO) - add_feature_info(${_arg_FEATURE_INFO} _feature_enabled "${_extra_text}") - endif () - if (NOT _feature_enabled) - return() - endif () - - if (_arg_SOURCES_PREFIX_FROM_TARGET) - if (NOT TARGET ${_arg_SOURCES_PREFIX_FROM_TARGET}) - return() - else () - get_target_property(_arg_SOURCES_PREFIX ${_arg_SOURCES_PREFIX_FROM_TARGET} SOURCES_DIR) - endif () - endif () - - atomui_add_depends(${target_name} - PRIVATE ${_arg_DEPENDS} - PUBLIC ${_arg_PUBLIC_DEPENDS} - ) - target_compile_definitions(${target_name} - PRIVATE ${_arg_DEFINES} - PUBLIC ${_arg_PUBLIC_DEFINES} - ) - target_include_directories(${target_name} PRIVATE ${_arg_INCLUDES}) - - atomui_set_public_includes(${target_name} "${_arg_PUBLIC_INCLUDES}") - - if (_arg_SOURCES_PREFIX) - foreach (source IN LISTS _arg_SOURCES) - list(APPEND prefixed_sources "${_arg_SOURCES_PREFIX}/${source}") - endforeach () - - if (NOT IS_ABSOLUTE ${_arg_SOURCES_PREFIX}) - set(_arg_SOURCES_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/${_arg_SOURCES_PREFIX}") - endif () - target_include_directories(${target_name} PRIVATE $) - - set(_arg_SOURCES ${prefixed_sources}) - endif () - target_sources(${target_name} PRIVATE ${_arg_SOURCES}) - - atomui_set_public_headers(${target_name} "${_arg_SOURCES}") - - if (_arg_PROPERTIES) - set_target_properties(${target_name} PROPERTIES ${_arg_PROPERTIES}) - endif () -endfunction() - -# list functions -function(atomui_list_subtract lhs rhs result_var_name) - set(result) - foreach (item IN LISTS lhs) - if (NOT "${item}" IN_LIST rhs) - list(APPEND result "${item}") - endif () - endforeach () - set("${result_var_name}" "${result}" PARENT_SCOPE) -endfunction() - -function(atomui_list_intersect lhs rhs result_var_name) - set(result) - foreach (item IN LISTS lhs) - if ("${item}" IN_LIST rhs) - list(APPEND result "${item}") - endif () - endforeach () - set("${result_var_name}" "${result}" PARENT_SCOPE) -endfunction() - -function(atomui_list_union lhs rhs result_var_name) - set(result) - foreach (item IN LISTS lhs rhs) - if (NOT "${item}" IN_LIST result) - list(APPEND result "${item}") - endif () - endforeach () - set("${result_var_name}" "${result}" PARENT_SCOPE) -endfunction() - -function(_list_add_string_suffix input_list suffix result_var_name) - set(result) - foreach (element ${input_list}) - list(APPEND result "${element}${suffix}") - endforeach () - set("${result_var_name}" "${result}" PARENT_SCOPE) -endfunction() - -function(_list_escape_for_shell input_list result_var_name) - set(result "") - foreach (element ${input_list}) - string(REPLACE " " "\\ " element "${element}") - set(result "${result}${element} ") - endforeach () - set("${result_var_name}" "${result}" PARENT_SCOPE) -endfunction() - -function(atomui_list_replace input_list old new) - set(replaced_list) - foreach (item ${${input_list}}) - if (${item} STREQUAL ${old}) - list(APPEND replaced_list ${new}) - else () - list(APPEND replaced_list ${item}) - endif () - endforeach () - set("${input_list}" "${replaced_list}" PARENT_SCOPE) -endfunction() - -macro(atomui_merge_list target list) - foreach (_listItem ${${list}}) - list(APPEND ${target} ${_listItem}) - endforeach () - if (target) - list(REMOVE_DUPLICATES ${target}) - endif () -endmacro() - -function(atomui_precondition var) - cmake_parse_arguments( - PRECONDITION # prefix - "NEGATE" # options - "MESSAGE" # single-value args - "" # multi-value args - ${ARGN}) - - if (PRECONDITION_NEGATE) - if (${var}) - if (PRECONDITION_MESSAGE) - message(FATAL_ERROR "Error! ${PRECONDITION_MESSAGE}") - else () - message(FATAL_ERROR "Error! Variable ${var} is true or not empty. The value of ${var} is ${${var}}.") - endif () - endif () - else () - if (NOT ${var}) - if (PRECONDITION_MESSAGE) - message(FATAL_ERROR "Error! ${PRECONDITION_MESSAGE}") - else () - message(FATAL_ERROR "Error! Variable ${var} is false, empty or not set.") - endif () - endif () - endif () -endfunction() - -# Assert is 'NOT ${LHS} ${OP} ${RHS}' is true. -function(atomui_precondition_binary_op OP LHS RHS) - cmake_parse_arguments( - PRECONDITIONBINOP # prefix - "NEGATE" # options - "MESSAGE" # single-value args - "" # multi-value args - ${ARGN}) - - if (PRECONDITIONBINOP_NEGATE) - if (${LHS} ${OP} ${RHS}) - if (PRECONDITIONBINOP_MESSAGE) - message(FATAL_ERROR "Error! ${PRECONDITIONBINOP_MESSAGE}") - else () - message(FATAL_ERROR "Error! ${LHS} ${OP} ${RHS} is true!") - endif () - endif () - else () - if (NOT ${LHS} ${OP} ${RHS}) - if (PRECONDITIONBINOP_MESSAGE) - message(FATAL_ERROR "Error! ${PRECONDITIONBINOP_MESSAGE}") - else () - message(FATAL_ERROR "Error! ${LHS} ${OP} ${RHS} is false!") - endif () - endif () - endif () -endfunction() - -# Translate a yes/no variable to the presence of a given string in a -# variable. -# -# Usage: -# atomui_translate_flag(is_set flag_name var_name) -# -# If is_set is true, sets ${var_name} to ${flag_name}. Otherwise, -# unsets ${var_name}. -function(atomui_translate_flag is_set flag_name var_name) - if (${is_set}) - set("${var_name}" "${flag_name}" PARENT_SCOPE) - else () - set("${var_name}" "" PARENT_SCOPE) - endif () -endfunction() - -macro(atomui_translate_flags prefix options) - foreach (var ${options}) - atomui_translate_flag("${${prefix}_${var}}" "${var}" "${prefix}_${var}_keyword") - endforeach () -endmacro() - -# Set ${outvar} to ${${invar}}, asserting if ${invar} is not set. -function(atomui_precondition_translate_flag invar outvar) - atomui_precondition(${invar}) - set(${outvar} "${${invar}}" PARENT_SCOPE) -endfunction() - -# Set variable to value if value is not null or false. Otherwise set variable to -# default_value. -function(atomui_set_with_default variable value) - cmake_parse_argument( - SWD - "" - "DEFAULT" - "" ${ARGN}) - atomui_precondition(SWD_DEFAULT - MESSAGE "Must specify a default argument") - if (value) - set(${variable} ${value} PARENT_SCOPE) - else () - set(${variable} ${SWD_DEFAULT} PARENT_SCOPE) - endif () -endfunction() - -function(atomui_dump_vars) - set(ATOMUI_STDLIB_GLOBAL_CMAKE_CACHE) - get_cmake_property(variableNames VARIABLES) - foreach (variableName ${variableNames}) - if (variableName MATCHES "^ATOMUI") - set(ATOMUI_STDLIB_GLOBAL_CMAKE_CACHE "${ATOMUI_STDLIB_GLOBAL_CMAKE_CACHE}set(${variableName} \"${${variableName}}\")\n") - message("set(${variableName} \"${${variableName}}\")") - endif () - endforeach () -endfunction() - -# -# Look for either a program in execute_process()'s path or for a hardcoded path. -# Find a program's version and set it in the parent scope. -# Replace newlines with spaces so it prints on one line. -# -function(atomui_find_version cmd flag find_in_path) - if (find_in_path) - message(STATUS "Finding installed version for: ${cmd}") - else () - message(STATUS "Finding version for: ${cmd}") - endif () - execute_process( - COMMAND ${cmd} ${flag} - OUTPUT_VARIABLE out - OUTPUT_STRIP_TRAILING_WHITESPACE) - if (NOT out) - if (find_in_path) - message(STATUS "tried to find version for ${cmd}, but ${cmd} not found in path, continuing") - else () - message(FATAL_ERROR "tried to find version for ${cmd}, but ${cmd} not found") - endif () - else () - string(REPLACE "\n" " " out2 ${out}) - message(STATUS "Found version: ${out2}") - endif () - message(STATUS "") -endfunction() - -function(atomui_append_flag value) - foreach (variable ${ARGN}) - set(${variable} "${${variable}} ${value}" PARENT_SCOPE) - endforeach (variable) -endfunction() - -function(atomui_append_flag_if condition value) - if (${condition}) - foreach (variable ${ARGN}) - set(${variable} "${${variable}} ${value}" PARENT_SCOPE) - endforeach (variable) - endif () -endfunction() - -macro(atomui_add_flag_if_supported flag name) - check_c_compiler_flag("-Werror ${flag}" "C_SUPPORTS_${name}") - atomui_append_flag_if("C_SUPPORTS_${name}" "${flag}" CMAKE_C_FLAGS) - check_cxx_compiler_flag("-Werror ${flag}" "CXX_SUPPORTS_${name}") - atomui_append_flag_if("CXX_SUPPORTS_${name}" "${flag}" CMAKE_CXX_FLAGS) -endmacro() - -function(atomui_add_flag_or_print_warning flag name) - check_c_compiler_flag("-Werror ${flag}" "C_SUPPORTS_${name}") - check_cxx_compiler_flag("-Werror ${flag}" "CXX_SUPPORTS_${name}") - if (C_SUPPORTS_${name} AND CXX_SUPPORTS_${name}) - message(STATUS "Building with ${flag}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}" PARENT_SCOPE) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}" PARENT_SCOPE) - set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} ${flag}" PARENT_SCOPE) - else () - message(WARNING "${flag} is not supported.") - endif () -endfunction() - -function(atomui_add_files target) - list(REMOVE_AT ARGV 0) - foreach (file ${ARGV}) - list(APPEND ${target} ${CMAKE_CURRENT_SOURCE_DIR}/${file}) - endforeach () - set(${target} ${${target}} PARENT_SCOPE) -endfunction() - -function(atomui_generate_header_guard filename output) - string(TOUPPER ${filename} filename) - string(REPLACE "." "_" filename ${filename}) - string(REPLACE "/" "_" filename ${filename}) - set(${output} HAVE_${filename} PARENT_SCOPE) -endfunction() - -function(atomui_define_have name) - atomui_generate_header_guard(${name} haveName) - set(${haveName} ON PARENT_SCOPE) -endfunction() - -macro(atomui_find_parent_dir path output) - get_filename_component(${output} ${path} ABSOLUTE) - get_filename_component(${output} ${${output}} DIRECTORY) -endmacro() - -macro(atomui_add_rt_require_lib name) - list(APPEND ATOMUI_RT_REQUIRE_LIBS ${name}) - if (NOT ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) - set(ATOMUI_RT_REQUIRE_LIBS ${ATOMUI_RT_REQUIRE_LIBS} PARENT_SCOPE) - endif () -endmacro() - -macro(atomui_check_library_exists library function location variable) - check_library_exists("${library}" "${function}" "${location}" "${variable}") - if (${${variable}}) - set(ATOMUI_${variable} ON) - endif () -endmacro() - -macro(atomui_check_symbol_exists symbol files variable) - check_symbol_exists("${symbol}" "${files}" "${variable}") - if (${${variable}}) - set(ATOMUI_${variable} ON) - endif () -endmacro() - -# Beware that there is no implementation of remove_llvm_definitions. - -macro(atomui_add_definitions) - # We don't want no semicolons on ATOMUI_DEFINITIONS: - foreach (arg ${ARGN}) - if (DEFINED ATOMUI_DEFINITIONS) - set(ATOMUI_DEFINITIONS "${ATOMUI_DEFINITIONS} ${arg}") - else () - set(ATOMUI_DEFINITIONS ${arg}) - endif () - endforeach (arg) - add_definitions(${ARGN}) -endmacro() - -macro(atomui_check_headers) - foreach (_filename ${ARGV}) - atomui_generate_header_guard(${_filename} _guardName) - check_include_file(${_filename} ${_guardName}) - if (${${_guardName}}) - set(ATOMUI_${_guardName} ON) - endif () - endforeach () -endmacro() - -macro(atomui_check_funcs) - foreach (_func ${ARGV}) - string(TOUPPER ${_func} upcase) - check_function_exists(${_func} HAVE_${upcase}) - if (${HAVE_${upcase}}) - set(ATOMUI_HAVE_${upcase} ON) - endif () - endforeach () -endmacro() - -# Set each output directory according to ${CMAKE_CONFIGURATION_TYPES}. -# Note: Don't set variables CMAKE_*_OUTPUT_DIRECTORY any more, -# or a certain builder, for eaxample, msbuild.exe, would be confused. -function(atomui_set_output_directory target) - cmake_parse_arguments(ARG "" "BINARY_DIR;LIBRARY_DIR" "" ${ARGN}) - - # module_dir -- corresponding to LIBRARY_OUTPUT_DIRECTORY. - # It affects output of add_library(MODULE). - if (WIN32 OR CYGWIN) - # DLL platform - set(module_dir ${ARG_BINARY_DIR}) - else () - set(module_dir ${ARG_LIBRARY_DIR}) - endif () - if (NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".") - foreach (build_mode ${CMAKE_CONFIGURATION_TYPES}) - string(TOUPPER "${build_mode}" CONFIG_SUFFIX) - if (ARG_BINARY_DIR) - string(REPLACE ${CMAKE_CFG_INTDIR} ${build_mode} bi ${ARG_BINARY_DIR}) - set_target_properties(${target} PROPERTIES "RUNTIME_OUTPUT_DIRECTORY_${CONFIG_SUFFIX}" ${bi}) - endif () - if (ARG_LIBRARY_DIR) - string(REPLACE ${CMAKE_CFG_INTDIR} ${build_mode} li ${ARG_LIBRARY_DIR}) - set_target_properties(${target} PROPERTIES "ARCHIVE_OUTPUT_DIRECTORY_${CONFIG_SUFFIX}" ${li}) - endif () - if (module_dir) - string(REPLACE ${CMAKE_CFG_INTDIR} ${build_mode} mi ${module_dir}) - set_target_properties(${target} PROPERTIES "LIBRARY_OUTPUT_DIRECTORY_${CONFIG_SUFFIX}" ${mi}) - endif () - endforeach () - else () - if (ARG_BINARY_DIR) - set_target_properties(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${ARG_BINARY_DIR}) - endif () - if (ARG_LIBRARY_DIR) - set_target_properties(${target} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${ARG_LIBRARY_DIR}) - endif () - if (module_dir) - set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${module_dir}) - endif () - endif () -endfunction() - -function(atomui_set_if_target var target) - if (TARGET "${target}") - set(_result ON) - else () - set(_result OFF) - endif () - set(${var} "${_result}" PARENT_SCOPE) -endfunction() \ No newline at end of file diff --git a/nativelibs/include/atomui/CMakeLists.txt b/nativelibs/include/atomui/CMakeLists.txt deleted file mode 100644 index 9a2bb089a..000000000 --- a/nativelibs/include/atomui/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# This source file is part of the atomui project -# -# Copyright (c) 2017 - 2022 qinware, All rights reserved. -# Copyright (c) 2017 - 2022 chinboy -# -# See https://qinware.com/LICENSE.txt for license information -# -# Created by chinboy on 2025/01/10. - -configure_file(Config.h.in ${CMAKE_CURRENT_BINARY_DIR}/Config.h ESCAPE_QUOTES) \ No newline at end of file diff --git a/nativelibs/include/atomui/Compiler.h b/nativelibs/include/atomui/Compiler.h deleted file mode 100644 index e34981dbf..000000000 --- a/nativelibs/include/atomui/Compiler.h +++ /dev/null @@ -1,1417 +0,0 @@ -// This source file is part of the atomui project -// -// Copyright (c) 2017 - 2025 qinware, All rights reserved. -// Copyright (c) 2017 - 2025 chinboy -// -// See https://qinware.com/LICENSE.txt for license information -// -// Created by chinboy on 2025/01/10. - -#pragma once - -#include "atomui/SystemDetection.h" -#include "atomui/ProcessorDetection.h" - -/* - The compiler, must be one of: (ATOMUI_CC_x) - - COVERITY - Coverity cov-scan - SYM - Digital Mars C/C++ (used to be Symantec C++) - MSVC - Microsoft Visual C/C++, Intel C++ for Windows - BOR - Borland/Turbo C++ - WAT - Watcom C++ - GNU - GNU C++ - COMEAU - Comeau C++ - EDG - Edison Design Group C++ - OC - CenterLine C++ - SUN - Forte Developer, or Sun Studio C++ - MIPS - MIPSpro C++ - DEC - DEC C++ - HPACC - HP aC++ - USLC - SCO OUDK and UDK - CDS - Reliant C++ - KAI - KAI C++ - INTEL - Intel C++ for Linux, Intel C++ for Windows - HIGHC - MetaWare High C/C++ - PGI - Portland Group C++ - GHS - Green Hills Optimizing C++ Compilers - RVCT - ARM Realview Compiler Suite - CLANG - C++ front-end for the LLVM compiler - - - Should be sorted most to least authoritative. -*/ - -#if defined(__COVERITY__) -# define ATOMUI_CC_COVERITY -# define ATOMUI_COMPILER_COMPLAINS_ABOUT_RETURN_AFTER_UNREACHABLE -#endif - -/* Symantec C++ is now Digital Mars */ -#if defined(__DMC__) || defined(__SC__) -# define ATOMUI_CC_SYM -/* "explicit" semantics implemented in 8.1e but keyword recognized since 7.5 */ -# if defined(__SC__) && __SC__ < 0x750 -# error "Compiler not supported" -# endif - -#elif defined(_MSC_VER) -# define ATOMUI_CC_MSVC (_MSC_VER) -# define ATOMUI_CC_MSVC_NET -# define ATOMUI_CC_MSVC_ONLY ATOMUI_CC_MSVC -# ifdef __clang__ -# undef ATOMUI_CC_MSVC_ONLY -# define ATOMUI_CC_CLANG ((__clang_major__ * 100) + __clang_minor__) -# define ATOMUI_CC_CLANG_ONLY ATOMUI_CC_CLANG -# endif -# define ATOMUI_OUTOFLINE_TEMPLATE inline -# define ATOMUI_COMPILER_MANGLES_RETURN_TYPE -# define ATOMUI_COMPILER_MANGLES_ACCESS_SPECIFIER -# define ATOMUI_FUNC_INFO __FUNCSIG__ -# define ATOMUI_ASSUME_IMPL(expr) __assume(expr) -# define ATOMUI_UNREACHABLE_IMPL() __assume(0) -# define ATOMUI_DECL_EXPORT __declspec(dllexport) -# define ATOMUI_DECL_IMPORT __declspec(dllimport) -# if _MSC_VER < 1938 // stdext is deprecated since VS 2022 17.8 -# define ATOMUI_MAKE_CHECKED_ARRAY_ITERATOR(x, N) stdext::make_checked_array_iterator(x, size_t(N)) // Since _MSC_VER >= 1500 -# endif -# define ATOMUI_COMPILER_COMPLAINS_ABOUT_RETURN_AFTER_UNREACHABLE - -#elif defined(__BORLANDC__) || defined(__TURBOC__) -# define ATOMUI_CC_BOR -# define ATOMUI_INLINE_TEMPLATE -# if __BORLANDC__ < 0x502 -# error "Compiler not supported" -# endif - -#elif defined(__WATCOMC__) -# define ATOMUI_CC_WAT - -/* ARM Realview Compiler Suite - RVCT compiler also defines __EDG__ and __GNUC__ (if --gnu flag is given), - so check for it before that */ -#elif defined(__ARMCC__) || defined(__CC_ARM) -# define ATOMUI_CC_RVCT -/* work-around for missing compiler intrinsics */ -# define __is_empty(X) false -# define __is_pod(X) false -# define ATOMUI_DECL_DEPRECATED __attribute__ ((__deprecated__)) -# ifdef ATOMUI_OS_LINUX -# define ATOMUI_DECL_EXPORT __attribute__((visibility("default"))) -# define ATOMUI_DECL_IMPORT __attribute__((visibility("default"))) -# define ATOMUI_DECL_HIDDEN __attribute__((visibility("hidden"))) -# else -# define ATOMUI_DECL_EXPORT __declspec(dllexport) -# define ATOMUI_DECL_IMPORT __declspec(dllimport) -# endif - -#elif defined(__GNUC__) -# define ATOMUI_CC_GNU (__GNUC__ * 100 + __GNUC_MINOR__) -# if defined(__MINGW32__) -# define ATOMUI_CC_MINGW -# endif -# if defined(__clang__) -/* Clang also masquerades as GCC */ -# if defined(__apple_build_version__) -// The Clang version reported by Apple Clang in __clang_major__ -// and __clang_minor__ does _not_ reflect the actual upstream -// version of the compiler. To allow consumers to use a single -// define to verify the Clang version we hard-code the versions -// based on the best available info we have about the actual -// version: http://en.wikipedia.org/wiki/Xcode#Toolchain_Versions -# if __apple_build_version__ >= 14030022 // Xcode 14.3 -# define ATOMUI_CC_CLANG 1500 -# elif __apple_build_version__ >= 14000029 // Xcode 14.0 -# define ATOMUI_CC_CLANG 1400 -# elif __apple_build_version__ >= 13160021 // Xcode 13.3 -# define ATOMUI_CC_CLANG 1300 -# elif __apple_build_version__ >= 13000029 // Xcode 13.0 -# define ATOMUI_CC_CLANG 1200 -# elif __apple_build_version__ >= 12050022 // Xcode 12.5 -# define ATOMUI_CC_CLANG 1110 -# elif __apple_build_version__ >= 12000032 // Xcode 12.0 -# define ATOMUI_CC_CLANG 1000 -# elif __apple_build_version__ >= 11030032 // Xcode 11.4 -# define ATOMUI_CC_CLANG 900 -# elif __apple_build_version__ >= 11000033 // Xcode 11.0 -# define ATOMUI_CC_CLANG 800 -# else -# error "Unsupported Apple Clang version" -# endif -# else - // Non-Apple Clang, so we trust the versions reported -# define ATOMUI_CC_CLANG ((__clang_major__ * 100) + __clang_minor__) -# endif -# define ATOMUI_CC_CLANG_ONLY ATOMUI_CC_CLANG -# if __has_builtin(__builtin_assume) -# define ATOMUI_ASSUME_IMPL(expr) __builtin_assume(expr) -# else -# define ATOMUI_ASSUME_IMPL(expr) if (expr){} else __builtin_unreachable() -# endif -# define ATOMUI_UNREACHABLE_IMPL() __builtin_unreachable() -# if !defined(__has_extension) -# /* Compatibility with older Clang versions */ -# define __has_extension __has_feature -# endif -# if defined(__APPLE__) - /* Apple/clang specific features */ -# define ATOMUI_DECL_CF_RETURNS_RETAINED __attribute__((cf_returns_retained)) -# ifdef __OBJC__ -# define ATOMUI_DECL_NS_RETURNS_AUTORELEASED __attribute__((ns_returns_autoreleased)) -# endif -# endif -# ifdef __EMSCRIPTEN__ -# define ATOMUI_CC_EMSCRIPTEN -# endif -# else -/* Plain GCC */ -# define ATOMUI_CC_GNU_ONLY ATOMUI_CC_GNU -# if ATOMUI_CC_GNU >= 405 -# define ATOMUI_ASSUME_IMPL(expr) if (expr){} else __builtin_unreachable() -# define ATOMUI_UNREACHABLE_IMPL() __builtin_unreachable() -# define ATOMUI_DECL_DEPRECATED_X(text) __attribute__ ((__deprecated__(text))) -# endif -# endif - -# ifdef ATOMUI_OS_WIN -# define ATOMUI_DECL_EXPORT __declspec(dllexport) -# define ATOMUI_DECL_IMPORT __declspec(dllimport) -# else -# define ATOMUI_DECL_EXPORT_OVERRIDABLE __attribute__((visibility("default"), weak)) -# ifdef ATOMUI_USE_PROTECTED_VISIBILITY -# define ATOMUI_DECL_EXPORT __attribute__((visibility("protected"))) -# else -# define ATOMUI_DECL_EXPORT __attribute__((visibility("default"))) -# endif -# define ATOMUI_DECL_IMPORT __attribute__((visibility("default"))) -# define ATOMUI_DECL_HIDDEN __attribute__((visibility("hidden"))) -# endif - -# define ATOMUI_FUNC_INFO __PRETTY_FUNCTION__ -# define ATOMUI_TYPEOF(expr) __typeof__(expr) -# define ATOMUI_DECL_DEPRECATED __attribute__ ((__deprecated__)) -# define ATOMUI_DECL_UNUSED __attribute__((__unused__)) -# define ATOMUI_LIKELY(expr) __builtin_expect(!!(expr), true) -# define ATOMUI_UNLIKELY(expr) __builtin_expect(!!(expr), false) -# define ATOMUI_NORETURN __attribute__((__noreturn__)) -# define ATOMUI_REQUIRED_RESULT __attribute__ ((__warn_unused_result__)) -# define ATOMUI_DECL_PURE_FUNCTION __attribute__((pure)) -# define ATOMUI_DECL_CONST_FUNCTION __attribute__((const)) -# define ATOMUI_DECL_COLD_FUNCTION __attribute__((cold)) -# if ATOMUI_CC_GNU >= 403 && !defined(ATOMUI_CC_CLANG) -# define ATOMUI_ALLOC_SIZE(x) __attribute__((alloc_size(x))) -# endif - -/* IBM compiler versions are a bit messy. There are actually two products: - the C product, and the C++ product. The C++ compiler is always packaged - with the latest version of the C compiler. Version numbers do not always - match. This little table (I'm not sure it's accurate) should be helpful: - - C++ product C product - - C Set 3.1 C Compiler 3.0 - ... ... - C++ Compiler 3.6.6 C Compiler 4.3 - ... ... - Visual Age C++ 4.0 ... - ... ... - Visual Age C++ 5.0 C Compiler 5.0 - ... ... - Visual Age C++ 6.0 C Compiler 6.0 - - Now: - __xlC__ is the version of the C compiler in hexadecimal notation - is only an approximation of the C++ compiler version - __IBMCPP__ is the version of the C++ compiler in decimal notation - but it is not defined on older compilers like C Set 3.1 */ -#elif defined(__xlC__) -# define ATOMUI_CC_XLC -# if __xlC__ < 0x400 -# error "Compiler not supported" -# elif __xlC__ >= 0x0600 -# define ATOMUI_TYPEOF(expr) __typeof__(expr) -# define ATOMUI_PACKED __attribute__((__packed__)) -# endif - -/* Older versions of DEC C++ do not define __EDG__ or __EDG - observed - on DEC C++ V5.5-004. New versions do define __EDG__ - observed on - Compaq C++ V6.3-002. - This compiler is different enough from other EDG compilers to handle - it separately anyway. */ -#elif defined(__DECCXX) || defined(__DECC) -# define ATOMUI_CC_DEC -/* Compaq C++ V6 compilers are EDG-based but I'm not sure about older - DEC C++ V5 compilers. */ -# if defined(__EDG__) -# define ATOMUI_CC_EDG -# endif -/* Compaq has disabled EDG's _BOOL macro and uses _BOOL_EXISTS instead - - observed on Compaq C++ V6.3-002. - In any case versions prior to Compaq C++ V6.0-005 do not have bool. */ -# if !defined(_BOOL_EXISTS) -# error "Compiler not supported" -# endif -/* Spurious (?) error messages observed on Compaq C++ V6.5-014. */ -/* Apply to all versions prior to Compaq C++ V6.0-000 - observed on - DEC C++ V5.5-004. */ -# if __DECCXX_VER < 60060000 -# define ATOMUI_BROKEN_TEMPLATE_SPECIALIZATION -# endif -/* avoid undefined symbol problems with out-of-line template members */ -# define ATOMUI_OUTOFLINE_TEMPLATE inline - -/* The Portland Group C++ compiler is based on EDG and does define __EDG__ - but the C compiler does not */ -#elif defined(__PGI) -# define ATOMUI_CC_PGI -# if defined(__EDG__) -# define ATOMUI_CC_EDG -# endif - -/* Compilers with EDG front end are similar. To detect them we test: - __EDG documented by SGI, observed on MIPSpro 7.3.1.1 and KAI C++ 4.0b - __EDG__ documented in EDG online docs, observed on Compaq C++ V6.3-002 - and PGI C++ 5.2-4 */ -#elif !defined(ATOMUI_OS_HPUX) && (defined(__EDG) || defined(__EDG__)) -# define ATOMUI_CC_EDG -/* From the EDG documentation (does not seem to apply to Compaq C++ or GHS C): - _BOOL - Defined in C++ mode when bool is a keyword. The name of this - predefined macro is specified by a configuration flag. _BOOL - is the default. - __BOOL_DEFINED - Defined in Microsoft C++ mode when bool is a keyword. */ -# if !defined(_BOOL) && !defined(__BOOL_DEFINED) && !defined(__ghs) -# error "Compiler not supported" -# endif - -/* The Comeau compiler is based on EDG and does define __EDG__ */ -# if defined(__COMO__) -# define ATOMUI_CC_COMEAU - -/* The `using' keyword was introduced to avoid KAI C++ warnings - but it's now causing KAI C++ errors instead. The standard is - unclear about the use of this keyword, and in practice every - compiler is using its own set of rules. Forget it. */ -# elif defined(__KCC) -# define ATOMUI_CC_KAI - -/* Uses CFront, make sure to read the manual how to tweak templates. */ -# elif defined(__ghs) -# define ATOMUI_CC_GHS -# define ATOMUI_DECL_DEPRECATED __attribute__ ((__deprecated__)) -# define ATOMUI_PACKED __attribute__ ((__packed__)) -# define ATOMUI_FUNC_INFO __PRETTY_FUNCTION__ -# define ATOMUI_TYPEOF(expr) __typeof__(expr) -# define ATOMUI_UNREACHABLE_IMPL() -# if defined(__cplusplus) -# define ATOMUI_COMPILER_AUTO_TYPE -# define ATOMUI_COMPILER_STATIC_ASSERT -# define ATOMUI_COMPILER_RANGE_FOR -# if __GHS_VERSION_NUMBER >= 201505 -# define ATOMUI_COMPILER_ALIGNAS -# define ATOMUI_COMPILER_ALIGNOF -# define ATOMUI_COMPILER_ATOMICS -# define ATOMUI_COMPILER_ATTRIBUTES -# define ATOMUI_COMPILER_AUTO_FUNCTION -# define ATOMUI_COMPILER_CLASS_ENUM -# define ATOMUI_COMPILER_DECLTYPE -# define ATOMUI_COMPILER_DEFAULT_MEMBERS -# define ATOMUI_COMPILER_DELETE_MEMBERS -# define ATOMUI_COMPILER_DELEGATING_CONSTRUCTORS -# define ATOMUI_COMPILER_EXPLICIT_CONVERSIONS -# define ATOMUI_COMPILER_EXPLICIT_OVERRIDES -# define ATOMUI_COMPILER_EXTERN_TEMPLATES -# define ATOMUI_COMPILER_INHERITING_CONSTRUCTORS -# define ATOMUI_COMPILER_INITIALIZER_LISTS -# define ATOMUI_COMPILER_LAMBDA -# define ATOMUI_COMPILER_NONSTATIC_MEMBER_INIT -# define ATOMUI_COMPILER_NOEXCEPT -# define ATOMUI_COMPILER_NULLPTR -# define ATOMUI_COMPILER_RANGE_FOR -# define ATOMUI_COMPILER_RAW_STRINGS -# define ATOMUI_COMPILER_REF_QUALIFIERS -# define ATOMUI_COMPILER_RVALUE_REFS -# define ATOMUI_COMPILER_STATIC_ASSERT -# define ATOMUI_COMPILER_TEMPLATE_ALIAS -# define ATOMUI_COMPILER_THREAD_LOCAL -# define ATOMUI_COMPILER_UDL -# define ATOMUI_COMPILER_UNICODE_STRINGS -# define ATOMUI_COMPILER_UNIFORM_INIT -# define ATOMUI_COMPILER_UNRESTRICTED_UNIONS -# define ATOMUI_COMPILER_VARIADIC_MACROS -# define ATOMUI_COMPILER_VARIADIC_TEMPLATES -# endif -# endif //__cplusplus - -# elif defined(__DCC__) -# define ATOMUI_CC_DIAB -# if !defined(__bool) -# error "Compiler not supported" -# endif - -/* The UnixWare 7 UDK compiler is based on EDG and does define __EDG__ */ -# elif defined(__USLC__) && defined(__SCO_VERSION__) -# define ATOMUI_CC_USLC -/* The latest UDK 7.1.1b does not need this, but previous versions do */ -# if !defined(__SCO_VERSION__) || (__SCO_VERSION__ < 302200010) -# define ATOMUI_OUTOFLINE_TEMPLATE inline -# endif - -/* Never tested! */ -# elif defined(CENTERLINE_CLPP) || defined(OBJECTCENTER) -# define ATOMUI_CC_OC - -/* CDS++ defines __EDG__ although this is not documented in the Reliant - documentation. It also follows conventions like _BOOL and this documented */ -# elif defined(sinix) -# define ATOMUI_CC_CDS -# endif - -/* VxWorks' DIAB toolchain has an additional EDG type C++ compiler - (see __DCC__ above). This one is for C mode files (__EDG is not defined) */ -#elif defined(_DIAB_TOOL) -# define ATOMUI_CC_DIAB -# define ATOMUI_FUNC_INFO __PRETTY_FUNCTION__ - -/* Never tested! */ -#elif defined(__HIGHC__) -# define ATOMUI_CC_HIGHC - -#elif defined(__SUNPRO_CC) || defined(__SUNPRO_C) -# define ATOMUI_CC_SUN -# define ATOMUI_COMPILER_MANGLES_RETURN_TYPE -/* 5.0 compiler or better - 'bool' is enabled by default but can be disabled using -features=nobool - in which case _BOOL is not defined - this is the default in 4.2 compatibility mode triggered by -compat=4 */ -# if __SUNPRO_CC >= 0x500 -# define ATOMUI_NO_TEMPLATE_TEMPLATE_PARAMETERS - /* see http://developers.sun.com/sunstudio/support/Ccompare.html */ -# if __SUNPRO_CC >= 0x590 -# define ATOMUI_TYPEOF(expr) __typeof__(expr) -# endif -# if __SUNPRO_CC >= 0x550 -# define ATOMUI_DECL_EXPORT __global -# endif -# if !defined(_BOOL) -# error "Compiler not supported" -# endif -/* 4.2 compiler or older */ -# else -# error "Compiler not supported" -# endif - -/* CDS++ does not seem to define __EDG__ or __EDG according to Reliant - documentation but nevertheless uses EDG conventions like _BOOL */ -#elif defined(sinix) -# define ATOMUI_CC_EDG -# define ATOMUI_CC_CDS -# if !defined(_BOOL) -# error "Compiler not supported" -# endif -# define ATOMUI_BROKEN_TEMPLATE_SPECIALIZATION - -#else -# error "AtomUI has not been tested with this compiler" -#endif - -/* - * SG10's SD-6 feature detection and some useful extensions from Clang and GCC - * https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations - * http://clang.llvm.org/docs/LanguageExtensions.html#feature-checking-macros - * Not using wrapper macros, per http://eel.is/c++draft/cpp.cond#7.sentence-2 - */ -#ifndef __has_builtin -# define __has_builtin(x) 0 -#endif -#ifndef __has_feature -# define __has_feature(x) 0 -#endif -#ifndef __has_attribute -# define __has_attribute(x) 0 -#endif -#ifndef __has_cpp_attribute -# define __has_cpp_attribute(x) 0 -#endif -#ifndef __has_include -# define __has_include(x) 0 -#endif -#ifndef __has_include_next -# define __has_include_next(x) 0 -#endif - -/* - detecting ASAN can be helpful to disable slow tests - clang uses feature, gcc defines __SANITIZE_ADDRESS__ - unconditionally check both in case other compilers mirror - either of those options - */ -#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__) -# define ATOMUI_ASAN_ENABLED -#endif - -#ifdef __cplusplus -# if __has_include() /* remove this check once Integrity, QNX have caught up */ -# include -# endif -#endif - -/* - * C++11 support - * - * Paper Macro SD-6 macro - * N2341 ATOMUI_COMPILER_ALIGNAS - * N2341 ATOMUI_COMPILER_ALIGNOF - * N2427 ATOMUI_COMPILER_ATOMICS - * N2761 ATOMUI_COMPILER_ATTRIBUTES __cpp_attributes = 200809 - * N2541 ATOMUI_COMPILER_AUTO_FUNCTION - * N1984 N2546 ATOMUI_COMPILER_AUTO_TYPE - * N2437 ATOMUI_COMPILER_CLASS_ENUM - * N2235 ATOMUI_COMPILER_CONSTEXPR __cpp_constexpr = 200704 - * N2343 N3276 ATOMUI_COMPILER_DECLTYPE __cpp_decltype = 200707 - * N2346 ATOMUI_COMPILER_DEFAULT_MEMBERS - * N2346 ATOMUI_COMPILER_DELETE_MEMBERS - * N1986 ATOMUI_COMPILER_DELEGATING_CONSTRUCTORS - * N2437 ATOMUI_COMPILER_EXPLICIT_CONVERSIONS - * N3206 N3272 ATOMUI_COMPILER_EXPLICIT_OVERRIDES - * N1987 ATOMUI_COMPILER_EXTERN_TEMPLATES - * N2540 ATOMUI_COMPILER_INHERITING_CONSTRUCTORS - * N2672 ATOMUI_COMPILER_INITIALIZER_LISTS - * N2658 N2927 ATOMUI_COMPILER_LAMBDA __cpp_lambdas = 200907 - * N2756 ATOMUI_COMPILER_NONSTATIC_MEMBER_INIT - * N2855 N3050 ATOMUI_COMPILER_NOEXCEPT - * N2431 ATOMUI_COMPILER_NULLPTR - * N2930 ATOMUI_COMPILER_RANGE_FOR - * N2442 ATOMUI_COMPILER_RAW_STRINGS __cpp_raw_strings = 200710 - * N2439 ATOMUI_COMPILER_REF_QUALIFIERS - * N2118 N2844 N3053 ATOMUI_COMPILER_RVALUE_REFS __cpp_rvalue_references = 200610 - * N1720 ATOMUI_COMPILER_STATIC_ASSERT __cpp_static_assert = 200410 - * N2258 ATOMUI_COMPILER_TEMPLATE_ALIAS - * N2659 ATOMUI_COMPILER_THREAD_LOCAL - * N2660 ATOMUI_COMPILER_THREADSAFE_STATICS - * N2765 ATOMUI_COMPILER_UDL __cpp_user_defined_literals = 200809 - * N2442 ATOMUI_COMPILER_UNICODE_STRINGS __cpp_unicode_literals = 200710 - * N2640 ATOMUI_COMPILER_UNIFORM_INIT - * N2544 ATOMUI_COMPILER_UNRESTRICTED_UNIONS - * N1653 ATOMUI_COMPILER_VARIADIC_MACROS - * N2242 N2555 ATOMUI_COMPILER_VARIADIC_TEMPLATES __cpp_variadic_templates = 200704 - * - * - * For the C++ standards C++14 and C++17, we use only the SD-6 macro. - * - * For any future version of the C++ standard, we use only the C++20 feature test macro. - * For library features, we assume is present (this header includes it). - * - * For a full listing of feature test macros, see - * https://en.cppreference.com/w/cpp/feature_test - * Exceptions: - * ATOMUI_DECL_CONSTEXPR_DTOR constexpr in C++20 for explicit destructors __cpp_constexpr >= 201907L - * ATOMUI_CONSTEXPR_DTOR constexpr in C++20 for variables __cpp_constexpr >= 201907L otherwise const - * ATOMUI_DECL_EATOMUI_DELETE_X(message) = delete("reason"), __cpp_deleted_function >= 202403L - * - * C++ extensions: - * ATOMUI_COMPILER_RESTRICTED_VLA variable-length arrays, prior to __cpp_runtime_arrays - */ - -/* - * Now that we require C++17, we unconditionally expect threadsafe statics mandated since C++11 - */ -#define ATOMUI_COMPILER_THREADSAFE_STATICS - -#if defined(ATOMUI_CC_CLANG) -/* General C++ features */ -# define ATOMUI_COMPILER_RESTRICTED_VLA -# if __has_feature(attribute_deprecated_with_message) -# define ATOMUI_DECL_DEPRECATED_X(text) __attribute__ ((__deprecated__(text))) -# endif - -// Clang supports binary literals in C, C++98 and C++11 modes -// It's been supported "since the dawn of time itself" (cf. commit 179883) -# if __has_extension(cxx_binary_literals) -# define ATOMUI_COMPILER_BINARY_LITERALS -# endif - -// Variadic macros are supported for gnu++98, c++11, c99 ... since 2.9 -# if ATOMUI_CC_CLANG >= 209 -# if !defined(__STRICT_ANSI__) || defined(__GXX_EXPERIMENTAL_CXX0X__) \ - || (defined(__cplusplus) && (__cplusplus >= 201103L)) \ - || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) -# define ATOMUI_COMPILER_VARIADIC_MACROS -# endif -# endif - -/* C++11 features, see http://clang.llvm.org/cxx_status.html */ -# if (defined(__cplusplus) && __cplusplus >= 201103L) \ - || defined(__GXX_EXPERIMENTAL_CXX0X__) -/* Detect C++ features using __has_feature(), see http://clang.llvm.org/docs/LanguageExtensions.html#cxx11 */ -# if __has_feature(cxx_alignas) -# define ATOMUI_COMPILER_ALIGNAS -# define ATOMUI_COMPILER_ALIGNOF -# endif -# if __has_feature(cxx_atomic) && __has_include() -# define ATOMUI_COMPILER_ATOMICS -# endif -# if __has_feature(cxx_attributes) -# define ATOMUI_COMPILER_ATTRIBUTES -# endif -# if __has_feature(cxx_auto_type) -# define ATOMUI_COMPILER_AUTO_FUNCTION -# define ATOMUI_COMPILER_AUTO_TYPE -# endif -# if __has_feature(cxx_strong_enums) -# define ATOMUI_COMPILER_CLASS_ENUM -# endif -# if __has_feature(cxx_constexpr) && ATOMUI_CC_CLANG > 302 /* CLANG 3.2 has bad/partial support */ -# define ATOMUI_COMPILER_CONSTEXPR -# endif -# if __has_feature(cxx_decltype) /* && __has_feature(cxx_decltype_incomplete_return_types) */ -# define ATOMUI_COMPILER_DECLTYPE -# endif -# if __has_feature(cxx_defaulted_functions) -# define ATOMUI_COMPILER_DEFAULT_MEMBERS -# endif -# if __has_feature(cxx_deleted_functions) -# define ATOMUI_COMPILER_DELETE_MEMBERS -# endif -# if __has_feature(cxx_delegating_constructors) -# define ATOMUI_COMPILER_DELEGATING_CONSTRUCTORS -# endif -# if __has_feature(cxx_explicit_conversions) -# define ATOMUI_COMPILER_EXPLICIT_CONVERSIONS -# endif -# if __has_feature(cxx_override_control) -# define ATOMUI_COMPILER_EXPLICIT_OVERRIDES -# endif -# if __has_feature(cxx_inheriting_constructors) -# define ATOMUI_COMPILER_INHERITING_CONSTRUCTORS -# endif -# if __has_feature(cxx_generalized_initializers) -# define ATOMUI_COMPILER_INITIALIZER_LISTS -# define ATOMUI_COMPILER_UNIFORM_INIT /* both covered by this feature macro, according to docs */ -# endif -# if __has_feature(cxx_lambdas) -# define ATOMUI_COMPILER_LAMBDA -# endif -# if __has_feature(cxx_noexcept) -# define ATOMUI_COMPILER_NOEXCEPT -# endif -# if __has_feature(cxx_nonstatic_member_init) -# define ATOMUI_COMPILER_NONSTATIC_MEMBER_INIT -# endif -# if __has_feature(cxx_nullptr) -# define ATOMUI_COMPILER_NULLPTR -# endif -# if __has_feature(cxx_range_for) -# define ATOMUI_COMPILER_RANGE_FOR -# endif -# if __has_feature(cxx_raw_string_literals) -# define ATOMUI_COMPILER_RAW_STRINGS -# endif -# if __has_feature(cxx_reference_qualified_functions) -# define ATOMUI_COMPILER_REF_QUALIFIERS -# endif -# if __has_feature(cxx_rvalue_references) -# define ATOMUI_COMPILER_RVALUE_REFS -# endif -# if __has_feature(cxx_static_assert) -# define ATOMUI_COMPILER_STATIC_ASSERT -# endif -# if __has_feature(cxx_alias_templates) -# define ATOMUI_COMPILER_TEMPLATE_ALIAS -# endif -# if __has_feature(cxx_thread_local) -# if !defined(__FreeBSD__) /* FreeBSD clang fails on __cxa_thread_atexit */ -# define ATOMUI_COMPILER_THREAD_LOCAL -# endif -# endif -# if __has_feature(cxx_user_literals) -# define ATOMUI_COMPILER_UDL -# endif -# if __has_feature(cxx_unicode_literals) -# define ATOMUI_COMPILER_UNICODE_STRINGS -# endif -# if __has_feature(cxx_unrestricted_unions) -# define ATOMUI_COMPILER_UNRESTRICTED_UNIONS -# endif -# if __has_feature(cxx_variadic_templates) -# define ATOMUI_COMPILER_VARIADIC_TEMPLATES -# endif -/* Features that have no __has_feature() check */ -# if ATOMUI_CC_CLANG >= 209 /* since clang 2.9 */ -# define ATOMUI_COMPILER_EXTERN_TEMPLATES -# endif -# endif // (defined(__cplusplus) && __cplusplus >= 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X__) - -/* C++1y features, deprecated macros. Do not update this list. */ -# if defined(__cplusplus) && __cplusplus > 201103L -//# if __has_feature(cxx_binary_literals) -//# define ATOMUI_COMPILER_BINARY_LITERALS // see above -//# endif -# if __has_feature(cxx_generic_lambda) -# define ATOMUI_COMPILER_GENERIC_LAMBDA -# endif -# if __has_feature(cxx_init_capture) -# define ATOMUI_COMPILER_LAMBDA_CAPTURES -# endif -# if __has_feature(cxx_relaxed_constexpr) -# define ATOMUI_COMPILER_RELAXED_CONSTEXPR_FUNCTIONS -# endif -# if __has_feature(cxx_decltype_auto) && __has_feature(cxx_return_type_deduction) -# define ATOMUI_COMPILER_RETURN_TYPE_DEDUCTION -# endif -# if __has_feature(cxx_variable_templates) -# define ATOMUI_COMPILER_VARIABLE_TEMPLATES -# endif -# if __has_feature(cxx_runtime_array) -# define ATOMUI_COMPILER_VLA -# endif -# endif // if defined(__cplusplus) && __cplusplus > 201103L - -# if defined(__STDC_VERSION__) -# if __has_feature(c_static_assert) -# define ATOMUI_COMPILER_STATIC_ASSERT -# endif -# if __has_feature(c_thread_local) && __has_include() -# if !defined(__FreeBSD__) /* FreeBSD clang fails on __cxa_thread_atexit */ -# define ATOMUI_COMPILER_THREAD_LOCAL -# endif -# endif -# endif - -# ifndef ATOMUI_DECL_UNUSED -# define ATOMUI_DECL_UNUSED __attribute__((__unused__)) -# endif -# define ATOMUI_DECL_UNUSED_MEMBER ATOMUI_DECL_UNUSED -#endif // defined(ATOMUI_CC_CLANG) - -#if defined(ATOMUI_CC_GNU_ONLY) -# define ATOMUI_COMPILER_RESTRICTED_VLA -# if ATOMUI_CC_GNU >= 403 -// GCC supports binary literals in C, C++98 and C++11 modes -# define ATOMUI_COMPILER_BINARY_LITERALS -# endif -# if !defined(__STRICT_ANSI__) || defined(__GXX_EXPERIMENTAL_CXX0X__) \ - || (defined(__cplusplus) && (__cplusplus >= 201103L)) \ - || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) - // Variadic macros are supported for gnu++98, c++11, C99 ... since forever (gcc 2.97) -# define ATOMUI_COMPILER_VARIADIC_MACROS -# endif -# if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L -# if ATOMUI_CC_GNU >= 403 - /* C++11 features supported in GCC 4.3: */ -# define ATOMUI_COMPILER_DECLTYPE -# define ATOMUI_COMPILER_RVALUE_REFS -# define ATOMUI_COMPILER_STATIC_ASSERT -# endif -# if ATOMUI_CC_GNU >= 404 - /* C++11 features supported in GCC 4.4: */ -# define ATOMUI_COMPILER_AUTO_FUNCTION -# define ATOMUI_COMPILER_AUTO_TYPE -# define ATOMUI_COMPILER_EXTERN_TEMPLATES -# define ATOMUI_COMPILER_UNIFORM_INIT -# define ATOMUI_COMPILER_UNICODE_STRINGS -# define ATOMUI_COMPILER_VARIADIC_TEMPLATES -# endif -# if ATOMUI_CC_GNU >= 405 - /* C++11 features supported in GCC 4.5: */ -# define ATOMUI_COMPILER_EXPLICIT_CONVERSIONS - /* GCC 4.4 implements initializer_list but does not define typedefs required - * by the standard. */ -# define ATOMUI_COMPILER_INITIALIZER_LISTS -# define ATOMUI_COMPILER_LAMBDA -# define ATOMUI_COMPILER_RAW_STRINGS -# define ATOMUI_COMPILER_CLASS_ENUM -# endif -# if ATOMUI_CC_GNU >= 406 - /* Pre-4.6 compilers implement a non-final snapshot of N2346, hence default and delete - * functions are supported only if they are public. Starting from 4.6, GCC handles - * final version - the access modifier is not relevant. */ -# define ATOMUI_COMPILER_DEFAULT_MEMBERS -# define ATOMUI_COMPILER_DELETE_MEMBERS - /* C++11 features supported in GCC 4.6: */ -# define ATOMUI_COMPILER_NULLPTR -# define ATOMUI_COMPILER_UNRESTRICTED_UNIONS -# define ATOMUI_COMPILER_RANGE_FOR -# endif -# if ATOMUI_CC_GNU >= 407 - /* GCC 4.4 implemented and std::atomic using its old intrinsics. - * However, the implementation is incomplete for most platforms until GCC 4.7: - * instead, std::atomic would use an external lock. Since we need an std::atomic - * that is behavior-compatible with QBasicAtomic, we only enable it here */ -# define ATOMUI_COMPILER_ATOMICS - /* GCC 4.6.x has problems dealing with noexcept expressions, - * so turn the feature on for 4.7 and above, only */ -# define ATOMUI_COMPILER_NOEXCEPT - /* C++11 features supported in GCC 4.7: */ -# define ATOMUI_COMPILER_NONSTATIC_MEMBER_INIT -# define ATOMUI_COMPILER_DELEGATING_CONSTRUCTORS -# define ATOMUI_COMPILER_EXPLICIT_OVERRIDES -# define ATOMUI_COMPILER_TEMPLATE_ALIAS -# define ATOMUI_COMPILER_UDL -# endif -# if ATOMUI_CC_GNU >= 408 -# define ATOMUI_COMPILER_ATTRIBUTES -# define ATOMUI_COMPILER_ALIGNAS -# define ATOMUI_COMPILER_ALIGNOF -# define ATOMUI_COMPILER_INHERITING_CONSTRUCTORS -# define ATOMUI_COMPILER_THREAD_LOCAL -# if ATOMUI_CC_GNU > 408 || __GNUC_PATCHLEVEL__ >= 1 -# define ATOMUI_COMPILER_REF_QUALIFIERS -# endif -# endif -# if ATOMUI_CC_GNU >= 500 - /* GCC 4.6 introduces constexpr, but it's bugged (at least) in the whole - * 4.x series, see e.g. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57694 */ -# define ATOMUI_COMPILER_CONSTEXPR -# endif -# endif -# if __cplusplus > 201103L -# if ATOMUI_CC_GNU >= 409 - /* C++1y features in GCC 4.9 - deprecated, do not update this list */ -//# define ATOMUI_COMPILER_BINARY_LITERALS // already supported since GCC 4.3 as an extension -# define ATOMUI_COMPILER_LAMBDA_CAPTURES -# define ATOMUI_COMPILER_RETURN_TYPE_DEDUCTION -# endif -# endif -# if defined(__STDC_VERSION__) && __STDC_VERSION__ > 199901L -# if ATOMUI_CC_GNU >= 407 - /* C11 features supported in GCC 4.7: */ -# define ATOMUI_COMPILER_STATIC_ASSERT -# endif -# if ATOMUI_CC_GNU >= 409 && defined(__has_include) -/* C11 features supported in GCC 4.9: */ -# if __has_include() -# define ATOMUI_COMPILER_THREAD_LOCAL -# endif -# endif -# endif -#endif - -#if defined(ATOMUI_CC_MSVC) && !defined(ATOMUI_CC_CLANG) -# if defined(__cplusplus) - /* C++11 features supported in VC8 = VC2005: */ -# define ATOMUI_COMPILER_VARIADIC_MACROS - - /* 2005 supports the override and final contextual keywords, in - the same positions as the C++11 variants, but 'final' is - called 'sealed' instead: - http://msdn.microsoft.com/en-us/library/0w2w91tf%28v=vs.80%29.aspx - The behavior is slightly different in C++/CLI, which requires the - "virtual" keyword to be present too, so don't define for that. - So don't define ATOMUI_COMPILER_EXPLICIT_OVERRIDES (since it's not - the same as the C++11 version), but define the ATOMUI_DECL_* flags - accordingly. */ - /* C++11 features supported in VC10 = VC2010: */ -# define ATOMUI_COMPILER_AUTO_FUNCTION -# define ATOMUI_COMPILER_AUTO_TYPE -# define ATOMUI_COMPILER_DECLTYPE -# define ATOMUI_COMPILER_EXTERN_TEMPLATES -# define ATOMUI_COMPILER_LAMBDA -# define ATOMUI_COMPILER_NULLPTR -# define ATOMUI_COMPILER_RVALUE_REFS -# define ATOMUI_COMPILER_STATIC_ASSERT - /* C++11 features supported in VC11 = VC2012: */ -# define ATOMUI_COMPILER_EXPLICIT_OVERRIDES /* ...and use std C++11 now */ -# define ATOMUI_COMPILER_CLASS_ENUM -# define ATOMUI_COMPILER_ATOMICS - /* C++11 features in VC12 = VC2013 */ -# define ATOMUI_COMPILER_DELETE_MEMBERS -# define ATOMUI_COMPILER_DELEGATING_CONSTRUCTORS -# define ATOMUI_COMPILER_EXPLICIT_CONVERSIONS -# define ATOMUI_COMPILER_NONSTATIC_MEMBER_INIT -# define ATOMUI_COMPILER_RAW_STRINGS -# define ATOMUI_COMPILER_TEMPLATE_ALIAS -# define ATOMUI_COMPILER_VARIADIC_TEMPLATES -# define ATOMUI_COMPILER_INITIALIZER_LISTS // VC 12 SP 2 RC - /* C++11 features in VC14 = VC2015 */ -# define ATOMUI_COMPILER_DEFAULT_MEMBERS -# define ATOMUI_COMPILER_ALIGNAS -# define ATOMUI_COMPILER_ALIGNOF -# define ATOMUI_COMPILER_INHERITING_CONSTRUCTORS -# define ATOMUI_COMPILER_NOEXCEPT -# define ATOMUI_COMPILER_RANGE_FOR -# define ATOMUI_COMPILER_REF_QUALIFIERS -# define ATOMUI_COMPILER_THREAD_LOCAL -# define ATOMUI_COMPILER_UDL -# define ATOMUI_COMPILER_UNICODE_STRINGS -# define ATOMUI_COMPILER_UNRESTRICTED_UNIONS -# if _MSC_FULL_VER >= 190023419 -# define ATOMUI_COMPILER_ATTRIBUTES -// Almost working, see https://connect.microsoft.com/VisualStudio/feedback/details/2011648 -//# define ATOMUI_COMPILER_CONSTEXPR -# define ATOMUI_COMPILER_UNIFORM_INIT -# endif -# if _MSC_VER >= 1910 -# define ATOMUI_COMPILER_CONSTEXPR -# endif -// MSVC versions before 19.36 have a bug in C++20 comparison implementation. -// This leads to ambiguities when resolving comparison operator overloads in -// certain scenarios (the buggy MSVC versions were checked using our CI and -// compiler explorer). -# if _MSC_VER < 1936 -# define ATOMUI_COMPILER_LACKS_THREE_WAY_COMPARE_SYMMETRY -# endif -# define ATOMUI_COMPILER_SLOW_QSTRNLEN_COMPILATION -# endif /* __cplusplus */ -#endif // defined(ATOMUI_CC_MSVC) && !defined(ATOMUI_CC_CLANG) - -#ifdef ATOMUI_COMPILER_UNICODE_STRINGS -# define ATOMUI_STDLIB_UNICODE_STRINGS -#elif defined(__cplusplus) -# error "AtomUI requires Unicode string support in both the compiler and the standard library" -#endif - -#ifdef __cplusplus -# include -# if defined(ATOMUI_OS_QNX) -// By default, QNX 7.0 uses libc++ (from LLVM) and -// QNX 6.X uses Dinkumware's libcpp. In all versions, -// it is also possible to use GNU libstdc++. - -// For Dinkumware, some features must be disabled -// (mostly because of library problems). -// Dinkumware is assumed when __GLIBCXX__ (GNU libstdc++) -// and _LIBCPP_VERSION (LLVM libc++) are both absent. -# if !defined(__GLIBCXX__) && !defined(_LIBCPP_VERSION) - -// Older versions of libcpp (QNX 650) do not support C++11 features -// _HAS_* macros are set to 1 by toolchains that actually include -// Dinkum C++11 libcpp. - -# if !defined(_HAS_CPP0X) || !_HAS_CPP0X -// Disable C++11 features that depend on library support -# undef ATOMUI_COMPILER_INITIALIZER_LISTS -# undef ATOMUI_COMPILER_RVALUE_REFS -# undef ATOMUI_COMPILER_REF_QUALIFIERS -# undef ATOMUI_COMPILER_NOEXCEPT -// Disable C++11 library features: -# undef ATOMUI_STDLIB_UNICODE_STRINGS -# endif // !_HAS_CPP0X -# if !defined(_HAS_NULLPTR_T) || !_HAS_NULLPTR_T -# undef ATOMUI_COMPILER_NULLPTR -# endif //!_HAS_NULLPTR_T -# if !defined(_HAS_CONSTEXPR) || !_HAS_CONSTEXPR -// The libcpp is missing constexpr keywords on important functions like std::numeric_limits<>::min() -// Disable constexpr support on QNX even if the compiler supports it -# undef ATOMUI_COMPILER_CONSTEXPR -# endif // !_HAS_CONSTEXPR -# endif // !__GLIBCXX__ && !_LIBCPP_VERSION -# endif // ATOMUI_OS_QNX -# if defined(ATOMUI_CC_CLANG) && defined(ATOMUI_OS_DARWIN) -# if defined(__GNUC_LIBSTD__) && ((__GNUC_LIBSTD__-0) * 100 + __GNUC_LIBSTD_MINOR__-0 <= 402) -// Apple has not updated libstdc++ since 2007, which means it does not have -// or std::move. Let's disable these features -# undef ATOMUI_COMPILER_INITIALIZER_LISTS -# undef ATOMUI_COMPILER_RVALUE_REFS -# undef ATOMUI_COMPILER_REF_QUALIFIERS -// Also disable , since it's clearly not there -# undef ATOMUI_COMPILER_ATOMICS -# endif -# if defined(__cpp_lib_memory_resource) \ - && ((defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 140000) \ - || (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 170000)) -# undef __cpp_lib_memory_resource // Only supported on macOS 14 and iOS 17 -# endif -# endif // defined(ATOMUI_CC_CLANG) && defined(ATOMUI_OS_DARWIN) -#endif - -// Don't break code that is already using ATOMUI_COMPILER_DEFAULT_DELETE_MEMBERS -#if defined(ATOMUI_COMPILER_DEFAULT_MEMBERS) && defined(ATOMUI_COMPILER_DELETE_MEMBERS) -# define ATOMUI_COMPILER_DEFAULT_DELETE_MEMBERS -#endif - -/* - * Compatibility macros for C++11/14 keywords and expressions. - * Don't use in new code and port away whenever you have a chance. - */ -#define ATOMUI_ALIGNOF(x) alignof(x) -#define ATOMUI_DECL_ALIGN(n) alignas(n) -#define ATOMUI_DECL_NOTHROW ATOMUI_DECL_NOEXCEPT -#ifdef __cplusplus -# define ATOMUI_CONSTEXPR constexpr -# define ATOMUI_DECL_CONSTEXPR constexpr -# define ATOMUI_DECL_EATOMUI_DEFAULT = default -# define ATOMUI_DECL_EATOMUI_DELETE = delete -# define ATOMUI_DECL_FINAL final -# define ATOMUI_DECL_NOEXCEPT noexcept -# define ATOMUI_DECL_NOEXCEPT_EXPR(x) noexcept(x) -# define ATOMUI_DECL_OVERRIDE override -# define ATOMUI_DECL_RELAXED_CONSTEXPR constexpr -# define ATOMUI_NULLPTR nullptr -# define ATOMUI_RELAXED_CONSTEXPR constexpr -#else -# define ATOMUI_CONSTEXPR const -# define ATOMUI_DECL_CONSTEXPR -# define ATOMUI_DECL_RELAXED_CONSTEXPR -# define ATOMUI_NULLPTR NULL -# define ATOMUI_RELAXED_CONSTEXPR const -# ifdef ATOMUI_CC_GNU -# define ATOMUI_DECL_NOEXCEPT __attribute__((__nothrow__)) -# else -# define ATOMUI_DECL_NOEXCEPT -# endif -#endif - -#if __has_cpp_attribute(nodiscard) && (!defined(ATOMUI_CC_CLANG) || __cplusplus > 201402L) // P0188R1 -// Can't use [[nodiscard]] with Clang and C++11/14, see https://bugs.llvm.org/show_bug.cgi?id=33518 -# undef ATOMUI_REQUIRED_RESULT -# define ATOMUI_REQUIRED_RESULT [[nodiscard]] -#endif - -#if __has_cpp_attribute(nodiscard) >= 201907L /* used for both P1771 and P1301... */ -// [[nodiscard]] constructor (P1771) -# ifndef ATOMUI_NODISCARD_CTOR -# define ATOMUI_NODISCARD_CTOR [[nodiscard]] -# endif -// [[nodiscard("reason")]] (P1301) -# ifndef ATOMUI_NODISCARD_X -# define ATOMUI_NODISCARD_X(message) [[nodiscard(message)]] -# endif -# ifndef ATOMUI_NODISCARD_CTOR_X -# define ATOMUI_NODISCARD_CTOR_X(message) [[nodiscard(message)]] -# endif -#endif - -#if __has_cpp_attribute(maybe_unused) -# undef ATOMUI_DECL_UNUSED -# define ATOMUI_DECL_UNUSED [[maybe_unused]] -#endif - -#if __has_cpp_attribute(noreturn) -# undef ATOMUI_NORETURN -# define ATOMUI_NORETURN [[noreturn]] -#endif - -#if __has_cpp_attribute(deprecated) -# ifdef ATOMUI_DECL_DEPRECATED -# undef ATOMUI_DECL_DEPRECATED -# endif -# ifdef ATOMUI_DECL_DEPRECATED_X -# undef ATOMUI_DECL_DEPRECATED_X -# endif -# define ATOMUI_DECL_DEPRECATED [[deprecated]] -# define ATOMUI_DECL_DEPRECATED_X(x) [[deprecated(x)]] -#endif - -#define ATOMUI_DECL_ENUMERATOR_DEPRECATED ATOMUI_DECL_DEPRECATED -#define ATOMUI_DECL_ENUMERATOR_DEPRECATED_X(x) ATOMUI_DECL_DEPRECATED_X(x) - -#ifndef ATOMUI_DECL_CONSTEXPR_DTOR -# if __cpp_constexpr >= 201907L -# define ATOMUI_DECL_CONSTEXPR_DTOR constexpr -# else -# define ATOMUI_DECL_CONSTEXPR_DTOR inline -# endif -#endif - -#ifndef ATOMUI_CONSTEXPR_DTOR -# if __cpp_constexpr >= 201907L -# define ATOMUI_CONSTEXPR_DTOR constexpr -# else -# define ATOMUI_CONSTEXPR_DTOR const -# endif -#endif - -#ifndef ATOMUI_DECL_EATOMUI_DELETE_X -// Clang advertises the feature-testing macro but issues a warning -// if one isn't also using C++26, -// https://github.com/llvm/llvm-project/issues/109311 -# if defined(__cpp_deleted_function) && __cpp_deleted_function >= 202403L \ - && (!defined(ATOMUI_CC_CLANG_ONLY) || __cplusplus > 202302L) // C++26 -# define ATOMUI_DECL_EATOMUI_DELETE_X(reason) = delete(reason) -# else -# define ATOMUI_DECL_EATOMUI_DELETE_X(reason) = delete -# endif -#endif - -#ifndef ATOMUI_LIKELY_BRANCH -# if __has_cpp_attribute(likely) -# define ATOMUI_LIKELY_BRANCH [[likely]] -# define ATOMUI_UNLIKELY_BRANCH [[unlikely]] -# else -# define ATOMUI_LIKELY_BRANCH -# define ATOMUI_UNLIKELY_BRANCH -# endif -#endif - -/* - * Fallback macros to certain compiler features - */ - -#ifndef ATOMUI_NORETURN -# define ATOMUI_NORETURN -#endif -#ifndef ATOMUI_LIKELY -# define ATOMUI_LIKELY(x) (x) -#endif -#ifndef ATOMUI_UNLIKELY -# define ATOMUI_UNLIKELY(x) (x) -#endif -#ifndef ATOMUI_ASSUME_IMPL -# define ATOMUI_ASSUME_IMPL(expr) atomui_noop() -#endif -#ifndef ATOMUI_UNREACHABLE_IMPL -# define ATOMUI_UNREACHABLE_IMPL() atomui_noop() -#endif -#ifndef ATOMUI_ALLOC_SIZE -# define ATOMUI_ALLOC_SIZE(x) -#endif -#ifndef ATOMUI_REQUIRED_RESULT -# define ATOMUI_REQUIRED_RESULT -#endif -#ifndef ATOMUI_NODISCARD_X -# define ATOMUI_NODISCARD_X(message) ATOMUI_REQUIRED_RESULT -#endif -#ifndef ATOMUI_NODISCARD_CTOR -# define ATOMUI_NODISCARD_CTOR -#endif -#ifndef ATOMUI_NODISCARD_CTOR_X -# define ATOMUI_NODISCARD_CTOR_X(message) ATOMUI_NODISCARD_CTOR -#endif -#ifndef ATOMUI_DECL_DEPRECATED -# define ATOMUI_DECL_DEPRECATED -#endif -#ifndef ATOMUI_DECL_VARIABLE_DEPRECATED -# define ATOMUI_DECL_VARIABLE_DEPRECATED ATOMUI_DECL_DEPRECATED -#endif -#ifndef ATOMUI_DECL_DEPRECATED_X -# define ATOMUI_DECL_DEPRECATED_X(text) ATOMUI_DECL_DEPRECATED -#endif -#ifndef ATOMUI_DECL_EXPORT -# define ATOMUI_DECL_EXPORT -#endif -#ifndef ATOMUI_DECL_EXPORT_OVERRIDABLE -# define ATOMUI_DECL_EXPORT_OVERRIDABLE ATOMUI_DECL_EXPORT -#endif -#ifndef ATOMUI_DECL_IMPORT -# define ATOMUI_DECL_IMPORT -#endif -#ifndef ATOMUI_DECL_HIDDEN -# define ATOMUI_DECL_HIDDEN -#endif -#ifndef ATOMUI_DECL_UNUSED -# define ATOMUI_DECL_UNUSED -#endif -#ifndef ATOMUI_DECL_UNUSED_MEMBER -# define ATOMUI_DECL_UNUSED_MEMBER -#endif -#ifndef ATOMUI_FUNC_INFO -# if defined(ATOMUI_OS_SOLARIS) || defined(ATOMUI_CC_XLC) -# define ATOMUI_FUNC_INFO __FILE__ "(line number unavailable)" -# else -# define ATOMUI_FUNC_INFO __FILE__ ":" ATOMUI_STRINGIFY(__LINE__) -# endif -#endif -#ifndef ATOMUI_DECL_CF_RETURNS_RETAINED -# define ATOMUI_DECL_CF_RETURNS_RETAINED -#endif -#ifndef ATOMUI_DECL_NS_RETURNS_AUTORELEASED -# define ATOMUI_DECL_NS_RETURNS_AUTORELEASED -#endif -#ifndef ATOMUI_DECL_PURE_FUNCTION -# define ATOMUI_DECL_PURE_FUNCTION -#endif -#ifndef ATOMUI_DECL_CONST_FUNCTION -# define ATOMUI_DECL_CONST_FUNCTION ATOMUI_DECL_PURE_FUNCTION -#endif -#ifndef ATOMUI_DECL_COLD_FUNCTION -# define ATOMUI_DECL_COLD_FUNCTION -#endif - -/* - * Warning/diagnostic handling - */ - -#define ATOMUI_DO_PRAGMA(text) _Pragma(#text) -#if defined(ATOMUI_CC_MSVC) && !defined(ATOMUI_CC_CLANG) -# undef ATOMUI_DO_PRAGMA /* not needed */ -# define ATOMUI_WARNING_PUSH __pragma(warning(push)) -# define ATOMUI_WARNING_POP __pragma(warning(pop)) -# define ATOMUI_WARNING_DISABLE_MSVC(number) __pragma(warning(disable: number)) -# define ATOMUI_WARNING_DISABLE_INTEL(number) -# define ATOMUI_WARNING_DISABLE_CLANG(text) -# define ATOMUI_WARNING_DISABLE_GCC(text) -# define ATOMUI_WARNING_DISABLE_DEPRECATED ATOMUI_WARNING_DISABLE_MSVC(4996) -# define ATOMUI_WARNING_DISABLE_FLOAT_COMPARE -# define ATOMUI_WARNING_DISABLE_INVALID_OFFSETOF -#elif defined(ATOMUI_CC_CLANG) -# define ATOMUI_WARNING_PUSH ATOMUI_DO_PRAGMA(clang diagnostic push) -# define ATOMUI_WARNING_POP ATOMUI_DO_PRAGMA(clang diagnostic pop) -# define ATOMUI_WARNING_DISABLE_CLANG(text) ATOMUI_DO_PRAGMA(clang diagnostic ignored text) -# define ATOMUI_WARNING_DISABLE_GCC(text) -# define ATOMUI_WARNING_DISABLE_INTEL(number) -# define ATOMUI_WARNING_DISABLE_MSVC(number) -# define ATOMUI_WARNING_DISABLE_DEPRECATED ATOMUI_WARNING_DISABLE_CLANG("-Wdeprecated-declarations") -# define ATOMUI_WARNING_DISABLE_FLOAT_COMPARE ATOMUI_WARNING_DISABLE_CLANG("-Wfloat-equal") -# define ATOMUI_WARNING_DISABLE_INVALID_OFFSETOF ATOMUI_WARNING_DISABLE_CLANG("-Winvalid-offsetof") -#elif defined(ATOMUI_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) -# define ATOMUI_WARNING_PUSH ATOMUI_DO_PRAGMA(GCC diagnostic push) -# define ATOMUI_WARNING_POP ATOMUI_DO_PRAGMA(GCC diagnostic pop) -# define ATOMUI_WARNING_DISABLE_GCC(text) ATOMUI_DO_PRAGMA(GCC diagnostic ignored text) -# define ATOMUI_WARNING_DISABLE_CLANG(text) -# define ATOMUI_WARNING_DISABLE_INTEL(number) -# define ATOMUI_WARNING_DISABLE_MSVC(number) -# define ATOMUI_WARNING_DISABLE_DEPRECATED ATOMUI_WARNING_DISABLE_GCC("-Wdeprecated-declarations") -# define ATOMUI_WARNING_DISABLE_FLOAT_COMPARE ATOMUI_WARNING_DISABLE_GCC("-Wfloat-equal") -# define ATOMUI_WARNING_DISABLE_INVALID_OFFSETOF ATOMUI_WARNING_DISABLE_GCC("-Winvalid-offsetof") -#else // All other compilers, GCC < 4.6 and MSVC < 2008 -# define ATOMUI_WARNING_DISABLE_GCC(text) -# define ATOMUI_WARNING_PUSH -# define ATOMUI_WARNING_POP -# define ATOMUI_WARNING_DISABLE_INTEL(number) -# define ATOMUI_WARNING_DISABLE_MSVC(number) -# define ATOMUI_WARNING_DISABLE_CLANG(text) -# define ATOMUI_WARNING_DISABLE_GCC(text) -# define ATOMUI_WARNING_DISABLE_DEPRECATED -# define ATOMUI_WARNING_DISABLE_FLOAT_COMPARE -# define ATOMUI_WARNING_DISABLE_INVALID_OFFSETOF -#endif - -#ifndef ATOMUI_IGNORE_DEPRECATIONS -#define ATOMUI_IGNORE_DEPRECATIONS(statement) \ - ATOMUI_WARNING_PUSH \ - ATOMUI_WARNING_DISABLE_DEPRECATED \ - statement \ - ATOMUI_WARNING_POP -#endif - -// The body must be a statement: -#define ATOMUI_CAST_IGNORE_ALIGN(body) ATOMUI_WARNING_PUSH ATOMUI_WARNING_DISABLE_GCC("-Wcast-align") body ATOMUI_WARNING_POP - -// This macro can be used to calculate member offsets for types with a non standard layout. -// It uses the fact that offsetof() is allowed to support those types since C++17 as an optional -// feature. All our compilers do support this, but some issue a warning, so we wrap the offsetof() -// call in a macro that disables the compiler warning. -#define ATOMUI_OFFSETOF(Class, member) \ - []() -> size_t { \ - ATOMUI_WARNING_PUSH ATOMUI_WARNING_DISABLE_INVALID_OFFSETOF \ - return offsetof(Class, member); \ - ATOMUI_WARNING_POP \ - }() - -/* - Proper for-scoping in MIPSpro CC -*/ -#ifndef ATOMUI_NO_KEYWORDS -# if defined(ATOMUI_CC_MIPS) || (defined(ATOMUI_CC_HPACC) && defined(__ia64)) -# define for if (0) {} else for -# endif -#endif - -#ifdef ATOMUI_COMPILER_RVALUE_REFS -#define qMove(x) std::move(x) -#else -#define qMove(x) (x) -#endif - -#if defined(__cplusplus) -#if __has_cpp_attribute(clang::fallthrough) -# define ATOMUI_FALLTHROUGH() [[clang::fallthrough]] -#elif __has_cpp_attribute(gnu::fallthrough) -# define ATOMUI_FALLTHROUGH() [[gnu::fallthrough]] -#elif __has_cpp_attribute(fallthrough) -# define ATOMUI_FALLTHROUGH() [[fallthrough]] -#endif -#endif -#ifndef ATOMUI_FALLTHROUGH -# ifdef ATOMUI_CC_GNU -# define ATOMUI_FALLTHROUGH() __attribute__((fallthrough)) -# else -# define ATOMUI_FALLTHROUGH() (void)0 -# endif -#endif - -#if defined(__has_attribute) && __has_attribute(uninitialized) -# define ATOMUI_DECL_UNINITIALIZED __attribute__((uninitialized)) -#else -# define ATOMUI_DECL_UNINITIALIZED -#endif - - -/* - Sanitize compiler feature availability -*/ -#if !defined(ATOMUI_PROCESSOR_X86) -# undef ATOMUI_COMPILER_SUPPORTS_SSE2 -# undef ATOMUI_COMPILER_SUPPORTS_SSE3 -# undef ATOMUI_COMPILER_SUPPORTS_SSSE3 -# undef ATOMUI_COMPILER_SUPPORTS_SSE4_1 -# undef ATOMUI_COMPILER_SUPPORTS_SSE4_2 -# undef ATOMUI_COMPILER_SUPPORTS_AVX -# undef ATOMUI_COMPILER_SUPPORTS_AVX2 -# undef ATOMUI_COMPILER_SUPPORTS_F16C -#endif -#if !defined(ATOMUI_PROCESSOR_ARM) -# undef ATOMUI_COMPILER_SUPPORTS_NEON -#endif -#if !defined(ATOMUI_PROCESSOR_MIPS) -# undef ATOMUI_COMPILER_SUPPORTS_MIPS_DSP -# undef ATOMUI_COMPILER_SUPPORTS_MIPS_DSPR2 -#endif - -// Compiler version check -#if defined(__cplusplus) && (__cplusplus < 201703L) -# ifdef ATOMUI_CC_MSVC -# error "AtomUI requires a C++17 compiler, and a suitable value for __cplusplus. On MSVC, you must pass the /Zc:__cplusplus option to the compiler." -# else -# error "AtomUI requires a C++17 compiler" -# endif -#endif // __cplusplus - -#if defined(__cplusplus) && defined(ATOMUI_CC_MSVC) && !defined(ATOMUI_CC_CLANG) -# if ATOMUI_CC_MSVC < 1927 - // Check below only works with 16.7 or newer -# error "AtomUI requires at least Visual Studio 2019 version 16.7 (VC++ version 14.27). Please upgrade." -# endif - -// On MSVC we require /permissive- set by user code. Check that we are -// under its rules -- for instance, check that std::nullptr_t->bool is -// not an implicit conversion, as per -// https://docs.microsoft.com/en-us/cpp/overview/cpp-conformance-improvements?view=msvc-160#nullptr_t-is-only-convertible-to-bool-as-a-direct-initialization -static_assert(!std::is_convertible_v, - "On MSVC you must pass the /permissive- option to the compiler."); -#endif - -#ifdef ATOMUI_PROCESSOR_X86_32 -# if defined(ATOMUI_CC_GNU) -# define ATOMUI_FASTCALL __attribute__((regparm(3))) -# elif defined(ATOMUI_CC_MSVC) -# define ATOMUI_FASTCALL __fastcall -# else -# define ATOMUI_FASTCALL -# endif -#else -# define ATOMUI_FASTCALL -#endif - -// enable gcc warnings for printf-style functions -#if defined(ATOMUI_CC_GNU) && !defined(__INSURE__) -# if defined(ATOMUI_CC_MINGW) && !defined(ATOMUI_CC_CLANG) -# define ATOMUI_ATTRIBUTE_FORMAT_PRINTF(A, B) \ - __attribute__((format(gnu_printf, (A), (B)))) -# else -# define ATOMUI_ATTRIBUTE_FORMAT_PRINTF(A, B) \ - __attribute__((format(printf, (A), (B)))) -# endif -#else -# define ATOMUI_ATTRIBUTE_FORMAT_PRINTF(A, B) -#endif - -#ifdef ATOMUI_CC_MSVC -# define ATOMUI_NEVER_INLINE __declspec(noinline) -# define ATOMUI_ALWAYS_INLINE __forceinline -#elif defined(ATOMUI_CC_GNU) -# define ATOMUI_NEVER_INLINE __attribute__((noinline)) -# define ATOMUI_ALWAYS_INLINE inline __attribute__((always_inline)) -#else -# define ATOMUI_NEVER_INLINE -# define ATOMUI_ALWAYS_INLINE inline -#endif - -//defines the type for the WNDPROC on windows -//the alignment needs to be forced for sse2 to not crash with mingw -#if defined(ATOMUI_OS_WIN) -# if defined(ATOMUI_CC_MINGW) && defined(ATOMUI_PROCESSOR_X86_32) -# define ATOMUI_ENSURE_STACK_ALIGNED_FOR_SSE __attribute__ ((force_align_arg_pointer)) -# else -# define ATOMUI_ENSURE_STACK_ALIGNED_FOR_SSE -# endif -# define ATOMUI_WIN_CALLBACK CALLBACK ATOMUI_ENSURE_STACK_ALIGNED_FOR_SSE -#endif - -#ifdef __cpp_conditional_explicit -#define ATOMUI_IMPLICIT explicit(false) -#else -#define ATOMUI_IMPLICIT -#endif - -#if defined(__cplusplus) - -#ifdef __cpp_constinit -# if defined(ATOMUI_CC_MSVC) && !defined(ATOMUI_CC_CLANG) - // https://developercommunity.visualstudio.com/t/C:-constinit-for-an-optional-fails-if-/1406069 -# define ATOMUI_CONSTINIT -# else -# define ATOMUI_CONSTINIT constinit -# endif -#elif defined(__has_cpp_attribute) && __has_cpp_attribute(clang::require_constant_initialization) -# define ATOMUI_CONSTINIT [[clang::require_constant_initialization]] -#elif defined(ATOMUI_CC_GNU_ONLY) && ATOMUI_CC_GNU >= 1000 -# define ATOMUI_CONSTINIT __constinit -#else -# define ATOMUI_CONSTINIT -#endif - -#ifndef ATOMUI_OUTOFLINE_TEMPLATE -# define ATOMUI_OUTOFLINE_TEMPLATE -#endif -#ifndef ATOMUI_INLINE_TEMPLATE -# define ATOMUI_INLINE_TEMPLATE inline -#endif - -/* - Avoid some particularly useless warnings from some stupid compilers. - To get ALL C++ compiler warnings, define ATOMUI_CC_WARNINGS or comment out - the line "#define ATOMUI_NO_WARNINGS". See also ATOMUIBUG-26877. -*/ -#if !defined(ATOMUI_CC_WARNINGS) -# define ATOMUI_NO_WARNINGS -#endif -#if defined(ATOMUI_NO_WARNINGS) -# if defined(ATOMUI_CC_MSVC) -ATOMUI_WARNING_DISABLE_MSVC(4251) /* class 'type' needs to have dll-interface to be used by clients of class 'type2' */ -ATOMUI_WARNING_DISABLE_MSVC(4244) /* conversion from 'type1' to 'type2', possible loss of data */ -ATOMUI_WARNING_DISABLE_MSVC(4275) /* non - DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier' */ -ATOMUI_WARNING_DISABLE_MSVC(4514) /* unreferenced inline function has been removed */ -ATOMUI_WARNING_DISABLE_MSVC(4800) /* 'type' : forcing value to bool 'true' or 'false' (performance warning) */ -ATOMUI_WARNING_DISABLE_MSVC(4097) /* typedef-name 'identifier1' used as synonym for class-name 'identifier2' */ -ATOMUI_WARNING_DISABLE_MSVC(4706) /* assignment within conditional expression */ -ATOMUI_WARNING_DISABLE_MSVC(4355) /* 'this' : used in base member initializer list */ -ATOMUI_WARNING_DISABLE_MSVC(4710) /* function not inlined */ -ATOMUI_WARNING_DISABLE_MSVC(4530) /* C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc */ -# elif defined(ATOMUI_CC_BOR) -# pragma option -w-inl -# pragma option -w-aus -# pragma warn -inl -# pragma warn -pia -# pragma warn -ccc -# pragma warn -rch -# pragma warn -sig -# endif -#endif - -#if !defined(ATOMUI_NO_EXCEPTIONS) -# if !defined(ATOMUI_MOC_RUN) -# if defined(ATOMUI_CC_GNU) && !defined(__cpp_exceptions) -# define ATOMUI_NO_EXCEPTIONS -# endif -# elif defined(ATOMUI_BOOTSTRAPPED) -# define ATOMUI_NO_EXCEPTIONS -# endif -#endif - -// libstdc++ shipped with gcc < 11 does not have a fix for defect LWG 3346 -#if __cplusplus >= 202002L && (!defined(_GLIBCXX_RELEASE) || _GLIBCXX_RELEASE >= 11) -# define ATOMUI_COMPILER_HAS_LWG3346 -#endif - -#if defined(__cplusplus) && __cplusplus >= 202002L // P0846 doesn't have a feature macro :/ -# if !defined(ATOMUI_CC_MSVC_ONLY) || ATOMUI_CC_MSVC >= 1939 // claims C++20 support but lacks P0846 - // 1939 is known to work - // 1936 is known to fail -# define ATOMUI_COMPILER_HAS_P0846 -# endif -#endif - -#ifdef ATOMUI_COMPILER_HAS_P0846 -# define ATOMUI_ENABLE_P0846_SEMANTICS_FOR(func) -#else - class ATOMUI_CLASS_JUST_FOR_P0846_SIMULATION; -# define ATOMUI_ENABLE_P0846_SEMANTICS_FOR(func) \ - template \ - void func (ATOMUI_CLASS_JUST_FOR_P0846_SIMULATION *); \ - /* end */ -#endif - -#endif // __cplusplus diff --git a/nativelibs/include/atomui/Config.h.in b/nativelibs/include/atomui/Config.h.in deleted file mode 100644 index c9ec209c1..000000000 --- a/nativelibs/include/atomui/Config.h.in +++ /dev/null @@ -1,31 +0,0 @@ -// This source file is part of the atomui project -// -// Copyright (c) 2017 - 2025 qinware, All rights reserved. -// Copyright (c) 2017 - 2025 chinboy -// -// See https://qinware.com/LICENSE.txt for license information -// -// Created by chinboy on 2025/01/10. - -#pragma once - -#include "atomui/Compiler.h" - -#define ATOMUI_VERSION_MAJOR ${PROJECT_VERSION_MAJOR} -#define ATOMUI_VERSION_MINOR ${PROJECT_VERSION_MINOR} -#define ATOMUI_VERSION_PATCH ${PROJECT_VERSION_PATCH} -#define ATOMUI_VERSION_BUILD "${ATOMUI_VERSION_BUILD}" - -namespace atomui { - -const char ATOMUI_VERSION_LONG[] = "${PROJECT_VERSION}"; -const char ATOMUI_AUTHOR[] = "Qinware Technologies Ltd."; -const char ATOMUI_YEAR[] = "${ATOMUI_COPYRIGHT_YEAR}"; - -const char ATOMUI_DISPLAY_NAME[] = "${ATOMUI_DISPLAY_NAME}"; -const char ATOMUI_PACKAGE_NAME[] = "${ATOMUI_PACKAGE_NAME}"; -const char ATOMUI_PACKAGE_CASED_NAME[] = "${ATOMUI_PACKAGE_CASED_NAME}"; - -const char ATOMUI_COMPANY_NAME[] = "${ATOMUI_COMPANY_NAME}"; - -} diff --git a/nativelibs/include/atomui/Global.h b/nativelibs/include/atomui/Global.h deleted file mode 100644 index 188f54712..000000000 --- a/nativelibs/include/atomui/Global.h +++ /dev/null @@ -1,49 +0,0 @@ -// This source file is part of the atomui project -// -// Copyright (c) 2017 - 2025 qinware, All rights reserved. -// Copyright (c) 2017 - 2025 chinboy -// -// See https://qinware.com/LICENSE.txt for license information -// -// Created by chinboy on 2025/01/10. - -#pragma once - -#include "atomui/Config.h" -#include -#ifdef ATOMUI_OS_WINDOWS -#include -#endif - -#ifdef __cplusplus -constexpr -#endif -inline void atomui_noop() -#ifdef __cplusplus - noexcept -#endif -{ -} - -#if defined(ATOMUI_LIBRARY) -# define ATOMUI_EXPORT ATOMUI_DECL_EXPORT -#elif defined(ATOMUI_STATIC_LIB) // Abuse single files for manual tests -# define ATOMUI_EXPORT -#else -# define ATOMUI_EXPORT ATOMUI_DECL_IMPORT -#endif - -namespace atomui -{ -ATOMUI_EXPORT std::string version_string(); -} - -#if defined(ATOMUI_OS_WIN) -#ifndef STD_CALL_TYPE -#define STD_CALL_TYPE __stdcall -#endif -#else -#ifndef STD_CALL_TYPE -#define STD_CALL_TYPE -#endif -#endif diff --git a/nativelibs/include/atomui/ProcessorDetection.h b/nativelibs/include/atomui/ProcessorDetection.h deleted file mode 100644 index fd1266ac3..000000000 --- a/nativelibs/include/atomui/ProcessorDetection.h +++ /dev/null @@ -1,389 +0,0 @@ -// This source file is part of the atomui project -// -// Copyright (c) 2017 - 2025 qinware, All rights reserved. -// Copyright (c) 2017 - 2025 chinboy -// -// See https://qinware.com/LICENSE.txt for license information -// -// Created by chinboy on 2025/01/10. - -#pragma once - -/* - This file uses preprocessor #defines to set various ATOMUI_PROCESSOR_* #defines - based on the following patterns: - - ATOMUI_PROCESSOR_{FAMILY} - ATOMUI_PROCESSOR_{FAMILY}_{VARIANT} - ATOMUI_PROCESSOR_{FAMILY}_{REVISION} - - The first is always defined. Defines for the various revisions/variants are - optional and usually dependent on how the compiler was invoked. Variants - that are a superset of another should have a define for the superset. - - In addition to the processor family, variants, and revisions, we also set - ATOMUI_BYTE_ORDER appropriately for the target processor. For bi-endian - processors, we try to auto-detect the byte order using the __BIG_ENDIAN__, - __LITTLE_ENDIAN__, or __BYTE_ORDER__ preprocessor macros. - - Note: when adding support for new processors, be sure to update - config.tests/arch/arch.cpp to ensure that configure can detect the target - and host architectures. -*/ - -/* Machine byte-order, reuse preprocessor provided macros when available */ -#if defined(__ORDER_BIG_ENDIAN__) -# define ATOMUI_BIG_ENDIAN __ORDER_BIG_ENDIAN__ -#else -# define ATOMUI_BIG_ENDIAN 4321 -#endif -#if defined(__ORDER_LITTLE_ENDIAN__) -# define ATOMUI_LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__ -#else -# define ATOMUI_LITTLE_ENDIAN 1234 -#endif - -/* - Alpha family, no revisions or variants - - Alpha is bi-endian, use endianness auto-detection implemented below. -*/ -#if defined(__alpha__) || defined(_M_ALPHA) -# define ATOMUI_PROCESSOR_ALPHA -// ATOMUI_BYTE_ORDER not defined, use endianness auto-detection - -/* - ARM family, known revisions: V5, V6, V7, V8 - - ARM is bi-endian, detect using __ARMEL__ or __ARMEB__, falling back to - auto-detection implemented below. -*/ -#elif defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) || defined(_M_ARM64) || defined(__aarch64__) || defined(__ARM64__) -# if defined(__aarch64__) || defined(__ARM64__) || defined(_M_ARM64) -# define ATOMUI_PROCESSOR_ARM_64 -# define ATOMUI_PROCESSOR_WORDSIZE 8 -# else -# define ATOMUI_PROCESSOR_ARM_32 -# endif -# if defined(__ARM_ARCH) && __ARM_ARCH > 1 -# define ATOMUI_PROCESSOR_ARM __ARM_ARCH -# elif defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM > 1 -# define ATOMUI_PROCESSOR_ARM __TARGET_ARCH_ARM -# elif defined(_M_ARM) && _M_ARM > 1 -# define ATOMUI_PROCESSOR_ARM _M_ARM -# elif defined(__ARM64_ARCH_8__) \ - || defined(__aarch64__) \ - || defined(__ARMv8__) \ - || defined(__ARMv8_A__) \ - || defined(_M_ARM64) -# define ATOMUI_PROCESSOR_ARM 8 -# elif defined(__ARM_ARCH_7__) \ - || defined(__ARM_ARCH_7A__) \ - || defined(__ARM_ARCH_7R__) \ - || defined(__ARM_ARCH_7M__) \ - || defined(__ARM_ARCH_7S__) \ - || defined(_ARM_ARCH_7) \ - || defined(__CORE_CORTEXA__) -# define ATOMUI_PROCESSOR_ARM 7 -# elif defined(__ARM_ARCH_6__) \ - || defined(__ARM_ARCH_6J__) \ - || defined(__ARM_ARCH_6T2__) \ - || defined(__ARM_ARCH_6Z__) \ - || defined(__ARM_ARCH_6K__) \ - || defined(__ARM_ARCH_6ZK__) \ - || defined(__ARM_ARCH_6M__) -# define ATOMUI_PROCESSOR_ARM 6 -# elif defined(__ARM_ARCH_5TEJ__) \ - || defined(__ARM_ARCH_5TE__) -# define ATOMUI_PROCESSOR_ARM 5 -# else -# define ATOMUI_PROCESSOR_ARM 0 -# endif -# if ATOMUI_PROCESSOR_ARM >= 8 -# define ATOMUI_PROCESSOR_ARM_V8 -# endif -# if ATOMUI_PROCESSOR_ARM >= 7 -# define ATOMUI_PROCESSOR_ARM_V7 -# endif -# if ATOMUI_PROCESSOR_ARM >= 6 -# define ATOMUI_PROCESSOR_ARM_V6 -# endif -# if ATOMUI_PROCESSOR_ARM >= 5 -# define ATOMUI_PROCESSOR_ARM_V5 -# else -# error "ARM architecture too old" -# endif -# if defined(__ARMEL__) || defined(_M_ARM64) -# define ATOMUI_BYTE_ORDER ATOMUI_LITTLE_ENDIAN -# elif defined(__ARMEB__) -# define ATOMUI_BYTE_ORDER ATOMUI_BIG_ENDIAN -# else -// ATOMUI_BYTE_ORDER not defined, use endianness auto-detection -#endif - -/* - AVR32 family, no revisions or variants - - AVR32 is big-endian. -*/ -// #elif defined(__avr32__) -// # define ATOMUI_PROCESSOR_AVR32 -// # define ATOMUI_BYTE_ORDER ATOMUI_BIG_ENDIAN - -/* - Blackfin family, no revisions or variants - - Blackfin is little-endian. -*/ -// #elif defined(__bfin__) -// # define ATOMUI_PROCESSOR_BLACKFIN -// # define ATOMUI_BYTE_ORDER ATOMUI_LITTLE_ENDIAN - -/* - PA-RISC family, no revisions or variants - - PA-RISC is big-endian. -*/ -#elif defined(__hppa__) -# define ATOMUI_PROCESSOR_HPPA -# define ATOMUI_BYTE_ORDER ATOMUI_BIG_ENDIAN - -/* - X86 family, known variants: 32- and 64-bit - - X86 is little-endian. -*/ -#elif defined(__i386) || defined(__i386__) || defined(_M_IX86) -# define ATOMUI_PROCESSOR_X86_32 -# define ATOMUI_BYTE_ORDER ATOMUI_LITTLE_ENDIAN -# define ATOMUI_PROCESSOR_WORDSIZE 4 - -/* - * We define ATOMUI_PROCESSOR_X86 == 6 for anything above a equivalent or better - * than a Pentium Pro (the processor whose architecture was called P6) or an - * Athlon. - * - * All processors since the Pentium III and the Athlon 4 have SSE support, so - * we use that to detect. That leaves the original Athlon, Pentium Pro and - * Pentium II. - */ - -# if defined(_M_IX86) -# define ATOMUI_PROCESSOR_X86 (_M_IX86/100) -# elif defined(__i686__) || defined(__athlon__) || defined(__SSE__) || defined(__pentiumpro__) -# define ATOMUI_PROCESSOR_X86 6 -# elif defined(__i586__) || defined(__k6__) || defined(__pentium__) -# define ATOMUI_PROCESSOR_X86 5 -# elif defined(__i486__) || defined(__80486__) -# define ATOMUI_PROCESSOR_X86 4 -# else -# define ATOMUI_PROCESSOR_X86 3 -# endif - -#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64) -# define ATOMUI_PROCESSOR_X86 6 -# define ATOMUI_PROCESSOR_X86_64 -# define ATOMUI_BYTE_ORDER ATOMUI_LITTLE_ENDIAN -# define ATOMUI_PROCESSOR_WORDSIZE 8 - -/* - Itanium (IA-64) family, no revisions or variants - - Itanium is bi-endian, use endianness auto-detection implemented below. -*/ -#elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64) -# define ATOMUI_PROCESSOR_IA64 -# define ATOMUI_PROCESSOR_WORDSIZE 8 -// ATOMUI_BYTE_ORDER not defined, use endianness auto-detection - -/* - LoongArch family, known variants: 32- and 64-bit - - LoongArch is little-endian. -*/ -#elif defined(__loongarch__) -# define ATOMUI_PROCESSOR_LOONGARCH -# if __loongarch_grlen == 64 -# define ATOMUI_PROCESSOR_LOONGARCH_64 -# else -# define ATOMUI_PROCESSOR_LOONGARCH_32 -# endif -# define ATOMUI_BYTE_ORDER ATOMUI_LITTLE_ENDIAN - -/* - Motorola 68000 family, no revisions or variants - - M68K is big-endian. -*/ -#elif defined(__m68k__) -# define ATOMUI_PROCESSOR_M68K -# define ATOMUI_BYTE_ORDER ATOMUI_BIG_ENDIAN - -/* - MIPS family, known revisions: I, II, III, IV, 32, 64 - - MIPS is bi-endian, use endianness auto-detection implemented below. -*/ -#elif defined(__mips) || defined(__mips__) || defined(_M_MRX000) -# define ATOMUI_PROCESSOR_MIPS -# if defined(_MIPS_ARCH_MIPS1) || (defined(__mips) && __mips - 0 >= 1) -# define ATOMUI_PROCESSOR_MIPS_I -# endif -# if defined(_MIPS_ARCH_MIPS2) || (defined(__mips) && __mips - 0 >= 2) -# define ATOMUI_PROCESSOR_MIPS_II -# endif -# if defined(_MIPS_ARCH_MIPS3) || (defined(__mips) && __mips - 0 >= 3) -# define ATOMUI_PROCESSOR_MIPS_III -# endif -# if defined(_MIPS_ARCH_MIPS4) || (defined(__mips) && __mips - 0 >= 4) -# define ATOMUI_PROCESSOR_MIPS_IV -# endif -# if defined(_MIPS_ARCH_MIPS5) || (defined(__mips) && __mips - 0 >= 5) -# define ATOMUI_PROCESSOR_MIPS_V -# endif -# if defined(_MIPS_ARCH_MIPS32) || defined(__mips32) || (defined(__mips) && __mips - 0 >= 32) -# define ATOMUI_PROCESSOR_MIPS_32 -# endif -# if defined(_MIPS_ARCH_MIPS64) || defined(__mips64) -# define ATOMUI_PROCESSOR_MIPS_64 -# define ATOMUI_PROCESSOR_WORDSIZE 8 -# endif -# if defined(__MIPSEL__) -# define ATOMUI_BYTE_ORDER ATOMUI_LITTLE_ENDIAN -# elif defined(__MIPSEB__) -# define ATOMUI_BYTE_ORDER ATOMUI_BIG_ENDIAN -# else -// ATOMUI_BYTE_ORDER not defined, use endianness auto-detection -# endif - -/* - Power family, known variants: 32- and 64-bit - - There are many more known variants/revisions that we do not handle/detect. - See http://en.wikipedia.org/wiki/Power_Architecture - and http://en.wikipedia.org/wiki/File:PowerISA-evolution.svg - - Power is bi-endian, use endianness auto-detection implemented below. -*/ -#elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__) \ - || defined(_ARCH_COM) || defined(_ARCH_PWR) || defined(_ARCH_PPC) \ - || defined(_M_MPPC) || defined(_M_PPC) -# define ATOMUI_PROCESSOR_POWER -# if defined(__ppc64__) || defined(__powerpc64__) || defined(__64BIT__) -# define ATOMUI_PROCESSOR_POWER_64 -# define ATOMUI_PROCESSOR_WORDSIZE 8 -# else -# define ATOMUI_PROCESSOR_POWER_32 -# endif -// ATOMUI_BYTE_ORDER not defined, use endianness auto-detection - -/* - RISC-V family, known variants: 32- and 64-bit - - RISC-V is little-endian. -*/ -#elif defined(__riscv) -# define ATOMUI_PROCESSOR_RISCV -# if __riscv_xlen == 64 -# define ATOMUI_PROCESSOR_RISCV_64 -# else -# define ATOMUI_PROCESSOR_RISCV_32 -# endif -# define ATOMUI_BYTE_ORDER ATOMUI_LITTLE_ENDIAN - -/* - S390 family, known variant: S390X (64-bit) - - S390 is big-endian. -*/ -#elif defined(__s390__) -# define ATOMUI_PROCESSOR_S390 -# if defined(__s390x__) -# define ATOMUI_PROCESSOR_S390_X -# endif -# define ATOMUI_BYTE_ORDER ATOMUI_BIG_ENDIAN - -/* - SuperH family, optional revision: SH-4A - - SuperH is bi-endian, use endianness auto-detection implemented below. -*/ -// #elif defined(__sh__) -// # define ATOMUI_PROCESSOR_SH -// # if defined(__sh4a__) -// # define ATOMUI_PROCESSOR_SH_4A -// # endif -// ATOMUI_BYTE_ORDER not defined, use endianness auto-detection - -/* - SPARC family, optional revision: V9 - - SPARC is big-endian only prior to V9, while V9 is bi-endian with big-endian - as the default byte order. Assume all SPARC systems are big-endian. -*/ -#elif defined(__sparc__) -# define ATOMUI_PROCESSOR_SPARC -# if defined(__sparc_v9__) || defined(__sparcv9) -# define ATOMUI_PROCESSOR_SPARC_V9 -# endif -# if defined(__sparc64__) -# define ATOMUI_PROCESSOR_SPARC_64 -# endif -# define ATOMUI_BYTE_ORDER ATOMUI_BIG_ENDIAN - -#endif - -/* - NOTE: - GCC 4.6 added __BYTE_ORDER__, __ORDER_BIG_ENDIAN__, __ORDER_LITTLE_ENDIAN__ - and __ORDER_PDP_ENDIAN__ in SVN r165881. If you are using GCC 4.6 or newer, - this code will properly detect your target byte order; if you are not, and - the __LITTLE_ENDIAN__ or __BIG_ENDIAN__ macros are not defined, then this - code will fail to detect the target byte order. -*/ -// Some processors support either endian format, try to detect which we are using. -#if !defined(ATOMUI_BYTE_ORDER) -# if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == ATOMUI_BIG_ENDIAN || __BYTE_ORDER__ == ATOMUI_LITTLE_ENDIAN) -// Reuse __BYTE_ORDER__ as-is, since our ATOMUI_*_ENDIAN #defines match the preprocessor defaults -# define ATOMUI_BYTE_ORDER __BYTE_ORDER__ -# elif defined(__BIG_ENDIAN__) || defined(_big_endian__) || defined(_BIG_ENDIAN) -# define ATOMUI_BYTE_ORDER ATOMUI_BIG_ENDIAN -# elif defined(__LITTLE_ENDIAN__) || defined(_little_endian__) || defined(_LITTLE_ENDIAN) -# define ATOMUI_BYTE_ORDER ATOMUI_LITTLE_ENDIAN -# else -# error "Unable to determine byte order!" -# endif -#endif - -/* - Size of a pointer and the machine register size. We detect a 64-bit system by: - * GCC and compatible compilers (Clang, ICC on OS X and Windows) always define - __SIZEOF_POINTER__. This catches all known cases of ILP32 builds on 64-bit - processors. - * Most other Unix compilers define __LP64__ or _LP64 on 64-bit mode - (Long and Pointer 64-bit) - * If ATOMUI_PROCESSOR_WORDSIZE was defined above, it's assumed to match the pointer - size. - Otherwise, we assume to be 32-bit and then check in qglobal.cpp that it is right. -*/ - -#if defined __SIZEOF_POINTER__ -# define ATOMUI_POINTER_SIZE __SIZEOF_POINTER__ -#elif defined(__LP64__) || defined(_LP64) -# define ATOMUI_POINTER_SIZE 8 -#elif defined(ATOMUI_PROCESSOR_WORDSIZE) -# define ATOMUI_POINTER_SIZE ATOMUI_PROCESSOR_WORDSIZE -#else -# define ATOMUI_POINTER_SIZE 4 -#endif - -/* - Define ATOMUI_PROCESSOR_WORDSIZE to be the size of the machine's word (usually, - the size of the register). On some architectures where a pointer could be - smaller than the register, the macro is defined above. - - Falls back to ATOMUI_POINTER_SIZE if not set explicitly for the platform. -*/ -#ifndef ATOMUI_PROCESSOR_WORDSIZE -# define ATOMUI_PROCESSOR_WORDSIZE ATOMUI_POINTER_SIZE -#endif diff --git a/nativelibs/include/atomui/SystemDetection.h b/nativelibs/include/atomui/SystemDetection.h deleted file mode 100644 index cdee7ea46..000000000 --- a/nativelibs/include/atomui/SystemDetection.h +++ /dev/null @@ -1,222 +0,0 @@ -// This source file is part of the atomui project -// -// Copyright (c) 2017 - 2025 qinware, All rights reserved. -// Copyright (c) 2017 - 2025 chinboy -// -// See https://qinware.com/LICENSE.txt for license information -// -// Created by chinboy on 2025/01/10. - -#pragma once - -/* - The operating system, must be one of: (ATOMUI_OS_x) - - DARWIN - Any Darwin system (macOS, iOS, watchOS, tvOS) - MACOS - macOS - IOS - iOS - WATCHOS - watchOS - TVOS - tvOS - VISIONOS - visionOS - WIN32 - Win32 (Windows 2000/XP/Vista/7 and Windows Server 2003/2008) - CYGWIN - Cygwin - SOLARIS - Sun Solaris - HPUX - HP-UX - LINUX - Linux [has variants] - FREEBSD - FreeBSD [has variants] - NETBSD - NetBSD - OPENBSD - OpenBSD - INTERIX - Interix - AIX - AIX - HURD - GNU Hurd - QNX - QNX [has variants] - QNX6 - QNX RTP 6.1 - LYNX - LynxOS - BSD4 - Any BSD 4.4 system - UNIX - Any UNIX BSD/SYSV system - ANDROID - Android platform - HAIKU - Haiku - WEBOS - LG WebOS - WASM - WebAssembly - - The following operating systems have variants: - LINUX - both ATOMUI_OS_LINUX and ATOMUI_OS_ANDROID are defined when building for Android - - only ATOMUI_OS_LINUX is defined if building for other Linux systems - MACOS - both ATOMUI_OS_BSD4 and ATOMUI_OS_IOS are defined when building for iOS - - both ATOMUI_OS_BSD4 and ATOMUI_OS_MACOS are defined when building for macOS - FREEBSD - ATOMUI_OS_FREEBSD is defined only when building for FreeBSD with a BSD userland - - ATOMUI_OS_FREEBSD_KERNEL is always defined on FreeBSD, even if the userland is from GNU -*/ - -#if defined(__APPLE__) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__)) -# include -# define ATOMUI_OS_APPLE -# if defined(TARGET_OS_MAC) && TARGET_OS_MAC -# define ATOMUI_OS_DARWIN -# define ATOMUI_OS_BSD4 -# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE -# define ATOMUI_PLATFORM_UIKIT -# if defined(TARGET_OS_WATCH) && TARGET_OS_WATCH -# define ATOMUI_OS_WATCHOS -# elif defined(TARGET_OS_TV) && TARGET_OS_TV -# define ATOMUI_OS_TVOS -# elif defined(TARGET_OS_VISION) && TARGET_OS_VISION -# define ATOMUI_OS_VISIONOS -# else -# // TARGET_OS_IOS is only available in newer SDKs, -# // so assume any other iOS-based platform is iOS for now -# define ATOMUI_OS_IOS -# endif -# else -# // TARGET_OS_OSX is only available in newer SDKs, -# // so assume any non iOS-based platform is macOS for now -# define ATOMUI_OS_MACOS -# endif -# else -# error "AtomUI has not been ported to this Apple platform" -# endif -#elif defined(__WEBOS__) -# define ATOMUI_OS_WEBOS -# define ATOMUI_OS_LINUX -#elif defined(__ANDROID__) || defined(ANDROID) -# define ATOMUI_OS_ANDROID -# define ATOMUI_OS_LINUX -#elif defined(__CYGWIN__) -# define ATOMUI_OS_CYGWIN -#elif !defined(SAG_COM) && (!defined(WINAPI_FAMILY) || WINAPI_FAMILY==WINAPI_FAMILY_DESKTOP_APP) && (defined(WIN64) || defined(_WIN64) || defined(__WIN64__)) -# define ATOMUI_OS_WIN32 -# define ATOMUI_OS_WIN64 -#elif !defined(SAG_COM) && (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)) -# define ATOMUI_OS_WIN32 -#elif defined(__sun) || defined(sun) -# define ATOMUI_OS_SOLARIS -#elif defined(hpux) || defined(__hpux) -# define ATOMUI_OS_HPUX -#elif defined(__EMSCRIPTEN__) -# define ATOMUI_OS_WASM -#elif defined(__linux__) || defined(__linux) -# define ATOMUI_OS_LINUX -#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) -# ifndef __FreeBSD_kernel__ -# define ATOMUI_OS_FREEBSD -# endif -# define ATOMUI_OS_FREEBSD_KERNEL -# define ATOMUI_OS_BSD4 -#elif defined(__NetBSD__) -# define ATOMUI_OS_NETBSD -# define ATOMUI_OS_BSD4 -#elif defined(__OpenBSD__) -# define ATOMUI_OS_OPENBSD -# define ATOMUI_OS_BSD4 -#elif defined(__INTERIX) -# define ATOMUI_OS_INTERIX -# define ATOMUI_OS_BSD4 -#elif defined(_AIX) -# define ATOMUI_OS_AIX -#elif defined(__Lynx__) -# define ATOMUI_OS_LYNX -#elif defined(__GNU__) -# define ATOMUI_OS_HURD -#elif defined(__QNXNTO__) -# define ATOMUI_OS_QNX -#elif defined(__INTEGRITY) -# define ATOMUI_OS_INTEGRITY -#elif defined(__rtems__) -# define ATOMUI_OS_RTEMS -#elif defined(__vxworks) -# define ATOMUI_OS_VXWORKS -#elif defined(__HAIKU__) -# define ATOMUI_OS_HAIKU -#elif defined(__MAKEDEPEND__) -#else -# error "AtomUI has not been ported to this OS" -#endif - -#if defined(ATOMUI_OS_WIN32) || defined(ATOMUI_OS_WIN64) -# define ATOMUI_OS_WINDOWS -# define ATOMUI_OS_WIN -// On Windows, pointers to dllimport'ed variables are not constant expressions, -// so to keep to certain initializations (like QMetaObject) constexpr, we need -// to use functions instead. -# define ATOMUI_NO_DATA_RELOCATION -#endif - -#if defined(ATOMUI_OS_WIN) -# undef ATOMUI_OS_UNIX -#elif !defined(ATOMUI_OS_UNIX) -# define ATOMUI_OS_UNIX -#endif - -#ifdef ATOMUI_OS_DARWIN -# include -# include - -# define ATOMUI_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios, tvos, watchos) \ - ((defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && macos != __MAC_NA && __MAC_OS_X_VERSION_MAX_ALLOWED >= macos) || \ - (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && ios != __IPHONE_NA && __IPHONE_OS_VERSION_MAX_ALLOWED >= ios) || \ - (defined(__TV_OS_VERSION_MAX_ALLOWED) && tvos != __TVOS_NA && __TV_OS_VERSION_MAX_ALLOWED >= tvos) || \ - (defined(__WATCH_OS_VERSION_MAX_ALLOWED) && watchos != __WATCHOS_NA && __WATCH_OS_VERSION_MAX_ALLOWED >= watchos)) - -# define ATOMUI_DARWIN_DEPLOYMENT_TARGET_BELOW(macos, ios, tvos, watchos) \ - ((defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && macos != __MAC_NA && __MAC_OS_X_VERSION_MIN_REQUIRED < macos) || \ - (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && ios != __IPHONE_NA && __IPHONE_OS_VERSION_MIN_REQUIRED < ios) || \ - (defined(__TV_OS_VERSION_MIN_REQUIRED) && tvos != __TVOS_NA && __TV_OS_VERSION_MIN_REQUIRED < tvos) || \ - (defined(__WATCH_OS_VERSION_MIN_REQUIRED) && watchos != __WATCHOS_NA && __WATCH_OS_VERSION_MIN_REQUIRED < watchos)) - -# define ATOMUI_MACOS_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios) \ - ATOMUI_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios, __TVOS_NA, __WATCHOS_NA) -# define ATOMUI_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(macos) \ - ATOMUI_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, __IPHONE_NA, __TVOS_NA, __WATCHOS_NA) -# define ATOMUI_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(ios) \ - ATOMUI_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_NA, ios, __TVOS_NA, __WATCHOS_NA) -# define ATOMUI_TVOS_PLATFORM_SDK_EQUAL_OR_ABOVE(tvos) \ - ATOMUI_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_NA, __IPHONE_NA, tvos, __WATCHOS_NA) -# define ATOMUI_WATCHOS_PLATFORM_SDK_EQUAL_OR_ABOVE(watchos) \ - ATOMUI_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_NA, __IPHONE_NA, __TVOS_NA, watchos) - -# define ATOMUI_MACOS_IOS_DEPLOYMENT_TARGET_BELOW(macos, ios) \ - ATOMUI_DARWIN_DEPLOYMENT_TARGET_BELOW(macos, ios, __TVOS_NA, __WATCHOS_NA) -# define ATOMUI_MACOS_DEPLOYMENT_TARGET_BELOW(macos) \ - ATOMUI_DARWIN_DEPLOYMENT_TARGET_BELOW(macos, __IPHONE_NA, __TVOS_NA, __WATCHOS_NA) -# define ATOMUI_IOS_DEPLOYMENT_TARGET_BELOW(ios) \ - ATOMUI_DARWIN_DEPLOYMENT_TARGET_BELOW(__MAC_NA, ios, __TVOS_NA, __WATCHOS_NA) -# define ATOMUI_TVOS_DEPLOYMENT_TARGET_BELOW(tvos) \ - ATOMUI_DARWIN_DEPLOYMENT_TARGET_BELOW(__MAC_NA, __IPHONE_NA, tvos, __WATCHOS_NA) -# define ATOMUI_WATCHOS_DEPLOYMENT_TARGET_BELOW(watchos) \ - ATOMUI_DARWIN_DEPLOYMENT_TARGET_BELOW(__MAC_NA, __IPHONE_NA, __TVOS_NA, watchos) - -#else // !ATOMUI_OS_DARWIN - -#define ATOMUI_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios, tvos, watchos) (0) -#define ATOMUI_MACOS_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios) (0) -#define ATOMUI_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(macos) (0) -#define ATOMUI_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(ios) (0) -#define ATOMUI_TVOS_PLATFORM_SDK_EQUAL_OR_ABOVE(tvos) (0) -#define ATOMUI_WATCHOS_PLATFORM_SDK_EQUAL_OR_ABOVE(watchos) (0) - -#endif // ATOMUI_OS_DARWIN - -#ifdef __LSB_VERSION__ -# if __LSB_VERSION__ < 40 -# error "This version of the Linux Standard Base is unsupported" -# endif -#ifndef ATOMUI_LINUXBASE -# define ATOMUI_LINUXBASE -#endif -#endif - -#if defined (__ELF__) -# define ATOMUI_OF_ELF -#endif -#if defined (__MACH__) && defined (__APPLE__) -# define ATOMUI_OF_MACH_O -#endif - -#if defined(__SIZEOF_INT128__) -// Compiler used in VxWorks SDK declares __SIZEOF_INT128__ but VxWorks doesn't support this type, -// so we can't rely solely on compiler here. -// MSVC STL used by MSVC and clang-cl does not support int128 -#if !defined(ATOMUI_OS_VXWORKS) && !defined(_MSC_VER) -# define ATOMUI_COMPILER_SUPPORTS_INT128 __SIZEOF_INT128__ -#endif -#endif // defined(__SIZEOF_INT128__) diff --git a/nativelibs/include/atomui/WindowUtils.h b/nativelibs/include/atomui/WindowUtils.h deleted file mode 100644 index 2b4cba198..000000000 --- a/nativelibs/include/atomui/WindowUtils.h +++ /dev/null @@ -1,30 +0,0 @@ -// This source file is part of the atomui project -// -// Copyright (c) 2017 - 2025 qinware, All rights reserved. -// Copyright (c) 2017 - 2025 chinboy -// -// See https://qinware.com/LICENSE.txt for license information -// -// Created by chinboy on 2025/01/10. - -#pragma once -#include "atomui/Global.h" - -#ifdef ATOMUI_OS_WINDOWS -using ATOMUI_WIN_HANDLE = HWND; -#else -using ATOMUI_WIN_HANDLE = void *; -#endif - -namespace atomui -{ -class ATOMUI_EXPORT WindowUtils -{ -public: - WindowUtils() = delete; - - static void setIgnoresMouseEvents(ATOMUI_WIN_HANDLE windowHandle, bool flag); - static bool ignoresMouseEvents(ATOMUI_WIN_HANDLE windowHandle); - static void moveWindow(ATOMUI_WIN_HANDLE windowHandle, int x, int y); -}; -} diff --git a/nativelibs/include/atomui/bridge/WindowUtils.h b/nativelibs/include/atomui/bridge/WindowUtils.h deleted file mode 100644 index 5b33f5db0..000000000 --- a/nativelibs/include/atomui/bridge/WindowUtils.h +++ /dev/null @@ -1,27 +0,0 @@ -// This source file is part of the atomui project -// -// Copyright (c) 2017 - 2025 qinware, All rights reserved. -// Copyright (c) 2017 - 2025 chinboy -// -// See https://qinware.com/LICENSE.txt for license information -// -// Created by chinboy on 2025/01/10. - -#pragma once - -#include "atomui/Global.h" -#include "atomui/WindowUtils.h" - -#if defined(__APPLE__) && defined(__MACH__) -#include -#endif - -struct CGSize; - -extern "C" ATOMUI_EXPORT void AtomUISetWindowIgnoresMouseEvents(ATOMUI_WIN_HANDLE windowHandle, bool flag); -extern "C" ATOMUI_EXPORT bool AtomUIGetWindowIgnoresMouseEvents(ATOMUI_WIN_HANDLE windowHandle); -extern "C" ATOMUI_EXPORT void AtomUISetMacOSCaptionButtonsPosition(ATOMUI_WIN_HANDLE windowHandle, double x, double y, double spacing); - -#if defined(__APPLE__) && defined(__MACH__) -extern "C" ATOMUI_EXPORT CGSize AtomUIMacOSCaptionsSize(ATOMUI_WIN_HANDLE windowHandle, double spacing); -#endif diff --git a/nativelibs/include/atomui/xmake.lua b/nativelibs/include/atomui/xmake.lua deleted file mode 100644 index d3c78d9b6..000000000 --- a/nativelibs/include/atomui/xmake.lua +++ /dev/null @@ -1,8 +0,0 @@ --- This source file is part of the atomui project --- --- Copyright (c) 2017 - 2022 qinware, All rights reserved. --- Copyright (c) 2017 - 2022 chinboy --- --- See https://qinware.com/LICENSE.txt for license information --- --- Created by chinboy on 2025/05/19. diff --git a/nativelibs/src/CMakeLists.txt b/nativelibs/src/CMakeLists.txt deleted file mode 100644 index 633be2ca2..000000000 --- a/nativelibs/src/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -# This source file is part of the atomui project -# -# Copyright (c) 2017 - 2022 qinware, All rights reserved. -# Copyright (c) 2017 - 2022 chinboy -# -# See https://qinware.com/LICENSE.txt for license information -# -# Created by chinboy on 2025/01/10. - -atomui_add_library(AtomUINative - BUILD_DEFAULT - SOURCES - Global.cpp - bridge/WindowUtils.cpp - ${ATOMUI_INCLUDE_DIR}/atomui/WindowUtils.h -) - -atomui_extend_library(AtomUINative CONDITION APPLE - SOURCES - macos/WindowUtils.mm - DEPENDS - ${FWFoundation} ${FWAppKit} -) - -atomui_extend_library(AtomUINative CONDITION WIN32 - SOURCES - windows/WindowUtils.cpp -) - -atomui_extend_library(AtomUINative CONDITION LINUX - SOURCES - linux/WindowUtils.cpp - DEPENDS - PkgConfig::XCB ${X11_LIBRARIES} - INCLUDES ${XCB_INCLUDE_DIRS} ${X11_INCLUDE_DIR} -) -target_link_libraries(AtomUINative INTERFACE ${X11_LIBRARIES}) diff --git a/nativelibs/src/Global.cpp b/nativelibs/src/Global.cpp deleted file mode 100644 index bdd38e2f5..000000000 --- a/nativelibs/src/Global.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// This source file is part of the atomui project -// -// Copyright (c) 2017 - 2025 qinware, All rights reserved. -// Copyright (c) 2017 - 2025 chinboy -// -// See https://qinware.com/LICENSE.txt for license information -// -// Created by chinboy on 2025/01/10. - -#include "atomui/Global.h" -#include - -namespace atomui -{ - std::string version_string() - { - return std::string{ATOMUI_VERSION_LONG}; - } - -} diff --git a/nativelibs/src/WindowUtils.cpp b/nativelibs/src/WindowUtils.cpp deleted file mode 100644 index 07a3c324b..000000000 --- a/nativelibs/src/WindowUtils.cpp +++ /dev/null @@ -1,10 +0,0 @@ -// This source file is part of the atomui project -// -// Copyright (c) 2017 - 2025 qinware, All rights reserved. -// Copyright (c) 2017 - 2025 chinboy -// -// See https://qinware.com/LICENSE.txt for license information -// -// Created by chinboy on 2025/01/10. - -#include "atomui/WindowUtils.h" diff --git a/nativelibs/src/bridge/WindowUtils.cpp b/nativelibs/src/bridge/WindowUtils.cpp deleted file mode 100644 index 7d3b09ead..000000000 --- a/nativelibs/src/bridge/WindowUtils.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// This source file is part of the atomui project -// -// Copyright (c) 2017 - 2025 qinware, All rights reserved. -// Copyright (c) 2017 - 2025 chinboy -// -// See https://qinware.com/LICENSE.txt for license information -// -// Created by chinboy on 2025/01/10. - -#include "atomui/bridge/WindowUtils.h" -#include "atomui/WindowUtils.h" - -using namespace atomui; - -void AtomUISetWindowIgnoresMouseEvents(ATOMUI_WIN_HANDLE windowHandle, bool flag) -{ - WindowUtils::setIgnoresMouseEvents(windowHandle, flag); -} - -bool AtomUIGetWindowIgnoresMouseEvents(ATOMUI_WIN_HANDLE windowHandle) -{ - return WindowUtils::ignoresMouseEvents(windowHandle); -} diff --git a/nativelibs/src/linux/WindowUtils.cpp b/nativelibs/src/linux/WindowUtils.cpp deleted file mode 100644 index 0311ebb2f..000000000 --- a/nativelibs/src/linux/WindowUtils.cpp +++ /dev/null @@ -1,186 +0,0 @@ -// This source file is part of the atomui project -// -// Copyright (c) 2017 - 2025 qinware, All rights reserved. -// Copyright (c) 2017 - 2025 chinboy -// -// See https://qinware.com/LICENSE.txt for license information -// -// Created by chinboy on 2025/07/05. - -#include "atomui/WindowUtils.h" -#include -#include -#include -#include - -namespace atomui -{ -void WindowUtils::setIgnoresMouseEvents(ATOMUI_WIN_HANDLE windowHandle, bool flag) -{ - xcb_connection_t* connection = xcb_connect(nullptr, nullptr); - if (int err = xcb_connection_has_error(connection)) - { - std::cerr << "XCB connection error: " << err << std::endl; - return; - } - - // 检查形状扩展 - xcb_shape_query_version_cookie_t shape_cookie = xcb_shape_query_version(connection); - xcb_generic_error_t* error = nullptr; - xcb_shape_query_version_reply_t* shape_reply = - xcb_shape_query_version_reply(connection, shape_cookie, &error); - - if (error) - { - std::cerr << "SHAPE extension error: " << error->error_code << std::endl; - free(error); - xcb_disconnect(connection); - return; - } - - if (!shape_reply) - { - std::cerr << "SHAPE extension not available" << std::endl; - xcb_disconnect(connection); - return; - } - - free(shape_reply); - - auto window = static_cast(reinterpret_cast(windowHandle)); - - xcb_void_cookie_t cookie; - - if (flag) - { - // 启用鼠标事件穿透:设置输入形状为空 - cookie = xcb_shape_rectangles_checked( - connection, - XCB_SHAPE_SO_SET, - XCB_SHAPE_SK_INPUT, - XCB_CLIP_ORDERING_UNSORTED, - window, - 0, - 0, - 0, // num_rects = 0 表示空区域 - nullptr // rects = nullptr - ); - } - else - { - // 禁用鼠标事件穿透:恢复默认输入形状(整个窗口) - // 获取窗口几何信息 - xcb_get_geometry_cookie_t geom_cookie = xcb_get_geometry(connection, window); - xcb_get_geometry_reply_t* geom_reply = xcb_get_geometry_reply(connection, geom_cookie, nullptr); - - if (!geom_reply) - { - std::cerr << "Failed to get window geometry" << std::endl; - xcb_disconnect(connection); - return; - } - - // 创建一个覆盖整个窗口的矩形 - xcb_rectangle_t rect = { - 0, // x - 0, // y - geom_reply->width, - geom_reply->height - }; - - free(geom_reply); - - // 设置输入形状为整个窗口 - cookie = xcb_shape_rectangles_checked( - connection, - XCB_SHAPE_SO_SET, - XCB_SHAPE_SK_INPUT, - XCB_CLIP_ORDERING_UNSORTED, - window, - 0, - 0, - 1, - &rect - ); - } - - error = xcb_request_check(connection, cookie); - if (error) - { - std::cerr << "Shape operation error: " << error->error_code << std::endl; - free(error); - } - - xcb_flush(connection); - xcb_disconnect(connection); -} - -bool WindowUtils::ignoresMouseEvents(ATOMUI_WIN_HANDLE windowHandle) -{ - xcb_connection_t* connection = xcb_connect(nullptr, nullptr); - if (int err = xcb_connection_has_error(connection)) - { - std::cerr << "XCB connection error: " << err << std::endl; - return false; // 默认返回 false - } - - // 检查形状扩展 - xcb_shape_query_version_cookie_t shape_cookie = xcb_shape_query_version(connection); - xcb_generic_error_t* error = nullptr; - xcb_shape_query_version_reply_t* shape_reply = - xcb_shape_query_version_reply(connection, shape_cookie, &error); - - if (error) - { - std::cerr << "SHAPE extension error: " << error->error_code << std::endl; - free(error); - xcb_disconnect(connection); - return false; - } - - if (!shape_reply) - { - std::cerr << "SHAPE extension not available" << std::endl; - xcb_disconnect(connection); - return false; - } - free(shape_reply); - - auto window = static_cast(reinterpret_cast(windowHandle)); - - // 查询窗口的输入形状 - xcb_shape_get_rectangles_cookie_t rects_cookie = - xcb_shape_get_rectangles(connection, window, XCB_SHAPE_SK_INPUT); - - xcb_shape_get_rectangles_reply_t* rects_reply = - xcb_shape_get_rectangles_reply(connection, rects_cookie, &error); - - if (error) - { - std::cerr << "Shape query error: " << error->error_code << std::endl; - free(error); - xcb_disconnect(connection); - return false; - } - - bool ignores = false; - - if (rects_reply) - { - int num_rects = xcb_shape_get_rectangles_rectangles_length(rects_reply); - - // 如果矩形数量为0,表示输入区域为空(鼠标穿透) - ignores = (num_rects == 0); - - free(rects_reply); - } - else - { - ignores = false; - } - - xcb_disconnect(connection); - return ignores; -} - -} diff --git a/nativelibs/src/macos/WindowUtils.mm b/nativelibs/src/macos/WindowUtils.mm deleted file mode 100644 index 4c1a1de1c..000000000 --- a/nativelibs/src/macos/WindowUtils.mm +++ /dev/null @@ -1,126 +0,0 @@ -// This source file is part of the atomui project -// -// Copyright (c) 2017 - 2025 qinware, All rights reserved. -// Copyright (c) 2017 - 2025 chinboy -// -// See https://qinware.com/LICENSE.txt for license information -// -// Created by chinboy on 2025/01/10. - -#include "atomui/WindowUtils.h" -#include "atomui/bridge/WindowUtils.h" -#include -#include -#import -#import - -namespace atomui { - -void WindowUtils::setIgnoresMouseEvents(ATOMUI_WIN_HANDLE windowHandle, bool flag) { - NSWindow *window = (__bridge NSWindow *)windowHandle; - [window setIgnoresMouseEvents:flag]; -} - -bool WindowUtils::ignoresMouseEvents(ATOMUI_WIN_HANDLE windowHandle) { - NSWindow *window = (__bridge NSWindow *)windowHandle; - return [window ignoresMouseEvents]; -} - -// 定义按钮类型 -enum WindowButtonType { - CloseButton = 0, - MinimizeButton, - ZoomButton -}; - -// 调整按钮位置的方法 -void adjust_window_captions_position(NSWindow* window, CGFloat x, CGFloat y, CGFloat spacing) { - if (!window) { - return; - } - - // 获取三个标准按钮 - NSButton* closeButton = [window standardWindowButton:NSWindowCloseButton]; - NSButton* minimizeButton = [window standardWindowButton:NSWindowMiniaturizeButton]; - NSButton* zoomButton = [window standardWindowButton:NSWindowZoomButton]; - - CGFloat offset = x; - // 仅调整垂直位置(下移) - if (closeButton) { - NSRect frame = closeButton.frame; - frame.origin.x = offset; - frame.origin.y = -y; - [closeButton setFrame:frame]; - offset += spacing + frame.size.width; - } - - if (minimizeButton) { - NSRect frame = minimizeButton.frame; - frame.origin.x = offset; - frame.origin.y = -y; - [minimizeButton setFrame:frame]; - offset += spacing + frame.size.width; - } - - if (zoomButton) { - NSRect frame = zoomButton.frame; - frame.origin.x = offset; - frame.origin.y = -y; - [zoomButton setFrame:frame]; - } - - // 强制重绘标题栏 - [[closeButton superview] setNeedsDisplay:YES]; -} - -CGSize window_captions_size(NSWindow* window, CGFloat spacing) -{ - if (!window) { - return CGSize{0, 0}; - } - - // 获取三个标准按钮 - NSButton* closeButton = [window standardWindowButton:NSWindowCloseButton]; - NSButton* minimizeButton = [window standardWindowButton:NSWindowMiniaturizeButton]; - NSButton* zoomButton = [window standardWindowButton:NSWindowZoomButton]; - - // 计算总宽度和最大高度 - CGFloat totalWidth = 0; - CGFloat maxHeight = 0; - - if (closeButton) { - NSRect frame = closeButton.frame; - totalWidth += spacing + frame.size.width; - maxHeight = MAX(maxHeight, frame.size.height); - } - - if (minimizeButton) { - NSRect frame = minimizeButton.frame; - totalWidth += spacing + frame.size.width; - maxHeight = MAX(maxHeight, frame.size.height); - } - - if (zoomButton) { - NSRect frame = zoomButton.frame; - totalWidth += frame.size.width; - maxHeight = MAX(maxHeight, frame.size.height); - } - - return CGSize{totalWidth, maxHeight}; -} - -} - -extern "C" { -void AtomUISetMacOSCaptionButtonsPosition(ATOMUI_WIN_HANDLE windowHandle, double x, double y, double spacing) -{ - auto window = (__bridge NSWindow *)windowHandle; - atomui::adjust_window_captions_position(window, x, y, spacing); -} - -CGSize AtomUIMacOSCaptionsSize(ATOMUI_WIN_HANDLE windowHandle, double spacing) -{ - auto window = (__bridge NSWindow *)windowHandle; - return atomui::window_captions_size(window, spacing); -} -} \ No newline at end of file diff --git a/nativelibs/src/windows/WindowUtils.cpp b/nativelibs/src/windows/WindowUtils.cpp deleted file mode 100644 index 598601c13..000000000 --- a/nativelibs/src/windows/WindowUtils.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// This source file is part of the atomui project -// -// Copyright (c) 2017 - 2025 qinware, All rights reserved. -// Copyright (c) 2017 - 2025 chinboy -// -// See https://qinware.com/LICENSE.txt for license information -// -// Created by chinboy on 2025/01/12. - -#include "atomui/WindowUtils.h" -#include - -namespace atomui -{ -long window_style(ATOMUI_WIN_HANDLE windowHandle) -{ - return GetWindowLong(windowHandle, GWL_STYLE); -} - -void set_window_style(ATOMUI_WIN_HANDLE windowHandle, long style) -{ - SetWindowLong(windowHandle, GWL_STYLE, style); -} - -long window_extended_style(ATOMUI_WIN_HANDLE windowHandle) -{ - return GetWindowLong(windowHandle, GWL_EXSTYLE); -} - -void set_window_extended_style(ATOMUI_WIN_HANDLE windowHandle, long style) -{ - SetWindowLong(windowHandle, GWL_EXSTYLE, style); -} - -void WindowUtils::setIgnoresMouseEvents(ATOMUI_WIN_HANDLE windowHandle, bool flag) -{ - auto styles = window_extended_style(windowHandle); - if (flag) - { - styles |= (WS_EX_TRANSPARENT | WS_EX_LAYERED); - } - else - { - styles &= ~(WS_EX_TRANSPARENT | WS_EX_LAYERED); - } - set_window_extended_style(windowHandle, styles); -} - -bool WindowUtils::ignoresMouseEvents(ATOMUI_WIN_HANDLE windowHandle) -{ - const auto styles = window_extended_style(windowHandle); - return styles & WS_EX_TRANSPARENT; -} - -} diff --git a/nativelibs/src/xmake.lua b/nativelibs/src/xmake.lua deleted file mode 100644 index e8f7e7f8b..000000000 --- a/nativelibs/src/xmake.lua +++ /dev/null @@ -1,31 +0,0 @@ --- This source file is part of the atomui project --- --- Copyright (c) 2017 - 2022 qinware, All rights reserved. --- Copyright (c) 2017 - 2022 chinboy --- --- See https://qinware.com/LICENSE.txt for license information --- --- Created by chinboy on 2025/05/19. - -target("AtomUINative", function() - set_kind("shared") - - add_defines("ATOMUI_LIBRARY") - add_files("Global.cpp") - add_files("bridge/WindowUtils.cpp") - add_files("WindowUtils.cpp") - - set_prefixdir("$(arch)") - - if is_os("macosx") then - add_frameworks("Foundation", "AppKit") - add_files("macos/WindowUtils.mm") - elseif is_os("windows") then - set_prefixname("") - add_files("windows/WindowUtils.cpp") - elseif is_os("linux") then - add_syslinks("xcb") - add_syslinks("xcb-shape") - add_files("linux/WindowUtils.cpp") - end -end) diff --git a/nativelibs/tests/unittests/xmake.lua b/nativelibs/tests/unittests/xmake.lua deleted file mode 100644 index d3c78d9b6..000000000 --- a/nativelibs/tests/unittests/xmake.lua +++ /dev/null @@ -1,8 +0,0 @@ --- This source file is part of the atomui project --- --- Copyright (c) 2017 - 2022 qinware, All rights reserved. --- Copyright (c) 2017 - 2022 chinboy --- --- See https://qinware.com/LICENSE.txt for license information --- --- Created by chinboy on 2025/05/19. diff --git a/nativelibs/xmake.lua b/nativelibs/xmake.lua deleted file mode 100644 index 8103c6bec..000000000 --- a/nativelibs/xmake.lua +++ /dev/null @@ -1,70 +0,0 @@ --- This source file is part of the atomui project --- --- Copyright (c) 2017 - 2022 qinware, All rights reserved. --- Copyright (c) 2017 - 2022 chinboy --- --- See https://qinware.com/LICENSE.txt for license information --- --- Created by chinboy on 2025/05/19. --- -add_rules("mode.debug", "mode.release") -set_xmakever("3.0.0") - -set_project("AtomUINative") -set_version("0.0.1", {build = "%Y%m%d%H%M"}) - -set_warnings("all", "error") - --- set language std version -set_languages("c17", "cxx20") - --- add module directories -add_moduledirs("xmake/modules") - --- define global variables -ATOMUI_SOURCE_DIR = os.projectdir() -ATOMUI_INCLUDE_DIR = path.join(ATOMUI_SOURCE_DIR, "include/atomui") - --- add option definitions -includes("xmake/options.lua") -includes("xmake/toolchains/atomui") - -add_includedirs("include", {public = true}) -add_includedirs("$(builddir)/include", {public = true}) - --- global config header generator -set_configdir("$(builddir)/include/atomui") -add_configfiles(path.join(ATOMUI_INCLUDE_DIR, "Config.h.in")) - -ATOMUI_PACKAGE_NAME = "atomui" -ATOMUI_PACKAGE_CASED_NAME = "AtomUI" -ATOMUI_PACKAGE_STRING = ATOMUI_PACKAGE_NAME .. " " .. ATOMUI_PACKAGE_CASED_NAME -ATOMUI_PACKAGE_BUGREPORT = "https://qinware.com/bugs/" -ATOMUI_DISPLAY_NAME = ATOMUI_PACKAGE_CASED_NAME -ATOMUI_COPYRIGHT_YEAR = "2025" -ATOMUI_COMPANY_NAME = "Qinware" -ATOMUI_COPYRIGHT = "Copyright Qinware Technologies Ltd. (c) 2018-2025" - -set_configvar("ATOMUI_PACKAGE_NAME", ATOMUI_PACKAGE_NAME) -set_configvar("ATOMUI_PACKAGE_CASED_NAME", ATOMUI_PACKAGE_CASED_NAME) -set_configvar("ATOMUI_PACKAGE_STRING", ATOMUI_PACKAGE_STRING) -set_configvar("ATOMUI_PACKAGE_BUGREPORT", ATOMUI_PACKAGE_BUGREPORT) -set_configvar("ATOMUI_DISPLAY_NAME", ATOMUI_DISPLAY_NAME) -set_configvar("ATOMUI_COPYRIGHT_YEAR", ATOMUI_COPYRIGHT_YEAR) -set_configvar("ATOMUI_COMPANY_NAME", ATOMUI_COMPANY_NAME) -set_configvar("ATOMUI_COPYRIGHT", ATOMUI_COPYRIGHT) - -if has_config("build_unittests") then includes("tests/unittests") end - -if is_mode("debug") then add_defines("ATOMUI_DEBUG_BUILD") end - -if is_os("linux") then - add_requires("libxcb") -end - -includes("include/atomui") -includes("src") - -before_build(function() - import("handle_info_summary")() -end) diff --git a/nativelibs/xmake/modules/handle_info_summary.lua b/nativelibs/xmake/modules/handle_info_summary.lua deleted file mode 100644 index 1fe81e6fb..000000000 --- a/nativelibs/xmake/modules/handle_info_summary.lua +++ /dev/null @@ -1,20 +0,0 @@ --- This source file is part of the atomui project --- --- Copyright (c) 2017 - 2022 qinware, All rights reserved. --- Copyright (c) 2017 - 2022 chinboy --- --- See https://qinware.com/LICENSE.txt for license information --- --- Created by chinboy on 2025/05/20. -local handleRequirePackages = import("handle_require_packages") -local summaryOutput = import("summary_output") -local config = import("core.project.config") - -function main() - local executed = config.get("atomui.on_config_executed") - if executed == nil then - handleRequirePackages() - summaryOutput() - config.set("atomui.on_config_executed", true) - end -end diff --git a/nativelibs/xmake/modules/handle_require_packages.lua b/nativelibs/xmake/modules/handle_require_packages.lua deleted file mode 100644 index 7d62c5ffa..000000000 --- a/nativelibs/xmake/modules/handle_require_packages.lua +++ /dev/null @@ -1,12 +0,0 @@ --- This source file is part of the atomui project --- --- Copyright (c) 2017 - 2022 qinware, All rights reserved. --- Copyright (c) 2017 - 2022 chinboy --- --- See https://qinware.com/LICENSE.txt for license information --- --- Created by chinboy on 2025/05/20. - -function main() - -- detect require packages -end diff --git a/nativelibs/xmake/modules/header_defines.lua b/nativelibs/xmake/modules/header_defines.lua deleted file mode 100644 index 06951ffab..000000000 --- a/nativelibs/xmake/modules/header_defines.lua +++ /dev/null @@ -1,31 +0,0 @@ --- This source file is part of the atomui project --- --- Copyright (c) 2017 - 2022 qinware, All rights reserved. --- Copyright (c) 2017 - 2022 chinboy --- --- See https://qinware.com/LICENSE.txt for license information --- --- Created by chinboy on 2025/05/19. - -function main() - set_configdir("$(builddir)/include/atomui") - add_configfiles(path.join(ATOMUI_INCLUDE_DIR, "Config.h.in")) - - ATOMUI_PACKAGE_NAME = "atomui" - ATOMUI_PACKAGE_CASED_NAME = "AtomUI" - ATOMUI_PACKAGE_STRING = ATOMUI_PACKAGE_NAME .. " " .. ATOMUI_PACKAGE_CASED_NAME - ATOMUI_PACKAGE_BUGREPORT = "https://qinware.com/bugs/" - ATOMUI_DISPLAY_NAME = ATOMUI_PACKAGE_CASED_NAME - ATOMUI_COPYRIGHT_YEAR = "2025" - ATOMUI_COMPANY_NAME = "Qinware" - ATOMUI_COPYRIGHT = "Copyright Qinware Technologies Ltd. (c) 2018-2025" - - set_configvar("ATOMUI_PACKAGE_NAME", ATOMUI_PACKAGE_NAME) - set_configvar("ATOMUI_PACKAGE_CASED_NAME", ATOMUI_PACKAGE_CASED_NAME) - set_configvar("ATOMUI_PACKAGE_STRING", ATOMUI_PACKAGE_STRING) - set_configvar("ATOMUI_PACKAGE_BUGREPORT", ATOMUI_PACKAGE_BUGREPORT) - set_configvar("ATOMUI_DISPLAY_NAME", ATOMUI_DISPLAY_NAME) - set_configvar("ATOMUI_COPYRIGHT_YEAR", ATOMUI_COPYRIGHT_YEAR) - set_configvar("ATOMUI_COMPANY_NAME", ATOMUI_COMPANY_NAME) - set_configvar("ATOMUI_COPYRIGHT", ATOMUI_COPYRIGHT) -end \ No newline at end of file diff --git a/nativelibs/xmake/modules/summary_output.lua b/nativelibs/xmake/modules/summary_output.lua deleted file mode 100644 index 6831a77aa..000000000 --- a/nativelibs/xmake/modules/summary_output.lua +++ /dev/null @@ -1,25 +0,0 @@ --- This source file is part of the atomui project --- --- Copyright (c) 2017 - 2022 qinware, All rights reserved. --- Copyright (c) 2017 - 2022 chinboy --- --- See https://qinware.com/LICENSE.txt for license information --- --- Created by chinboy on 2025/05/20. - -local project = import("core.project.project") -local project_config = import("core.project.config") - -function main() - cprint("--------------------------------------------------------------------------------------") - cprint("Thank for using AtomUI project, have a lot of fun!") - cprint("--------------------------------------------------------------------------------------") - cprint("BUILD_MODE : ${color.success}%s", project_config.mode()) - cprint("PROJECT_SOURCE_DIR: ${color.success}%s", os.projectdir()) - cprint("PROJECT_BINARY_DIR: ${color.success}%s", "$(builddir)") - cprint("CONFIGURE_DIR : ${color.success}%s", project_config.directory()) - cprint("XMAKE_INSTALL_DIR : ${color.success}%s", "$(programdir)") - cprint("HOST : ${color.success}%s", project_config.host()) - cprint("PLATFORM : ${color.success}%s", project_config.plat()) - cprint("ARCHITECTURE : ${color.success}%s", project_config.arch()) -end diff --git a/nativelibs/xmake/options.lua b/nativelibs/xmake/options.lua deleted file mode 100644 index 85c0af6c9..000000000 --- a/nativelibs/xmake/options.lua +++ /dev/null @@ -1,15 +0,0 @@ --- This source file is part of the atomui project --- --- Copyright (c) 2017 - 2022 qinware, All rights reserved. --- Copyright (c) 2017 - 2022 chinboy --- --- See https://qinware.com/LICENSE.txt for license information --- --- Created by chinboy on 2025/05/19. - -option("build_unittests", function() - set_showmenu(true) - set_default(false) - set_category("option") - set_description("Build targets for the AtomUI library unittests.") -end) diff --git a/nativelibs/xmake/toolchains/atomui/check.lua b/nativelibs/xmake/toolchains/atomui/check.lua deleted file mode 100644 index 395ea2f16..000000000 --- a/nativelibs/xmake/toolchains/atomui/check.lua +++ /dev/null @@ -1,147 +0,0 @@ ---!A cross-toolchain build utility based on Lua --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Copyright (C) 2015-present, TBOOX Open Source Group. --- --- @author ruki --- @file check.lua --- - --- imports -import("core.project.config") -import("lib.detect.find_path") -import("lib.detect.find_tool") -import("detect.sdks.find_xcode") -import("detect.sdks.find_cross_toolchain") - --- find xcode on macos -function _find_xcode(toolchain) - -- get apple device - local simulator - local appledev = toolchain:config("appledev") or config.get("appledev") - if appledev and appledev == "simulator" then - simulator = true - appledev = "simulator" - elseif not toolchain:is_plat("macosx") and toolchain:is_arch("i386", "x86_64") then - simulator = true - appledev = "simulator" - end - - -- find xcode - local xcode_sdkver = toolchain:config("xcode_sdkver") or config.get("xcode_sdkver") - local xcode = find_xcode(config.get("xcode"), {force = true, verbose = true, - find_codesign = toolchain:is_global(), - sdkver = xcode_sdkver, - appledev = appledev, - plat = toolchain:plat(), - arch = toolchain:arch()}) - if not xcode then - cprint("checking for Xcode directory ... ${color.nothing}${text.nothing}") - return - end - - -- save target minver - -- - -- @note we need to differentiate the version for the system, - -- because the xcode toolchain of iphoneos/macosx may need to be used at the same time. - -- - -- e.g. - -- - -- target("test") - -- set_toolchains("xcode", {plat = os.host(), arch = os.arch()}) - -- - -- xcode found - xcode_sdkver = xcode.sdkver - - local target_minver = toolchain:config("target_minver") or config.get("target_minver") - if xcode_sdkver and not target_minver then - target_minver = xcode.target_minver - end - - if toolchain:is_global() then - config.set("xcode", xcode.sdkdir, {force = true, readonly = true}) - cprint("checking for Xcode directory ... ${color.success}%s", xcode.sdkdir) - end - toolchain:config_set("xcode", xcode.sdkdir) - toolchain:config_set("xcode_sdkver", xcode_sdkver) - toolchain:config_set("target_minver", target_minver) - toolchain:config_set("appledev", appledev) - toolchain:configs_save() - cprint("checking for SDK version of Xcode for %s (%s) ... ${color.success}%s", toolchain:plat(), toolchain:arch(), xcode_sdkver) -end - --- check the cross toolchain -function main(toolchain) - - -- get sdk directory - local sdkdir = toolchain:sdkdir() - local bindir = toolchain:bindir() - local cross = toolchain:cross() - if not sdkdir and not bindir then - bindir = try {function () return os.iorunv("llvm-config", {"--bindir"}) end} - if bindir then - sdkdir = path.directory(bindir) - elseif is_host("linux") and os.isfile("/usr/bin/llvm-ar") then - sdkdir = "/usr" - elseif is_host("macosx") then - if os.arch() == "arm64" then - bindir = find_path("llvm-ar", "/opt/homebrew/opt/llvm/bin") - else - bindir = find_path("llvm-ar", "/usr/local/Cellar/llvm/*/bin") - end - if bindir then - sdkdir = path.directory(bindir) - end - elseif is_host("windows") then - local llvm_ar = find_tool("llvm-ar", {force = true, envs = {PATH = os.getenv("PATH")}}) - if llvm_ar and llvm_ar.program and path.is_absolute(llvm_ar.program) then - bindir = path.directory(llvm_ar.program) - sdkdir = path.directory(bindir) - end - end - end - - -- find cross toolchain from external envirnoment - local cross_toolchain = find_cross_toolchain(sdkdir, {bindir = bindir, cross = cross}) - if not cross_toolchain then - -- find it from packages - for _, package in ipairs(toolchain:packages()) do - local installdir = package:installdir() - if installdir and os.isdir(installdir) then - cross_toolchain = find_cross_toolchain(installdir) - if cross_toolchain then - break - end - end - end - end - if cross_toolchain then - toolchain:config_set("cross", cross_toolchain.cross) - toolchain:config_set("bindir", cross_toolchain.bindir) - toolchain:config_set("sdkdir", cross_toolchain.sdkdir) - toolchain:configs_save() - else - raise("llvm toolchain not found!") - end - - if toolchain:is_plat("cross") and (not toolchain:cross() or toolchain:cross():match("^%s*$")) then - raise("Missing cross target. Use `--cross=name` to specify.") - end - - -- attempt to find xcode to pass `-isysroot` on macos - if toolchain:is_plat("macosx") then - _find_xcode(toolchain) - end - return cross_toolchain -end diff --git a/nativelibs/xmake/toolchains/atomui/xmake.lua b/nativelibs/xmake/toolchains/atomui/xmake.lua deleted file mode 100644 index ec8677ba5..000000000 --- a/nativelibs/xmake/toolchains/atomui/xmake.lua +++ /dev/null @@ -1,135 +0,0 @@ -toolchain("atomui", function() - set_kind("standalone") - set_homepage("https://llvm.org/") - set_description( - "A collection of modular and reusable compiler and toolchain technologies") - set_runtimes("c++_static", "c++_shared", "stdc++_static", "stdc++_shared") - - set_toolset("cc", "clang") - set_toolset("cxx", "clang", "clang++") - set_toolset("mxx", "clang", "clang++") - set_toolset("mm", "clang") - set_toolset("cpp", "clang -E") - set_toolset("as", "clang") - set_toolset("ld", "clang++", "clang") - set_toolset("sh", "clang++", "clang") - set_toolset("ar", "llvm-ar") - set_toolset("strip", "llvm-strip") - set_toolset("ranlib", "llvm-ranlib") - set_toolset("objcopy", "llvm-objcopy") - set_toolset("mrc", "llvm-rc") - set_toolset("dlltool", "llvm-dlltool") - - on_check("check") - - on_load(function(toolchain) - local arch = toolchain:arch() - local target_minver = toolchain:config("target_minver") - if xcode_sdkver and not target_minver then - target_minver = xcode.target_minver - end - -- add runtimes - if toolchain:is_plat("windows") then - toolchain:add("runtimes", "MT", "MTd", "MD", "MDd") - end - - -- add march flags - local march - if toolchain:is_plat("windows") and not is_host("windows") then - -- cross-compilation for windows - if toolchain:is_arch("i386", "x86") then - march = "-target i386-pc-windows-msvc" - else - march = "-target x86_64-pc-windows-msvc" - end - toolchain:add("ldflags", "-fuse-ld=lld") - toolchain:add("shflags", "-fuse-ld=lld") - elseif toolchain:is_arch("x86_64", "x64") then - march = "-m64" - elseif toolchain:is_arch("i386", "x86") then - march = "-m32" - elseif toolchain:is_plat("cross") then - local sysroot - local sdkdir = toolchain:sdkdir() - local bindir = toolchain:bindir() - local cross = toolchain:cross():gsub("(.*)%-$", "%1") - march = "--target=" .. cross - if bindir and os.isexec(path.join(bindir, cross .. "-gcc" .. - (is_host("windows") and ".exe" or - ""))) then - local gcc_toolchain = path.directory(bindir) - toolchain:add("cxflags", "--gcc-toolchain=" .. gcc_toolchain) - toolchain:add("mxflags", "--gcc-toolchain=" .. gcc_toolchain) - toolchain:add("asflags", "--gcc-toolchain=" .. gcc_toolchain) - toolchain:add("ldflags", "--gcc-toolchain=" .. gcc_toolchain) - toolchain:add("shflags", "--gcc-toolchain=" .. gcc_toolchain) - end - if sdkdir and os.isdir(path.join(sdkdir, cross, "include")) then - sysroot = path.join(sdkdir, cross) - end - if sysroot then - if os.isdir(path.join(sysroot, "libc")) then - sysroot = path.join(sysroot, "libc") - end - toolchain:add("cxflags", "--sysroot=" .. sysroot) - toolchain:add("mxflags", "--sysroot=" .. sysroot) - toolchain:add("asflags", "--sysroot=" .. sysroot) - toolchain:add("ldflags", "--sysroot=" .. sysroot) - toolchain:add("shflags", "--sysroot=" .. sysroot) - end - end - - if toolchain:is_plat("macosx") then - local appledev = toolchain:config("appledev") - if target_minver then - local target = ("%s-apple-macos%s"):format(arch, target_minver) - if appledev == "catalyst" then - target = ("%s-apple-ios%s-macabi"):format(arch, - target_minver) - end - march = "-target " .. target - end - end - - if march then - toolchain:add("cxflags", march) - toolchain:add("mxflags", march) - toolchain:add("asflags", march) - toolchain:add("ldflags", march) - toolchain:add("shflags", march) - end - - -- init flags for macOS - if toolchain:is_plat("macosx") then - local xcode_dir = get_config("xcode") - local xcode_sdkver = toolchain:config("xcode_sdkver") - local xcode_sdkdir = nil - if xcode_dir and xcode_sdkver then - xcode_sdkdir = xcode_dir .. - "/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX" .. - xcode_sdkver .. ".sdk" - toolchain:add("cxflags", {"-isysroot", xcode_sdkdir}) - toolchain:add("mxflags", {"-isysroot", xcode_sdkdir}) - toolchain:add("ldflags", {"-isysroot", xcode_sdkdir}) - toolchain:add("shflags", {"-isysroot", xcode_sdkdir}) - else - -- @see https://github.com/xmake-io/xmake/issues/1179 - local macsdk = - "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" - if os.exists(macsdk) then - toolchain:add("cxflags", {"-isysroot", macsdk}) - toolchain:add("mxflags", {"-isysroot", macsdk}) - toolchain:add("ldflags", {"-isysroot", macsdk}) - toolchain:add("shflags", {"-isysroot", macsdk}) - end - end - toolchain:add("mxflags", "-fobjc-arc") - end - - -- add bin search library for loading some dependent .dll files windows - local bindir = toolchain:bindir() - if bindir and is_host("windows") then - toolchain:add("runenvs", "PATH", bindir) - end - end) -end) diff --git a/references/Code Style.md b/references/Code Style.md deleted file mode 100644 index 896ccee56..000000000 --- a/references/Code Style.md +++ /dev/null @@ -1,22 +0,0 @@ -# Code Styles - -## C# Naming Style -- Type, NameSpace, Method, Property, Event: **UpperCamelCase** -- Interface: **IUpperCamelCase** -- Type parameter: **TUpperCamelCase** -- Local variable, Parameter: **lowerCamelCase** -- Public Field (基本不用): **UpperCamelCase** -- Private Field: **_lowerCamelCase** - -- Control Template Part Name: **PART_UpperCamelCase** -- Control Pseudo Class Name: **STATE_UpperCamelCase** - -## 其他 -- 使用Rider配置,尽量和Rider的建议保持一致即可。 -- 不要在一行中声明多个变量; - -## Xaml -- 使用 XamlStyler插件,添加配置。 -- 不超过两个属性的共用一行。 -- Name:UpperCamelCase。 -- 结构复杂增加注释。 \ No newline at end of file diff --git a/references/docfx.json b/references/docfx.json deleted file mode 100644 index 75c449dac..000000000 --- a/references/docfx.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/dotnet/docfx/main/schemas/docfx.schema.json", - "metadata": [ - { - "src": [ - { - "src": "../src", - "files": [ - "AtomUI.Base/AtomUI.Base.csproj", - "AtomUI.Controls/AtomUI.Controls.csproj", - "AtomUI.Theme/AtomUI.Theme.csproj" - ] - } - ], - "dest": "../../output/references/api" - } - ], - "build": { - "content": [ - { - "files": [ - "**/*.{md,yml}" - ], - "src": "../../output/references" - }, - { - "files": [ - "**/*.{md,yml}" - ] - } - ], - "resource": [ - ], - "output": "../../output/references/site", - "template": [ - "default", - "modern" - ], - "globalMetadata": { - "_appName": "qinware", - "_appTitle": "qinware", - "_enableSearch": true, - "pdf": false - } - } -} \ No newline at end of file diff --git a/references/index.md b/references/index.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/references/toc.yml b/references/toc.yml deleted file mode 100644 index a2a2fa2bc..000000000 --- a/references/toc.yml +++ /dev/null @@ -1,2 +0,0 @@ -- name: API - href: api/ \ No newline at end of file diff --git a/scripts/PublishToLocalSources.ps1 b/scripts/PublishToLocalSources.ps1 index 9e3d15655..e0d1bbdc9 100644 --- a/scripts/PublishToLocalSources.ps1 +++ b/scripts/PublishToLocalSources.ps1 @@ -1,8 +1,6 @@ param ( [string]$localSourcesDir = "D:/nuget.local", [string]$buildType = "Release", - [string]$preReleaseTag, - [bool]$nativeOnly=$false ) function Push-NuGetPackages { @@ -43,24 +41,17 @@ function Push-NuGetPackages { } } -dotnet build -v diag --configuration $buildType ../src/AtomUI.Native/AtomUI.Native.csproj -dotnet pack --no-build --configuration $buildType ../src/AtomUI.Native/AtomUI.Native.csproj -v:diag +dotnet build -v diag --configuration $buildType ../packages/AtomUI/AtomUI.csproj +dotnet pack --no-build --configuration $buildType ../packages/AtomUI/AtomUI.csproj +dotnet pack --no-build --configuration $buildType ../src/AtomUI.IconPkg.Generator/AtomUI.IconPkg.Generator.csproj +dotnet pack --no-build --configuration $buildType ../src/AtomUI.Generator/AtomUI.Generator.csproj + Push-NuGetPackages -Source $localSourcesDir -if (!$nativeOnly) { - dotnet build -v diag --configuration $buildType ../packages/AtomUI/AtomUI.csproj - dotnet pack --no-build --configuration $buildType ../packages/AtomUI/AtomUI.csproj - dotnet pack --no-build --configuration $buildType ../src/AtomUI.IconPkg.Generator/AtomUI.IconPkg.Generator.csproj - dotnet pack --no-build --configuration $buildType ../src/AtomUI.Generator/AtomUI.Generator.csproj +dotnet build -v diag --configuration $buildType ../src/AtomUI.Controls.DataGrid/AtomUI.Controls.DataGrid.csproj +dotnet pack --no-build --configuration $buildType ../src/AtomUI.Controls.DataGrid/AtomUI.Controls.DataGrid.csproj - Push-NuGetPackages -Source $localSourcesDir - - dotnet build -v diag --configuration $buildType ../src/AtomUI.Controls.DataGrid/AtomUI.Controls.DataGrid.csproj - dotnet pack --no-build --configuration $buildType ../src/AtomUI.Controls.DataGrid/AtomUI.Controls.DataGrid.csproj - - dotnet build -v diag --configuration $buildType ../src/AtomUI.Controls.ColorPicker/AtomUI.Controls.ColorPicker.csproj - dotnet pack --no-build --configuration $buildType ../src/AtomUI.Controls.ColorPicker/AtomUI.Controls.ColorPicker.csproj - - Push-NuGetPackages -Source $localSourcesDir -} +dotnet build -v diag --configuration $buildType ../src/AtomUI.Controls.ColorPicker/AtomUI.Controls.ColorPicker.csproj +dotnet pack --no-build --configuration $buildType ../src/AtomUI.Controls.ColorPicker/AtomUI.Controls.ColorPicker.csproj +Push-NuGetPackages -Source $localSourcesDir diff --git a/src/AtomUI.Controls/Buttons/Themes/ButtonThemes.axaml b/src/AtomUI.Controls/Buttons/Themes/ButtonThemes.axaml index 6e619d5c9..5509337c3 100644 --- a/src/AtomUI.Controls/Buttons/Themes/ButtonThemes.axaml +++ b/src/AtomUI.Controls/Buttons/Themes/ButtonThemes.axaml @@ -10,5 +10,5 @@ - + \ No newline at end of file diff --git a/src/AtomUI.Controls/Dialog/Dialog.cs b/src/AtomUI.Controls/Dialog/Dialog.cs index 46c8f9eff..856336299 100644 --- a/src/AtomUI.Controls/Dialog/Dialog.cs +++ b/src/AtomUI.Controls/Dialog/Dialog.cs @@ -38,9 +38,6 @@ public class Dialog : Control, public static readonly StyledProperty TitleIconProperty = AvaloniaProperty.Register(nameof (TitleIcon)); - - public static readonly StyledProperty WindowManagerAddShadowHintProperty = - AvaloniaProperty.Register(nameof(WindowManagerAddShadowHint), false); public static readonly StyledProperty ChildProperty = AvaloniaProperty.Register(nameof(Child)); @@ -62,6 +59,9 @@ public class Dialog : Control, public static readonly StyledProperty IsMaximizableProperty = AvaloniaProperty.Register(nameof (IsMaximizable), false); + + public static readonly StyledProperty IsMinimizableProperty = + AvaloniaProperty.Register(nameof (IsMinimizable), true); public static readonly StyledProperty IsDragMovableProperty = AvaloniaProperty.Register(nameof (IsDragMovable), false); @@ -102,9 +102,7 @@ public class Dialog : Control, public static readonly StyledProperty IsMotionEnabledProperty = MotionAwareControlProperty.IsMotionEnabledProperty.AddOwner(); - public static readonly AttachedProperty TakesFocusFromNativeControlProperty = - AvaloniaProperty.RegisterAttached(nameof(TakesFocusFromNativeControl), true); - + public static readonly StyledProperty DialogHostTypeProperty = AvaloniaProperty.Register(nameof(VerticalOffset), DialogHostType.Overlay); @@ -120,12 +118,6 @@ public class Dialog : Control, set => SetValue(TitleIconProperty, value); } - public bool WindowManagerAddShadowHint - { - get => GetValue(WindowManagerAddShadowHintProperty); - set => SetValue(WindowManagerAddShadowHintProperty, value); - } - [Content] public Control? Child { @@ -177,6 +169,13 @@ public class Dialog : Control, set => SetValue(IsMaximizableProperty, value); } + // 仅对 Window 类型的 Dialog 有效 + public bool IsMinimizable + { + get => GetValue(IsMinimizableProperty); + set => SetValue(IsMinimizableProperty, value); + } + public bool IsDragMovable { get => GetValue(IsDragMovableProperty); @@ -244,12 +243,6 @@ public class Dialog : Control, set => SetValue(TopmostProperty, value); } - public bool TakesFocusFromNativeControl - { - get => GetValue(TakesFocusFromNativeControlProperty); - set => SetValue(TakesFocusFromNativeControlProperty, value); - } - public DialogHostType DialogHostType { get => GetValue(DialogHostTypeProperty); @@ -346,7 +339,15 @@ public class Dialog : Control, CompositeDisposable relayBindingDisposables = new CompositeDisposable(); if (DialogHostType == DialogHostType.Window) { - + var windowDialogHost = new DialogHost(topLevel, this); + relayBindingDisposables.Add(BindUtils.RelayBind(this, TitleProperty, windowDialogHost, DialogHost.TitleProperty)); + relayBindingDisposables.Add(BindUtils.RelayBind(this, TitleIconProperty, windowDialogHost, DialogHost.IconProperty)); + relayBindingDisposables.Add(BindUtils.RelayBind(this, IsMotionEnabledProperty, windowDialogHost, DialogHost.IsMotionEnabledProperty)); + relayBindingDisposables.Add(BindUtils.RelayBind(this, IsResizableProperty, windowDialogHost, DialogHost.CanResizeProperty)); + relayBindingDisposables.Add(BindUtils.RelayBind(this, IsMaximizableProperty, windowDialogHost, DialogHost.CanMaximizeProperty)); + relayBindingDisposables.Add(BindUtils.RelayBind(this, IsMinimizableProperty, windowDialogHost, DialogHost.CanMinimizeProperty)); + relayBindingDisposables.Add(BindUtils.RelayBind(this, IsDragMovableProperty, windowDialogHost, DialogHost.IsMoveEnabledProperty)); + dialogHost = windowDialogHost; } else { @@ -365,6 +366,7 @@ public class Dialog : Control, dialogHost = overlayDialogHost; } } + Debug.Assert(dialogHost != null); var handlerCleanup = new CompositeDisposable(7); UpdateHostSizing(dialogHost, topLevel, placementTarget); @@ -380,14 +382,14 @@ public class Dialog : Control, { dialogHost.Transform = null; } - // if (dialogHost is DialogHost topLevelDialog) - // { - // topLevelDialog - // .Bind( - // ThemeVariantScope.ActualThemeVariantProperty, - // this.GetBindingObservable(ThemeVariantScope.ActualThemeVariantProperty)) - // .DisposeWith(handlerCleanup); - // } + if (dialogHost is DialogHost topLevelDialog) + { + topLevelDialog + .Bind( + ThemeVariantScope.ActualThemeVariantProperty, + this.GetBindingObservable(ThemeVariantScope.ActualThemeVariantProperty)) + .DisposeWith(handlerCleanup); + } UpdateHostPosition(dialogHost, placementTarget); SubscribeToEventHandler>(dialogHost, RootTemplateApplied, @@ -461,14 +463,25 @@ public class Dialog : Control, _openState = new DialogOpenState(placementTarget, topLevel, dialogHost, cleanupPopup); - WindowManagerAddShadowHintChanged(dialogHost, WindowManagerAddShadowHint); - - dialogHost.Show(); - - if (TakesFocusFromNativeControl) + if (dialogHost is DialogHost windowDialog) { - dialogHost.TakeFocus(); + if (IsModal) + { + if (topLevel is Window windowTopLevel) + { + windowDialog.ShowDialog(windowTopLevel); + } + } + else + { + windowDialog.Show(); + } } + else + { + dialogHost.Show(); + } + using (BeginIgnoringIsOpen()) { SetCurrentValue(IsOpenProperty, true); @@ -510,11 +523,6 @@ public class Dialog : Control, Closed?.Invoke(this, EventArgs.Empty); } - public static bool GetTakesFocusFromNativeControl(Control control) - { - return control.GetValue(TakesFocusFromNativeControlProperty); - } - protected override Size MeasureCore(Size availableSize) { return new Size(); @@ -605,14 +613,6 @@ public class Dialog : Control, return Disposable.Create((unsubscribe, target, handler), state => state.unsubscribe(state.target, state.handler)); } - private static void WindowManagerAddShadowHintChanged(IDialogHost host, bool hint) - { - // if (host is DialogHost pr) - // { - // pr.WindowManagerAddShadowHint = hint; - // } - } - private void HandleChildChanged(AvaloniaPropertyChangedEventArgs e) { LogicalChildren.Clear(); @@ -886,6 +886,11 @@ public class Dialog : Control, } } } + + internal void NotifyDialogHostCloseRequest() + { + Close(); + } private IgnoreIsOpenScope BeginIgnoringIsOpen() { diff --git a/src/AtomUI.Controls/Dialog/DialogHost.cs b/src/AtomUI.Controls/Dialog/DialogHost.cs index ffee2e677..cbca4dc94 100644 --- a/src/AtomUI.Controls/Dialog/DialogHost.cs +++ b/src/AtomUI.Controls/Dialog/DialogHost.cs @@ -1,6 +1,126 @@ +using AtomUI.Controls.DialogPositioning; +using Avalonia; +using Avalonia.Controls; +using Avalonia.Media; +using Avalonia.Styling; +using Avalonia.VisualTree; + namespace AtomUI.Controls; -public sealed class DialogHost : Window +public sealed class DialogHost : Window, + IDialogHost, + IHostedVisualTreeRoot, + IStyleHost, + IMotionAwareControl { + #region 公共属性定义 + + public static readonly StyledProperty TransformProperty = + AvaloniaProperty.Register(nameof(Transform)); + public static readonly StyledProperty IsMotionEnabledProperty = + MotionAwareControlProperty.IsMotionEnabledProperty.AddOwner(); + + public Transform? Transform + { + get => GetValue(TransformProperty); + set => SetValue(TransformProperty, value); + } + + public bool IsMotionEnabled + { + get => GetValue(IsMotionEnabledProperty); + set => SetValue(IsMotionEnabledProperty, value); + } + Visual? IHostedVisualTreeRoot.Host + { + get + { + // If the parent is attached to a visual tree, then return that. However the parent + // will possibly be a standalone Popup (i.e. a Popup not attached to a visual tree, + // created by e.g. a ContextMenu): if this is the case, return the ParentTopLevel + // if set. This helps to allow the focus manager to restore the focus to the outer + // scope when the popup is closed. + var parentVisual = Parent as Visual; + if (parentVisual?.IsAttachedToVisualTree() == true) + { + return parentVisual; + } + return ParentTopLevel ?? parentVisual; + } + } + + IStyleHost? IStyleHost.StylingParent => Parent; + + public TopLevel ParentTopLevel { get; } + + Visual IDialogHost.HostedVisualTreeRoot => this; + + #endregion + + #region 内部属性定义 + Control IMotionAwareControl.PropertyBindTarget => this; + #endregion + + protected override Type StyleKeyOverride { get; } = typeof(DialogHost); + + private DialogPositionRequest? _dialogPositionRequest; + private Size _dialogSize; + private bool _needsUpdate; + private readonly ManagedDialogPositioner _positioner; + private Dialog _dialog; + + public DialogHost(TopLevel parent, Dialog dialog) + { + ParentTopLevel = parent; + _positioner = new ManagedDialogPositioner(new ManagedDialogPositionerDialogImplHelper(PlatformImpl!,MoveResize)); + _dialog = dialog; + } + + public void SetChild(Control? control) => Content = control; + + void IDialogHost.ConfigurePosition(DialogPositionRequest request) + { + _dialogPositionRequest = request; + _needsUpdate = true; + UpdatePosition(); + } + + protected override void ArrangeCore(Rect finalRect) + { + if (_dialogSize != finalRect.Size) + { + _dialogSize = finalRect.Size; + _needsUpdate = true; + UpdatePosition(); + } + + base.ArrangeCore(finalRect); + } + + private void UpdatePosition() + { + if (_needsUpdate && _dialogPositionRequest is not null) + { + _needsUpdate = false; + _positioner.Update(_dialogPositionRequest, _dialogSize); + } + } + + private void MoveResize(PixelPoint position, Size size, double scaling) + { + // Move(position); + // _scalingOverride = scaling; + // UpdateScaling(true); + // Resize(size, true, WindowResizeReason.Layout); + } + + protected override void OnClosing(WindowClosingEventArgs e) + { + if (!e.IsProgrammatic) + { + e.Cancel = true; + _dialog.NotifyDialogHostCloseRequest(); + } + } } \ No newline at end of file diff --git a/src/AtomUI.Controls/Dialog/IDialogHost.cs b/src/AtomUI.Controls/Dialog/IDialogHost.cs index 8af3c98c6..efa373f85 100644 --- a/src/AtomUI.Controls/Dialog/IDialogHost.cs +++ b/src/AtomUI.Controls/Dialog/IDialogHost.cs @@ -24,5 +24,4 @@ public interface IDialogHost : IDisposable, IFocusScope void SetChild(Control? control); void Show(); void Hide(); - void TakeFocus(); } \ No newline at end of file diff --git a/src/AtomUI.Controls/Dialog/OverlayDialogHost.cs b/src/AtomUI.Controls/Dialog/OverlayDialogHost.cs index 5a8c74b5c..e5f825005 100644 --- a/src/AtomUI.Controls/Dialog/OverlayDialogHost.cs +++ b/src/AtomUI.Controls/Dialog/OverlayDialogHost.cs @@ -283,11 +283,6 @@ public sealed class OverlayDialogHost : ContentControl, } } - public void TakeFocus() - { - // Nothing to do here: overlay popups are implemented inside the window. - } - void IDialogHost.ConfigurePosition(DialogPositionRequest positionRequest) { _dialogPositionRequest = positionRequest; diff --git a/src/AtomUI.Controls/Dialog/Themes/DialogHostTheme.axaml b/src/AtomUI.Controls/Dialog/Themes/DialogHostTheme.axaml new file mode 100644 index 000000000..0dbf9dfa2 --- /dev/null +++ b/src/AtomUI.Controls/Dialog/Themes/DialogHostTheme.axaml @@ -0,0 +1,17 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/AtomUI.Controls/Dialog/Themes/DialogThemes.axaml b/src/AtomUI.Controls/Dialog/Themes/DialogThemes.axaml index b27c2048b..56b02f045 100644 --- a/src/AtomUI.Controls/Dialog/Themes/DialogThemes.axaml +++ b/src/AtomUI.Controls/Dialog/Themes/DialogThemes.axaml @@ -6,5 +6,6 @@ + \ No newline at end of file diff --git a/src/AtomUI.Controls/Window/Themes/WindowTheme.axaml b/src/AtomUI.Controls/Window/Themes/WindowTheme.axaml index 113988d44..5e5af7f01 100644 --- a/src/AtomUI.Controls/Window/Themes/WindowTheme.axaml +++ b/src/AtomUI.Controls/Window/Themes/WindowTheme.axaml @@ -1,44 +1,47 @@ - - - - - - - + + + + + + - - - + + + + + + + - - - - - - - - + + + + - - + + + + + - - \ No newline at end of file + \ No newline at end of file diff --git a/src/AtomUI.Controls/Window/Themes/WindowTheme.cs b/src/AtomUI.Controls/Window/Themes/WindowTheme.cs new file mode 100644 index 000000000..b78707661 --- /dev/null +++ b/src/AtomUI.Controls/Window/Themes/WindowTheme.cs @@ -0,0 +1,7 @@ +using Avalonia.Styling; + +namespace AtomUI.Controls.Themes; + +internal class WindowTheme : ControlTheme +{ +} \ No newline at end of file diff --git a/src/AtomUI.Controls/Window/Themes/WindowThemes.axaml b/src/AtomUI.Controls/Window/Themes/WindowThemes.axaml index 900a59e10..63175f38a 100644 --- a/src/AtomUI.Controls/Window/Themes/WindowThemes.axaml +++ b/src/AtomUI.Controls/Window/Themes/WindowThemes.axaml @@ -1,9 +1,11 @@ - - - + + + \ No newline at end of file diff --git a/src/AtomUI.Native/AtomUI.Native.csproj b/src/AtomUI.Native/AtomUI.Native.csproj deleted file mode 100644 index b36ae86be..000000000 --- a/src/AtomUI.Native/AtomUI.Native.csproj +++ /dev/null @@ -1,112 +0,0 @@ - - - - $(AtomUITargetFrameworks) - enable - enable - true - true - $(AtomUINativeVersion) - - - - - - - - - - - - - $(OutputPathWithoutFramework)/$(AtomUINativeWindowsX64DeployPath)/$(AtomUINativeWindowsArtifactName) - $(OutputPathWithoutFramework)/$(AtomUINativeWindowsArm64DeployPath)/$(AtomUINativeWindowsArtifactName) - $(OutputPathWithoutFramework)/$(AtomUINativeMacOSDeployPath)/$(AtomUINativeMacOSArtifactName) - $(OutputPathWithoutFramework)/$(AtomUINativeLinuxX64DeployPath)/$(AtomUINativeLinuxArtifactName) - - - - $([System.IO.Path]::Combine($(MSBuildProjectDirectory), $(IntermediateOutputPathWithoutFramework), 'AtomUINative')) - $([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)/../../nativelibs')) - $([System.IO.Path]::GetFullPath('$(OutputPathWithoutFramework)')) - $(OutputPathWithoutFramework)/$(AtomUINativeDeployPath) - $([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)/../../scripts/BuildAtomUINative.ps1')) - - $(AtomUINavtiveBuildPath)/.native_compiled - - - - - - - - - - - - Debug - - - - - Release - - - - - - - $([System.Environment]::ProcessorCount) - - - - - - - - - - - - - - - - $(AtomUINativeMacOSDeployPath)/$(AtomUINativeMacOSArtifactName) - $(AtomUINativeMacOSDeployPath) - true - PreserveNewest - - - $(AtomUINativeWindowsX64DeployPath)/$(AtomUINativeWindowsArtifactName) - $(AtomUINativeWindowsX64DeployPath) - true - PreserveNewest - - - - $(AtomUINativeWindowsArm64DeployPath)/$(AtomUINativeWindowsArtifactName) - $(AtomUINativeWindowsArm64DeployPath) - true - PreserveNewest - - - - $(AtomUINativeLinuxX64DeployPath)/$(AtomUINativeLinuxArtifactName) - $(AtomUINativeLinuxX64DeployPath) - true - PreserveNewest - - - - \ No newline at end of file diff --git a/src/AtomUI.Native/Interop/WindowUtilsImpl.cs b/src/AtomUI.Native/Interop/WindowUtilsImpl.cs deleted file mode 100644 index 47ad2c217..000000000 --- a/src/AtomUI.Native/Interop/WindowUtilsImpl.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Runtime.InteropServices; - -namespace AtomUI.Native.Interop; - -internal static partial class WindowUtilsImpl -{ - private const string NativeLibName = "AtomUINative"; - - [LibraryImport(NativeLibName)] - internal static partial void AtomUISetWindowIgnoresMouseEvents(IntPtr handle, - [MarshalAs(UnmanagedType.Bool)] bool flag); - - [LibraryImport(NativeLibName)] - [return: MarshalAs(UnmanagedType.Bool)] - internal static partial bool AtomUIGetWindowIgnoresMouseEvents(IntPtr handle); - - [LibraryImport(NativeLibName)] - internal static partial void AtomUILockWindowBuddyLayer(IntPtr windowHandle, IntPtr buddyHandle); - - [LibraryImport(NativeLibName)] - internal static partial void AtomUISetMacOSCaptionButtonsPosition(IntPtr windowHandle, double x, double y, double spacing); - - [LibraryImport(NativeLibName)] - internal static partial CGSize AtomUIMacOSCaptionsSize(IntPtr windowHandle, double spacing); -} - -// 定义与 CGSize 对应的结构体 -[StructLayout(LayoutKind.Sequential)] -internal struct CGSize -{ - public double Width; - public double Height; - - public override string ToString() => - $"Width: {Width}, Height: {Height}"; -} \ No newline at end of file diff --git a/src/AtomUI.Native/WindowUtils.cs b/src/AtomUI.Native/WindowUtils.cs deleted file mode 100644 index 6f8f3e3f8..000000000 --- a/src/AtomUI.Native/WindowUtils.cs +++ /dev/null @@ -1,61 +0,0 @@ -using AtomUI.Native.Interop; -using Avalonia; -using Avalonia.Controls; - -namespace AtomUI.Native; - -internal static class WindowUtils -{ - public static void SetWindowIgnoreMouseEvents(this WindowBase window, bool flag) - { - var windowHandle = window.PlatformImpl?.Handle?.Handle; - if (windowHandle is not null) - - { - WindowUtilsImpl.AtomUISetWindowIgnoresMouseEvents(windowHandle.Value, flag); - } - } - - public static bool GetWindowIgnoreMouseEvents(this WindowBase window) - { - var windowHandle = window.PlatformImpl?.Handle?.Handle; - if (windowHandle is not null) - - { - return WindowUtilsImpl.AtomUIGetWindowIgnoresMouseEvents(windowHandle.Value); - } - - return false; - } - - public static void LockWindowBuddyLayer(this WindowBase window, WindowBase buddyWindow) - { - var windowHandle = window.PlatformImpl?.Handle?.Handle; - var buddyHandle = buddyWindow.PlatformImpl?.Handle?.Handle; - if (windowHandle is not null && buddyHandle is not null) - { - WindowUtilsImpl.AtomUILockWindowBuddyLayer(windowHandle.Value, buddyHandle.Value); - } - } - - public static void SetMacOSOptionButtonsPosition(this WindowBase window, double x, double y, double spacing = 10.0) - { - var windowHandle = window.PlatformImpl?.Handle?.Handle; - if (windowHandle is not null) - { - WindowUtilsImpl.AtomUISetMacOSCaptionButtonsPosition(windowHandle.Value, x, y, spacing); - } - } - - public static Size GetMacOSOptionsSize(this WindowBase window, double spacing = 10.0) - { - var windowHandle = window.PlatformImpl?.Handle?.Handle; - Size size = new Size(); - if (windowHandle is not null) - { - var result = WindowUtilsImpl.AtomUIMacOSCaptionsSize(windowHandle.Value, spacing); - size = new Size(result.Width, result.Height); - } - return size; - } -} \ No newline at end of file