celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject [19/19] celix git commit: Merge commit 'ee29b00d7a80af43d351e61916d5a5aa90f97e46' into feature/CELIX-417-cmake-refactor
Date Thu, 18 Jan 2018 17:05:22 GMT
Merge commit 'ee29b00d7a80af43d351e61916d5a5aa90f97e46' into feature/CELIX-417-cmake-refactor


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

Branch: refs/heads/feature/CELIX-417-cmake-refactor
Commit: ac0d0d7712fe30420da22f828efe7fc8287da498
Parents: 5ecaa64 ee29b00
Author: Pepijn Noltes <pepijnnoltes@gmail.com>
Authored: Thu Jan 18 18:04:41 2018 +0100
Committer: Pepijn Noltes <pepijnnoltes@gmail.com>
Committed: Thu Jan 18 18:04:41 2018 +0100

----------------------------------------------------------------------
 CMakeLists.txt                                  |  11 +-
 KEYS                                            |  59 +++++
 NOTICE                                          |   2 +-
 RELEASE_NOTES                                   |  39 ++-
 cmake/CMakeCelix-local.cmake                    |  31 ---
 cmake/CMakeCelix.cmake                          |  31 +++
 cmake/cmake_celix/BundlePackaging.cmake         |  88 +++++--
 cmake/cmake_celix/DeployPackaging.cmake         | 137 +++++++----
 cmake/cmake_celix/DockerPackaging.cmake         | 236 ++++++++++---------
 cmake/cmake_celix/Runtimes.cmake                |  17 ++
 cmake/cmake_celix/create_target_filesystem.sh   |   3 +-
 dependency_manager/src/dm_component_impl.c      |  67 +++---
 dfi/CMakeLists.txt                              |  40 ++--
 documents/cmake_commands/readme.md              | 135 +++++------
 etcdlib/CMakeLists.txt                          |   3 +-
 examples/dm_example/CMakeLists.txt              |  44 ++--
 .../dm_example/phase1/src/phase1_activator.c    |   1 +
 examples/dm_example/phase1/src/phase1_cmp.c     |  11 +
 examples/dm_example/phase1/src/phase1_cmp.h     |   3 +-
 examples/dm_example_cxx/CMakeLists.txt          |  42 ++--
 examples/log_service_example/CMakeLists.txt     |   2 +-
 framework/include/celix_launcher.h              |   2 +
 framework/src/celix_launcher.c                  |  77 +++++-
 pubsub/examples/keys/publisher/private/.gitkeep |  14 ++
 pubsub/examples/keys/publisher/public/.gitkeep  |  16 ++
 .../examples/keys/subscriber/private/.gitkeep   |  16 ++
 pubsub/examples/keys/subscriber/public/.gitkeep |  16 ++
 .../pubsub/msg_descriptors/poi1.properties      |  17 ++
 .../pubsub/msg_descriptors/poi2.properties      |  17 ++
 .../pubsub_admin_udp_mc/src/topic_publication.c |  11 +-
 .../private/src/topic_publication.c             |   9 +-
 .../private/src/topic_subscription.c            |   4 +-
 .../public/include/pubsub_admin_match.h         |  21 +-
 .../public/src/pubsub_admin_match.c             |  31 ++-
 shell/CMakeLists.txt                            |   2 +-
 utils/include/properties.h                      |   2 +
 utils/src/properties.c                          |  28 +++
 37 files changed, 856 insertions(+), 429 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/ac0d0d77/CMakeLists.txt
