Skip to content

Commit

Permalink
Updates documentation and adds svc tracking intro and exmpl code.
Browse files Browse the repository at this point in the history
  • Loading branch information
pnoltes committed Mar 9, 2022
1 parent d88d486 commit 516c1fd
Show file tree
Hide file tree
Showing 13 changed files with 551 additions and 125 deletions.
21 changes: 5 additions & 16 deletions CMakeLists.txt
Expand Up @@ -18,20 +18,13 @@
cmake_minimum_required (VERSION 3.14)
cmake_policy(SET CMP0012 NEW)
cmake_policy(SET CMP0042 NEW)
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.9.0")
cmake_policy(SET CMP0068 NEW)
endif()
cmake_policy(SET CMP0068 NEW)

project (Celix C CXX)
project(Celix C CXX)

include(cmake/celix_project/CelixProject.cmake)
include(cmake/cmake_celix/UseCelix.cmake)

# see https://public.kitware.com/Bug/view.php?id=15696
IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} EQUAL 3.3 AND ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
message( FATAL_ERROR "Building Celix using CMake 3.3 and makefiles is not supported due to a bug in the Makefile Generator (see Bug 15696). Please change the used CMake version - both, CMake 3.2 and CMake 3.4 are working fine. Or use a different generator (e.g. Ninja)." )
ENDIF()

# Options
option(ENABLE_TESTING "Enables unit/bundle testing" FALSE)
if (ENABLE_TESTING)
Expand All @@ -41,8 +34,6 @@ if (ENABLE_TESTING)
endif()
endif ()

set(ENABLE_MORE_WARNINGS OFF)

# Set C specific flags
set(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 -fPIC ${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS "-Wall -Werror ${CMAKE_C_FLAGS}")
Expand Down Expand Up @@ -80,6 +71,7 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
endif()
endif()

option(ENABLE_MORE_WARNINGS "whether to enable more compiler warnings." ON)
if (ENABLE_MORE_WARNINGS)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4)
Expand Down Expand Up @@ -117,11 +109,8 @@ endif()

# Set version for the framework package/release
set(CELIX_MAJOR "2")
set(CELIX_MINOR "2")
set(CELIX_MICRO "1")

# Default bundle version
set(DEFAULT_VERSION 1.0.0)
set(CELIX_MINOR "3")
set(CELIX_MICRO "0")

if (ENABLE_TESTING)
enable_testing()
Expand Down
58 changes: 16 additions & 42 deletions documents/building/README.md
Expand Up @@ -22,7 +22,7 @@ limitations under the License.
# Apache Celix - Building and Installing
Apache Celix aims to be support a broad range of UNIX platforms.

Currently the [continuous integration build server](https://travis-ci.org/apache/celix) builds and tests Apache Celix for:
Currently, the [continuous integration build server](https://travis-ci.org/apache/celix) builds and tests Apache Celix for:

* Ubuntu Bionic Beaver (20.04)
* GCC
Expand Down Expand Up @@ -51,68 +51,42 @@ The following packages (libraries + headers) should be installed on your system:

For debian based systems (apt), the following command should work:
```bash
#required for celix framework and default bundles
#### prepare system
sudo apt-get update
sudo apt-get upgrade

#### get dependencies
sudo apt-get install -yq --no-install-recommends \
build-essential \
git \
curl \
uuid-dev \
libjansson-dev \
libcurl4-openssl-dev \
default-jdk \
cmake \
libffi-dev \
libzip-dev \
libxml2-dev

#required if the ZMQ PubSubAdmin option (BUILD_PUBSUB_PSA_ZMQ) is enabled.
sudo apt-get install -yq --no-install-recommends \
libczmq-dev

#required if the ENABLE_TESTING option is enabled.
sudo apt-get install -yq --no-install-recommends \
libcpputest-dev

#required if the C++ Remote Service Admin option (BUILD_REMOTE_SERVICE_ADMIN) is enabled.
sudo apt-get install -yq --no-install-recommends \
libxml2-dev \
libczmq-dev \
libcpputest-dev \
rapidjson-dev

#The installed cmake version for Ubuntu 18 is older than 3.14,
#The cmake version for Ubuntu 20 is older than 3.14,
#use snap to install the latest cmake version
snap install --classic cmake
```

For Fedora based systems (dnf), the following command should work:
```bash
sudo dnf group install -y "C Development Tools and Libraries"
sudo dnf install \
cmake \
make \
git \
java \
libcurl-devel \
jansson-devel \
libffi-devel \
libzip-devel \
libxml2-devel \
libuuid-devel
snap install cmake
```

For OSX systems with brew installed, the following command should work:
```bash
brew update && \
brew install lcov libffi libzip cmake && \
brew install lcov libffi libzip czmq rapidjson libxml2 cmake && \
brew link --force libffi
```

## Download the Apache Celix sources
To get started you first have to download the Apache Celix sources. This can be done by cloning the Apache Celix git repository:

```bash
#Create a new workspace to work in, e.g:
mkdir ${HOME}/workspace
export WS=${HOME}/workspace
cd ${WS}

#clone the repro
git clone --single-branch --branch master https://github.com/apache/celix.git
```
Expand All @@ -122,7 +96,7 @@ Apache Celix uses [CMake](https://cmake.org) as build system. CMake can generate

### Building using CMake and makefiles:
```bash
cd ${WS}/celix
cd celix
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
Expand All @@ -134,7 +108,7 @@ With use of CMake, Apache Celix makes it possible to edit build options. This en
To edit the options use ccmake or cmake-gui. For cmake-gui an additional package install can be necessary (Fedora: `dnf install cmake-gui`).

```bash
cd ${WS}/celix/build
cd celix/build
ccmake .
#Edit options, e.g. enable BUILD_REMOTE_SHELL to build the remote (telnet) shell
#Edit the CMAKE_INSTALL_PREFIX config to set the install location
Expand All @@ -145,7 +119,7 @@ For this guide we assume the CMAKE_INSTALL_PREFIX is `/usr/local`.
## Installing Apache Celix

```bash
cd ${WS}/celix/build
cd celix/build
make -j
sudo make install
```
Expand Down
2 changes: 1 addition & 1 deletion documents/getting_started/creating_a_simple_bundle.md
Expand Up @@ -62,7 +62,7 @@ project(myproject C CXX)
#Part 2. setup compilers
SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 -Wall -Werror -fPIC ${CMAKE_C_FLAGS}")
SET(CMAKE_C_FLAGS_DEBUG "-g -DDEBUG")
SET(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
SET(CMAKE_CXX_FLAGS "-std=c++17 ${CMAKE_CXX_FLAGS}")
SET(CMAKE_CXX_FLAGS_DEBUG "-g -DDEBUG")
#Part 3. find Celix package.
Expand Down
1 change: 1 addition & 0 deletions documents/intro/README.md
Expand Up @@ -84,5 +84,6 @@ For more information see:
* [Apache Celix - Services](services.md)
* [Apache Celix - Components](components.md)
* TODO MAYBE add Creating Containers readme
* TODO MAYBE Services on demand -> meta tracker in C and C++
* [Apache Celix - Getting Started Guide](../getting_started/README.md) TODO MAYBE REMOVE, replaced with bundles.md, services.md
* [Apache Celix - CMake Commands](../cmake_commands/README.md)

0 comments on commit 516c1fd

Please sign in to comment.