Skip to content

Commit

Permalink
site: Update docs, add some details about Xcode
Browse files Browse the repository at this point in the history
  • Loading branch information
kohlschuetter committed Jan 4, 2024
1 parent c81910d commit f4351f7
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/site/markdown/crosscomp.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,7 @@ the JNI code as follows:

Right now, crossclang only supports C and C++. However, adding support other languages should
be relatively straightforward.

## See also

[Developing with Xcode](xcode.html).
2 changes: 2 additions & 0 deletions src/site/markdown/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Here are some instructions to get started.

* [Developing with Eclipse](eclipse.html)

* [Developing with Xcode](xcode.html)

* [Custom architectures: Building and running](customarch.html)

* [Cross-compiling junixsocket](crosscomp.html)
Expand Down
35 changes: 35 additions & 0 deletions src/site/markdown/xcode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Developing with Xcode

The recommended editor for working with the native C code is Xcode. Even for non-Apple targets.

This works thanks to crossclang, also see [Cross-compiling junixsocket](crosscomp.html).

## Setup

In order to develop with Xcode, using crossclang, you need to install a custom Xcode SDK.

Run the following script from the Terminal, which creates a symbolic link under
`~/Library/Developer/Toolchains` to the `crossclang.sdk`, which essentially tells Xcode to use
our "crossclang" clang wrapper script instead of its built-in version, among other things.

./junixsocket-native/crossclang/Xcode-Support/install

You then need to:

1. Restart Xcode
2. Set the Toolchain to "crossclang" (via Xcode -> Toolchains..., or via a button in the launch window)
3. Open junixsocket-native.xcodeproj
4. Run "Clean Build Folder"
5. Run "Build"

Note that you need to switch back to the default Xcode Toolchain when you develop other projects.

## Building from the command-line

AFter installing the "crossclang" Toolchain, you can also build from the command-line.
In this case, you don't have to switch the Toolchain via Xcode:

xcodebuild -project junixsocket-native/junixsocket-native.xcodeproj -configuration Release \
-target "All Architectures" -toolchain crossclang USE_HEADERMAP=NO \
CURRENT_ARCH=undefined_arch arch=undefined_arch ARCHS=arm64 CODE_SIGNING_ALLOWED=NO \
clean build

0 comments on commit f4351f7

Please sign in to comment.