----------------------------------------------------------------------
diff --cc CMakeLists.txt
index 9697da9,2fbf62d..d05ec8a
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@@ -21,10 -21,24 +21,10 @@@ cmake_policy(SET CMP0042 NEW
  
  project (Celix C CXX)
  
- include(GNUInstallDirs)
+ include(GNUInstallDirs)                                                                
                                                                                         
                  
+ 
  set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
- set(CMAKE_BUILD_TYPE "Debug")
  
 -#Setup vars conform the FindCelix setup, so that examples and supporting cmake command can
assume these variables are set
 -set(CELIX_FOUND true)
 -set(CELIX_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/framework/public/include ${CMAKE_SOURCE_DIR}/utils/public/include)
 -set(CELIX_LIBRARIES celix_framework celix_utils celix_dfi)
 -set(CELIX_LAUNCHER celix)
 -set(CELIX_FRAMEWORK_LIBRARY celix_framework)
 -set(CELIX_UTILS_LIBRARY celix_utils)
 -set(CELIX_DFI_LIBRARY celix_dfi)
 -set(CELIX_DM_LIB dependency_manager_so)
 -set(CELIX_DM_STATIC_LIB dependency_manager_static)
 -set(CELIX_DM_STATIC_CXX_LIB dependency_manager_cxx_static)
 -set(CELIX_PROJECT true) #Note this var is not set by FindCelix and can be used to test if
this is the celix project or a project using celix
 -
 -set(CMAKE_BUILD_TYPE "Debug")
  
  # 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")
@@@ -73,13 -86,11 +72,13 @@@ set(DEFAULT_VERSION 1.0.0
  add_subdirectory(utils)
  add_subdirectory(dfi)
  add_subdirectory(etcdlib)
+ 
  add_subdirectory(framework)
- include_directories(framework/public/include)
  
 -include_directories(framework/public/include)
 +#launcher
  add_subdirectory(launcher)
 +
 +#Bundles
  add_subdirectory(config_admin)
  add_subdirectory(device_access)
  add_subdirectory(deployment_admin)

http://git-wip-us.apache.org/repos/asf/celix/blob/ac0d0d77/cmake/CMakeCelix.cmake
----------------------------------------------------------------------
diff --cc cmake/CMakeCelix.cmake
index 0000000,8c14577..f67648b
mode 000000,100644..100644
--- a/cmake/CMakeCelix.cmake
+++ b/cmake/CMakeCelix.cmake
@@@ -1,0 -1,32 +1,31 @@@
+ # Licensed to the Apache Software Foundation (ASF) under one
+ # or more contributor license agreements.  See the NOTICE file
+ # distributed with this work for additional information
+ # regarding copyright ownership.  The ASF licenses this file
+ # to you under the Apache License, Version 2.0 (the
+ # "License"); you may not use this file except in compliance
+ # with the License.  You may obtain a copy of the License at
+ # 
+ #   http://www.apache.org/licenses/LICENSE-2.0
+ # 
+ # Unless required by applicable law or agreed to in writing,
+ # software distributed under the License is distributed on an
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ # KIND, either express or implied.  See the License for the
+ # specific language governing permissions and limitations
+ # under the License.
+ 
 -
+ set(CELIX_CMAKE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
+ 
 -if (ANDROID)
 -	add_definitions( -DANDROID )
 -endif ()
 -
+ include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/Dependencies.cmake)
 -include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/BundlePackaging.cmake)
 -include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/DeployPackaging.cmake)
 -include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/DockerPackaging.cmake)
 -include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/Runtimes.cmake)
+ include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/ApacheRat.cmake)
+ include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/CodeCoverage.cmake)
+ include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/BuildOptions.cmake)
++
++include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/UseCelix.cmake)
++
++#UseCelix includes:
++#include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/BundlePackaging.cmake)
++#include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/DeployPackaging.cmake)
++#include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/DockerPackaging.cmake)
++#include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/Runtimes.cmake)

http://git-wip-us.apache.org/repos/asf/celix/blob/ac0d0d77/cmake/cmake_celix/BundlePackaging.cmake
----------------------------------------------------------------------
diff --cc cmake/cmake_celix/BundlePackaging.cmake
index 205bec1,f3adde3..8e1755c
--- a/cmake/cmake_celix/BundlePackaging.cmake
+++ b/cmake/cmake_celix/BundlePackaging.cmake
@@@ -88,13 -88,16 +88,17 @@@ function(check_bundle BUNDLE
      endif()
  endfunction()
  
 +
  function(add_bundle)
+     #message(DEPRECATION"add_bundle is DEPRECATION, use add_celix_bundle instead.")
+     add_celix_bundle(${ARGN})
+ endfunction()
+ function(add_celix_bundle)
      list(GET ARGN 0 BUNDLE_TARGET_NAME)
      list(REMOVE_AT ARGN 0)
  
      set(OPTIONS NO_ACTIVATOR)
-     set(ONE_VAL_ARGS VERSION ACTIVATOR SYMBOLIC_NAME NAME DESCRIPTION FILENAME)
 -    set(ONE_VAL_ARGS VERSION ACTIVATOR SYMBOLIC_NAME NAME DESCRIPTION) 
++    set(ONE_VAL_ARGS VERSION ACTIVATOR SYMBOLIC_NAME NAME DESCRIPTION FILE_NAME)
      set(MULTI_VAL_ARGS SOURCES PRIVATE_LIBRARIES EXPORT_LIBRARIES IMPORT_LIBRARIES HEADERS)
      cmake_parse_arguments(BUNDLE "${OPTIONS}" "${ONE_VAL_ARGS}" "${MULTI_VAL_ARGS}" ${ARGN})
  
@@@ -143,22 -143,14 +147,22 @@@
          #create lib from sources
          add_library(${BUNDLE_TARGET_NAME} SHARED ${BUNDLE_SOURCES})
          set_library_version(${BUNDLE_TARGET_NAME} ${BUNDLE_VERSION})
 -        set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_TARGET_IS_LIB" TRUE)
 +        set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES
 +                "BUNDLE_TARGET_IS_LIB" TRUE
 +                "BUNDLE_TARGET" "${BUNDLE_TARGET_NAME}_bundle"
 +        )
 +        target_link_libraries(${BUNDLE_TARGET_NAME} PRIVATE Celix::framework)
      else()
          add_custom_target(${BUNDLE_TARGET_NAME})
 +        set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES
 +                "BUNDLE_TARGET_IS_LIB" FALSE
 +                "BUNDLE_TARGET" "${BUNDLE_TARGET_NAME}_bundle"
 +        )
      endif()
      add_custom_target(${BUNDLE_TARGET_NAME}_bundle
 -        DEPENDS "$<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_FILE>"
 +        DEPENDS ${BUNDLE_TARGET_NAME} "$<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_FILE>"
      )
