Skip to content

Commit a18fd9a

Browse files
Force .ui files to generate .py files.
This is a work-around to ensure that .py files that were generated with a newer Qt are not used for older Maya versions.
1 parent 2f5324e commit a18fd9a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

python/CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ function(add_ui_compile
3535
output_file)
3636
if(MAYA_VERSION GREATER_EQUAL 2022)
3737
# Maya 2022 and above. Use Maya provided 'uic' executable to
38-
# compile .ui files into .py files.
38+
# compile .ui files into .py files. Earlier versions of Maya
39+
# can only compile to C++ code with 'uic'.
3940
find_program(MAYA_QT_UIC_EXECUTABLE
4041
uic
4142
HINTS
@@ -49,10 +50,11 @@ function(add_ui_compile
4950
"Maya provided Qt 'uic' executable path"
5051
)
5152

52-
set(EXEC_SCRIPT ${CMAKE_SOURCE_DIR}/scripts/internal/compileUI.py)
5353
# Runs 'uic -g python <ui_file> -o <output_python_file>'
5454
add_custom_command(
55-
OUTPUT ${output_file}
55+
OUTPUT
56+
${output_file}
57+
${output_file}.never_exist # force re-run.
5658
COMMAND ${MAYA_QT_UIC_EXECUTABLE} -g python ${input_file} -o ${output_file}
5759
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
5860
DEPENDS ${input_file}
@@ -67,7 +69,9 @@ function(add_ui_compile
6769
# into .py files.
6870
set(EXEC_SCRIPT ${CMAKE_SOURCE_DIR}/scripts/internal/compileUI.py)
6971
add_custom_command(
70-
OUTPUT ${output_file}
72+
OUTPUT
73+
${output_file}
74+
${output_file}.never_exist # force re-run.
7175
COMMAND ${MAYA_PYTHON_EXECUTABLE} ${EXEC_SCRIPT} ${input_file}
7276
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
7377
DEPENDS ${input_file}

0 commit comments

Comments
 (0)