CELIX-379: Refactors LAUNCHER option so that it will be used in the created 
softlink and eclipse launcher file. Also updated add_deploy documentation


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

Branch: refs/heads/master
Commit: fcbbec5181617b0f43f36189d3f3a234f8221133
Parents: fbd81b9
Author: Pepijn Noltes <pepijnnol...@gmail.com>
Authored: Tue Oct 11 10:42:01 2016 +0200
Committer: Pepijn Noltes <pepijnnol...@gmail.com>
Committed: Tue Oct 11 10:42:01 2016 +0200

----------------------------------------------------------------------
 cmake/cmake_celix/Packaging.cmake  | 32 +++++++++++++++++++-------------
 documents/cmake_commands/readme.md |  2 ++
 2 files changed, 21 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/fcbbec51/cmake/cmake_celix/Packaging.cmake
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/Packaging.cmake 
b/cmake/cmake_celix/Packaging.cmake
index a2a969b..881c2fd 100644
--- a/cmake/cmake_celix/Packaging.cmake
+++ b/cmake/cmake_celix/Packaging.cmake
@@ -536,12 +536,26 @@ 
$<JOIN:$<TARGET_PROPERTY:${DEPLOY_TARGET},DEPLOY_PROPERTIES>,
         INPUT "${STAGE1_PROPERTIES}"
     )
 
+
+    #Setup launcher using celix target, celix binary or custom launcher
+    if (DEPLOY_LAUNCHER)
+        if (IS_ABSOLUTE "${DEPLOY_LAUNCHER}")
+            #assuming target
+            set(LAUNCHER "${DEPLOY_LAUNCHER}")
+        else()
+            set(LAUNCHER "$<TARGET_FILE:${DEPLOY_LAUNCHER}>")
+        endif()
+    else()
+        #Use CELIX_LAUNCHER
+        set(LAUNCHER "${CELIX_LAUNCHER}")
+    endif()
+
     #softlink celix exe file
     add_custom_command(OUTPUT "${DEPLOY_EXE}"
-        COMMAND ${LINK_CMD} -s "${CELIX_LAUNCHER}" "${DEPLOY_EXE}"
+        COMMAND ${LINK_CMD} -s "${LAUNCHER}" "${DEPLOY_EXE}"
         WORKING_DIRECTORY ${DEPLOY_LOCATION}
-        DEPENDS "${CELIX_LAUNCHER}" 
-        COMMENT "Symbolic link celix exe to ${DEPLOY_EXE}" VERBATIM
+        DEPENDS "${LAUNCHER}" 
+        COMMENT "Symbolic link launcher to ${DEPLOY_EXE}" VERBATIM
     ) 
 
 
@@ -556,22 +570,14 @@ 
$<JOIN:$<TARGET_PROPERTY:${DEPLOY_TARGET},DEPLOY_PROPERTIES>,
         OUTPUT ${DEPLOY_RELEASE_SH}
         CONTENT ${RELEASE_CONTENT}
     )
-    if(DEPLOY_LAUNCHER)
-        if(TARGET ${DEPLOY_LAUNCHER})
-            set(RUN_CONTENT 
"${RELEASE_CONTENT}\n$<TARGET_FILE:${DEPLOY_LAUNCHER}> \$@\n")
-        else() 
-            set(RUN_CONTENT "${RELEASE_CONTENT}\n${DEPLOY_LAUNCHER} \$@\n")
-        endif()
-    else()
-        set(RUN_CONTENT "${RELEASE_CONTENT}\ncelix \$@\n")
-    endif()
+    set(RUN_CONTENT "${RELEASE_CONTENT}\n${LAUNCHER} \$@\n")
     file(GENERATE
         OUTPUT ${DEPLOY_RUN_SH}
         CONTENT ${RUN_CONTENT}
     )
 
     #generate eclipse project launch file
-    set(PROGRAM_NAME "${CELIX_LAUNCHER}")
+    set(PROGRAM_NAME "${LAUNCHER}")
     set(CONTAINER_NAME ${DEPLOY_NAME})
     set(PROJECT_ATTR "${CMAKE_PROJECT_NAME}-build")
     set(WORKING_DIRECTORY ${DEPLOY_LOCATION})

http://git-wip-us.apache.org/repos/asf/celix/blob/fcbbec51/documents/cmake_commands/readme.md
----------------------------------------------------------------------
diff --git a/documents/cmake_commands/readme.md 
b/documents/cmake_commands/readme.md
index a796180..9045cf2 100644
--- a/documents/cmake_commands/readme.md
+++ b/documents/cmake_commands/readme.md
@@ -160,6 +160,7 @@ add_deploy(<deploy_target_name>
     [COPY] 
     [GROUP group_name]
     [NAME deploy_name]
+    [LAUNCHER launcher]
     [BUNDLES <bundle1> <bundle2> ...]
     [PROPERTIES "prop1=val1" "prop2=val2" ...]
 )
@@ -177,6 +178,7 @@ If the bundle target is never added CMake will give an 
error:
 - 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 LAUNCHER is provided that path or target will be used as launcher 
executable for the deployment. If no LAUNCHER is not provided the celix 
executable 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
 

Reply via email to