当前位置:网站首页>编译命令行终端 swift
编译命令行终端 swift
2022-07-06 17:56:00 【全栈程序员站长】
大家好,又见面了,我是全栈君
So, this is where swift lives, after you've installed XCode 6 Beta:
/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift
Also, there's a directory named swift which has various libraries:
/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift
To start playing in a terminal:
export PATH=/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:$PATH
You could also change this in XCode 6's Preferences.
I use it via xcrun:
$ xcrun swift -v -o test test.swift
Swift version 1.0 (swift-600.0.34.4.5)
Target: x86_64-apple-darwin14.0.0
/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file test.swift -enable-objc-attr-requires-objc-module -target x86_64-apple-darwin14.0.0 -module-name test -sdk /Applications/Xcode6-Beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -color-diagnostics -o /var/folders/2p/rs8p19s957ggyxzntnj3tp_40000gn/T/test-bb5ff8.o
/usr/bin/ld /var/folders/2p/rs8p19s957ggyxzntnj3tp_40000gn/T/test-bb5ff8.o -force_load /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_macosx.a -syslibroot /Applications/Xcode6-Beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -lSystem -arch x86_64 -L /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -rpath /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -macosx_version_min 10.10.0 -no_objc_category_merging -o test
Note however the swift libraries are loaded (via @rpath) from /Applications/Xcode6-Beta/.../swift/macosx so the binary won't work on another system unless it's got the same version of Xcode installed in the same place. Unless you want to do lots of copying/install_name_tool calls to sort it out...
$ otool -l test |fgrep path
name @rpath/libswiftAppKit.dylib (offset 24)
name @rpath/libswiftCoreGraphics.dylib (offset 24)
name @rpath/libswiftDarwin.dylib (offset 24)
name @rpath/libswiftDispatch.dylib (offset 24)
name @rpath/libswiftFoundation.dylib (offset 24)
name @rpath/libswiftObjectiveC.dylib (offset 24)
name @rpath/libswift_stdlib_core.dylib (offset 24)
path /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.x
1. 安装xcode 6 beta
2. 设置路径:
export PATH=/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:$PATH
3. vim test.swift
println("Hello swift")
4.
xcrun swift -v -o test test.swift
5 ./test
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/116893.html原文链接:https://javaforall.cn
边栏推荐
- 【信号与系统】
- LeetCode:1175. 质数排列
- Failed to successfully launch or connect to a child MSBuild. exe process. Verify that the MSBuild. exe
- go-zero微服务实战系列(九、极致优化秒杀性能)
- 身体质量指数程序,入门写死的小程序项目
- Sword finger offer II 035 Minimum time difference - quick sort plus data conversion
- Start from the bottom structure to learn the customization and testing of fpga---- FIFO IP
- 2022 Google CTF segfault Labyrinth WP
- Meet in the middle
- 黑马笔记---创建不可变集合与Stream流
猜你喜欢
Go zero micro service practical series (IX. ultimate optimization of seckill performance)
移植DAC芯片MCP4725驱动到NUC980
从底层结构开始学习FPGA----FIFO IP的定制与测试
Dynamic planning idea "from getting started to giving up"
一起看看matlab工具箱内部是如何实现BP神经网络的
Js逆向——捅了【马蜂窝】的ob混淆与加速乐
1123. The nearest common ancestor of the deepest leaf node
Installation of gazebo & connection with ROS
云呐-工单管理制度及流程,工单管理规范
ARM裸板调试之JTAG原理
随机推荐
域分析工具BloodHound的使用说明
golang 基础 —— 数据类型
MySQL script batch queries all tables containing specified field types in the database
docker 方法安装mysql
How to prevent overfitting in cross validation
【芯片方案设计】脉搏血氧仪
Taro applet enables wxml code compression
云呐-工单管理制度及流程,工单管理规范
一起看看matlab工具箱内部是如何实现BP神经网络的
NEON优化:log10函数的优化案例
Share a general compilation method of so dynamic library
Yunna | work order management measures, how to carry out work order management
【案例分享】网络环路检测基本功能配置
Segmenttree
Your cache folder contains root-owned files, due to a bug in npm ERR! previous versions of npm which
C language instance_ three
负载均衡性能参数如何测评?
分享一个通用的so动态库的编译方法
NEON优化:性能优化常见问题QA
C语言实例_4