@@ -56,6 +56,8 @@ option(FILAMENT_ENABLE_FGVIEWER "Enable the frame graph viewer" OFF)
5656
5757option (FILAMENT_USE_ABSEIL_LOGGING "Use Abseil to log, may increase binary size" OFF )
5858
59+ option (FILAMENT_ENABLE_EXPERIMENTAL_GCC_SUPPORT "Enable GCC support (unsupported)" OFF )
60+
5961# This is to disable GTAO for the short-term while we investigate a way to better manage size increases.
6062# On the regular filament build (where size is of less concern), we enable GTAO by default.
6163option (FILAMENT_DISABLE_GTAO "Disable GTAO" OFF )
@@ -295,15 +297,10 @@ set(TOOLS ${CMAKE_CURRENT_SOURCE_DIR}/tools)
295297# ==================================================================================================
296298set (MIN_CLANG_VERSION "6.0" )
297299
298- if (CMAKE_C_COMPILER_ID MATCHES "Clang" )
299- if (CMAKE_C_COMPILER_VERSION VERSION_LESS MIN_CLANG_VERSION)
300- message (FATAL_ERROR "Detected C compiler Clang ${CMAKE_C_COMPILER_VERSION} < ${MIN_CLANG_VERSION} " )
301- endif ()
302- elseif (NOT MSVC )
303- message (FATAL_ERROR "Detected C compiler ${CMAKE_C_COMPILER_ID} is unsupported" )
304- endif ()
305-
306- if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
300+ set (FILAMENT_USING_GCC OFF )
301+ if (CMAKE_C_COMPILER_ID MATCHES "GNU" AND FILAMENT_ENABLE_EXPERIMENTAL_GCC_SUPPORT)
302+ set (FILAMENT_USING_GCC ON )
303+ elseif (CMAKE_C_COMPILER_ID MATCHES "Clang" )
307304 if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS MIN_CLANG_VERSION)
308305 message (FATAL_ERROR "Detected CXX compiler Clang ${CMAKE_CXX_COMPILER_VERSION} < ${MIN_CLANG_VERSION} " )
309306 endif ()
@@ -344,7 +341,11 @@ if (MSVC)
344341 set (CXX_STANDARD "/std:c++latest" )
345342 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_STANDARD} /W0 /Zc:__cplusplus" )
346343else ()
347- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_STANDARD} -fstrict-aliasing -Wno-unknown-pragmas -Wno-unused-function -Wno-deprecated-declarations" )
344+ if (FILAMENT_USING_GCC)
345+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_STANDARD} -Wno-changes-meaning -Wno-return-type -Wno-attributes -Wno-unknown-pragmas -Wno-class-memaccess -Wno-multichar -Wno-deprecated-declarations -Wno-subobject-linkage -Wno-invalid-constexpr" )
346+ else ()
347+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_STANDARD} -fstrict-aliasing -Wno-unknown-pragmas -Wno-unused-function -Wno-deprecated-declarations" )
348+ endif ()
348349 if (APPLE )
349350 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nullability-extension" )
350351 endif ()
@@ -365,10 +366,14 @@ endif()
365366if (LINUX)
366367 option (USE_STATIC_LIBCXX "Link against the static runtime libraries." ON )
367368 if (${USE_STATIC_LIBCXX} )
368- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++" )
369- link_libraries ("-static-libgcc -static-libstdc++" )
370- link_libraries (libc++.a)
371- link_libraries (libc++abi.a)
369+ if (FILAMENT_USING_GCC)
370+ link_libraries ("-static-libgcc -static-libstdc++" )
371+ else ()
372+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++" )
373+ link_libraries ("-static-libgcc -static-libstdc++" )
374+ link_libraries (libc++.a)
375+ link_libraries (libc++abi.a)
376+ endif ()
372377 endif ()
373378
374379 # Only linux, clang doesn't want to use a shared library that is not PIC.
0 commit comments