Fixed building on MSVC

This commit is contained in:
Bartek Kryza
2024-01-11 16:32:03 +01:00
parent 555d0da4f6
commit 2006d62d4d
4 changed files with 16 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
param ($Prefix="C:\clang-uml", $BuildType="Release") param ($Prefix="C:\clang-uml", $BuildType="Release")
cmake -S . -B $BuildType -DCMAKE_PREFIX_PATH="$Prefix" -Thost=x64 cmake -S . -B $BuildType -DCMAKE_PREFIX_PATH="$Prefix" -DENABLE_CXX_MODULES_TEST_CASES=OFF -Thost=x64
cmake --build $BuildType --config $BuildType cmake --build $BuildType --config $BuildType
# Create compile commands in Visual Studio # Create compile commands in Visual Studio

View File

@@ -27,7 +27,7 @@ target_compile_options(clang-umllib PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:GNU>>: $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:GNU>>:
-Werror -Wall -Wextra -Wno-unused-parameter -Werror -Wall -Wextra -Wno-unused-parameter
-Wno-deprecated-declarations ${CUSTOM_COMPILE_OPTIONS}> -Wno-deprecated-declarations ${CUSTOM_COMPILE_OPTIONS}>
$<$<CXX_COMPILER_ID:MSVC>:/MP /W1 /bigobj /wd4291 /wd4624 /wd4244>) $<$<CXX_COMPILER_ID:MSVC>:/MP /MD /W1 /bigobj /wd4291 /wd4624 /wd4244>)
target_compile_definitions(clang-umllib PRIVATE target_compile_definitions(clang-umllib PRIVATE
$<$<CXX_COMPILER_ID:MSVC>: $<$<CXX_COMPILER_ID:MSVC>:
-DLLVM_FORCE_USE_OLD_TOOLCHAIN -DLLVM_FORCE_USE_OLD_TOOLCHAIN
@@ -44,7 +44,7 @@ target_compile_options(clang-uml PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:GNU>>: $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:GNU>>:
-Werror -Wall -Wextra -Wno-unused-parameter -Werror -Wall -Wextra -Wno-unused-parameter
-Wno-deprecated-declarations ${CUSTOM_COMPILE_OPTIONS}> -Wno-deprecated-declarations ${CUSTOM_COMPILE_OPTIONS}>
$<$<CXX_COMPILER_ID:MSVC>:/MP /W1 /bigobj /wd4291 /wd4624 /wd4244>) $<$<CXX_COMPILER_ID:MSVC>:/MP /MD /W1 /bigobj /wd4291 /wd4624 /wd4244>)
target_compile_definitions(clang-uml PRIVATE target_compile_definitions(clang-uml PRIVATE
${ENABLE_BACKWARD_CPP}) ${ENABLE_BACKWARD_CPP})
target_link_libraries(clang-uml target_link_libraries(clang-uml

View File

@@ -100,7 +100,7 @@ foreach(TEST_NAME ${TEST_NAMES})
-Wno-unused-parameter -Wno-unused-variable -Wno-unused-parameter -Wno-unused-variable
-Wno-attributes -Wno-nonnull -Wno-deprecated-enum-enum-conversion -Wno-attributes -Wno-nonnull -Wno-deprecated-enum-enum-conversion
${CUSTOM_COMPILE_OPTIONS}> ${CUSTOM_COMPILE_OPTIONS}>
$<$<CXX_COMPILER_ID:MSVC>:/W1 /bigobj /wd4624>>) $<$<CXX_COMPILER_ID:MSVC>:/MP /MD /W1 /bigobj /wd4624>>)
target_link_libraries(${TEST_NAME} PRIVATE ${CLANG_UML_TEST_LIBRARIES}) target_link_libraries(${TEST_NAME} PRIVATE ${CLANG_UML_TEST_LIBRARIES})
endforeach() endforeach()

View File

@@ -428,6 +428,7 @@ TEST_CASE("Test common::model::package full_name", "[unit-test]")
"namespaceA_1_1B_1_1C_1_1D_1_1E_1_1F_1_1G.html"); "namespaceA_1_1B_1_1C_1_1D_1_1E_1_1F_1_1G.html");
} }
#if !defined(_MSC_VER)
{ {
auto using_namespace = path{"/A/B/C", path_type::kFilesystem}; auto using_namespace = path{"/A/B/C", path_type::kFilesystem};
auto pkg = package(using_namespace, path_type::kFilesystem); auto pkg = package(using_namespace, path_type::kFilesystem);
@@ -437,6 +438,17 @@ TEST_CASE("Test common::model::package full_name", "[unit-test]")
CHECK(pkg.full_name(false) == "A/B/C/D/E/F/G"); CHECK(pkg.full_name(false) == "A/B/C/D/E/F/G");
CHECK(pkg.full_name(true) == "D/E/F/G"); CHECK(pkg.full_name(true) == "D/E/F/G");
} }
#else
{
auto using_namespace = path{"A\\B\\C", path_type::kFilesystem};
auto pkg = package(using_namespace, path_type::kFilesystem);
pkg.set_name("G");
pkg.set_namespace(path{"A\\B\\C\\D\\E\\F", path_type::kFilesystem});
CHECK(pkg.full_name(false) == "A\\B\\C\\D\\E\\F\\G");
CHECK(pkg.full_name(true) == "D\\E\\F\\G");
}
#endif
{ {
auto using_namespace = path{"A.B.C", path_type::kModule}; auto using_namespace = path{"A.B.C", path_type::kModule};