celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject celix git commit: CELIX-335: Add celix cmake command documentation. Add eclipse launcher generation for deployments
Date Mon, 25 Jan 2016 12:23:08 GMT
Repository: celix
Updated Branches:
  refs/heads/feature/CELIX-335_deploy_refactoring e925d8f21 -> 5b4e5ffe8


CELIX-335: Add celix cmake command documentation. Add eclipse launcher generation for deployments


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/5b4e5ffe
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/5b4e5ffe
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/5b4e5ffe

Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 5b4e5ffe8a4d7a493a7498977149ee70e85127ee
Parents: e925d8f
Author: Pepijn Noltes <pepijnnoltes@gmail.com>
Authored: Mon Jan 25 13:22:19 2016 +0100
Committer: Pepijn Noltes <pepijnnoltes@gmail.com>
Committed: Mon Jan 25 13:22:19 2016 +0100

----------------------------------------------------------------------
 cmake/cmake_celix/Packaging.cmake  |  22 +++-
 cmake/cmake_celix/RunConfig.in     |  37 +++---
 documents/cmake_commands/readme.md | 201 ++++++++++++++++++++++++++++++++
 3 files changed, 236 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/5b4e5ffe/cmake/cmake_celix/Packaging.cmake
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/Packaging.cmake b/cmake/cmake_celix/Packaging.cmake
index 16e63d0..bde696b 100644
--- a/cmake/cmake_celix/Packaging.cmake
+++ b/cmake/cmake_celix/Packaging.cmake
@@ -105,7 +105,7 @@ function(add_bundle)
     list(REMOVE_AT ARGN 0)
 
     set(OPTIONS NO_ACTIVATOR)
-    set(ONE_VAL_ARGS VERSION ACTIVATOR SYMBOLIC_NAME NAME) 
+    set(ONE_VAL_ARGS VERSION ACTIVATOR SYMBOLIC_NAME NAME DESCRIPTION) 
     set(MULTI_VAL_ARGS SOURCES PRIVATE_LIBRARIES EXPORT_LIBRARIES HEADERS)
     cmake_parse_arguments(BUNDLE "${OPTIONS}" "${ONE_VAL_ARGS}" "${MULTI_VAL_ARGS}" ${ARGN})
 
@@ -153,9 +153,7 @@ function(add_bundle)
         set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_TARGET_IS_LIB" TRUE)
         add_dependencies(bundles ${BUNDLE_TARGET_NAME})
     else()
