Skip to content

Commit

Permalink
Use ExternalProject with Generator and InteropTests (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanlabelle authored Sep 18, 2024
1 parent 7c4d5d2 commit f8ece3d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 38 deletions.
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

0 comments on commit f8ece3d

Please sign in to comment.