Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cmake/defaults/cxx_defaults.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,10 @@ ELSEIF(RV_VFX_PLATFORM STREQUAL "CY2023")
"MuQt5"
)
ENDIF()

# Suppress noisy warnings globally
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
ADD_COMPILE_OPTIONS(-Wno-cast-function-type-mismatch -Wno-deprecated-declarations)
ELSEIF(MSVC)
ADD_COMPILE_OPTIONS(/wd4996) # Equivalent to -Wno-deprecated-declarations
ENDIF()
31 changes: 31 additions & 0 deletions src/build/make_pyside.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,37 @@ def prepare() -> None:

cmakelist.write(new_line)

def patch_cmakelist(path):
if not os.path.exists(path):
return
print(f"Suppressing cast-function-type-mismatch in {path}")
with open(path, "r") as f:
content = f.read()

if "-Wno-cast-function-type-mismatch" not in content:
suppress_flag = (
'\nif(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")\n'
" add_compile_options(-Wno-cast-function-type-mismatch)\n"
"endif()\n"
)
# Find project(...) and insert after it
project_match = re.search(r"project\s*\(.*?\)", content, re.IGNORECASE | re.DOTALL)
if project_match:
insert_pos = project_match.end()
content = content[:insert_pos] + suppress_flag + content[insert_pos:]
else:
content += suppress_flag

with open(path, "w") as f:
f.write(content)

# Patch root CMakeLists.txt
patch_cmakelist(os.path.join(SOURCE_DIR, "CMakeLists.txt"))
# Patch shiboken2 CMakeLists.txt
patch_cmakelist(os.path.join(SOURCE_DIR, "sources", "shiboken2", "CMakeLists.txt"))
# Patch pyside2 CMakeLists.txt
patch_cmakelist(os.path.join(SOURCE_DIR, "sources", "pyside2", "CMakeLists.txt"))


def remove_broken_shortcuts(python_home: str) -> None:
"""
Expand Down
31 changes: 31 additions & 0 deletions src/build/make_pyside6.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,37 @@ def get_fallback_clang_filename_suffix(version):

cmakelist.write(new_line)

def patch_cmakelist(path):
if not os.path.exists(path):
return
print(f"Suppressing cast-function-type-mismatch in {path}")
with open(path, "r") as f:
content = f.read()

if "-Wno-cast-function-type-mismatch" not in content:
suppress_flag = (
'\nif(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")\n'
" add_compile_options(-Wno-cast-function-type-mismatch)\n"
"endif()\n"
)
# Find project(...) and insert after it
project_match = re.search(r"project\s*\(.*?\)", content, re.IGNORECASE | re.DOTALL)
if project_match:
insert_pos = project_match.end()
content = content[:insert_pos] + suppress_flag + content[insert_pos:]
else:
content += suppress_flag

with open(path, "w") as f:
f.write(content)

# Patch root CMakeLists.txt
patch_cmakelist(os.path.join(SOURCE_DIR, "CMakeLists.txt"))
# Patch shiboken6 CMakeLists.txt
patch_cmakelist(os.path.join(SOURCE_DIR, "sources", "shiboken6", "CMakeLists.txt"))
# Patch pyside6 CMakeLists.txt
patch_cmakelist(os.path.join(SOURCE_DIR, "sources", "pyside6", "CMakeLists.txt"))


def remove_broken_shortcuts(python_home: str) -> None:
"""
Expand Down
Loading