Skip to content

Commit

Permalink
Fixed building on MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
bkryza committed Jan 11, 2024
1 parent 555d0da commit 2006d62
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
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

# Create compile commands in Visual Studio
Expand Down
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ target_compile_options(clang-umllib PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:GNU>>:
-Werror -Wall -Wextra -Wno-unused-parameter
-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
$<$<CXX_COMPILER_ID:MSVC>:
-DLLVM_FORCE_USE_OLD_TOOLCHAIN
Expand All @@ -44,7 +44,7 @@ target_compile_options(clang-uml PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:GNU>>:
-Werror -Wall -Wextra -Wno-unused-parameter
-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
${ENABLE_BACKWARD_CPP})
target_link_libraries(clang-uml
Expand Down
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ foreach(TEST_NAME ${TEST_NAMES})
-Wno-unused-parameter -Wno-unused-variable
-Wno-attributes -Wno-nonnull -Wno-deprecated-enum-enum-conversion
${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})
endforeach()

Expand Down
12 changes: 12 additions & 0 deletions tests/test_model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

#if !defined(_MSC_VER)
{
auto using_namespace = path{"/A/B/C", path_type::kFilesystem};
auto pkg = package(using_namespace, path_type::kFilesystem);
Expand All @@ -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(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};
Expand Down

0 comments on commit 2006d62

Please sign in to comment.