Skip to content

Commit

Permalink
Support building with Clang on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
laudrup committed Oct 3, 2021
1 parent 7cecfea commit 3683b54
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,14 @@ jobs:
cc: "cl", cxx: "cl",
cxx_standard: 17,
}

# Clang Windows
- {
name: "Windows Clang",
os: windows-2019,
cmake_args: "-T ClangCL"
}

steps:
- uses: actions/checkout@v2

Expand Down
16 changes: 6 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,7 @@ if (MASTER_PROJECT AND CMAKE_BUILD_TYPE MATCHES Debug)
endif()
endif()

# Assumptions:
# Clang and GNU compilers run on Linux or Linux-like platforms.
# MSVC compilers run on Windows platforms.

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
if(UNIX)

set(
LIBCXX_PREFIX_PATH
Expand Down Expand Up @@ -214,9 +210,9 @@ if (MASTER_PROJECT AND CMAKE_BUILD_TYPE MATCHES Debug)

endif()

endif() # Clang or GNU
endif() # UNIX

if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
if(WIN32)

add_compile_options(/W4)
add_compile_options(/bigobj)
Expand All @@ -227,7 +223,7 @@ if (MASTER_PROJECT AND CMAKE_BUILD_TYPE MATCHES Debug)
add_compile_options(/permissive-)
endif()

endif() # MSVC
endif() # WIN32

add_executable(
self_test
Expand Down Expand Up @@ -378,7 +374,7 @@ if (MASTER_PROJECT AND CMAKE_BUILD_TYPE MATCHES Debug)
endif()

# Shameless hack to get target to work on Windows.
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
if(UNIX)

add_custom_target(
run_self_test
Expand All @@ -400,7 +396,7 @@ if (MASTER_PROJECT AND CMAKE_BUILD_TYPE MATCHES Debug)

endif()

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
if(UNIX)

add_custom_target(
run_coverage
Expand Down

0 comments on commit 3683b54

Please sign in to comment.