Comments (7)
In that case you'd need to have a separate custom command for each .ui
file, and a single custom target to aggregate all of those, something like:
SET(SOURCES file1.ui file2.ui file3.ui)
set(UI_GENERATION_COMMANDS)
foreach(SOURCE SOURCES)
set(OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/${SOURCE}.py")
add_custom_command(
OUTPUT "${OUTPUT_FILE}"
COMMAND "uic -g python -o ${OUTPUT_FILE} ${SOURCE}"
COMMENT "Generating ${SOURCE} -> ${OUTPUT_FILE}"
)
list(APPEND UI_GENERATION_COMMANDS "${OUTPUT_FILE}")
endforeach()
add_custom_target(GenerateUIToPy ALL DEPENDS ${UI_GENERATION_COMMANDS})
from avrdude.
OK, thanks a lot for the explanation.
Alas, I just noticed that there appears to be a lot of confusion about the uic command for PySide. In the past, the command was called pyside2-uic. Older versions of uic only supported Java and C++ as generator targets, yet the silently accepted -g python
– and generated C++ code. :-o Then, the Qt5 in Ubuntu22.04 has dropped pyside2-uic entirely (probably because it was based on Python 2.7 still), but did not upgrade their Qt to a recent enough version that would support Python code generation.
So bottom line, this would probably prevent many people from experimenting with it, and I decided to rather load the .ui files at run-time instead.
But it's nevertheless good to know the solution! The issue tracker will record it for eternity. ;-)
from avrdude.
Just wondering if you can provide a quick tip here. Thanks.
from avrdude.
Either set CMAKE_AUTOUIC to TRUE
before creating a target (a library or executable) or set the AUTOUIC property of the target to TRUE
.
Then add your .ui
files to your target as if it is a regular cpp source.
Sample:
set(CMAKE_AUTOUIC ON)
add_library(testLib
mainwindow.cpp
mainwindow.h
mainwindow.ui
)
or
add_library(testLib
mainwindow.cpp
mainwindow.h
mainwindow.ui
)
set_target_properties(testLib
PROPERTIES AUTOUIC ON
)
from avrdude.
there're other ways to achieve the same, but the one above is the most convenient
and the one you've tried to use (manyally invoking the uic
) is probably the least convenient/recommended
from avrdude.
I tried CMAKE_AUTOUIC
, to no avail.
Problem here: it's not C++, it's Python. I do not need to compile anything but only the .ui files. As far as I could see, CMAKE_AUTOUIC
only seems to parse C++ implementation files – which I don't have.
I don't even know how I would setup a CMake target for something that isn't going to be a classic compilation result. (A couple of steps later, it might become one: when trying to create a portable bundle out of all the Python files.)
It's not that I'd object to using C++, but the purpose of all this is to demonstrate a Python wrapper around our backend library.
from avrdude.
Besides, your example is also valuable in case we'd have a need for running any similar custom command in future.
from avrdude.
Related Issues (20)
- Which programmer supports "-E reset"? HOT 16
- Regression: EEPROM issue with official STK500 V1 FW -- avrdude 7.1 is okay but not 7.2 and 7.3 HOT 12
- EE-Prom data falsified by mySmartUSB Progammer HOT 32
- avr_{read,write}_mem fail to initialize progress reporting HOT 4
- Old `avrdude_message()` can go away HOT 3
- avr_write_mem() does not really write something HOT 13
- Progress reporting functions should be better documented HOT 1
- avr*timestamp() oddities HOT 4
- Wrong message level in `jtag3_prmsg()` HOT 1
- 0xff optimization when reading HOT 7
- Error when using linuxgpio HOT 3
- v7.3 detected as malware HOT 1
- Add support for libgpiod v2+ API HOT 2
- "jtag2 is not a unique start of a programmer name"
- `-F` option not honored
- Add support for more AVR-DU parts HOT 2
- Add support for emscripten HOT 6
- Trouble with Raspberry pi 5 HOT 13
- linuxgpio sysfs fallback improvement to deal with shifted GPIO numbering in new kernel version HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from avrdude.