-        add_custom_target(${BUNDLE_TARGET_NAME}
-          DEPENDS "$<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_FILE>"
-        )
+        add_custom_target(${BUNDLE_TARGET_NAME})
     endif()
     add_custom_target(${BUNDLE_TARGET_NAME}_bundle
         DEPENDS "$<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_FILE>"
@@ -240,6 +238,7 @@ SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY \"0\")
     set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_NAME" ${BUNDLE_NAME})
#The bundle name default target name
     set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_SYMBOLIC_NAME" ${BUNDLE_SYMBOLIC_NAME})
#The bundle symbolic name. Default target name
     set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_VERSION" ${BUNDLE_VERSION})
#The bundle version. Default 0.0.0
+    set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_DESCRIPTION" "${BUNDLE_DESCRIPTION}")
#The bundle description.
 
     #headers
     set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_ACTIVATOR" 1) #Library
containing the activator (if any)
@@ -407,6 +406,10 @@ function(bundle_version BUNDLE VERSION)
     set_target_properties(${BUNDLE} PROPERTIES "BUNDLE_VERSION" ${VERSION})
 endfunction()
 
+function(bundle_description BUNDLE DESC) 
+    set_target_properties(${BUNDLE} PROPERTIES "BUNDLE_DESCRIPTION" ${DESC})
+endfunction()
+
 function(install_bundle)
     #0 is bundle TARGET
     list(GET ARGN 0 BUNDLE)
@@ -468,13 +471,12 @@ function(add_deploy)
 
     add_custom_command(OUTPUT ${DEPLOY_LOCATION}/timestamp
         COMMAND ${CMAKE_COMMAND} -E touch ${DEPLOY_LOCATION}/timestamp
-        DEPENDS  "$<TARGET_PROPERTY:${DEPLOY_TARGET},DEPLOY_TARGET_DEPS>" "${DEPLOY_LOCATION}/config.properties"
"${DEPLOY_LOCATION}/run.sh"
+        DEPENDS  "$<TARGET_PROPERTY:${DEPLOY_TARGET},DEPLOY_TARGET_DEPS>" "${DEPLOY_LOCATION}/config.properties"
"${DEPLOY_LOCATION}/run.sh" 
         WORKING_DIRECTORY "${DEPLOY_LOCATION}"
         COMMENT "Deploying ${DEPLOY_PRINT_NAME}" VERBATIM
     )
 
 
-    #TODO generate in the CMakeFiles/deploy.dir/<GROUP_NAME>/DEPLOY_NAME> location
     file(GENERATE 
         OUTPUT "${DEPLOY_LOCATION}/config.properties.step1"
         CONTENT "cosgi.auto.start.1=$<JOIN:$<TARGET_PROPERTY:${DEPLOY_TARGET},DEPLOY_BUNDLES>,
>
@@ -488,6 +490,14 @@ $<JOIN:$<TARGET_PROPERTY:${DEPLOY_TARGET},DEPLOY_PROPERTIES>,
         INPUT "${DEPLOY_LOCATION}/config.properties.step1"
     )
 
+    set(CONTAINER_NAME ${DEPLOY_NAME})
+    set(PROGRAM_NAME "${CMAKE_BIN_DIRECTORY}/launcher/celix")
+    set(PROJECT_ATTR "build")
+    set(WORKING_DIRECTORY ${DEPLOY_LOCATION})
+    set(PATHS "${CMAKE_BIN_DIRECTORY}/framework:${CMAKE_BIN_DIRECTORY}/utils:${CMAKE_BIN_DIRECTORY}/dfi")
+    configure_file("${CELIX_CMAKE_DIRECTORY}/cmake_celix/RunConfig.in"  "${DEPLOY_LOCATION}/${DEPLOY_NAME}")
+
+
     if(APPLE) 
         file(GENERATE
             OUTPUT ${DEPLOY_LOCATION}/run.sh

http://git-wip-us.apache.org/repos/asf/celix/blob/5b4e5ffe/cmake/cmake_celix/RunConfig.in
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/RunConfig.in b/cmake/cmake_celix/RunConfig.in
index a63be99..888b992 100644
--- a/cmake/cmake_celix/RunConfig.in
+++ b/cmake/cmake_celix/RunConfig.in
@@ -1,21 +1,22 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
-<stringAttribute key="bad_container_name" value="@CONTAINER_NAME@"/>
-<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="0"/>
-<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
-<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="@PROGRAM_NAME@"/>
-<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="@PROJECT_ATTR@"/>
-<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
-<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="org.eclipse.cdt.core.default.config.1"/>
-<stringAttribute key="org.eclipse.cdt.launch.WORKING_DIRECTORY" value="@WORKING_DIRECTORY@"/>
-<booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="true"/>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/@PROJECT_ATTR@"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="4"/>
-</listAttribute>
-<mapAttribute key="org.eclipse.debug.core.environmentVariables">
-<mapEntry key="@LIBRARY_PATH@" value="@FW_PATH@:@UTILS_PATH@"/>
-</mapAttribute>
+    <stringAttribute key="bad_container_name" value="${CONTAINER_NAME}"/>
+    <intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="0"/>
+    <stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
+    <stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="${PROGRAM_NAME}"/>
+    <stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="${PROJECT_ATTR}"/>
+    <booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
+    <stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="org.eclipse.cdt.core.default.config.1"/>
+    <stringAttribute key="org.eclipse.cdt.launch.WORKING_DIRECTORY" value="${WORKING_DIRECTORY}"/>
+    <booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="true"/>
+    <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+        <listEntry value="/${PROJECT_ATTR}"/>
+    </listAttribute>
+    <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+        <listEntry value="4"/>
+    </listAttribute>
+    <mapAttribute key="org.eclipse.debug.core.environmentVariables">
+        <mapEntry key="LD_LIBRARY_PATH" value="${PATHS}"/>
+        <mapEntry key="DYLD_LIBRARY_PATH" value="${PATHS}"/>
+    </mapAttribute>
 </launchConfiguration>

http://git-wip-us.apache.org/repos/asf/celix/blob/5b4e5ffe/documents/cmake_commands/readme.md
----------------------------------------------------------------------
diff --git a/documents/cmake_commands/readme.md b/documents/cmake_commands/readme.md
new file mode 100644
index 0000000..d95d07e
--- /dev/null
+++ b/documents/cmake_commands/readme.md
@@ -0,0 +1,201 @@
+#Apache Celix - CMake Commands
+
+For Apache Celix several cmake command are added to be able to work with bundles and Apache
Celix deployments.
+
+#Bundles
+
+##add_bundle
+Add a bundle to the project.  There are three variants:
+- With SOURCES the bundle will be created using a list of sources files as input for the
bundle activator library.
+- With ACTIVATOR the bundle will be created using the library target or absolute path to
existing library as activator library.
+- With no SOURCES or ACTIVATOR a bundle without a activator will be created.
+
+```CMake
+add_bundle(<bundle_target_name> 
+    SOURCES source1 source2 ...
+    [NAME bundle_name] 
+    [SYMBOLIC_NAME bundle_symbolic_name]
+    [DESCRIPTION bundle_description]
+    [VERSION bundle_version]
+    [PRIVATE_LIBRARIES private_lib1 private_lib2 ...]
+    [EXPORT_LIBRARIES export_lib1 export_lib2 ...]
+    [IMPORT_LIBRARIES import_lib1 import_lib2 ...]
+    [HEADERS "header1: header1_value" "header2: header2_value" ...]
+)
+```
+
+```CMake
+add_bundle(<bundle_target_name> 
+    ACTIVATOR <activator_lib>
+    [NAME bundle_name] 
+    [SYMBOLIC_NAME bundle_symbolic_name]
+    [DESCRIPTION bundle_description]
+    [VERSION bundle_version]
+    [PRIVATE_LIBRARIES private_lib1 private_lib2 ...]
+    [EXPORT_LIBRARIES export_lib1 export_lib2 ...]
+    [IMPORT_LIBRARIES import_lib1 import_lib2 ...]
+    [HEADERS "header1: header1_value" "header2: header2_value" ...]
+)
+```
+
+```CMake
+add_bundle(<bundle_target_name> 
+    [NAME bundle_name] 
+    [SYMBOLIC_NAME bundle_symbolic_name]
+    [DESCRIPTION bundle_description]
+    [VERSION bundle_version]
+    [PRIVATE_LIBRARIES private_lib1 private_lib2 ...]
+    [EXPORT_LIBRARIES export_lib1 export_lib2 ...]
+    [IMPORT_LIBRARIES import_lib1 import_lib2 ...]
+    [HEADERS "header1: header1_value" "header2: header2_value" ...]
+)
+```
+
+If NAME is provided that will be used as Bundle-Name. Default the bundle target name is used
as symbolic name.
+If SYMBOLIC_NAME is provided that will be used as Bundle-SymbolicName. Default the bundle
target name is used as symbolic name.
+If DESCRIPTION is provided that will be used as Bundle-Description. Default this is empty
+if VERSION is provided. That will be used for the Bundle-Version. In combination with SOURCES
the version will alse be use to set the activator library target property VERSION and SOVERSION.
+For SOVERSION only the major part is used. Expected scheme is "<major>.<minor>.<path>".
Default version is "0.0.0"
+If PRIVATE_LIBRARIES is provided all provided lib are added to the "Private-Library" manifest
statement and added in the root of the bundle. libraries can be cmake library targets or absolute
paths to existing libraries.  
+If EXPORT_LIBRARIES is provided all provided lib are added to the "Export-Library" manifest
statement and added in the root of the bundle. libraries can be cmake library targets or absolute
paths to existing libraries. This is not yet supported by the celix framework.
+If EXPORT_LIBRARIES is provided all provided lib are added to the "Import-Library" manifest
statement and added in the root of the bundle. libraries can be cmake library targets or absolute
paths to existing libraries.  This is not yet supported by the celix framework
+If HEADERS is provided the headers values are appended to the bundle manifest.
+
+##bundle_private_libs
+Add libraries to a bundle target. The libraries should be cmake library targets or an absolute
path to a existing library.
+
+```CMake
+bundle_private_libs(<bundle_target>
+    lib1 lib2 ...
+)
+```
+
+##bundle_files
+Add files to the target bundle. DESTINATION is relative to the bundle archive root. 
+The rest of the command is conform file(COPY ...) cmake command.
+See cmake file(COPY ...) command for more info.
+
+```CMake
+bundle_files(<bundle_target>
+    files... DESTINATION <dir>
+    [FILE_PERMISSIONS permissions...]
+    [DIRECTORY_PERMISSIONS permissions...]
+    [NO_SOURCE_PERMISSIONS] [USE_SOURCE_PERMISSIONS]
+    [FILES_MATCHING]
+    [[PATTERN <pattern> | REGEX <regex>]
+    [EXCLUDE] [PERMISSIONS permissions...]] [...])
+)
+```
+
+
+##bundle_headers
+Append the provided headers to the target bundle manifest.
+
+```CMake
+bundle_headers(<bundle_target>
+    "header1: header1_value"
+    "header2: header2_value"
+    ...
+)
+```
+
+##bundle_symbolic_name
+Set bundle symbolic name
+
+```CMake
+bundle_symbolic_name(<bundle_target> symbolic_name)
+```
+
+##bundle_name
+Set bundle name
+
+```CMake
+bundle_name(<bundle_target> name)
+```
+
+##bundle_version
+Set bundle version
+
+```CMake
+bundle_version(<bundle_target> version)
+```
+
+##bundle_description
+Set bundle description
+
+```CMake
+bundle_description(<bundle_target> description)
+```
+
+##install_bundle
+Install bundle when 'make install' is executed. 
+Bundles are installed at <install-prefix>/share/<project_name>/bundles.
+Headers are installed at <install-prefix>/include/<project_name>/<bundle_name>
+Resources are installed at <install-prefix>/shared/<pronect_name>/<bundle_name>
+
+```CMake
+install_bundle(<bundle_target>
+    [PROJECT_NAME] project_name
+    [BUNDLE_NAME] bundle_name
+    [HEADERS header_file1 header_file2 ...]
+    [RESOURCES resource1 resource2 ...]
+)
+```
+
+If PROJECT_NAME is provided that will be used as project name for installing. Default is
the cmake project name.
+If BUNDLE_NAME is provided that will be used as bundle for installing the headers. Default
is the bundle target name.
+if HEADERS is provided the list of provided headers will be installed.
+if RESOURCES is provided the list of provided resources will be installed.
+
+#Deployments
+
+#add_deploy
+Add a deployment, consisting out of a selection of bundles, for the project. 
+Deployments can be used to run/test a selection of bundles in the celix framework.
+A deployment can be found in <cmake_build_dir>/deploy[/<group_name>]/<deploy_name>.

+Use the run.sh to run the deployments.
+
+```CMake
+add_deploy(<deploy_target_name>
+    [COPY] 
+    [GROUP group_name]
+    [NAME deploy_name]
+    [BUNDLES <bundle1> <bundle2> ...]
+    [PROPERTIES "prop1=val1" "prop2=val2" ...]
+)
+```
+
+If COPY is provided the selected bundles will be copied in a bundles dir and the generated
config.properties will use relative paths to the bundle locations. Default bundles will not
be copied and the generated config.properties will use absolute references to the bundle locations.
+If GROUP is provided the deployment will be grouped in the provided group name. 
+If NAME is provided that name will be used for the deployment dir. Default the deploy target
name will be used.
+If BUNDLES is provided the list of bundles will be added the the generated config.properties
for startup. Combined with COPY the bundles will also be copied to a bundles dir.
+If PROPERTIES is provided the list of properties will be appended to the generated config.properties
+
+#deploy_bundles_dir
+Deploy a selection of bundles to the provided bundle dir. This can be used to create an endpoints
/ proxies bundles dir for the remote service admin or drivers bundles dir for the device access.

+
+```CMake
+deploy_bundles_dir(<deploy_target_name>
+    DIR_NAME dir_name
+    BUNDLES bundle1 bundle2 ...
+)
+```
+
+#deploy_bundles
+Deploy the selected bundles. The bundles are configured for auto starting. 
+
+```CMake
+deploy_bundles(<deploy_target_name>
+    bundle1 bundle2 ...
+)
+```
+
+#deploy_properties
+
+```CMake
+Add the provided properties to the target deploy config.properties.
+
+deploy_properties(<deploy_target_name>
+    "prop1=val1" "prop2=val2" ...
+)
+


Mime
View raw message