summaryrefslogtreecommitdiff
path: root/objective-c/README.md
blob: 328e49932a31b6b76c5c2fa462b8b3a02c216688 (plain)
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# Building Ice for Objective-C on macOS

This page describes how to build and install Ice for Objective-C from source
code on macOS. If you prefer, you can install a [Homebrew][1] package instead.

* [Objective\-C Build Requirements](#objective-c-build-requirements)
  * [Operating Systems and Compilers](#operating-systems-and-compilers)
* [Building Ice for Objective\-C](#building-ice-for-objective-c)
  * [Build configurations and platforms](#build-configurations-and-platforms)
  * [Ice Xcode SDK](#ice-xcode-sdk)
* [Installing an Objective\-C Source Build](#installing-an-objective-c-source-build)
* [Building the Test Suite](#building-the-test-suite)
* [Running the Test Suite](#running-the-test-suite)
  * [macOS](#macos)
  * [iOS Simulator](#ios-simulator)
  * [iOS](#ios)

## Objective-C Build Requirements

### Operating Systems and Compilers

Ice for Objective-C is currently only supported on macOS and iOS, and was
extensively tested using the operating system and compiler versions listed for
our [supported platforms][2].

## Building Ice for Objective-C

The build of Ice for Objective-C requires that you first build Ice for C++ in
the `cpp` subdirectory for the same configuration(s) and platform(s).

Review the top-level [config/Make.rules](../config/Make.rules) in your build
tree and update the configuration if needed. The comments in the file provide
more information.

Change to the Ice for Objective-C source subdirectory:
```
    cd objective-c
```
Run `make` to build the Ice Objective-C libraries and test suite. Set `V=1` to
get a more detailed build output. You can build only the libraries with the
`srcs` target, or only the tests with the `tests` target. For example:
```
    make V=1 -j8 srcs
```

### Build configurations and platforms

The Objective-C source tree supports multiple build configurations and
platforms. To see the supported configurations and platforms:
```
    make print V=supported-configs
    make print V=supported-platforms
```
To build all the supported configurations and platforms:
```
    make CONFIGS=all PLATFORMS=all -j8
```
The `arc-` configurations (for [Automatic Reference Counting][3]) apply only to
the test suite; the Ice libraries don't use these configurations, and the same
Ice for Objective-C library can be used with and without ARC.

### Ice Xcode SDK

The build system supports building Xcode SDKs for Ice. These SDKs allow you to
easily develop Ice applications with Xcode. To build Xcode SDKs, use the
`xcodesdk` configurations:
```
    make CONFIGS=xcodesdk -j8 srcs     # Build the Objective-C mapping Xcode SDK
                                       # for the default platform
```
The Xcode SDKs are built into `ice/sdk`.

## Installing an Objective-C Source Build

Simply run `make install`. This will install Ice in the directory specified by
the `prefix` variable in `../config/Make.rules`.

When compiling Ice programs, you must pass the location of the
`<prefix>/include` directory to the compiler with the `-I` option, and the
location of the library directory with the `-L` option.

## Building the Test Suite

`make all` or `make tests` builds the test suite for the platform(s) and
configuration(s) you selected.

However, in order to run the test suite on `iphoneos`, you need to build the
Objective-C Controller app from Xcode:
 - Open the Objective-C Test Controller project located in the
 `objective-c/test/ios/controller` directory.
 - Build the `Objective-C Controller` or `Objective-C ARC Controller` app.

## Cleaning the source build

Running `make clean` will remove the binaries created for the default
configuration and platform.

To clean the binaries produced for a specific configuration or platform, you
need to specify the `CONFIGS` or `PLATFORMS` variable. For example,
`make CONFIGS=xcodesdk clean` will clean the Xcode SDK build.

To clean the build for all the supported configurations and platforms, run
`make CONFIGS=all PLATFORMS=all clean`.

Running `make distclean` will also clean the build for all the configurations
and platforms. In addition, it will also remove the generated files created by
the Slice compilers.

## Running the Test Suite

Python is required to run the test suite. After a successful source build, you
can run the tests as shown below. If everything worked out, you should see lots
of `ok` messages. In case of a failure, the tests abort with `failed`.

### macOS
```
    python3 allTests.py # default config and default platform
    python3 allTests --config=... --platform=... # use the specified config and platform
```
### iOS Simulator
```
    python3 allTests.py --config=xcodesdk --platform=iphonesimulator --controller-app
```
### iOS
 - Start the `Objective-C Controller` or `Objective-C ARC Controller` app on
 your iOS device, from Xcode.
 - On your Mac:
 ```
   python3 allTests.py --config=xcodesdk --platform=iphoneos
 ```
 or
 ```
   python3 allTests.py --config=arc-xcodesdk --platform=iphoneos
 ```
 All the test clients and servers run on the iOS device, not on your Mac
 computer.

[1]: https://doc.zeroc.com/ice/3.7/release-notes/using-the-macos-binary-distribution
[2]: https://doc.zeroc.com/ice/3.7/release-notes/supported-platforms-for-ice-3-8-0
[3]: https://en.wikipedia.org/wiki/Automatic_Reference_Counting