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

Set compilers in presets #151

Merged
merged 3 commits into from
Mar 29, 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
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
Loading