Author: abroekhuis
Date: Tue Feb  5 16:16:21 2013
New Revision: 1442644

URL: http://svn.apache.org/viewvc?rev=1442644&view=rev
Log:
CELIX-42: Several small updates for Win32 support

Added a CMake script to generate VS user project files for the deploy targets. 
This makes it possible to run those targets from within VS, i.e. for debugging.

Added:
    incubator/celix/trunk/cmake/vcxproj.user.in
Modified:
    incubator/celix/trunk/cmake/Packaging.cmake
    incubator/celix/trunk/examples/echo_service/client/private/src/echo_client.c
    
incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/CMakeLists.txt
    incubator/celix/trunk/framework/private/src/framework.c
    incubator/celix/trunk/framework/private/src/version.c
    incubator/celix/trunk/framework/private/src/wire.c

Modified: incubator/celix/trunk/cmake/Packaging.cmake
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/cmake/Packaging.cmake?rev=1442644&r1=1442643&r2=1442644&view=diff
==============================================================================
--- incubator/celix/trunk/cmake/Packaging.cmake (original)
+++ incubator/celix/trunk/cmake/Packaging.cmake Tue Feb  5 16:16:21 2013
@@ -24,7 +24,7 @@ ENDIF(NOT CPACK_COMMAND)
 
 find_program(JAR_COMMAND jar)
 if(JAR_COMMAND)
-       message("Using JAR to repack bundles, bundles can be used by Apache 
ACE")
+       message(STATUS "Using JAR to repack bundles, bundles can be used by 
Apache ACE")
 else(JAR_COMMAND)
     message("No JAR support, generated bundles are not usable for Apache ACE")
 endif(JAR_COMMAND)
@@ -151,38 +151,54 @@ MACRO(deploy)
        DEPENDS ${DEPS} celix
        COMMENT "Deploy target ${DEPLOY_NAME}")
     ADD_DEPENDENCIES(deploy ${__deployTarget})
+    
+    GET_DIRECTORY_PROPERTY(PROPS ADDITIONAL_MAKE_CLEAN_FILES)
+       SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES 
"${PROPS};${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/bundles")
        
        CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/cmake/config.properties.in 
${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/config.properties @ONLY)
        
-       set(FW_PATH ${CMAKE_BINARY_DIR}/framework)
-       set(UTILS_PATH ${CMAKE_BINARY_DIR}/utils)
-       set(LAUNCHER ${CMAKE_BINARY_DIR}/launcher/celix)
-       
        IF(UNIX)
-         IF(APPLE)
-           set(LIBRARY_PATH DYLD_LIBRARY_PATH)
-         ELSE(APPLE)
-           set(LIBRARY_PATH LD_LIBRARY_PATH)
-         ENDIF(APPLE)
+               set(FW_PATH ${CMAKE_BINARY_DIR}/framework)
+               set(UTILS_PATH ${CMAKE_BINARY_DIR}/utils)
+               set(LAUNCHER ${CMAKE_BINARY_DIR}/launcher/celix)
+               
+               IF(UNIX)
+                 IF(APPLE)
+                   set(LIBRARY_PATH DYLD_LIBRARY_PATH)
+                 ELSE(APPLE)
+                   set(LIBRARY_PATH LD_LIBRARY_PATH)
+                 ENDIF(APPLE)
+               ENDIF(UNIX)
+       
+               CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/cmake/run.sh.in 
${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/run.sh @ONLY)
+
+               # Generate an Eclipse launch file to be able to run the 
deployment from Eclipse 
+               # Linux/unix is assumed since we do only support VS on windows
+               string(REPLACE "/" ";" LIST ${PROJECT_BINARY_DIR})
+               list(LENGTH LIST len)
+               MATH(EXPR test "${len} - 1")
+               LIST(GET LIST ${test} last)
+       
+               SET(CONTAINER_NAME ${DEPLOY_NAME})
+               SET(PROGRAM_NAME ${LAUNCHER})
+               SET(PROJECT_ATTR ${last})
+               SET(WORKING_DIRECTORY 
"${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/")
+               
+               CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/cmake/RunConfig.in 
${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/${DEPLOY_NAME}.launch @ONLY)
        ENDIF(UNIX)
        
