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-414: Changes how celix_add_container/add_deploy handles the LAUNHCER argument.
Date Thu, 16 Nov 2017 18:22:18 GMT
Repository: celix
Updated Branches:
  refs/heads/develop f9dcf5567 -> 78e435b97


CELIX-414: Changes how celix_add_container/add_deploy handles the LAUNHCER argument.


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

Branch: refs/heads/develop
Commit: 78e435b97c31da70b99bd7c202203b97b26a9520
Parents: f9dcf55
Author: Pepijn Noltes <pepijnnoltes@gmail.com>
Authored: Thu Nov 16 19:22:01 2017 +0100
Committer: Pepijn Noltes <pepijnnoltes@gmail.com>
Committed: Thu Nov 16 19:22:01 2017 +0100

----------------------------------------------------------------------
 cmake/cmake_celix/DeployPackaging.cmake | 53 +++++++++++-----------------
 cmake/cmake_celix/main.c.in             | 24 +++++++++++++
 2 files changed, 45 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/78e435b9/cmake/cmake_celix/DeployPackaging.cmake
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/DeployPackaging.cmake b/cmake/cmake_celix/DeployPackaging.cmake
index 3ed6ebe..21944c9 100644
--- a/cmake/cmake_celix/DeployPackaging.cmake
+++ b/cmake/cmake_celix/DeployPackaging.cmake
@@ -23,24 +23,8 @@ set_target_properties(containers PROPERTIES "CONTAINER_DEPLOYMENTS" "")
#initial
 
 get_directory_property(CLEANFILES ADDITIONAL_MAKE_CLEAN_FILES)
 list(APPEND CLEANFILES "${CMAKE_BINARY_DIR}/deploy")
+list(APPEND CLEANFILES "${CMAKE_BINARY_DIR}/celix")
 set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CLEANFILES}")
-
-set(CELIX_MAIN_CONTENT "
-#include \"celix_launcher.h\"
-
-int main(int argc, char *argv[]) {
-    return celixLauncher_launchWithArgs(argc, argv);
-}
-")
-file(GENERATE
-    OUTPUT "${PROJECT_BINARY_DIR}/celix/gen/main.c"
-    CONTENT "${CELIX_MAIN_CONTENT}"
-)
-file(GENERATE
-        OUTPUT "${PROJECT_BINARY_DIR}/celix/gen/main.cc"
-        CONTENT "${CELIX_MAIN_CONTENT}"
-)
-unset(CELIX_MAIN_CONTENT)
 #####
 
 function(add_deploy)
@@ -84,34 +68,39 @@ function(add_celix_container)
     set(CONTAINER_ECLIPSE_LAUNCHER "${CONTAINER_LOC}/${CONTAINER_NAME}.launch")
 
     if (CONTAINER_LAUNCHER_SRC)
-        set(LAUNCHER_SRC ${CONTAINER_LAUNCHER_SRC})
+        get_filename_component(SRC_FILENAME ${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/main.cc")
+	    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/main.c")
+	    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(TIMESTAMP_HEADER ${CMAKE_BINARY_DIR}/celix/timestamps/${CONTAINER_TARGET}-timestamp-header.h)
-    add_custom_command(OUTPUT ${TIMESTAMP_HEADER}
-        COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/celix/timestamps
-        COMMAND ${CMAKE_COMMAND} -E touch ${TIMESTAMP_HEADER}
-        DEPENDS  "$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_TARGET_DEPS>" ${CONTAINER_FILE_TARGETS}
-        COMMENT "Deploying ${CONTAINER_PRINT_NAME} Celix container" VERBATIM
-    )
-
     if (CONTAINER_LAUNCHER)
-        add_custom_target(${CONTAINER_TARGET}
-                DEPENDS ${TIMESTAMP_HEADER}
-        )
         if (IS_ABSOLUTE "${CONTAINER_LAUNCHER}")
             set(LAUNCHER "${CONTAINER_LAUNCHER}")
         else()
             #assuming target
             set(LAUNCHER "$<TARGET_FILE:${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
+        )
+
         include_directories(${CELIX_INCLUDE_DIRS})
-        add_executable(${CONTAINER_TARGET} ${LAUNCHER_SRC} ${TIMESTAMP_HEADER})
+        add_executable(${CONTAINER_TARGET} ${LAUNCHER_SRC})
         set_target_properties(${CONTAINER_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CONTAINER_LOC})
         target_link_libraries(${CONTAINER_TARGET} ${CELIX_FRAMEWORK_LIBRARY} ${CELIX_UTILS_LIBRARY})
         set(LAUNCHER "$<TARGET_FILE:${CONTAINER_TARGET}>")

http://git-wip-us.apache.org/repos/asf/celix/blob/78e435b9/cmake/cmake_celix/main.c.in
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/main.c.in b/cmake/cmake_celix/main.c.in
new file mode 100644
index 0000000..455b7dd
--- /dev/null
+++ b/cmake/cmake_celix/main.c.in
@@ -0,0 +1,24 @@
+/**
+ *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.
+ */
+
+#include <celix_launcher.h>
+
+int main(int argc, char *argv[]) {
+    return celixLauncher_launchWithArgs(argc, argv);
+}
\ No newline at end of file


Mime
View raw message