-     add_dependencies(bundles ${BUNDLE_TARGET_NAME}_bundle)
+     add_dependencies(celix-bundles ${BUNDLE_TARGET_NAME}_bundle)
      #######################################################################
     
  
@@@ -211,18 -203,14 +215,19 @@@
      #############################
      ### BUNDLE TARGET PROPERTIES
      #############################
 +    #alreadyer set
 +    #   BUNDLE_TARGET_IS_LIB -> true (can be use to test if target is bundle target
 +    #   BUNDLE_TARGET -> refers to the _bundle target which is responsible for building
the zip file
      #internal use
 +    set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_IS_BUNDLE_TARGET" TRUE)
#indicate that this is a bundle target
      set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_DEPEND_TARGETS" "") #bundle
target dependencies. Note can be extended after the add_bundle call
--    set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_GEN_DIR" ${BUNDLE_GEN_DIR})
#location for generated output. 
++    set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_GEN_DIR" ${BUNDLE_GEN_DIR})
#location for generated output.
++    set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_CREATE_BUNDLE_TARGET"
${BUNDLE_TARGET_NAME}_bundle)
  
      #bundle specific
 -    set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_CONTENT_DIR" ${BUNDLE_CONTENT_DIR})
#location where the content to be jar/zipped. 
 -    set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_FILE" ${BUNDLE_FILE})
#target bundle file (.zip)
 -    set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_FILE_NAME" ${BUNDLE_FILE_NAME})
#target bundle file (.zip)
 +    set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_CONTENT_DIR" ${BUNDLE_CONTENT_DIR})
#location where the content to be jar/zipped.
 +    set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_FILENAME" ${BUNDLE_FILENAME})
#target bundle filename (.zip)
 +    set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_FILE" ${BUNDLE_FILE})
#target bundle abs file path (.zip)
  
      #name and version
      set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_NAME" ${BUNDLE_NAME})
#The bundle name default target name

http://git-wip-us.apache.org/repos/asf/celix/blob/ac0d0d77/cmake/cmake_celix/DeployPackaging.cmake
----------------------------------------------------------------------
diff --cc cmake/cmake_celix/DeployPackaging.cmake
index dfef9dd,26f5c90..2065b47
--- a/cmake/cmake_celix/DeployPackaging.cmake
+++ b/cmake/cmake_celix/DeployPackaging.cmake
@@@ -28,9 -28,10 +28,9 @@@ set_directory_properties(PROPERTIES ADD
  #####
  
  function(add_deploy)
 -    #message(DEPRECATION "add_deploy is depecrated, use add_celix_container instead.")
++    #message(DEPRECATION "deploy_bundles_dir is depecrated, use celix_container_bundles_dir
instead.")
      add_celix_container(${ARGN})
  endfunction()
--
  function(add_celix_container)
      list(GET ARGN 0 CONTAINER_TARGET)
      list(REMOVE_AT ARGN 0)
@@@ -59,55 -60,77 +59,64 @@@
      endif ()
      ######
  
-     get_target_property(CONTAINERDEPS containers "CONTAINER_DEPLOYMENTS")
++    #add this target as depependency to the celix-containers target
+     get_target_property(CONTAINERDEPS celix-containers "CONTAINER_DEPLOYMENTS")
      list(APPEND CONTAINERDEPS ${CONTAINER_TARGET})
-     set_target_properties(containers PROPERTIES "CONTAINER_DEPLOYMENTS" "${CONTAINERDEPS}")
+     set_target_properties(celix-containers PROPERTIES "CONTAINER_DEPLOYMENTS" "${CONTAINERDEPS}")
  
      #FILE TARGETS FOR CONTAINER
      set(CONTAINER_PROPS "${CONTAINER_LOC}/config.properties")
      set(CONTAINER_ECLIPSE_LAUNCHER "${CONTAINER_LOC}/${CONTAINER_NAME}.launch")
  
--    if (CONTAINER_LAUNCHER_SRC)
-         get_filename_component(SRC_FILENAME ${LAUNCHER_SRC} NAME)
 -        get_filename_component(SRC_FILENAME ${CONTAINER_LAUNCHER_SRC} NAME)
--        set(LAUNCHER_SRC "${PROJECT_BINARY_DIR}/celix/gen/${CONTAINER_TARGET}-${SRC_FILENAME}")
--        set(LAUNCHER_ORG "${CONTAINER_LAUNCHER_SRC}")
--    elseif (CONTAINER_CXX)
--	    set(LAUNCHER_SRC "${PROJECT_BINARY_DIR}/celix/gen/${CONTAINER_TARGET}-main.cc")
--        set(LAUNCHER_ORG "${CELIX_CMAKE_DIRECTORY}/cmake_celix/main.c.in")
--    else()
--	    set(LAUNCHER_SRC "${PROJECT_BINARY_DIR}/celix/gen/${CONTAINER_TARGET}-main.c")
--        set(LAUNCHER_ORG "${CELIX_CMAKE_DIRECTORY}/cmake_celix/main.c.in")
--    endif()
--
++    set(LAUNCHER_DEP )
      if (CONTAINER_LAUNCHER)
          if (IS_ABSOLUTE "${CONTAINER_LAUNCHER}")
              set(LAUNCHER "${CONTAINER_LAUNCHER}")
          else()
              #assuming target
              set(LAUNCHER "$<TARGET_FILE:${CONTAINER_LAUNCHER}>")
++            set(LAUNCHER_DEP ${CONTAINER_LAUNCHER})
          endif()
--        add_custom_target(${CONTAINER_TARGET}
--                COMMAND ${CMAKE_COMMAND} -E create_symlink ${LAUNCHER} ${CONTAINER_LOC}/${CONTAINER_TARGET}
-                 DEPENDS  "$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_TARGET_DEPS>"
-                 COMMENT "Deploying ${CONTAINER_PRINT_NAME} Celix container" VERBATIM
--        )
--    else ()
--        add_custom_command(OUTPUT ${LAUNCHER_SRC}
--                COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/celix/gen
-                 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAUNCHER_ORG} ${LAUNCHER_SRC}
-                 DEPENDS  "$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_TARGET_DEPS>"
-                 COMMENT "Deploying ${CONTAINER_PRINT_NAME} Celix container" VERBATIM
 -        )
 -