-       CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/cmake/run.sh.in 
${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/run.sh @ONLY)
-       
-       GET_DIRECTORY_PROPERTY(PROPS ADDITIONAL_MAKE_CLEAN_FILES)
-       SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES 
"${PROPS};${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/bundles")
-       
-       # Generate an Eclipse launch file to be able to run the deployment from 
Eclipse 
-       string(REPLACE "/" ";" LIST ${PROJECT_BINARY_DIR})
-       list(LENGTH LIST len)
-       MATH(EXPR test "${len} - 1")
-       LIST(GET LIST ${test} last)
-
-       SET(CONTAINER_NAME ${DEPLOY_NAME})
-       SET(PROGRAM_NAME ${LAUNCHER})
-       SET(PROJECT_ATTR ${last})
-       SET(WORKING_DIRECTORY 
"${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/")
-       
-       CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/cmake/RunConfig.in 
${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/${DEPLOY_NAME}.launch @ONLY)
+       IF(WIN32)
+               GET_FILENAME_COMPONENT(apr_path ${APR_LIBRARY} PATH)
+               GET_FILENAME_COMPONENT(aprutil_path ${APRUTIL_LIBRARY} PATH)
+               GET_FILENAME_COMPONENT(zlib_path ${ZLIB_LIBRARY} PATH)
+               GET_FILENAME_COMPONENT(curl_path ${CURL_LIBRARY} PATH)
+               SET(celixutils_path 
"${PROJECT_BINARY_DIR}/utils/${CMAKE_BUILD_TYPE}")
+               SET(celixframework_path 
"${PROJECT_BINARY_DIR}/framework/${CMAKE_BUILD_TYPE}")
+               
+               SET(PATH 
"%PATH%;${apr_path};${aprutil_path};${zlib_path};${curl_path};${celixutils_path};${celixframework_path}")
+               
+               CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/cmake/vcxproj.user.in 
${CMAKE_CURRENT_BINARY_DIR}/deploy_${DEPLOY_NAME}.vcxproj.user @ONLY)
+       ENDIF(WIN32)
 ENDMACRO(deploy)
 
 # macro for scanning subdirectories for deploy.cmake files

Added: incubator/celix/trunk/cmake/vcxproj.user.in
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/cmake/vcxproj.user.in?rev=1442644&view=auto
==============================================================================
--- incubator/celix/trunk/cmake/vcxproj.user.in (added)
+++ incubator/celix/trunk/cmake/vcxproj.user.in Tue Feb  5 16:16:21 2013
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" 
xmlns="http://schemas.microsoft.com/developer/msbuild/2003";>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    
<LocalDebuggerCommand>$(MSBuildProjectDirectory)\launcher\$(Configuration)\celix.exe</LocalDebuggerCommand>
+    
<LocalDebuggerWorkingDirectory>$(ProjectDir)\deploy\@DEPLOY_NAME@</LocalDebuggerWorkingDirectory>
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+    <LocalDebuggerEnvironment>PATH=@PATH@
+$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>
+  </PropertyGroup>
+</Project>
\ No newline at end of file

