-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reverts commit 362b17f.
- Loading branch information
Showing
1 changed file
with
40 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,74 +8,52 @@ and the new one using CMake. | |
|
||
The Old-Makefiles commands are run in the root folder of Kamailio source code: | ||
|
||
``` bash | ||
``` | ||
Check failure on line 11 in docs/tutorials/cmake/commands.md GitHub Actions / check-formatFenced code blocks should have a language specified
|
||
cd /path/to/kamailio | ||
``` | ||
|
||
## You can build Kamailio using either of the following methods | ||
|
||
### Method 1: Using CMake and Make | ||
|
||
_**Note:**_ `make` should be called in **the build directory.** | ||
|
||
_**Note:**_ if `cmake` is in the example command, it usually has to be followed by `make` to perform the compilation or installation. | ||
The CMake commands have to be run after: | ||
|
||
``` bash | ||
``` | ||
Check failure on line 17 in docs/tutorials/cmake/commands.md GitHub Actions / check-formatFenced code blocks should have a language specified
|
||
cd /path/to/kamailio | ||
mkdir build | ||
cd build | ||
cmake .. [options ...] # Configuration phase | ||
make [target] # Build | ||
make install # Installation | ||
``` | ||
|
||
### Method 2: Using CMake for Configuration, Build, and Install | ||
|
||
Allow builds and install using the appropriate build system (`Unix Makefiles` or `Ninja`): | ||
|
||
_**Note:**_ All `cmake` commands should be called in `kamailio` **root directory.** | ||
|
||
``` bash | ||
cd path/to/kamailio | ||
cmake -S . -B build_folder [options ...] # Configuration phase | ||
cmake --build build_folder [-t target] # Build | ||
cmake --install build_folder # Installation | ||
``` | ||
|
||
## Configuration comparison: Old Makefiles vs. CMake | ||
|
||
| Description / Command | Old Makefiles Command | CMake Command | | ||
|-----------------------------------------------------------|------------------------------------------------|---------------------------------------------------| | ||
| Generate configuration files for the build system | `make cfg` | `cmake ..` | | ||
| Specify installation path prefix | `make PREFIX=/tmp/kamailio-dev cfg` | `cmake -DCMAKE_INSTALL_PREFIX=/tmp/kamailio-dev ..` | | ||
| Specify additional modules to be included in compilation | `make include_modules="app_lua db_mysql" cfg`| `cmake -DINCLUDE_MODULES="app_lua db_mysql" ..` | | ||
| Specify modules to be excluded from compilation | `make exclude_modules="app_lua db_mysql" cfg`| `cmake -DEXCLUDE_MODULES="app_lua db_mysql" ..` | | ||
| Specify the compiler (example with `clang`) | `make CC=clang` | `cmake -DCMAKE_C_COMPILER="clang" ..` | | ||
| Provide extra compiler and linker options/flags _**See note**_| | `LDFLAGS="-Wl,-z,relro" CFLAGS="-Wformat -Werror=format-security" cmake ..`| | ||
|
||
All these options can and **SHOULD** be combined in a single `CMake` command. | ||
|
||
_**Note:**_ Be sure to run this the **first** time you run the CMake configuration phase. Subsquent calls have the corresponding CMake variables used as cached already and therefore do no use the provided ones to initialize them. You can use `cmake --fresh ..` though, as if you were calling it the first time. | ||
|
||
## Provided targets comparison: Old Makefiles vs. CMake | ||
|
||
| Description / Command | Old-Makefiles | CMake | | ||
| -- | -- | -- | | ||
| Compile everything (core and modules) | `make all` | `make` \| `make all`| | ||
| Compile `kamailio` binary (the core) | `make` | `make kamailio` | | ||
| Compile `acc` modules (substitute with any other module name) | `make modules modules=src/modules/acc` | `make acc` | | ||
| Compile `acc` documentation (substitute with any other module name) | `make modules-readme modules=src/modules/acc` | `make acc_doc` | | ||
| Compiles all modules docs (both html and txt) (Requires `BUILD_DOC` option to be enabled Default=`ON`) | `make modules-readme` | `make kamailio_docs`| | ||
| Compile with verbose output (quiet off) | `make [target] Q=0` | `make [target] VERBOSE=1\|on` | | ||
| Generate the DB Schemas for the xml files | `make dbschema`| `make dbschema` | | ||
| Generate specific DB schema (replace `mysql` with the name of database as found in the `utils/kamctl/`) _**See note**_ | -- | `make dbschema_mysql` | | ||
| **Clean targets**||| | ||
| Clean everything build | `make distclean`| `make clean`| | ||
| Clean dbschema files | -- | `make dbschema_clean` | | ||
| Uninstall everything (requires that it was installed with `make install`)| -- | `make uninstall` | | ||
| **Install targets** ||| | ||
| Install all | `make install` | `make install` | | ||
| Install only docs | -- | `make install_kamailio_docs` | | ||
| Install only kamailio utils (`kamctl`,`kamdbctl` and their config files)| -- | `make install_kamailio_utils` | | ||
|
||
_**Note:**_ To produce the `xhttp_pi` schemas use both `make dbschema_pi_framework_mod` and `make dbschema_pi_framework_table`. | ||
Also, if `cmake` is in the example command, it usually has to be followed by | ||
`make` to perform the compilation. | ||
|
||
Legend for the table: | ||
|
||
- `OM` - Old-Makefiles | ||
Check failure on line 28 in docs/tutorials/cmake/commands.md GitHub Actions / check-formatUnordered list indentation
|
||
- `CM` - CMake | ||
Check failure on line 29 in docs/tutorials/cmake/commands.md GitHub Actions / check-formatUnordered list indentation
|
||
|
||
| Type | Description / Command | | ||
| :--- | :--- | | ||
| `---` | Generate config files for the build system | | ||
| `OM` | `make cfg` | | ||
| `CM` | `cmake ..` | | ||
| `---` | Specify installation path prefix | | ||
| `OM` | `make PREFIX=/tmp/kamailio-dev cfg` | | ||
| `CM` | `cmake -DCMAKE_INSTALL_PREFIX=/tmp/kamailio-dev ..` | | ||
| `---` | Specify additional modules to be included in compilation | | ||
| `OM` | `make include_modules="app_lua db_mysql" cfg` | | ||
| `CM` | `cmake -DINCLUDE_MODULES="app_lua db_mysql" ..` | | ||
| `---` | Specify modules to be excluded from compilation | | ||
| `OM` | `make exclude_modules="app_lua db_mysql" cfg` | | ||
| `CM` | `cmake -DEXCLUDE_MODULES="app_lua db_mysql" ..` | | ||
| `---` | Compile `kamailio` binary (the core) | | ||
| `OM` | `make` | | ||
| `CM` | `make kamailio` | | ||
| `---` | Compile everything (core and modules) | | ||
| `OM` | `make all` | | ||
| `CM` | `make` | | ||
| `---` | Compile `acc` modules (substitute with any other module name) | | ||
| `OM` | `make modules modules=src/modules/acc` | | ||
| `CM` | `make acc` | | ||
| `---` | Compile with verbose output (quiet off) | | ||
| `OM` | `make Q=0` | | ||
| `CM` | `make VERBOSE=on` | | ||
| `---` | Specify the compiler (example with `clang`) | | ||
| `OM` | `make CC=clang` | | ||
| `CM` | `cmake -DCMAKE_C_COMPILER="clang" ..` | |