celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abroekh...@apache.org
Subject svn commit: r1658960 - in /celix/trunk/launcher: CMakeLists.txt private/src/launcher.c
Date Wed, 11 Feb 2015 13:53:23 GMT
Author: abroekhuis
Date: Wed Feb 11 13:53:23 2015
New Revision: 1658960

URL: http://svn.apache.org/r1658960
Log:
CELIX-215: Added curl init/cleanup to the launcher

To be able to use curl properly it has to be initialised once while no other threads are running.
With Celix this cannot be done in a bundle, so to prevent problems during runtime, the launcher
now calls init/cleanup.
While this is not yet conditional, it could definitely be made an option. Environments that
do not use Curl probably don't want a launcher that depends on it.

Modified:
    celix/trunk/launcher/CMakeLists.txt
    celix/trunk/launcher/private/src/launcher.c

Modified: celix/trunk/launcher/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/trunk/launcher/CMakeLists.txt?rev=1658960&r1=1658959&r2=1658960&view=diff
==============================================================================
--- celix/trunk/launcher/CMakeLists.txt (original)
+++ celix/trunk/launcher/CMakeLists.txt Wed Feb 11 13:53:23 2015
@@ -16,11 +16,14 @@
 # under the License.
 celix_subproject(LAUNCHER "Option to build the launcher" "ON" DEPS UTILS FRAMEWORK)
 if (LAUNCHER) 
+    find_package(CURL REQUIRED)
+    
     add_executable(celix private/src/launcher)
     
-    target_link_libraries(celix celix_framework)
+    target_link_libraries(celix celix_framework ${CURL_LIBRARIES})
     include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
     include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
+    include_directories("${CURL_INCLUDE_DIRS}")
     
     install(TARGETS celix RUNTIME DESTINATION bin COMPONENT framework)
 endif (LAUNCHER) 
\ No newline at end of file

Modified: celix/trunk/launcher/private/src/launcher.c
URL: http://svn.apache.org/viewvc/celix/trunk/launcher/private/src/launcher.c?rev=1658960&r1=1658959&r2=1658960&view=diff
==============================================================================
--- celix/trunk/launcher/private/src/launcher.c (original)
+++ celix/trunk/launcher/private/src/launcher.c Wed Feb 11 13:53:23 2015
@@ -30,6 +30,7 @@
 #include <libgen.h>
 #include <apr_general.h>
 #include <apr_strings.h>
+#include <curl/curl.h>
 
 #include "framework.h"
 #include "properties.h"
@@ -60,6 +61,9 @@ int main(int argc, char *argv[]) {
 
 	(void) signal(SIGINT, launcher_shutdown);
 
+	// Before doing anything else, let's setup Curl
+	curl_global_init(CURL_GLOBAL_NOTHING);
+
 	rv = apr_initialize();
     if (rv != APR_SUCCESS) {
         return CELIX_START_ERROR;
@@ -169,6 +173,9 @@ int main(int argc, char *argv[]) {
 	apr_pool_destroy(memoryPool);
 	apr_terminate();
 
+	// Cleanup Curl
+	curl_global_cleanup();
+
 	printf("Launcher: Exit\n");
 
     return 0;



Mime
View raw message