]> OCCT Git - occt.git/commitdiff
Configuration - CLang-cl msvc support #101
authordpasukhi <dpasukhi@opencascade.com>
Sat, 12 Oct 2024 21:52:11 +0000 (22:52 +0100)
committerdpasukhi <dpasukhi@opencascade.com>
Sat, 12 Oct 2024 21:57:13 +0000 (22:57 +0100)
Update compiler flags and env.bat to work with clang-cl

adm/cmake/occt_defs_flags.cmake
adm/templates/env.bat
adm/templates/env.bat.in

index f33ae158f238e0d32f107d50f79fcefdc4530ffc..0d8fe91fb3cabec73108dba0b7a2dad70c1869d5 100644 (file)
@@ -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()
 
index c2c20424327e750fa4da872f2c89cc9413c0f27c..33e129a457f6fa49f613a96475bdf6244526861b 100644 (file)
@@ -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: 
@@ -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
index aa3bf6efc7c4b2f5cb72083ad6e3c2e91e3c8f49..d83de73336e2f46da21166cd2f9dbd370c38ab41 100644 (file)
@@ -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
@@ -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^)