++    elseif (CONTAINER_LAUNCHER_SRC)
++        get_filename_component(SRC_FILENAME ${CONTAINER_LAUNCHER_SRC} NAME)
++        set(LAUNCHER_SRC "${PROJECT_BINARY_DIR}/celix/gen/${CONTAINER_TARGET}-${SRC_FILENAME}")
++        set(LAUNCHER_ORG "${CONTAINER_LAUNCHER_SRC}")
++    else () #generate custom launcher
+         if (CONTAINER_CXX)
 -            set(STAGE1_LAUNCHER "${CMAKE_CURRENT_BINARY_DIR}/${CONTAINER_TARGET}-main-stage1.cc")
++            set(LAUNCHER_SRC "${PROJECT_BINARY_DIR}/celix/gen/${CONTAINER_TARGET}-main.cc")
+         else()
 -            set(STAGE1_LAUNCHER "${CMAKE_CURRENT_BINARY_DIR}/${CONTAINER_TARGET}-main-stage1.c")
++            set(LAUNCHER_SRC "${PROJECT_BINARY_DIR}/celix/gen/${CONTAINER_TARGET}-main.c")
+         endif()
+ 
+         file(GENERATE
 -                OUTPUT "${STAGE1_LAUNCHER}"
++                OUTPUT "${LAUNCHER_SRC}"
+                 CONTENT "#include <celix_launcher.h>
 -
+ int main(int argc, char *argv[]) {
 -    const char * config = \"cosgi.auto.start.1=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES>,
>\\n\\
++    const char * config = \"\\
+ $<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_EMBEDDED_PROPERTIES>,\\n\\
+ >\";
+ 
+     properties_pt packedConfig = properties_loadFromString(config);
 -
+     return celixLauncher_launchWithArgsAndProps(argc, argv, packedConfig);
+ }
+ "
          )
++    endif ()
  
 -        file(GENERATE
 -                OUTPUT "${LAUNCHER_SRC}"
 -                INPUT "${STAGE1_LAUNCHER}"
 -        )
 -
--        include_directories(${CELIX_INCLUDE_DIRS})
++    if (LAUNCHER_SRC) #compilation needed
          add_executable(${CONTAINER_TARGET} ${LAUNCHER_SRC})
          set_target_properties(${CONTAINER_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CONTAINER_LOC})
 -        target_link_libraries(${CONTAINER_TARGET} PRIVATE ${CELIX_FRAMEWORK_LIBRARY} ${CELIX_UTILS_LIBRARY})
 +        target_link_libraries(${CONTAINER_TARGET} PRIVATE Celix::framework)
          set(LAUNCHER "$<TARGET_FILE:${CONTAINER_TARGET}>")
++    else ()
++        #LAUNCHER already set
++        add_custom_target(${CONTAINER_TARGET}
++            COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAUNCHER} ${CONTAINER_LOC}/${CONTAINER_TARGET}
++        )
      endif ()
  
      #generate config.properties
