Revert CMakeLists.txt from tangxifan suggestion

This commit is contained in:
Kyle Chuang 2023-08-23 14:22:34 +08:00
parent 34f9067a2e
commit fe69bbf57f
1 changed files with 72 additions and 72 deletions

View File

@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 2.8.12)
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)
if (${CMAKE_VERSION} VERSION_GREATER "3.8")
@ -92,17 +92,17 @@ set(WITH_PARMYS OFF CACHE BOOL "Enable Yosys as elaborator and parmys-plugin as
# TCL file/lib required to link with SWIG generated wrapper
if (OPENFPGA_WITH_SWIG)
#Find Tcl
include(FindTCL)
message(STATUS "tcl.h path is : ${TCL_INCLUDE_PATH}")
message(STATUS "libtcl.so path is : ${TCL_LIBRARY}")
#Find Tcl
include(FindTCL)
message(STATUS "tcl.h path is : ${TCL_INCLUDE_PATH}")
message(STATUS "libtcl.so path is : ${TCL_LIBRARY}")
#Find SWIG
find_package(SWIG 3.0 REQUIRED)
if (SWIG_VERSION VERSION_GREATER_EQUAL "4.1.0")
message(WARNING "Using SWIG >= ${SWIG_VERSION} -flatstaticmethod flag for python")
endif()
include(UseSWIG)
#Find SWIG
find_package(SWIG 3.0 REQUIRED)
if (SWIG_VERSION VERSION_GREATER_EQUAL "4.1.0")
message(WARNING "Using SWIG >= ${SWIG_VERSION} -flatstaticmethod flag for python")
endif()
include(UseSWIG)
endif()
#Compiler flag configuration checks
@ -150,71 +150,71 @@ endif()
set(WARN_FLAGS "")
if (MSVC)
# Visual studio warnings
# Note that we do not use /Wall since it generates warnings about standard library headers
set(WARN_FLAGS_TO_CHECK # the flags to check if the compiler supports
"/W4" # Most warnings
)
# Visual studio warnings
# Note that we do not use /Wall since it generates warnings about standard library headers
set(WARN_FLAGS_TO_CHECK # the flags to check if the compiler supports
"/W4" # Most warnings
)
else ()
set(WARN_FLAGS_TO_CHECK # the flags to check if the compiler supports
#GCC-like
"-Wall" #Most warnings, typically good
"-Wextra" #Extra warning, usually good
"-Wpedantic" #Ensure ISO compliance (i.e. no non-standard extensions)
"-Wcast-qual" #Warn if cast removes qualifier (e.g. const char* -> char*)
"-Wcast-align" #Warn if a cast causes memory alignment changes
"-Wshadow" #Warn if local variable shadows another variable
"-Wformat=2" #Sanity checks for printf-like formatting
"-Wno-format-nonliteral" # But don't worry about non-literal formatting (i.e. run-time printf format strings)
"-Wlogical-op" #Checks for logical op when bit-wise expected
"-Wmissing-declarations" #Warn if a global function is defined with no declaration
"-Wmissing-include-dirs" #Warn if a user include directory is missing
"-Wredundant-decls" #Warn if there are overlapping declarations
"-Wswitch-default" #Warn if a switch has no default
"-Wundef" #Warn if #if() preprocessor refers to an undefined directive
"-Wunused" #Warn about unused variables/parameters
"-Wunused-variable" #Warn about variables that are not used
"-Wunused-parameter" #Warn about function parameters which are unused
"-Wdisabled-optimization" #Warn when optimizations are skipped (usually due to large/complex code)
"-Wnoexcept" #Warn when functions should be noexcept (i.e. compiler know it doesn't throw)
"-Woverloaded-virtual" #Warn when a function declaration overrides a virtual method
"-Wctor-dtor-privacy" #Warn about inaccessible constructors/destructors
"-Wnon-virtual-dtor" #Warn about missing virtual destructors
"-Wduplicated-cond" #Warn about identical conditions in if-else chains
"-Wduplicated-branches" #Warn when different branches of an if-else chain are equivalent
"-Wnull-dereference" #Warn about null pointer dereference execution paths
"-Wuninitialized" #Warn about uninitialized values
"-Winit-self" #Warn about self-initialization
"-Wcatch-value=3" #Warn when catch statements don't catch by reference
"-Wextra-semi" #Warn about redundant semicolons
"-Wimplicit-fallthrough=3" #Warn about case fallthroughs, but allow 'fallthrough' comments to suppress warnings
#GCC-like optional
#"-Wsuggest-final-types" #Suggest where 'final' would help if specified on a type methods
#"-Wsuggest-final-methods" #Suggest where 'final' would help if specified on methods
#"-Wsuggest-override" #Suggest where 'override' should be specified
#"-Wold-style-cast" #Warn about using c-style casts
#"-Wconversion" #Warn when type conversions may change value
#"-Wsign-conversion" #Warn if a conversion may change the sign
#"-Wpadded" #Will warn if additional padding is introduced to a struct/class. Turn on if optimizing class memory layouts
#"-Wstrict-overflow=2" #Warn if the compiler optimizes assuming signed overflow does not occur
#"-Wfloat-equal" #Warn about using direct floating point equality
#"-Wunsafe-loop-optimizations" #Warn when loops can't be optimized
#"-Wswitch-enum" #Warn about uncovered enumeration values in a switch (even if there is a default)
#"-Wsign-promo" #Warn when overload resolution converts an unsigned type to signed when an unsigned overload exists
#"-Wdouble-promotion" #Warn when float is implicitly prompted to double
#"-Wuseless-cast" #Warn about casts to the same type
#"-Wzero-as-null-pointer-constant" #Warn about using '0' instead of nullptr
)
set(WARN_FLAGS_TO_CHECK # the flags to check if the compiler supports
#GCC-like
"-Wall" #Most warnings, typically good
"-Wextra" #Extra warning, usually good
"-Wpedantic" #Ensure ISO compliance (i.e. no non-standard extensions)
"-Wcast-qual" #Warn if cast removes qualifier (e.g. const char* -> char*)
"-Wcast-align" #Warn if a cast causes memory alignment changes
"-Wshadow" #Warn if local variable shadows another variable
"-Wformat=2" #Sanity checks for printf-like formatting
"-Wno-format-nonliteral" # But don't worry about non-literal formtting (i.e. run-time printf format strings)
"-Wlogical-op" #Checks for logical op when bit-wise expected
"-Wmissing-declarations" #Warn if a global function is defined with no declaration
"-Wmissing-include-dirs" #Warn if a user include directory is missing
"-Wredundant-decls" #Warn if there are overlapping declarations
"-Wswitch-default" #Warn if a switch has no default
"-Wundef" #Warn if #if() preprocessor refers to an undefined directive
"-Wunused" #Warn about unused variables/parameters
"-Wunused-variable" #Warn about variables that are not used
"-Wunused-parameter" #Warn about function parameters which are unused
"-Wdisabled-optimization" #Warn when optimizations are skipped (usually due to large/complex code)
"-Wnoexcept" #Warn when functions should be noexcept (i.e. compiler know it doesn't throw)
"-Woverloaded-virtual" #Warn when a function declaration overrides a virtual method
"-Wctor-dtor-privacy" #Warn about inaccessible constructors/destructors
"-Wnon-virtual-dtor" #Warn about missing virtual destructors
"-Wduplicated-cond" #Warn about identical conditions in if-else chains
"-Wduplicated-branches" #Warn when different branches of an if-else chain are equivalent
"-Wnull-dereference" #Warn about null pointer dereference execution paths
"-Wuninitialized" #Warn about unitialized values
"-Winit-self" #Warn about self-initialization
"-Wcatch-value=3" #Warn when catch statements don't catch by reference
"-Wextra-semi" #Warn about redudnant semicolons
"-Wimplicit-fallthrough=3" #Warn about case fallthroughs, but allow 'fallthrough' comments to suppress warnings
#GCC-like optional
#"-Wsuggest-final-types" #Suggest where 'final' would help if specified on a type methods
#"-Wsuggest-final-methods" #Suggest where 'final' would help if specified on methods
#"-Wsuggest-override" #Suggest where 'override' should be specified
#"-Wold-style-cast" #Warn about using c-style casts
#"-Wconversion" #Warn when type conversions may change value
#"-Wsign-conversion" #Warn if a conversion may change the sign
#"-Wpadded" #Will warn if additional padding is introduced to a struct/class. Turn on if optimizing class memory layouts
#"-Wstrict-overflow=2" #Warn if the compiler optimizes assuming signed overflow does not occur
#"-Wfloat-equal" #Warn about using direct floating point equality
#"-Wunsafe-loop-optimizations" #Warn when loops can't be optimized
#"-Wswitch-enum" #Warn about uncovered enumeration values in a switch (even if there is a default)
#"-Wsign-promo" #Warn when overload resolution converts an unsigned type to signed when an unsigned overload exists
#"-Wdouble-promotion" #Warn when float is implicitly propted to double
#"-Wuseless-cast" #Warn about casts to the same type
#"-Wzero-as-null-pointer-constant" #Warn about using '0' instead of nullptr
)
endif()
# check and see if the compiler supports the various warning flags
# and add valid flags
foreach (flag ${WARN_FLAGS_TO_CHECK})
CHECK_CXX_COMPILER_FLAG(${flag} CXX_COMPILER_SUPPORTS_${flag})
if (CXX_COMPILER_SUPPORTS_${flag})
# flag supported, so enable it
set (WARN_FLAGS "${WARN_FLAGS} ${flag}")
endif()
CHECK_CXX_COMPILER_FLAG(${flag} CXX_COMPILER_SUPPORTS_${flag})
if (CXX_COMPILER_SUPPORTS_${flag})
# flag supported, so enable it
set (WARN_FLAGS "${WARN_FLAGS} ${flag}")
endif()
endforeach()
#Suppress IPO link warnings
@ -301,7 +301,7 @@ option(YOSYS_ENABLE_NDEBUG, "Enable non-debugging feature in compiled yosys" OFF
## Search and link dependent packages
## We need readline to compile
if (YOSYS_ENABLE_READLINE)
find_package(Readline REQUIRED)
find_package(Readline REQUIRED)
endif()
#PugiXml has some deliberate switch fallthrough cases (as indicated by comments), but they