3 Libical uses the [CMake buildsystem](https://cmake.org)
5 Please see the comments at the top of CMakeLists.txt for
6 the available configuration options you can pass to cmake.
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.
12 To build a debug version pass -DCMAKE_BUILD_TYPE=Debug to cmake.
14 To build libical you will need:
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
21 - libicu (not required but strongly recommended)
23 Building on Unix with gcc or clang:
33 Building on Windows with MicroSoft Visual Studio:
34 From a command prompt for the version of MSVC you want to use
39 % cmake -G "NMake Makefiles" ..
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.
48 Building on Windows with mingw:
49 Make sure you have the path to the MinGW programs in %PATH% first, for example:
52 % set "PATH=c:\MinGW\mingw64\bin;%PATH%"
55 % cmake -G "MinGW Makefiles" ..
57 % mingw32-make install
60 Building on Windows under Cygwin:
70 Building on MSYS with mingw:
75 % cmake -G "MSYS Makefiles" ..
80 To run the test suite, from inside the build directory
81 run `make test` (or `nmake test` or `mingw32-make test`)
83 To run the test suite in verbose mode, pass ARGS="-V" to the make command
84 For example: `nmake test ARGS="-V"`
86 By default, the buildsystem creates shared(dynamic) versions of the libraries.
87 Static libraries can be built by configuring at CMake time with:
90 % cmake -DLIBICAL_STATIC=True <more_cmake_options>
93 ## Building with Different Compilers
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:
99 % CC=clang CXX=clang++ cmake ..
102 ## Building for OSX (Mac)
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
111 Fix is to export PKG_CONFIG_PATH so CMake can find them, as in:
114 export PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig
117 ## Building for Android
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,...]
130 For more information about building CMake projects on Android see
131 <https://developer.android.com/ndk/guides/cmake>
133 ## Optional Dependencies
135 - libicu "International Components for Unicode" development libraries.
136 Highly recommended for RSCALE support.
137 libicu can be found at <https://icu.unicode.org>
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.
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>
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.**
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.
156 Requires the GObject Introspection development package:
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)).
163 You can also force CMake to ignore any of the optional dependencies
164 by passing the option -DCMAKE_DISABLE_FIND_PACKAGE_<PACKAGE>=True.
168 % cmake -DCMAKE_DISABLE_FIND_PACKAGE_ICU=True # tell cmake to ignore ICU
173 This C library can be built with bindings for these other languages:
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.
179 - Python bindings are built using gobject-introspection, which is enabled
180 by passing -DLIBICAL_GOBJECT_INTROSPECTION=True to cmake.
182 Requires the GObject Introspection development package (see above).
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).
187 - Java. If Java (and associated JNI) along with a C++ compiler is found the
188 buildsystem will create and install the Java bindings.
190 Depending on your system, you may need to set the JAVA_HOME environment variable as well.
192 Disable the Java bindings by passing -DLIBICAL_JAVA_BINDINGS=False to cmake.
194 ## Tweaking the Library Behavior
196 Use these CMake options to adjust the library behavior as follows:
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
203 ## Tweaking the Installation Directories
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).
208 You can override various installation folders by passing the following variables to cmake:
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
214 for example: `cmake -DCMAKE_INSTALL_PREFIX=/opt -DCMAKE_INSTALL_LIBDIR=/opt/lib32 ..`
216 ## Build the documentation
218 Run `make docs` to build the API documentation and reference.
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.
224 ## Using vcpkg to install dependencies
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.
231 For example: if you have vcpkg installed in your project folder:
234 export VCPKG_ROOT=$HOME/projects/vcpkg
235 cmake -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake <OPTIONS> ..
241 set VCPKG_ROOT=%HOMEPATH%\projects\vcpkg
242 cmake -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake <OPTIONS> ..
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.
252 Either way (using Microsoft-provided or your own vcpkg):
255 cmake "-DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%/scripts/buildsystems/vcpkg.cmake <OPTIONS> ..
258 ### Non-Windows Notes
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.