Skip to content

Commit

Permalink
Set compilers in presets (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanlabelle authored Mar 29, 2024
1 parent 4332d52 commit 2108d3f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ jobs:
submodules: recursive
- uses: ./.github/actions/windows-build
with:
config: debug
config: debug-msvc
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24 changes: 22 additions & 2 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,21 @@
"installDir": "${sourceDir}/out/debug",
"inherits": [ "base" ],
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_C_COMPILER": "clang-cl",
"CMAKE_CXX_COMPILER": "clang-cl"
}
},
{
"name": "debug-msvc",
"displayName": "Debug (MSVC)",
"binaryDir": "${sourceDir}/build/debug-msvc",
"installDir": "${sourceDir}/out/debug-msvc",
"inherits": [ "base" ],
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_C_COMPILER": "cl",
"CMAKE_CXX_COMPILER": "cl"
}
},
{
Expand All @@ -40,7 +54,9 @@
"installDir": "${sourceDir}/out/release",
"inherits": [ "base" ],
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_C_COMPILER": "cl",
"CMAKE_CXX_COMPILER": "cl"
}
}
],
Expand All @@ -49,6 +65,10 @@
"name": "debug",
"configurePreset": "debug"
},
{
"name": "debug-msvc",
"configurePreset": "debug-msvc"
},
{
"name": "release",
"configurePreset": "release"
Expand Down
3 changes: 0 additions & 3 deletions swiftwinrt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
project(swiftwinrt)

set(CMAKE_C_COMPILER cl)
set(CMAKE_CXX_COMPILER cl)

set(SWIFTWINRT_VERSION_STRING "0.0.1")
set(MicrosoftWindowsWinMD_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/winmd/src)

Expand Down
13 changes: 0 additions & 13 deletions tests/test_component/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
project(test_component_cpp)
include(nuget)

# For debug builds, build with clang which enables us to use DWARF symbols
# and debug both Swift and C++ code using lldb.
if (${CMAKE_BUILD_TYPE} STREQUAL "DEBUG")
set(CMAKE_C_COMPILER clang-cl)
set(CMAKE_CXX_COMPILER clang-cl)
else()
# For release builds don't use clang because the C++/WinRT generated code doesn't compile.
# It's not immediately clear if this is an issue with C++/WinRT or the compilation flags
# being used. But we are only using clang in debug builds to make debugging easier, so
# using this little hack for now.
set(CMAKE_C_COMPILER cl)
set(CMAKE_CXX_COMPILER cl)
endif()
set(H_FILE
${CMAKE_TEST_COMPONENT_OUTPUT}/test_component.h
)
Expand Down

0 comments on commit 2108d3f

Please sign in to comment.