--    set(STAGE1_PROPERTIES "${CMAKE_CURRENT_BINARY_DIR}/${CONTAINER_TARGET}-container-config-stage1.properties")
++    set(STAGE1_PROPERTIES "${PROJECT_BINARY_DIR}/celix/gen/${CONTAINER_TARGET}-container-config-stage1.properties")
      file(GENERATE 
          OUTPUT "${STAGE1_PROPERTIES}"
          CONTENT "cosgi.auto.start.1=$<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_BUNDLES>,
>
@@@ -133,20 -156,26 +142,21 @@@ $<JOIN:$<TARGET_PROPERTY:${CONTAINER_TA
          get_filename_component(CELIX_BIN_DIR ${CELIX_LAUNCHER} DIRECTORY)
      endif()
  
 -    if (CONTAINER_COPY)
 -        add_custom_target(${CONTAINER_TARGET}-deps
 -                DEPENDS $<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_DEPS>
 -        )
 -        add_dependencies(${CONTAINER_TARGET} ${CONTAINER_TARGET}-deps)
 -    endif ()
--
      #generate release.sh and optional run.sh
      if(APPLE)
          set(LIB_PATH_NAME "DYLD_LIBRARY_PATH")
      else()
          set(LIB_PATH_NAME "LD_LIBRARY_PATH")
      endif()
++
      set(RELEASE_SH ${CONTAINER_LOC}/release.sh)
--    set(RUN_SH ${CONTAINER_LOC}/run.sh)
      set(RELEASE_CONTENT "#!/bin/sh\nexport ${LIB_PATH_NAME}=${CELIX_LIB_DIRS}:\${${LIB_PATH_NAME}}\nexport
PATH=${CELIX_BIN_DIR}:\${PATH}")
      file(GENERATE
          OUTPUT ${RELEASE_SH}
          CONTENT ${RELEASE_CONTENT}
      )
++
++    set(RUN_SH ${CONTAINER_LOC}/run.sh)
      set(RUN_CONTENT "${RELEASE_CONTENT}\n${LAUNCHER} \$@\n")
      file(GENERATE
          OUTPUT ${RUN_SH}
@@@ -163,11 -192,11 +173,23 @@@
          CONTENT "${RUN_CONFIG_IN}"
      )
  
++    #add a custom target which can depend on generation expressions
++    add_custom_target(${CONTAINER_TARGET}-deps
++        DEPENDS
++            ${RUN_SH}
++            ${CONTAINER_ECLIPSE_LAUNCHER}
++            ${RELEASE_SH}
++            ${CONTAINER_PROPS}
++            $<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_TARGET_DEPS>
++    )
++    add_dependencies(${CONTAINER_TARGET} ${CONTAINER_TARGET}-deps)
++
++
      ##### Container Target Properties #####
      #internal use
 +    set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_TARGET_DEPS" "") #target
deps for the container.
      set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_BUNDLES" "") #bundles
to deploy fro the container.
      set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_COPY_BUNDLES" ${CONTAINER_COPY})
#copy bundles in bundle dir or link using abs paths. NOTE this cannot be changed after a add_deploy
command
 -    set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_DEPS" "") #target deps
for copy of bundles
  
      #deploy specific
      set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_NAME" "${CONTAINER_NAME}")
@@@ -188,8 -219,9 +212,8 @@@ endfunction(
  
  
  #NOTE can be used for drivers/proxies/endpoints bundle dirs
--
  function(deploy_bundles_dir)
+     #message(DEPRECATION "deploy_bundles_dir is depecrated, use celix_container_bundles_dir
instead.")
      celix_container_bundles_dir(${ARGN})
  endfunction()
  function(celix_container_bundles_dir)
@@@ -218,24 -250,18 +242,21 @@@
                  DEPENDS ${BUNDLE}
              )
          else()
 -            #assuming target
 -            get_target_property(BFN ${BUNDLE} BUNDLE_FILE_NAME) #would prefer to used target
generator, but this is not supporte in a OUTPUT argument
 -            set(OUT "${CONTAINER_LOC}/${BD_DIR_NAME}/${BFN}")
 +            string(MAKE_C_IDENTIFIER ${BUNDLE} BUNDLE_ID) #Create id with no special chars
(e.g. for target like Celix::shell)
 +            set(OUT "${CMAKE_BINARY_DIR}/celix/gen/${CONTAINER_TARGET}-copy-bundle-for-target-${BUNDLE_ID}.timestamp")
 +            set(DEST "${CONTAINER_LOC}/${BD_DIR_NAME}/$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILENAME>")
              add_custom_command(OUTPUT ${OUT}
 -                COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILE>"
${OUT}
 -                COMMENT "Copying bundle '${BFN}' to '${CONTAINER_LOC}/${BD_DIR_NAME}'"
 -                DEPENDS ${BUNDLE} ${BUNDLE}_bundle
 +                COMMAND ${CMAKE_COMMAND} -E touch ${OUT}
++                COMMAND ${CMAKE_COMMAND} -E make_directory ${CONTAINER_LOC}/${BD_DIR_NAME}
 +                COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILE>"
${DEST}
 +                COMMENT "Copying bundle '${BUNDLE}' to '${CONTAINER_LOC}/${BD_DIR_NAME}'"
-                 DEPENDS $<TARGET_PROPERTY:${BUNDLE},BUNDLE_BUILD_BUNDLE_TARGET>
++                DEPENDS ${BUNDLE} $<TARGET_PROPERTY:${BUNDLE},BUNDLE_CREATE_BUNDLE_TARGET>
              )
-             get_target_property(BUILD_BUNDLE_TARGET ${BUNDLE} BUNDLE_TARGET)
-             add_dependencies(${CONTAINER_TARGET} ${BUILD_BUNDLE_TARGET}) #ensure the the
deploy depends on the _bundle target, custom_command depends on add_library
- 
          endif()
          list(APPEND DEPS "${OUT}")
- 
      endforeach()
 -    set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_DEPS" "${DEPS}")
 +
 +    set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_TARGET_DEPS" "${DEPS}")
  endfunction()
  
  function(deploy_bundles)
@@@ -249,28 -276,30 +271,40 @@@ function(celix_container_bundles
  
      get_target_property(BUNDLES ${CONTAINER_TARGET} "CONTAINER_BUNDLES")
      get_target_property(COPY ${CONTAINER_TARGET} "CONTAINER_COPY_BUNDLES")
++    get_target_property(DEPS ${CONTAINER_TARGET} "CONTAINER_TARGET_DEPS")
  
      foreach(BUNDLE IN ITEMS ${ARGN})
 +           if (IS_ABSOLUTE ${BUNDLE} AND EXISTS ${BUNDLE})
 +               get_filename_component(BUNDLE_FILENAME ${BUNDLE} NAME)
 +               set(COPY_LOC "bundles/${BUNDLE_FILENAME}")
 +               set(ABS_LOC "${BUNDLE}")
 +           else () #assume target (could be a future target -> if (TARGET ...) not possible
 +               set(COPY_LOC "bundles/$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILENAME>")
 +               set(ABS_LOC "$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILE>")
++
++               if (NOT COPY) #in case of COPY dep will be added in celix_container_bundles_dir
++                   string(MAKE_C_IDENTIFIER ${BUNDLE} BUNDLE_ID) #Create id with no special
chars (e.g. for target like Celix::shell)
++                   set(OUT "${CMAKE_BINARY_DIR}/celix/gen/${CONTAINER_TARGET}-check-bundle-for-target-${BUNDLE_ID}.timestamp")
++                   add_custom_command(OUTPUT ${OUT}
++                       COMMAND ${CMAKE_COMMAND} -E touch ${OUT}
++                       DEPENDS ${BUNDLE} $<TARGET_PROPERTY:${BUNDLE},BUNDLE_CREATE_BUNDLE_TARGET>
++                   )
++                   list(APPEND DEPS ${OUT})
++               endif ()
 +           endif ()
             if(COPY)
 -                if(IS_ABSOLUTE ${BUNDLE} AND EXISTS ${BUNDLE})
 -                    get_filename_component(BUNDLE_FILENAME ${BUNDLE} NAME) 
 -                    list(APPEND BUNDLES "bundles/${BUNDLE_FILENAME}")
 -                else() #assuming target
 -                    get_target_property(BFN ${BUNDLE} BUNDLE_FILE_NAME)
 -                    list(APPEND BUNDLES "bundles/${BFN}")
 -                endif()
 +                list(APPEND BUNDLES ${COPY_LOC})
             else()
 -                if(IS_ABSOLUTE ${BUNDLE} AND EXISTS ${BUNDLE})
 -                    list(APPEND BUNDLES ${BUNDLE})
 -                else() #assuming target
 -                    list(APPEND BUNDLES "$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILE>")
 -                endif()
 +                list(APPEND BUNDLES ${ABS_LOC})
             endif()
     endforeach()
  
++    set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_BUNDLES" "${BUNDLES}")
++    set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_TARGET_DEPS" "${DEPS}")
++
     if(COPY) 
         celix_container_bundles_dir(${CONTAINER_TARGET} DIR_NAME bundles BUNDLES ${ARGN})
     endif()
--
--   set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_BUNDLES" "${BUNDLES}")
  endfunction()
  
  function(deploy_properties)

http://git-wip-us.apache.org/repos/asf/celix/blob/ac0d0d77/cmake/cmake_celix/DockerPackaging.cmake
----------------------------------------------------------------------
diff --cc cmake/cmake_celix/DockerPackaging.cmake
index b85da11,e0ffe5e..cb1442c
--- a/cmake/cmake_celix/DockerPackaging.cmake
+++ b/cmake/cmake_celix/DockerPackaging.cmake
@@@ -109,14 -75,75 +75,64 @@@ function(add_celix_docker
      list(APPEND CLEANFILES "$<TARGET_PROPERTY:${DOCKER_TARGET},DOCKER_LOC>")
      set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CLEANFILES}")
  
-     ###### Setup docker custom target timestamp
-     set(TIMESTAMP_FILE "${CMAKE_CURRENT_BINARY_DIR}/${DOCKER_TARGET}-docker-timestamp")
+     if (DOCKER_LAUNCHER_SRC)
+         get_filename_component(SRC_FILENAME ${DOCKER_LAUNCHER_SRC} NAME)
+         set(LAUNCHER_SRC "${PROJECT_BINARY_DIR}/celix/gen/${DOCKER_TARGET}-${SRC_FILENAME}")
+         set(LAUNCHER_ORG "${DOCKER_LAUNCHER_SRC}")
+     elseif (DOCKER_CXX)
+         set(LAUNCHER_SRC "${PROJECT_BINARY_DIR}/celix/gen/${DOCKER_TARGET}-main.cc")
+         set(LAUNCHER_ORG "${CELIX_CMAKE_DIRECTORY}/cmake_celix/main.c.in")
+     else()
+         set(LAUNCHER_SRC "${PROJECT_BINARY_DIR}/celix/gen/${DOCKER_TARGET}-main.c")
+         set(LAUNCHER_ORG "${CELIX_CMAKE_DIRECTORY}/cmake_celix/main.c.in")
+     endif()
  
-     add_custom_target(${DOCKER_TARGET}
-         DEPENDS ${TIMESTAMP_FILE}
-     )
+     if (DOCKER_LAUNCHER)
+         add_custom_target(${DOCKER_TARGET})
+         if (IS_ABSOLUTE "${DOCKER_LAUNCHER}")
+             set(LAUNCHER "${DOCKER_LAUNCHER}")
+             get_filename_component(EXE_FILENAME ${DOCKER_LAUNCHER} NAME)
+             set(DOCKER_ENTRYPOINT "ENTRYPOINT [\"/bin/${EXE_FILENAME}\"]")
+         else()
+             #assuming target
+             set(LAUNCHER "$<TARGET_FILE:${DOCKER_LAUNCHER}>")
+             set(DOCKER_ENTRYPOINT "ENTRYPOINT [\"/bin/$<TARGET_FILE_NAME:${DOCKER_TARGET}>\"]")
+         endif()
+     else ()
 -        add_custom_command(OUTPUT ${LAUNCHER_SRC}
 -                COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/celix/gen
 -        )
  
-     set(CELIX_LAUNCHER "$<TARGET_FILE:Celix::launcher>")
+         if (DOCKER_CXX)
 -            set(LAUNCHER_STAGE1 "${CMAKE_CURRENT_BINARY_DIR}/${DOCKER_TARGET}-docker-main-stage1.cc")
++            set(LAUNCHER_SRC "${CMAKE_CURRENT_BINARY_DIR}/${DOCKER_TARGET}-docker-main.cc")
+         else()
 -            set(LAUNCHER_STAGE1 "${CMAKE_CURRENT_BINARY_DIR}/${DOCKER_TARGET}-docker-main-stage1.c")
++            set(LAUNCHER_SRC "${CMAKE_CURRENT_BINARY_DIR}/${DOCKER_TARGET}-docker-main.c")
+         endif()
+ 
+         file(GENERATE
 -                OUTPUT "${LAUNCHER_STAGE1}"
++                OUTPUT ${LAUNCHER_SRC}
+                 CONTENT "#include <celix_launcher.h>
+ 
+ int main(int argc, char *argv[]) {
 -    const char * config = \"cosgi.auto.start.1=$<JOIN:$<TARGET_PROPERTY:${DOCKER_TARGET},DOCKER_BUNDLES>,
>\\n\\
 -$<JOIN:$<TARGET_PROPERTY:${DOCKER_TARGET},DOCKER_PROPERTIES>,\\n\\
++    const char * config = \"\\
++$<JOIN:$<TARGET_PROPERTY:${DOCKER_TARGET},DOCKER_EMBEDDED_PROPERTIES>,\\n\\
+ >\";
+ 
+     properties_pt packedConfig = properties_loadFromString(config);
 -
+     return celixLauncher_launchWithArgsAndProps(argc, argv, packedConfig);
+ }
+ "
+         )
+ 
 -        file(GENERATE
 -                OUTPUT "${LAUNCHER_SRC}"
 -                INPUT "${LAUNCHER_STAGE1}"
 -        )
 -
 -        add_executable(${DOCKER_TARGET} ${LAUNCHER_SRC})
 -        #   set_target_properties(${DOCKER_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${DOCKER_LOC})
 -        target_include_directories(${DOCKER_TARGET} PRIVATE ${CELIX_INCLUDE_DIRS})
 -        target_link_libraries(${DOCKER_TARGET} PRIVATE ${CELIX_FRAMEWORK_LIBRARY} ${CELIX_UTILS_LIBRARY})
++        add_executable(${DOCKER_TARGET} EXCLUDE_FROM_ALL ${LAUNCHER_SRC})
++        target_link_libraries(${DOCKER_TARGET} PRIVATE Celix::framework)
+         set(LAUNCHER "$<TARGET_FILE:${DOCKER_TARGET}>")
+         set(DOCKER_ENTRYPOINT "ENTRYPOINT [\"/bin/$<TARGET_FILE_NAME:${DOCKER_TARGET}>\"]")
+     endif ()
+ 
+ 
+     ###### Setup docker custom target timestamp
+     add_custom_target(${DOCKER_TARGET}-deps
+         DEPENDS ${FS_TIMESTAMP_FILE} $<TARGET_PROPERTY:${DOCKER_TARGET},DOCKER_DEPS>
+     )
+     add_dependencies(${DOCKER_TARGET} ${DOCKER_TARGET}-deps)
  
      #setup dependencies based on timestamp
      if (DOCKER_CREATE_FS)
@@@ -149,8 -173,9 +162,10 @@@
      set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_CREATE_FS" "${DOCKER_CREATE_FS}")
#wether to create a fs with the minimal needed libraries / etc files
      set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_INSTRUCTIONS" "") #list of
additional instructions
      set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_PROPERTIES" "")
++    set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_EMBEDDED_PROPERTIES" "")
      set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_DEPS" "")
  
+     set(DOCKERFILE_STAGE1 ${CMAKE_BINARY_DIR}/celix/gen/${DOCKER_TARGET}-Dockerfile.in)
      set(DOCKERFILE "$<TARGET_PROPERTY:${DOCKER_TARGET},DOCKER_LOC>/Dockerfile")
  
      file(GENERATE
@@@ -227,23 -246,22 +236,25 @@@ function(celix_docker_bundles
      foreach(BUNDLE IN ITEMS ${ARGN})
          if(IS_ABSOLUTE ${BUNDLE} AND EXISTS ${BUNDLE})
              get_filename_component(BUNDLE_FILENAME ${BUNDLE} NAME)
--            list(APPEND BUNDLES "${BUNDLES_DIR}/${BUNDLE_FILENAME}")
              set(OUT "${LOC}/${BUNDLES_DIR}/${BUNDLE_FILENAME}")
              add_custom_command(OUTPUT ${OUT}
                  COMMAND ${CMAKE_COMMAND} -E copy_if_different ${BUNDLE} ${OUT}
--                COMMENT "Copying bundle '${BUNDLE}' to '${OUT}'"
++                COMMENT "Copying bundle '${BUNDLE}' to '${LOC}/${BUNDLES_DIR}'"
                  DEPENDS ${BUNDLE}
              )
++            list(APPEND BUNDLES "${BUNDLES_DIR}/${BUNDLE_FILENAME}")
          else() #assuming target
-             list(APPEND BUNDLES "${BUNDLES_DIR}/${BUNDLE}.zip")
-             set(OUT ${LOC}/${BUNDLES_DIR}/${BUNDLE}.zip)
 -            get_target_property(BFN ${BUNDLE} BUNDLE_FILE_NAME)
 -            list(APPEND BUNDLES "${BUNDLES_DIR}/${BFN}")
 -            set(OUT ${LOC}/${BUNDLES_DIR}/${BFN})
++            string(MAKE_C_IDENTIFIER ${BUNDLE} BUNDLE_ID) #Create id with no special chars
(e.g. for target like Celix::shell)
++            set(OUT "${CMAKE_BINARY_DIR}/celix/gen/${DOCKER_TARGET}-copy-bundle-for-target-${BUNDLE_ID}.timestamp")
++            set(DEST "${LOC}/${BUNDLES_DIR}/$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILENAME>")
              add_custom_command(OUTPUT ${OUT}
--                    COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILE>"
"${OUT}"
--                    COMMENT "Copying bundle '${BUNDLE}' to '${OUT}'"
-                     DEPENDS ${BUNDLE}
 -                    DEPENDS ${BUNDLE} ${BUNDLE}_bundle
++                    COMMAND ${CMAKE_COMMAND} -E touch ${OUT}
++                    COMMAND ${CMAKE_COMMAND} -E make_directory ${LOC}/${BUNDLES_DIR}
++                    COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILE>"
${DEST}
++                    COMMENT "Copying bundle '${BUNDLE}' to '${LOC}/${BUNDLES_DIR}'"
++                    DEPENDS ${BUNDLE} $<TARGET_PROPERTY:${BUNDLE},BUNDLE_CREATE_BUNDLE_TARGET>
              )
-             get_target_property(BUILD_BUNDLE_TARGET ${BUNDLE} BUNDLE_BUILD_BUNDLE_TARGET)
-             add_dependencies(${DOCKER_TARGET} ${BUILD_BUNDLE_TARGET}) #ensure the the deploy
depends on the _bundle target, custom_command depends on add_library
++            list(APPEND BUNDLES "${BUNDLES_DIR}/$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILENAME>")
          endif()
          list(APPEND DEPS "${OUT}")
      endforeach()
@@@ -271,11 -285,7 +278,22 @@@ function(celix_docker_properties
      set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_PROPERTIES" "${PROPS}")
  endfunction()
  
- function(celix_docker_instructions)
-     if (NOT ENABLE_DOCKER)
-         return()
-     endif()
++function(celix_docker_embedded_properties)
++    #0 is docker TARGET
++    #1..n is properties
++    list(GET ARGN 0 DOCKER_TARGET)
++    list(REMOVE_AT ARGN 0)
++
++    get_target_property(PROPS ${DOCKER_TARGET} "DOCKER_EMBEDDED_PROPERTIES")
 +
++    foreach(PROP IN ITEMS ${ARGN})
++        list(APPEND PROPS ${PROP})
++    endforeach()
++
++    set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_EMBEDDED_PROPERTIES" "${PROPS}")
++endfunction()
++
+ function(celix_docker_instructions)
      #0 is docker TARGET
      #1..n is instructions
      list(GET ARGN 0 DOCKER_TARGET)


Mime
View raw message