Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ExternalProject with Generator and InteropTests #303

Merged
merged 2 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 4 additions & 33 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
support-spm:
name: Support Module (SPM)
name: SPM - Support Module
runs-on: windows-2022
timeout-minutes: 10

Expand All @@ -28,7 +28,7 @@ jobs:
run: swift test --verbose --skip-build

generator-and-interoptests-spm:
name: Generator and InteropTests (SPM)
name: SPM - Generator and InteropTests
runs-on: windows-2022
timeout-minutes: 15

Expand Down Expand Up @@ -61,8 +61,8 @@ jobs:
shell: pwsh
run: swift test --verbose --skip-build

support-cmake:
name: Support Module (CMake)
cmake:
name: CMake - All (No Tests)
runs-on: windows-2022
timeout-minutes: 15

Expand All @@ -77,32 +77,3 @@ jobs:
- name: CMake Build
shell: pwsh
run: cmake --build --preset debug

generator-cmake:
name: Generator (CMake)
runs-on: windows-2022
timeout-minutes: 15

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-swift

- name: Configure Generator
working-directory: Generator
shell: pwsh
run: cmake --preset debug

- name: Build Generator
working-directory: Generator
shell: pwsh
run: cmake --build --preset debug

- name: Generate InteropTests Projection
working-directory: InteropTests
shell: pwsh
run: cmake --preset debug -D SWIFT_WINRT_EXE=${Env:GITHUB_WORKSPACE}\Generator\build\debug\Sources\SwiftWinRT\SwiftWinRT.exe

- name: Build InteropTests Projection
working-directory: InteropTests
shell: pwsh
run: cmake --build --preset debug
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
}
},
{
"label": "Build Support Module (CMake)",
"label": "Build (CMake)",
"type": "cmake",
"command": "build",
"preset": "${command:cmake.activeBuildPresetName}",
Expand Down
17 changes: 16 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,19 @@ cmake_minimum_required(VERSION 3.21.0)

project(SwiftWinRT LANGUAGES C Swift)

add_subdirectory(Support)
add_subdirectory(Support)

include(ExternalProject)

ExternalProject_Add(Generator
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Generator
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/Generator
INSTALL_COMMAND "")
set(SWIFT_WINRT_EXE ${CMAKE_CURRENT_BINARY_DIR}/Generator/Sources/SwiftWinRT/SwiftWinRT.exe)

ExternalProject_Add(InteropTests
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/InteropTests
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/InteropTests
CMAKE_ARGS -DSWIFT_WINRT_EXE=${SWIFT_WINRT_EXE}
INSTALL_COMMAND ""
DEPENDS Generator)
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
#include <uchar.h>
#include "SWRT/windows/BaseTsd.h"

struct SWRT_HString_ {};
typedef struct SWRT_HString_* SWRT_HString;

struct SWRT_HStringBuffer_ {};
typedef struct SWRT_HStringBuffer_* SWRT_HStringBuffer;

SWRT_HResult SWRT_WindowsCreateString(const char16_t* sourceString, uint32_t length, SWRT_HString* string);
Expand Down
Loading