@@ -27,75 +27,12 @@ any build system to create and compile projects that use ArrayFire.
27
27
Among the many possible build systems on Linux we suggest using ArrayFire with
28
28
either CMake or Makefiles with CMake being our preferred build system.
29
29
30
- ## XCode
30
+ ## Build Instructions:
31
+ * [ CMake] ( #CMake )
32
+ * [ MakeFiles] ( #MakeFiles )
33
+ * [ XCode] ( #XCode )
31
34
32
- Although we recommend using CMake to build ArrayFire projects on OSX, you can
33
- use XCode if this is your preferred development platform.
34
- To save some time, we have created an sample XCode project in our
35
- [ ArrayFire Project Templates repository] ( https://github.com/arrayfire/arrayfire-project-templates ) .
36
-
37
- To set up a basic C/C++ project in XCode do the following:
38
-
39
- 1 . Start up XCode. Choose OSX -> Application, Command Line Tool for the project:
40
- <img src =" xcode-setup/xcode-startup.png " alt =" Create a command line too XCode Project " width =" 100% " />
41
-
42
- 2 . Fill in the details for your project and choose either C or C++ for the project:
43
- <img src =" xcode-setup/project-options.png " alt =" Create a C/C++ project " width =" 100% " />
44
-
45
- 3 . Next we need to configure the build settings. In the left-hand pane, click
46
- on the project. In the center pane, click on "Build Settings" followed by
47
- the "All" button:
48
- <img src =" xcode-setup/build-settings.png " alt =" Configure build settings " width =" 100% " />
49
-
50
- 4 . Now search for "Header Search Paths" and add ` /usr/local/include ` to the list:
51
- <img src =" xcode-setup/header-search-paths.png " alt =" Configure build settings " width =" 100% " />
52
-
53
- 5 . Then search for "Library Search Paths" and add ` /usr/local/lib ` to the list:
54
- <img src =" xcode-setup/library-search-paths.png " alt =" Configure build settings " width =" 100% " />
55
-
56
- 6 . Next, we need to make sure the executable is linked with an ArrayFire library:
57
- To do this, click the "Build Phases" tab and expand the "Link with Binary Library"
58
- menu:
59
- <img src =" xcode-setup/build-phases.png " alt =" Configure build settings " width =" 100% " />
60
-
61
- 7 . In the search dialog that pops up, choose the "Add Other" button from the
62
- lower right. Specify the ` /usr/local/lib ` folder:
63
- <img src =" xcode-setup/library-folder-path.png " alt =" Configure build settings " width =" 100% " />
64
-
65
- 8 . Lastly, select the ArrayFire library with which you wish to link your program.
66
- Your options will be:
67
-
68
- ~~~~~
69
- libafcuda.*.dylib - CUDA backend
70
- libafopencl.*.dylib - OpenCL backend
71
- libafcpu.*.dylib - CPU backend
72
- libaf.*.dylib - Unified backend
73
- ~~~~~
74
-
75
- In the picture below, we have elected to link with the OpenCL backend:
76
-
77
- <img src =" xcode-setup/pick-arrayfire-library.png " alt =" Configure build settings " width =" 100% " />
78
-
79
- 9 . Lastly, lets test ArrayFire's functionality. In the left hand pane open
80
- the main.cpp` file and insert the following code:
81
-
82
- ~~~~~
83
- // Include the ArrayFire header file
84
- #include <arrayfire.h>
85
-
86
- int main(int argc, const char * argv[]) {
87
- // Gather some information about the ArrayFire device
88
- af::info();
89
- return 0;
90
- }
91
- ~~~~~
92
-
93
- Finally, click the build button and you should see some information about your
94
- graphics card in the lower-section of your screen:
95
-
96
- <img src =" xcode-setup/afinfo-result.png " alt =" Configure build settings " width =" 100% " />
97
-
98
- ## CMake
35
+ ## <a name =" CMake " ></a >CMake
99
36
100
37
We recommend that the CMake build system be used to create ArrayFire projects.
101
38
If you are writing a new ArrayFire project in C/C++ from scratch, we suggest
@@ -193,7 +130,7 @@ would modify the `cmake` command above to contain the following definition:
193
130
194
131
You can also specify this information in the ccmake command-line interface.
195
132
196
- ## MakeFiles
133
+ ## < a name = " MakeFiles " ></ a > MakeFiles
197
134
198
135
Building ArrayFire projects with Makefiles is fairly similar to CMake except
199
136
you must specify all paths and libraries manually.
@@ -217,3 +154,113 @@ Here is a minimial example MakeFile which uses ArrayFire's CPU backend:
217
154
218
155
all: main.cpp Makefile
219
156
$(CC) main.cpp -o test $(INCLUDES) $(LIBS) $(LIB_PATHS)
157
+
158
+ ## <a name =" XCode " ></a > XCode
159
+
160
+ Although we recommend using CMake to build ArrayFire projects on OSX, you can
161
+ use XCode if this is your preferred development platform.
162
+ To save some time, we have created an sample XCode project in our
163
+ [ ArrayFire Project Templates repository] ( https://github.com/arrayfire/arrayfire-project-templates ) .
164
+
165
+ To set up a basic C/C++ project in XCode do the following:
166
+
167
+ 1 . Start up XCode. Choose OSX -> Application, Command Line Tool for the project:
168
+ \htmlonly
169
+ <br />
170
+ <a href =" xcode-setup/xcode-startup.png " >
171
+ <img src =" xcode-setup/xcode-startup.png " alt =" Create a command line too XCode Project " align =" middle " width =" 50% " />
172
+ </a >
173
+ \endhtmlonly
174
+
175
+ 2 . Fill in the details for your project and choose either C or C++ for the project:
176
+ \htmlonly
177
+ <br />
178
+ <a href =" xcode-setup/project-options.png " >
179
+ <img src =" xcode-setup/project-options.png " alt =" Create a C/C++ project " align =" middle " width =" 50% " />
180
+ </a >
181
+ \endhtmlonly
182
+
183
+ 3 . Next we need to configure the build settings. In the left-hand pane, click
184
+ on the project. In the center pane, click on "Build Settings" followed by
185
+ the "All" button:
186
+ \htmlonly
187
+ <br />
188
+ <a href =" xcode-setup/build-settings.png " >
189
+ <img src =" xcode-setup/build-settings.png " alt =" Configure build settings " align =" middle " width =" 50% " />
190
+ </a >
191
+ \endhtmlonly
192
+
193
+ 4 . Now search for "Header Search Paths" and add ` /usr/local/include ` to the list:
194
+ \htmlonly
195
+ <br />
196
+ <a href =" xcode-setup/header-search-paths.png " >
197
+ <img src =" xcode-setup/header-search-paths.png " alt =" Configure build settings " align =" middle " width =" 50% " />
198
+ </a >
199
+ \endhtmlonly
200
+
201
+ 5 . Then search for "Library Search Paths" and add ` /usr/local/lib ` to the list:
202
+ \htmlonly
203
+ <br />
204
+ <a href =" xcode-setup/library-search-paths.png " >
205
+ <img src =" xcode-setup/library-search-paths.png " alt =" Configure build settings " align =" middle " width =" 50% " />
206
+ </a >
207
+ \endhtmlonly
208
+
209
+ 6 . Next, we need to make sure the executable is linked with an ArrayFire library:
210
+ To do this, click the "Build Phases" tab and expand the "Link with Binary Library"
211
+ menu:
212
+ \htmlonly
213
+ <br />
214
+ <a href =" xcode-setup/build-phases.png " >
215
+ <img src =" xcode-setup/build-phases.png " alt =" Configure build settings " align =" middle " width =" 50% " />
216
+ </a >
217
+ \endhtmlonly
218
+
219
+ 7 . In the search dialog that pops up, choose the "Add Other" button from the
220
+ lower right. Specify the ` /usr/local/lib ` folder:
221
+ \htmlonly
222
+ <br />
223
+ <a href =" xcode-setup/library-folder-path.png " >
224
+ <img src =" xcode-setup/library-folder-path.png " alt =" Configure build settings " align =" middle " width =" 50% " />
225
+ </a >
226
+ \endhtmlonly
227
+
228
+ 8 . Lastly, select the ArrayFire library with which you wish to link your program.
229
+ Your options will be:
230
+ ~~~~~
231
+ libafcuda.*.dylib - CUDA backend
232
+ libafopencl.*.dylib - OpenCL backend
233
+ libafcpu.*.dylib - CPU backend
234
+ libaf.*.dylib - Unified backend
235
+ ~~~~~
236
+ In the picture below, we have elected to link with the OpenCL backend:
237
+ \htmlonly
238
+ <br />
239
+ <a href =" xcode-setup/pick-arrayfire-library.png " >
240
+ <img src =" xcode-setup/pick-arrayfire-library.png " alt =" Configure build settings " align =" middle " width =" 50% " />
241
+ </a >
242
+ \endhtmlonly
243
+
244
+ 9 . Lastly, lets test ArrayFire's functionality. In the left hand pane open
245
+ the main.cpp` file and insert the following code:
246
+
247
+ ~~~~~
248
+ // Include the ArrayFire header file
249
+ #include <arrayfire.h>
250
+
251
+ int main(int argc, const char * argv[]) {
252
+ // Gather some information about the ArrayFire device
253
+ af::info();
254
+ return 0;
255
+ }
256
+ ~~~~~
257
+
258
+ Finally, click the build button and you should see some information about your
259
+ graphics card in the lower-section of your screen:
260
+
261
+ \htmlonly
262
+ <br />
263
+ <a href =" xcode-setup/afinfo-result.png " >
264
+ <img src =" xcode-setup/afinfo-result.png " alt =" Configure build settings " align =" middle " width =" 50% " />
265
+ </a >
266
+ \endhtmlonly
0 commit comments