[Bf-blender-cvs] [820d191] master: OpenSubdiv: Add CMake option to enable -Werror in subsurf code

Sergey Sharybin noreply at git.blender.org
Thu Jul 30 10:34:33 CEST 2015


Commit: 820d19162678a478bac6a0945e2111b11bbea91e
Author: Sergey Sharybin
Date:   Thu Jul 30 10:31:22 2015 +0200
Branches: master
https://developer.blender.org/rB820d19162678a478bac6a0945e2111b11bbea91e

OpenSubdiv: Add CMake option to enable -Werror in subsurf code

===================================================================

M	CMakeLists.txt
M	intern/opensubdiv/CMakeLists.txt
M	source/blender/blenkernel/CMakeLists.txt

===================================================================

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c2c0e8e..198f6a3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -230,6 +230,8 @@ option(WITH_COMPOSITOR_WERROR  "Treat warnings as errors in compositor code" OFF
 mark_as_advanced(WITH_COMPOSITOR_WERROR)
 
 option(WITH_OPENSUBDIV    "Enable OpenSubdiv for surface subdivision" OFF)
+option(WITH_SUBSURF_WERROR  "Treat warnings as errors in subsurf code" OFF)
+mark_as_advanced(WITH_COMPOSITOR_WERROR)
 
 # GHOST Windowing Library Options
 option(WITH_GHOST_DEBUG   "Enable debugging output for the GHOST library" OFF)
diff --git a/intern/opensubdiv/CMakeLists.txt b/intern/opensubdiv/CMakeLists.txt
index 3f88ba5..fceaeb9 100644
--- a/intern/opensubdiv/CMakeLists.txt
+++ b/intern/opensubdiv/CMakeLists.txt
@@ -50,6 +50,11 @@ set(SRC
 	opensubdiv_partitioned.h
 )
 
+if(WITH_SUBSURF_WERROR)
+	ADD_CHECK_C_COMPILER_FLAG(CMAKE_C_FLAGS C_WERROR -Werror)
+	ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS C_WERROR -Werror)
+endif()
+
 macro(OPENSUBDIV_DEFINE_COMPONENT component)
 	if(${${component}})
 		add_definitions(-D${component})
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index f0d6cfb..5a3fb49 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -505,6 +505,16 @@ if(WITH_OPENSUBDIV)
 		../../../intern/opensubdiv
 		${OPENSUBDIV_INCLUDE_DIRS}
 	)
+	if(WITH_SUBSURF_WERROR)
+		if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
+			set_source_files_properties(intern/CCGSubSurf.c
+			                            intern/CCGSubSurf_legacy.c
+			                            intern/CCGSubSurf_opensubdiv.c
+			                            intern/CCGSubSurf_opensubdiv_converter.c
+			                            intern/CCGSubSurf_util.c
+			                            PROPERTIES COMPILE_FLAGS -Werror)
+		endif()
+	endif()
 endif()
 
 ## Warnings as errors, this is too strict!




More information about the Bf-blender-cvs mailing list