diff --git a/.github/workflows/build-artifacts.yml b/.github/workflows/build-artifacts.yml new file mode 100644 index 00000000..bc05c482 --- /dev/null +++ b/.github/workflows/build-artifacts.yml @@ -0,0 +1,13 @@ +name: build-artifacts + +on: + pull_request: + workflow_dispatch: + +jobs: + build: + uses: Itexoft/DevOpsKit/.github/workflows/cpp-multi-rid-build.yml@master + with: + project_name: simplecpp + build_targets: simplecpp + cmake_cxx_standard: "17" \ No newline at end of file diff --git a/.github/workflows/build-shim.yml b/.github/workflows/build-shim.yml new file mode 100644 index 00000000..3f225f44 --- /dev/null +++ b/.github/workflows/build-shim.yml @@ -0,0 +1,43 @@ +name: capi-bundle +on: + workflow_run: + workflows: ["nuget-artifacts"] + types: [completed] + +jobs: + bundle: + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + env: + CAPI_BUNDLE_DIR: capi-bundle + + steps: + - uses: actions/checkout@v4 + + - uses: actions/download-artifact@v4 + with: + path: _all_artifacts + + - name: assemble + shell: bash + run: | + set -euo pipefail + root="$CAPI_BUNDLE_DIR" + mkdir -p "$root/include" + cp -r include/. "$root/include/" + find _all_artifacts -name 'compile_commands.json' | while read json; do + rid=$(basename "$(dirname "$json")") + cp "$json" "$root/${rid}-compile_commands.json" + jq -r '.[].file' "$json" | grep -E '\.(h|hpp)$' | while read hdr; do + [ -f "$hdr" ] || continue + abs=$(realpath "$hdr") + rel=${abs#$(pwd)/} + mkdir -p "$root/include/$(dirname "$rel")" + cp -f "$abs" "$root/include/$rel" + done + done + + - uses: actions/upload-artifact@v4 + with: + name: capi-bundle + path: ${{ env.CAPI_BUNDLE_DIR }}/** \ No newline at end of file diff --git a/.github/workflows/nuget-artifacts.yml b/.github/workflows/nuget-artifacts.yml new file mode 100644 index 00000000..d596f8ad --- /dev/null +++ b/.github/workflows/nuget-artifacts.yml @@ -0,0 +1,20 @@ +name: nuget-artifacts + +on: + workflow_run: + workflows: [build-artifacts] + types: [completed] + workflow_dispatch: + +jobs: + pack: + if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} + uses: Itexoft/DevOpsKit/.github/workflows/nuget-package-publish.yml@master + secrets: inherit + with: + project_name: simplecpp + csproj_path: nuget/SimpleCpp.Native.csproj + build_workflow: build-artifacts + extra_paths: docs + publish_branch: master + publish: false \ No newline at end of file diff --git a/nuget/SimpleCpp.Native.csproj b/nuget/SimpleCpp.Native.csproj new file mode 100644 index 00000000..8262be9d --- /dev/null +++ b/nuget/SimpleCpp.Native.csproj @@ -0,0 +1,37 @@ + + + SimpleCpp.Native + netstandard2.0 + 1.3.2.1 + Cross-platform native binaries for SimpleCpp. + Denis Kudelin + LICENSE + https://github.com/Itexoft/simplecpp + https://github.com/Itexoft/simplecpp + git + README.md + true + false + false + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nuget/buildTransitive/SimpleCpp.Native.props b/nuget/buildTransitive/SimpleCpp.Native.props new file mode 100644 index 00000000..135caeb7 --- /dev/null +++ b/nuget/buildTransitive/SimpleCpp.Native.props @@ -0,0 +1,26 @@ + + + + <_SimpleCpp_Rid Condition="'$(RuntimeIdentifier)' != ''">$(RuntimeIdentifier) + + + <_SimpleCpp_Rid Condition="'$(_SimpleCpp_Rid)'=='' and '$(OS)'=='Windows_NT' and '$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture)'=='X64'">win-x64 + <_SimpleCpp_Rid Condition="'$(_SimpleCpp_Rid)'=='' and '$(OS)'=='Windows_NT' and '$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture)'=='Arm64'">win-arm64 + + + <_SimpleCpp_Rid Condition="'$(_SimpleCpp_Rid)'=='' and '$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' and '$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture)'=='X64'">linux-x64 + <_SimpleCpp_Rid Condition="'$(_SimpleCpp_Rid)'=='' and '$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' and '$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture)'=='Arm64'">linux-arm64 + + + <_SimpleCpp_Rid Condition="'$(_SimpleCpp_Rid)'=='' and '$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true' and '$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture)'=='X64'">osx-x64 + <_SimpleCpp_Rid Condition="'$(_SimpleCpp_Rid)'=='' and '$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true' and '$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture)'=='Arm64'">osx-arm64 + + + <_SimpleCpp_NativeRelativeLibPath>runtimes\$(_SimpleCpp_Rid)\native + <_SimpleCpp_NativeLibPath>$(MSBuildThisFileDirectory)\..\$(_SimpleCpp_NativeRelativeLibPath) + + + + + + \ No newline at end of file diff --git a/nuget/buildTransitive/SimpleCpp.Native.targets b/nuget/buildTransitive/SimpleCpp.Native.targets new file mode 100644 index 00000000..8939efbb --- /dev/null +++ b/nuget/buildTransitive/SimpleCpp.Native.targets @@ -0,0 +1,13 @@ + + + <_SimpleCpp_NativeLibs Include="$(_SimpleCpp_NativeLibPath)\*" /> + + + + + + + + + + \ No newline at end of file