[arch-commits] Commit in freecad/repos (4 files)
Date: Monday, December 7, 2020 @ 00:36:35 Author: foutrelis Revision: 771345 archrelease: copy trunk to community-staging-x86_64 Added: freecad/repos/community-staging-x86_64/ freecad/repos/community-staging-x86_64/FindPySide2Tools.cmake (from rev 771344, freecad/trunk/FindPySide2Tools.cmake) freecad/repos/community-staging-x86_64/PKGBUILD (from rev 771344, freecad/trunk/PKGBUILD) freecad/repos/community-staging-x86_64/freecad.xml (from rev 771344, freecad/trunk/freecad.xml) + FindPySide2Tools.cmake | 112 ++ PKGBUILD | 125 +++ freecad.xml|9 +++ 3 files changed, 246 insertions(+) Copied: freecad/repos/community-staging-x86_64/FindPySide2Tools.cmake (from rev 771344, freecad/trunk/FindPySide2Tools.cmake) === --- community-staging-x86_64/FindPySide2Tools.cmake (rev 0) +++ community-staging-x86_64/FindPySide2Tools.cmake 2020-12-07 00:36:35 UTC (rev 771345) @@ -0,0 +1,112 @@ +# Try to find PySide2 utilities, PYSIDE2UIC and PYSIDE2RCC: +# PYSIDE2UICBINARY - Location of PYSIDE2UIC executable +# PYSIDE2RCCBINARY - Location of PYSIDE2RCC executable +# PYSIDE2_TOOLS_FOUND - PySide2 utilities found. + +# Also provides macro similar to FindQt4.cmake's WRAP_UI and WRAP_RC, +# for the automatic generation of Python code from Qt4's user interface +# ('.ui') and resource ('.qrc') files. These macros are called: +# - PYSIDE_WRAP_UI +# - PYSIDE_WRAP_RC + +IF(PYSIDE2UICBINARY AND PYSIDE2RCCBINARY) + # Already in cache, be silent + set(PYSIDE2_TOOLS_FOUND_QUIETLY TRUE) +ENDIF(PYSIDE2UICBINARY AND PYSIDE2RCCBINARY) + +if(WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") +#pyside2 tools are often in same location as python interpreter +get_filename_component(PYTHON_BIN_DIR ${PYTHON_EXECUTABLE} PATH) +set(PYSIDE_BIN_DIR ${PYTHON_BIN_DIR}) +endif(WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + +# Since Qt v5.14, pyside2-uic and pyside2-rcc are directly provided by Qt5Core uic and rcc, with '-g python' option +# We test Qt5Core version to act accordingly + +FIND_PACKAGE(Qt5Core) + +IF(Qt5Core_VERSION VERSION_LESS 5.14) + # Legacy (< 5.14) + FIND_PROGRAM(PYSIDE2UICBINARY NAMES python2-pyside2-uic pyside2-uic pyside2-uic-${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} pyuic5 HINTS ${PYSIDE_BIN_DIR}) + FIND_PROGRAM(PYSIDE2RCCBINARY NAMES pyside2-rcc pyside2-rcc-${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} pyrcc5 HINTS ${PYSIDE_BIN_DIR}) + set(UICOPTIONS "") + set(RCCOPTIONS "") +ELSE(Qt5Core_VERSION VERSION_LESS 5.14) + # New (>= 5.14) + FIND_PROGRAM(PYSIDE2UICBINARY NAMES uic-qt5 uic pyside2-uic) + set(UICOPTIONS "--generator=python") + FIND_PROGRAM(PYSIDE2RCCBINARY NAMES rcc-qt5 rcc pyside2-rcc) + set(RCCOPTIONS "--generator=python" "--compress-algo=zlib" "--compress=1") +ENDIF(Qt5Core_VERSION VERSION_LESS 5.14) + +MACRO(PYSIDE_WRAP_UI outfiles) + FOREACH(it ${ARGN}) +GET_FILENAME_COMPONENT(outfile ${it} NAME_WE) +GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE) +SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.py) +#ADD_CUSTOM_TARGET(${it} ALL +# DEPENDS ${outfile} +#) +if(WIN32 OR APPLE) +ADD_CUSTOM_COMMAND(OUTPUT ${outfile} + COMMAND ${PYSIDE2UICBINARY} ${UICOPTIONS} ${infile} -o ${outfile} + MAIN_DEPENDENCY ${infile} +) +else() +# Especially on Open Build Service we don't want changing date like +# pyside2-uic generates in comments at beginning., which is why +# we follow the tool command with in-place sed. +ADD_CUSTOM_COMMAND(OUTPUT ${outfile} + COMMAND "${PYSIDE2UICBINARY}" ${UICOPTIONS} "${infile}" -o "${outfile}" + COMMAND sed -i "/^# /d" "${outfile}" + MAIN_DEPENDENCY "${infile}" +) +endif() +list(APPEND ${outfiles} ${outfile}) + ENDFOREACH(it) +ENDMACRO (PYSIDE_WRAP_UI) + +MACRO(PYSIDE_WRAP_RC outfiles) + FOREACH(it ${ARGN}) +GET_FILENAME_COMPONENT(outfile ${it} NAME_WE) +GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE) +SET(outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}_rc.py") +#ADD_CUSTOM_TARGET(${it} ALL +# DEPENDS ${outfile} +#) +if(WIN32 OR APPLE) +ADD_CUSTOM_COMMAND(OUTPUT ${outfile} + COMMAND ${PYSIDE2RCCBINARY} ${RCCOPTIONS} ${infile} -o ${outfile} + MAIN_DEPENDENCY ${infile} +) +else() +# Especially on Open Build Service we don't want changing date like +# pyside-rcc generates in comments at beginning, which is why +# we follow the tool command with in-place sed. +ADD_CUSTOM_COMMAND(OUTPUT "${outfile}" + COMMAND "${PYSIDE2RCCBINARY}" ${RCCOPTIONS} "${infile}" ${PY_ATTRIBUTE} -o "${outfile}" + COMMAND sed -i "/^# /d" "${outfile}" +
[arch-commits] Commit in freecad/repos (4 files)
Date: Thursday, November 19, 2020 @ 20:45:01 Author: foutrelis Revision: 757745 archrelease: copy trunk to community-staging-x86_64 Added: freecad/repos/community-staging-x86_64/ freecad/repos/community-staging-x86_64/FindPySide2Tools.cmake (from rev 757744, freecad/trunk/FindPySide2Tools.cmake) freecad/repos/community-staging-x86_64/PKGBUILD (from rev 757744, freecad/trunk/PKGBUILD) freecad/repos/community-staging-x86_64/freecad.xml (from rev 757744, freecad/trunk/freecad.xml) + FindPySide2Tools.cmake | 112 +++ PKGBUILD | 122 +++ freecad.xml|9 +++ 3 files changed, 243 insertions(+) Copied: freecad/repos/community-staging-x86_64/FindPySide2Tools.cmake (from rev 757744, freecad/trunk/FindPySide2Tools.cmake) === --- community-staging-x86_64/FindPySide2Tools.cmake (rev 0) +++ community-staging-x86_64/FindPySide2Tools.cmake 2020-11-19 20:45:01 UTC (rev 757745) @@ -0,0 +1,112 @@ +# Try to find PySide2 utilities, PYSIDE2UIC and PYSIDE2RCC: +# PYSIDE2UICBINARY - Location of PYSIDE2UIC executable +# PYSIDE2RCCBINARY - Location of PYSIDE2RCC executable +# PYSIDE2_TOOLS_FOUND - PySide2 utilities found. + +# Also provides macro similar to FindQt4.cmake's WRAP_UI and WRAP_RC, +# for the automatic generation of Python code from Qt4's user interface +# ('.ui') and resource ('.qrc') files. These macros are called: +# - PYSIDE_WRAP_UI +# - PYSIDE_WRAP_RC + +IF(PYSIDE2UICBINARY AND PYSIDE2RCCBINARY) + # Already in cache, be silent + set(PYSIDE2_TOOLS_FOUND_QUIETLY TRUE) +ENDIF(PYSIDE2UICBINARY AND PYSIDE2RCCBINARY) + +if(WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") +#pyside2 tools are often in same location as python interpreter +get_filename_component(PYTHON_BIN_DIR ${PYTHON_EXECUTABLE} PATH) +set(PYSIDE_BIN_DIR ${PYTHON_BIN_DIR}) +endif(WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + +# Since Qt v5.14, pyside2-uic and pyside2-rcc are directly provided by Qt5Core uic and rcc, with '-g python' option +# We test Qt5Core version to act accordingly + +FIND_PACKAGE(Qt5Core) + +IF(Qt5Core_VERSION VERSION_LESS 5.14) + # Legacy (< 5.14) + FIND_PROGRAM(PYSIDE2UICBINARY NAMES python2-pyside2-uic pyside2-uic pyside2-uic-${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} pyuic5 HINTS ${PYSIDE_BIN_DIR}) + FIND_PROGRAM(PYSIDE2RCCBINARY NAMES pyside2-rcc pyside2-rcc-${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} pyrcc5 HINTS ${PYSIDE_BIN_DIR}) + set(UICOPTIONS "") + set(RCCOPTIONS "") +ELSE(Qt5Core_VERSION VERSION_LESS 5.14) + # New (>= 5.14) + FIND_PROGRAM(PYSIDE2UICBINARY NAMES uic-qt5 uic pyside2-uic) + set(UICOPTIONS "--generator=python") + FIND_PROGRAM(PYSIDE2RCCBINARY NAMES rcc-qt5 rcc pyside2-rcc) + set(RCCOPTIONS "--generator=python" "--compress-algo=zlib" "--compress=1") +ENDIF(Qt5Core_VERSION VERSION_LESS 5.14) + +MACRO(PYSIDE_WRAP_UI outfiles) + FOREACH(it ${ARGN}) +GET_FILENAME_COMPONENT(outfile ${it} NAME_WE) +GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE) +SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.py) +#ADD_CUSTOM_TARGET(${it} ALL +# DEPENDS ${outfile} +#) +if(WIN32 OR APPLE) +ADD_CUSTOM_COMMAND(OUTPUT ${outfile} + COMMAND ${PYSIDE2UICBINARY} ${UICOPTIONS} ${infile} -o ${outfile} + MAIN_DEPENDENCY ${infile} +) +else() +# Especially on Open Build Service we don't want changing date like +# pyside2-uic generates in comments at beginning., which is why +# we follow the tool command with in-place sed. +ADD_CUSTOM_COMMAND(OUTPUT ${outfile} + COMMAND "${PYSIDE2UICBINARY}" ${UICOPTIONS} "${infile}" -o "${outfile}" + COMMAND sed -i "/^# /d" "${outfile}" + MAIN_DEPENDENCY "${infile}" +) +endif() +list(APPEND ${outfiles} ${outfile}) + ENDFOREACH(it) +ENDMACRO (PYSIDE_WRAP_UI) + +MACRO(PYSIDE_WRAP_RC outfiles) + FOREACH(it ${ARGN}) +GET_FILENAME_COMPONENT(outfile ${it} NAME_WE) +GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE) +SET(outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}_rc.py") +#ADD_CUSTOM_TARGET(${it} ALL +# DEPENDS ${outfile} +#) +if(WIN32 OR APPLE) +ADD_CUSTOM_COMMAND(OUTPUT ${outfile} + COMMAND ${PYSIDE2RCCBINARY} ${RCCOPTIONS} ${infile} -o ${outfile} + MAIN_DEPENDENCY ${infile} +) +else() +# Especially on Open Build Service we don't want changing date like +# pyside-rcc generates in comments at beginning, which is why +# we follow the tool command with in-place sed. +ADD_CUSTOM_COMMAND(OUTPUT "${outfile}" + COMMAND "${PYSIDE2RCCBINARY}" ${RCCOPTIONS} "${infile}" ${PY_ATTRIBUTE} -o "${outfile}" + COMMAND sed -i "/^# /d" "${outfile}" +