Skip to content

Commit

Permalink
Configuration - CLang-cl msvc support #101
Browse files Browse the repository at this point in the history
Update compiler flags and env.bat to work with clang-cl
  • Loading branch information
dpasukhi committed Oct 12, 2024
1 parent 8587096 commit 0e28054
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
10 changes: 8 additions & 2 deletions adm/cmake/occt_defs_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@ if (MSVC)
# suppress warning on using portable non-secure functions in favor of non-portable secure ones
add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
else()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -fPIC")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexceptions -fPIC")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexceptions")
if (NOT CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
else()
add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
endif()
add_definitions(-DOCC_CONVERT_SIGNALS)
endif()

Expand Down
4 changes: 4 additions & 0 deletions adm/templates/env.bat
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ if not "%DevEnvDir%" == "" (
)
) else if /I "%VCFMT%" == "gcc" (
rem MinGW
) else if /I "%VCFMT%" == "clang" (
rem clang
) else (
echo Error: first argument ^(%VCVER%^) should specify supported version of Visual C++,
echo one of:
Expand Down Expand Up @@ -184,6 +186,8 @@ if /I "%VCFMT%" == "vc9" (
set "VCPlatformToolSet=ClangCL"
) else if /I "%VCFMT%" == "gcc" (
rem MinGW
) else if /I "%VCFMT%" == "clang" (
rem clang
) else (
echo Error: wrong VS identifier
exit /B
Expand Down
4 changes: 4 additions & 0 deletions adm/templates/env.bat.in
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ if not "%DevEnvDir%" == "" (
)
) else if /I "%VCFMT%" == "gcc" (
rem MinGW
) else if /I "%VCFMT%" == "clang" (
rem clang
) else (
echo Error: wrong VS identifier
exit /B
Expand Down Expand Up @@ -118,6 +120,8 @@ if /I "%VCFMT%" == "vc9" (
set "VCPlatformToolSet=v142"
) else if /I "%VCFMT%" == "gcc" (
rem MinGW
) else if /I "%VCFMT%" == "clang" (
rem clang
) else (
echo Error: first argument ^(%VCVER%^) should specify supported version of Visual C++,
echo one of: vc10 ^(VS 2010 SP3^), vc11 ^(VS 2012 SP3^), vc12 ^(VS 2013^) or vc14 ^(VS 2015^)
Expand Down

0 comments on commit 0e28054

Please sign in to comment.