-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnotes
110 lines (71 loc) · 4.41 KB
/
notes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
In general from scratch:
- new project
- remove project file from folder, put one dir up
- target: add library or command line executable, remove dirs/files created, add files to build phases manually
- add settings.xconfig to target settings
- Build Active Architecture only: yes
- debug info: DWARF
- Enable Testability: yes
- make sure Deployment target version is deleted (this will revert it to default) on both projects and settings.
## Create project:
- Start with with Cross-platform Empty project: "COMMAND-SHIFT-N". Do no create local git repos.
- Close it. Move the project from its own dir created to one dir up. Delete dir.
- Add all the files (make sure to do scons -c to avoid including objects). Added folders: Create groups (create folder reference won't let add sources later)
- On the general project add "settings.xcconfig" configuration for debug and release
- Add macos Library target "libraryName". Dynamic. Currently 2 type of "Library" targets, choose second one, make sure it's STL C++
- remove libraryName directory
- add sources libraryName.cc in Compile Sources "Build Phases"
- make sure the scheme is set to build "Release" so that archiving build the exact same way as normal build
- unless there is a developer account, everything should be signed to run locally
- disable "Hardened Runtime" to allow non signed code (both debug and release)
- also, in Signing and Capabilities, disable library validation
- notice: test scheme should also be release
- make sure any needed library is "linked to" and not "embedded" in the frameworks
- Publish Your App With Symbol Information: add dSYM file so the symbols are kept in the crash reports (for example testflights). However this is only useful if we have different xcode versions. See: https://developer.apple.com/documentation/xcode/building-your-app-to-include-debugging-information/
- for executables: Add macos command line tool exampleName
## Gstreamer prefix/suffix xcode:
- Build Settings > Executable Prefix set to empty
- Build Settings > Executable Extension set to gplugin
## Add explicit FRAMEWORK_SEARCH_PATHS:
FRAMEWORK_SEARCH_PATHS = $QTFRAMES
## After versions update:
- May have to clean LIBRARY_SEARCH as it may point to wrong version dirs
## Cocoa plugin not found
Add $QTDIR/plugins/ explicit, currently: /opt/jlab_software/2.5/Darwin_macosx12.3.1-clang13.1.6/qt/system/clang_64/plugins/
to scheme environment var QT_PLUGIN_PATH
- if problems with plugin "cocoa":
* can set QT_DEBUG_PLUGINS to 1 in the env variables for more debugging
* can set QT_PLUGIN_PATH to plugin locations (cocoa plugin is under platforms there), currently /opt/jlab_software/2.4/Darwin_macosx10.15-clang12.0.0/qt/system/clang_64/plugins
## QT Widgets
QWidgets that are newed can be given a parent.
When the parent is destroyed, all of its children will be destroyed.
Hence, in Qt it is common practice to allocate objects on the stack with new, give them a parent, and never delete the memory yourself.
Also, when you add widgets to the layout, it reparents them to the widget the layout has been set on.
## QT Resources
resources could be the executable name to retrieve the path, for example argv[0]:
QFileInfo qrcFileInfoExecutable(argv[0]);
QString rccPath = qrcFileInfoExecutable.absolutePath() + "/" + "gemcResources.rcc";
QResource::registerResource(rccPath);
The rcc file (i.e. gemcResources.rcc) is obtained with:
rcc -binary exampleResources.qrc -o exampleResources.rcc
In xcode:
Solution 1:
add to the rcc file to the project and copy it in product directory
scons on the other hand knows about it because the qt module
compiles exampleResources.qrc directly
Solution 2:
In xcode: change type of qrc file to "C++ Source"
Select your project target and in Build Rules make a new custom rule ("+" button).
Set the "Process" drop down to "Source files with names matching" and type in *.qrc next to that.
Set the "Using" drop down to "Custom script:" and in the script type (find path to rcc):
$QTDIR/bin/rcc -name ${INPUT_FILE_BASE} ${INPUT_FILE_PATH} -o ${DERIVED_FILE_DIR}/qrc_${INPUT_FILE_BASE}.cc
Now add the "Output files" ("+" button):
${DERIVED_FILE_DIR}/qrc_${INPUT_FILE_BASE}.cc
## Using Namespace std
- never in headers
- can use std::cout
- can be inside scopes
## Shared schemes:
Shared schemes are stored in <.xcodeproj or .xcworkspace file>/xcshareddata/xcschemes/.
A shared scheme is visible to all users of a project or workspace file.
We do not need it at the moment.