Skip to content

Commit

Permalink
CELIX-379: Refactors LAUNCHER option so that it will be used in the c…
Browse files Browse the repository at this point in the history
…reated softlink and eclipse launcher file. Also updated add_deploy documentation
  • Loading branch information
pnoltes committed Oct 11, 2016
1 parent fbd81b9 commit fcbbec5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
32 changes: 19 additions & 13 deletions cmake/cmake_celix/Packaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
)


Expand All @@ -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})
Expand Down
2 changes: 2 additions & 0 deletions documents/cmake_commands/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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" ...]
)
Expand All @@ -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

Expand Down

0 comments on commit fcbbec5

Please sign in to comment.