Is the source code available somewhere and are there any dependencies with mismatched minimum deployment targets?
Post
Replies
Boosts
Views
Activity
Historically I've built from source and maintained third party packages in each project (that's overkill for you) which allowed me to manage dependencies separately for each project and never install anything.
Didn't actually do the exercise just randomly picked this question to answer while reviewing past couple of weeks of mostly unanswered questions.
For this question my steps were:
downloaded https://github.com/BjarneStroustrup/Programming-_Principles_and_Practice_Using_Cpp
cd path/to/Programming-_Principles_and_Practice_Using_Cpp
brew install fltk (doesn't matter where you run this)
created your MY_CPP_FILE.cpp
created build.sh with your g++ -w -Wall -std=c++11 Graph.cpp Window.cpp GUI.cpp MY_CPP_FILE.cpp `fltk-config --ldflags --use-images` -o MY_EXECUTABLE
chmod u+x build.sh
./build.sh
fixed the compilation errors then thought someone else must already have done this so checked pull requests and issues
reviewed my fixes against https://github.com/BjarneStroustrup/Programming-_Principles_and_Practice_Using_Cpp/pull/13/commits/ccb56864ac2a932bb85ef27699226b172ad796f9
chmod u+x MY_EXECUTABLE
./MY_EXECUTABLE (make sure you click the button and not the close box)
screenshot
You'll probably need to clean out what you have manually built from source and installed. Homebrew will manage fltk dependences for you.
brew deps fltk
jpeg-turbo
libpng
fltk-config provides information about the installed library:
fltk-config
Usage: fltk-config [OPTIONS]
Options:
[--version]
[--api-version]
Options telling what we are doing:
[--use-gl] use GL
[--use-images] use extra image formats (PNG, JPEG)
[--use-glut] use glut compatibility layer
[--use-forms] use forms compatibility layer
[--use-cairo] use cairo graphics lib
Options telling what information we request:
[--cc] return C compiler used to compile FLTK
[--cxx] return C++ compiler used to compile FLTK
[--optim] return compiler optimization used to compile FLTK
[--cflags] return flags to compile C using FLTK
[--cxxflags] return flags to compile C++ using FLTK
[--ldflags] return flags to link against FLTK
[--ldstaticflags] return flags to link against static FLTK library
even if there are DSOs installed
[--libs] return FLTK libraries full path for dependencies
[--prefix] return FLTK install time --prefix directory
[--includedir] return FLTK install time include directory
Options to compile and link an application:
[-g] compile the program with debugging information
[-Dname[=value]] compile the program with the given define
[--compile program.cxx]
[--post program] prepare the program for desktop use
fltk-config --ldflags --use-images
-L/usr/local/Cellar/fltk/1.3.8_1/lib -lfltk_images -lpng -lz -ljpeg -lfltk -lpthread -framework Cocoa
Note that Homebrew installs into /usr/local on Intel and /opt/homebrew on Apple Silicon.
How did you install fltk?
Homebrew is probably the best option for you to play with. Assuming you used brew install fltk then dependencies like libpng will be automatically installed and configured for you.
g++ -w -Wall -std=c++11 Graph.cpp Window.cpp GUI.cpp MY_CPP_FILE.cpp fltk-config --ldflags --use-images -o MY_EXECUTABLE will compile with updated PPP2 code that fixes known issues.
eg check https://github.com/BjarneStroustrup/Programming-_Principles_and_Practice_Using_Cpp/pull/13/commits/ccb56864ac2a932bb85ef27699226b172ad796f9
Check https://developer.apple.com/help/account/reference/supported-capabilities-tvos (you'll need at least a paid individual membership)
Did you symlink /usr/local/bin/python manually?
/usr/bin/python3 is an Xcode tool shim which you cannot symlink to as it maps its path and filename to the current Xcode install. eg /usr/bin/python3 -> /Applications/Xcode.app/Contents/Developer/usr/bin/python3
Workaround is to symlink directly to python3 in your Xcode or Xcode command line tools install. eg
sudo rm /usr/local/bin/python
sudo ln -s /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /usr/local/bin/python
OR
sudo ln -s //Library/Developer/CommandLineTools/usr/bin/python3 /usr/local/bin/python
Alternatively change your scripts to use python3
Try /System/Library/CoreServices/SystemVersion.plist
String is a special case which uses copy-on-write optimisations so the underlying buffer can be shared by different copies of a string.
Note the use of can as there are other factors that could impact this eg small string optimisations, bridging, compiler optimisations, etc.
https://developer.apple.com/documentation/swift/string#Performance-Optimizations
Also remember to pause updates with MDQueryDisableUpdates / MDQueryEnableUpdates while iterating over results:
https://developer.apple.com/documentation/coreservices/kmdquerywantsupdates
https://developer.apple.com/documentation/coreservices/1413041-mdquerydisableupdates
https://developer.apple.com/documentation/coreservices/1413066-mdqueryenableupdates
Ideally I'd put this in one of the daemons, so that monitoring won't be a problem. I am not currently using kMDQueryWantsUpdates... but can I? That is, will it keep working forever?
MDQueryExecute(query, CFOptionFlags(kMDQueryWantsUpdates.rawValue)) will keep monitoring forever with kMDQueryDidUpdateNotification notifications after the initial kMDQueryProgressNotification and kMDQueryDidFinishNotification notifications.
Note: In a command line context you'll probably need a manual RunLoop for the notifications to fire.
Might also be worth looking at the higher level NSMetadataQuery with enableUpdates().
What kind of app and do you want to keep monitoring while app is closed?
Are you using kMDQueryWantsUpdates to keep monitoring while the app is open?
You should probably try latest macOS 13 Ventura beta 4 (22A5311f).
Add ~/Library/Developer/Xcode/UserData/IDETemplateMacros.plist with an empty FILEHEADER entry to generate an empty comment.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>FILEHEADER</key>
<string></string>
</dict>
</plist>
Xcode help:
Customize text macros: https://help.apple.com/xcode/mac/9.0/index.html?localePath=en.lproj#/dev91a7a31fc
Text macros reference: https://help.apple.com/xcode/mac/9.0/index.html?localePath=en.lproj#/dev7fe737ce0
If you really want to remove that empty comment line then you will need to start adding custom file templates. eg for a No Comment Swift File template create the following:
~/Library/Developer/Xcode/Templates/File Templates/MultiPlatform/Source/No Comment Swift File.xctemplate/___FILEBASENAME___.swift with import Foundation followed by an empty line
~/Library/Developer/Xcode/Templates/File Templates/MultiPlatform/Source/No Comment Swift File.xctemplate/TemplateInfo.plist with something like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SupportsSwiftPackage</key>
<true/>
<key>Kind</key>
<string>Xcode.IDEFoundation.TextSubstitutionFileTemplateKind</string>
<key>Description</key>
<string>A no comment Swift file.</string>
<key>Summary</key>
<string>A no comment Swift file</string>
<key>SortOrder</key>
<string>1</string>
<key>Image</key>
<dict>
<key>FileTypeIcon</key>
<string>swift</string>
</dict>
<key>AllowedTypes</key>
<array>
<string>public.swift-source</string>
</array>
<key>Platforms</key>
<array/>
<key>DefaultCompletionName</key>
<string>File</string>
<key>MainTemplateFile</key>
<string>___FILEBASENAME___.swift</string>
</dict>
</plist>
The default empty Swift File template in the Xcode 14 beta is: /Applications/Xcode-beta.app/Contents/Developer/Library/Xcode/Templates/File Templates/MultiPlatform/Source/Swift File.xctemplate/ (do not edit this directly).
A Swift expert may provide a better answer.
+ is the builtin standard infix operator equivalent to infix operator +: AdditionPrecedence which you are overriding by extending CGPoint (vs add which is just a plain old static function and cannot be used as an infix operator between two targets).
https://developer.apple.com/documentation/swift/operator-declarations
You can define your own custom infix operator (with naming restricted to specific characters) like this: (although recommend against this)
infix operator ✜: AdditionPrecedence // heavy open centre cross
extension CGPoint {
static func ✜(lhs: Self, rhs: Self) -> CGPoint {
CGPoint(x: lhs.x + rhs.x, y: lhs.y + rhs.y)
}
}
private func testCGPoint() {
print(CGPoint(x: 2, y: 3) ✜ CGPoint(x: 4, y: 5))
}
https://docs.swift.org/swift-book/LanguageGuide/AdvancedOperators.html#ID46 (Custom Operators)
https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#ID418 (Lexical Structure - Operators)
https://developer.apple.com/documentation/xcode-release-notes/xcode-14-release-notes (scroll to last Deprecations)
Building iOS projects with deployment targets for the armv7, armv7s, and i386 architectures is no longer supported. (92831716)
Building for deployment to OS releases older than macOS 10.13, iOS 11, tvOS 11, and watchOS 4 is no longer supported. (92834476)
thank you I will look at these
Network framework is covered in the following WWDC sessions (which I'm rewatching as about to start work on the network server part of an app):
Introducing Network.framework: A modern alternative to Sockets: https://developer.apple.com/videos/play/wwdc2018/715/
Advances in Networking, Part 1: https://developer.apple.com/videos/play/wwdc2019/712/ (introduces NWProtocolWebSocket)
Advances in Networking, Part 2: https://developer.apple.com/videos/play/wwdc2019/713/ (introduces NWProtocolWebSocket)
Boost performance and security with modern networking: https://developer.apple.com/videos/play/wwdc2020/10111
Accelerate networking with HTTP/3 and QUIC: https://developer.apple.com/videos/play/wwdc2021/10094
Build device-to-device interactions with Network Framework: https://developer.apple.com/videos/play/wwdc2022/110339/