$darkmode
Libical API Documentation 4.0 STABLE VERSION Visit the v3.0 documentation
/tmp/B.47ejeh9m/BUILD/libical-4.0.3-build/libical-4.0.3/docs/INSTALL.md
1 # Building Libical
2 
3 Libical uses the [CMake buildsystem](https://cmake.org)
4 
5 Please see the comments at the top of CMakeLists.txt for
6 the available configuration options you can pass to cmake.
7 
8 The installation directory defaults to /usr/local on UNIX
9 and c:/Program Files on Windows. You can change this by
10 passing -DCMAKE_INSTALL_PREFIX=/install/path to cmake.
11 
12 To build a debug version pass -DCMAKE_BUILD_TYPE=Debug to cmake.
13 
14 To build libical you will need:
15 
16 - a C99-compliant C compiler (let us know if the build fails with your C compiler)
17 - a C11-compliant C compiler for libical-glib
18 - a C++11 compliant compiler for C++ bindings
19 - CMake version 3.20.0 or higher
20 - Perl
21 - libicu (not required but strongly recommended)
22 
23 Building on Unix with gcc or clang:
24 
25 ```shell
26 % mkdir build
27 % cd build
28 % cmake ..
29 % make
30 % make install
31 ```
32 
33 Building on Windows with MicroSoft Visual Studio:
34 From a command prompt for the version of MSVC you want to use
35 
36 ```shell
37 % mkdir build
38 % cd build
39 % cmake -G "NMake Makefiles" ..
40 % nmake
41 % nmake install
42 ```
43 
44 NOTE: Some MSVC 32bit compilers (like MSVC2005) use a 64bit version of time_t.
45 In these cases you must pass -DLIBICAL_ENABLE_MSVC_32BIT_TIME_T=true to cmake to make sure
46 the 32bit version of time_t is used instead.
47 
48 Building on Windows with mingw:
49 Make sure you have the path to the MinGW programs in %PATH% first, for example:
50 
51 ```shell
52 % set "PATH=c:\MinGW\mingw64\bin;%PATH%"
53 % mkdir build
54 % cd build
55 % cmake -G "MinGW Makefiles" ..
56 % mingw32-make
57 % mingw32-make install
58 ```
59 
60 Building on Windows under Cygwin:
61 
62 ```shell
63 % mkdir build
64 % cd build
65 % cmake ..
66 % make
67 % make install
68 ```
69 
70 Building on MSYS with mingw:
71 
72 ```shell
73 % mkdir build
74 % cd build
75 % cmake -G "MSYS Makefiles" ..
76 % nmake
77 % nmake install
78 ```
79 
80 To run the test suite, from inside the build directory
81 run `make test` (or `nmake test` or `mingw32-make test`)
82 
83 To run the test suite in verbose mode, pass ARGS="-V" to the make command
84 For example: `nmake test ARGS="-V"`
85 
86 By default, the buildsystem creates shared(dynamic) versions of the libraries.
87 Static libraries can be built by configuring at CMake time with:
88 
89 ```shell
90 % cmake -DLIBICAL_STATIC=True <more_cmake_options>
91 ```
92 
93 ## Building with Different Compilers
94 
95 For example, say you want to use Clang to build on Linux.
96 Then you can set the C and C++ compilers at CMake time, like so:
97 
98 ```shell
99 % CC=clang CXX=clang++ cmake ..
100 ```
101 
102 ## Building for OSX (Mac)
103 
104 ### Homebrew
105 
106 A couple of necessary dependencies do not have their headers
107 and development libraries linked into /usr/local/{include,lib} due
108 to possible contamination with the operating system versions of the
109 same name. This is known to be the case with libffi and libxml2
110 
111 Fix is to export PKG_CONFIG_PATH so CMake can find them, as in:
112 
113 ```shell
114 export PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig
115 ```
116 
117 ## Building for Android
118 
119 ```shell
120 % mkdir build
121 % cd build
122 % export ANDROID_NDK=/path/to/android-ndk
123 % cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
124  -DCMAKE_INSTALL_PREFIX=/install/path .. \
125  -DANDROID_ABI=[x86,x86_64,armeabi-v7a,arm64-v8a,...]
126 % make
127 % make install
128 ```
129 
130 For more information about building CMake projects on Android see
131 <https://developer.android.com/ndk/guides/cmake>
132 
133 ## Optional Dependencies
134 
135 - libicu "International Components for Unicode" development libraries.
136  Highly recommended for RSCALE support.
137  libicu can be found at <https://icu.unicode.org>
138 
139  If CMake doesn't locate your libicu installation try setting the
140  ICU_ROOT or ICU_BASE environment variables to the top folder where
141  libicu is installed and run cmake again.
142 
143 - Berkeley DB storage.
144  Optional for the Berkeley Database storage support.
145  The development toolkit can be found at <https://www.oracle.com/database/berkeley-db>
146 
147  **This code path has not been fully tested.**
148  **Don't be surprised if there are bugs.**
149  **Do NOT use for production code.**
150 
151 - GObject Introspection. To generate GObject introspection "typelib"
152  files pass the -DLIBICAL_GOBJECT_INTROSPECTION=True option to cmake. You'll
153  need to have the GObject Introspection development package v0.6.7 or higher
154  installed beforehand.
155 
156  Requires the GObject Introspection development package:
157 
158  - Ubuntu: apt-get install gobject-introspection
159  - Fedora: dnf install gobject-introspection
160  - Mac: brew install gobject-introspection pygobject3
161  - Windows: vcpkg install gobject-introspection (see [using vcpkg](#vcpkg)).
162 
163 You can also force CMake to ignore any of the optional dependencies
164 by passing the option -DCMAKE_DISABLE_FIND_PACKAGE_<PACKAGE>=True.
165 For instance:
166 
167 ```shell
168  % cmake -DCMAKE_DISABLE_FIND_PACKAGE_ICU=True # tell cmake to ignore ICU
169 ```
170 
171 ## Language Bindings
172 
173 This C library can be built with bindings for these other languages:
174 
175 - C++. If a C++ compiler is found the buildsystem will create and install the C++ bindings API.
176  Turn off the C++ bindings by passing -DLIBICAL_CXX_BINDINGS=False to cmake.
177  Don't mix ABI from C and C++ compilers.
178 
179 - Python bindings are built using gobject-introspection, which is enabled
180  by passing -DLIBICAL_GOBJECT_INTROSPECTION=True to cmake.
181 
182  Requires the GObject Introspection development package (see above).
183 
184  Don't forget to set (or append to, as needed) the GI_TYPELIB_PATH environment
185  variable to $PREFIX/lib/girepository-1.0 (or $PREFIX/lib64/girepository-1.0).
186 
187 - Java. If Java (and associated JNI) along with a C++ compiler is found the
188  buildsystem will create and install the Java bindings.
189 
190  Depending on your system, you may need to set the JAVA_HOME environment variable as well.
191 
192  Disable the Java bindings by passing -DLIBICAL_JAVA_BINDINGS=False to cmake.
193 
194 ## Tweaking the Library Behavior
195 
196 Use these CMake options to adjust the library behavior as follows:
197 
198 - LIBICAL_ENABLE_BUILTIN_TZDATA=[true|false]
199  Set to build using our own (instead of the system's) timezone data.
200  Default=false (use the system timezone data on non-Windows systems)
201  ALWAYS true on Windows systems
202 
203 ## Tweaking the Installation Directories
204 
205 By default, the installation layout is according to the
206 [GNU standard installation directories](https://www.gnu.org/prep/standards/html_node/Directory-Variables.html).
207 
208 You can override various installation folders by passing the following variables to cmake:
209 
210 - CMAKE_INSTALL_LIBDIR = The fullpath where you want the put the installed libraries
211 - CMAKE_INSTALL_INCLUDEDIR = The fullpath where you want to put the installed include files
212 - CMAKE_INSTALL_DATAROOTDIR = The fullpath where to want to put the shared files
213 
214 for example: `cmake -DCMAKE_INSTALL_PREFIX=/opt -DCMAKE_INSTALL_LIBDIR=/opt/lib32 ..`
215 
216 ## Build the documentation
217 
218 Run `make docs` to build the API documentation and reference.
219 
220 Disable the docs make target by running cmake with -DLIBICAL_BUILD_DOCS=False option.
221 Disable the libical-glib developer documentation by running cmake with -DLIBICAL_GLIB_BUILD_DOCS=False.
222 
223 <a name="vcpkg">
224 ## Using vcpkg to install dependencies
225 </a>
226 
227 If you want to use vcpkg (%VCPKG_ROOT% on Windows or $VCPKG_ROOT on non-Windows) to build
228 the dependencies as part of the project you can also tell CMake the vcpkg toolchain file
229 with the CMake "CMAKE_TOOLCHAIN_FILE" setting.
230 
231 For example: if you have vcpkg installed in your project folder:
232 
233 ```shell
234  export VCPKG_ROOT=$HOME/projects/vcpkg
235  cmake -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake <OPTIONS> ..
236 ```
237 
238 or on Windows:
239 
240 ```shell
241  set VCPKG_ROOT=%HOMEPATH%\projects\vcpkg
242  cmake -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake <OPTIONS> ..
243 ```
244 
245 ### Windows Notes
246 
247 MSVC comes with vcpkg pre-installed and sets `%VCPKG_ROOT%` for you.
248 However, the only way to update that vcpkg version is by upgrading
249 MSVC itself; which may not be what you want and may be too old.
250 Consider installing your own vcpkg instead of relying on the MSVC vcpkg.
251 
252 Either way (using Microsoft-provided or your own vcpkg):
253 
254 ```shell
255  cmake "-DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%/scripts/buildsystems/vcpkg.cmake <OPTIONS> ..
256 ```
257 
258 ### Non-Windows Notes
259 
260 You'll need to pre-install autoconf, automake and autoconf-archive for icu.
261 See `%VCPKG_ROOT%/ports/icu/portfile.cmake` for more info.