Modified: 
incubator/celix/trunk/examples/echo_service/client/private/src/echo_client.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/examples/echo_service/client/private/src/echo_client.c?rev=1442644&r1=1442643&r2=1442644&view=diff
==============================================================================
--- 
incubator/celix/trunk/examples/echo_service/client/private/src/echo_client.c 
(original)
+++ 
incubator/celix/trunk/examples/echo_service/client/private/src/echo_client.c 
Tue Feb  5 16:16:21 2013
@@ -59,8 +59,9 @@ void echoClient_start(ECHO_CLIENT client
 }
 
 void echoClient_stop(ECHO_CLIENT client) {
+       apr_status_t status;
        client->running = false;
-       apr_thread_join(APR_SUCCESS, client->sender);
+       apr_thread_join(&status, client->sender);
 }
 
 void echoClient_destroy(ECHO_CLIENT client) {

Modified: 
incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/CMakeLists.txt
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/CMakeLists.txt?rev=1442644&r1=1442643&r2=1442644&view=diff
==============================================================================
--- 
incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/CMakeLists.txt
 (original)
+++ 
incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/CMakeLists.txt
 Tue Feb  5 16:16:21 2013
@@ -25,7 +25,6 @@ include_directories(
        ../simple/public/include
 )
 
-message(GTK: ${GLIB_INCLUDE_DIRS})
 include_directories(${GTK_INCLUDE_DIRS})
 include_directories(${GLIB_INCLUDE_DIRS})
 include_directories(${GTHR_INCLUDE_DIRS})

Modified: incubator/celix/trunk/framework/private/src/framework.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/framework.c?rev=1442644&r1=1442643&r2=1442644&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/framework.c (original)
+++ incubator/celix/trunk/framework/private/src/framework.c Tue Feb  5 16:16:21 
2013
@@ -311,6 +311,14 @@ typedef void (*start_function_t)(void * 
 typedef void (*stop_function_t)(void * handle, bundle_context_t context);
 typedef void (*destroy_function_t)(void * handle, bundle_context_t context);
 
+#ifdef _WIN32
+HMODULE fw_getCurrentModule() {
+       HMODULE hModule = NULL;
+       GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, 
(LPCTSTR)fw_getCurrentModule, &hModule);
+       return hModule;
+}
+#endif
+
 celix_status_t fw_init(framework_t framework) {
        celix_status_t status = framework_acquireBundleLock(framework, 
framework->bundle, 
BUNDLE_INSTALLED|BUNDLE_RESOLVED|BUNDLE_STARTING|BUNDLE_ACTIVE);
        bundle_state_e state;
@@ -374,10 +382,11 @@ celix_status_t fw_init(framework_t frame
            return status;
        } else {
 #ifdef _WIN32
-               HMODULE this_process;
+               HMODULE handle = NULL;
+#else
+               void * handle = NULL;
 #endif
         unsigned int arcIdx;
-               void * handle;
                bundle_context_t context = NULL;
                ACTIVATOR activator;
 
@@ -406,8 +415,7 @@ celix_status_t fw_init(framework_t frame
         apr_thread_cond_create(&framework->shutdownGate, framework->mp);
 
 #ifdef _WIN32
-               GetModuleHandleEx(0,0,&this_process);
-               handle = GetModuleHandle(0);
+        handle = fw_getCurrentModule();
 #else
         handle = dlopen(NULL, RTLD_LAZY|RTLD_LOCAL);
 #endif

Modified: incubator/celix/trunk/framework/private/src/version.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/version.c?rev=1442644&r1=1442643&r2=1442644&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/version.c (original)
+++ incubator/celix/trunk/framework/private/src/version.c Tue Feb  5 16:16:21 
2013
@@ -41,7 +41,7 @@ struct version {
        char *qualifier;
 };
 
-static apr_status_t version_destroy(void *version);
+static apr_status_t version_destroy(void *handle);
 
 celix_status_t version_createVersion(apr_pool_t *pool, int major, int minor, 
int micro, char * qualifier, version_t *version) {
        celix_status_t status = CELIX_SUCCESS;
@@ -97,8 +97,8 @@ celix_status_t version_clone(version_t v
        return version_createVersion(pool, version->major, version->minor, 
version->micro, version->qualifier, clone);
 }
 
-apr_status_t version_destroy(void *versionP) {
-       version_t version = versionP;
+apr_status_t version_destroy(void *handle) {
+       version_t version = (version_t) handle;
        version->major = 0;
        version->minor = 0;
        version->micro = 0;

Modified: incubator/celix/trunk/framework/private/src/wire.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/wire.c?rev=1442644&r1=1442643&r2=1442644&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/wire.c (original)
+++ incubator/celix/trunk/framework/private/src/wire.c Tue Feb  5 16:16:21 2013
@@ -35,7 +35,7 @@ struct wire {
        capability_t capability;
 };
 
-apr_status_t wire_destroy(void *wireP);
+apr_status_t wire_destroy(void *handle);
 
 celix_status_t wire_create(apr_pool_t *pool, module_t importer, requirement_t 
requirement,
                module_t exporter, capability_t capability, wire_t *wire) {
@@ -56,8 +56,8 @@ celix_status_t wire_create(apr_pool_t *p
        return status;
 }
 
-apr_status_t wire_destroy(void *wireP) {
-       wire_t wire = wireP;
+apr_status_t wire_destroy(void *handle) {
+       wire_t wire = (wire_t) handle;
        wire->importer = NULL;
        wire->requirement = NULL;
        wire->exporter = NULL;


Reply via email to