You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by ab...@apache.org on 2011/05/13 20:11:43 UTC

svn commit: r1102841 - in /incubator/celix/trunk: .cproject CMakeLists.txt celix Default.launch celix_test/CMakeLists.txt cmake/ cmake/modules/ cmake/modules/FindAPR.cmake cmake/modules/FindCUnit.cmake framework/CMakeLists.txt mongoose/activator.c

Author: abroekhuis
Date: Fri May 13 18:11:42 2011
New Revision: 1102841

URL: http://svn.apache.org/viewvc?rev=1102841&view=rev
Log:
Updated cmake files to use FindLibraries for some dependencies

Added:
    incubator/celix/trunk/cmake/
    incubator/celix/trunk/cmake/modules/
    incubator/celix/trunk/cmake/modules/FindAPR.cmake
    incubator/celix/trunk/cmake/modules/FindCUnit.cmake
Modified:
    incubator/celix/trunk/.cproject
    incubator/celix/trunk/CMakeLists.txt
    incubator/celix/trunk/celix Default.launch
    incubator/celix/trunk/celix_test/CMakeLists.txt
    incubator/celix/trunk/framework/CMakeLists.txt
    incubator/celix/trunk/mongoose/activator.c

Modified: incubator/celix/trunk/.cproject
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/.cproject?rev=1102841&r1=1102840&r2=1102841&view=diff
==============================================================================
--- incubator/celix/trunk/.cproject (original)
+++ incubator/celix/trunk/.cproject Fri May 13 18:11:42 2011
@@ -221,7 +221,7 @@
 		<buildTargets>
 			<target name="all" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
 				<buildCommand>make</buildCommand>
-				<buildArguments>-C /Users/alexanderb/Documents/Celix/celix/build</buildArguments>
+				<buildArguments>-C ${workspace_loc:/celix}/build</buildArguments>
 				<buildTarget>all</buildTarget>
 				<stopOnError>true</stopOnError>
 				<useDefaultCommand>false</useDefaultCommand>
@@ -229,7 +229,7 @@
 			</target>
 			<target name="deploy" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
 				<buildCommand>make</buildCommand>
-				<buildArguments>-C /Users/alexanderb/Documents/workspace-c/celix/build</buildArguments>
+				<buildArguments>-C ${workspace_loc:/celix}/build</buildArguments>
 				<buildTarget>deploy</buildTarget>
 				<stopOnError>true</stopOnError>
 				<useDefaultCommand>true</useDefaultCommand>

Modified: incubator/celix/trunk/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/CMakeLists.txt?rev=1102841&r1=1102840&r2=1102841&view=diff
==============================================================================
--- incubator/celix/trunk/CMakeLists.txt (original)
+++ incubator/celix/trunk/CMakeLists.txt Fri May 13 18:11:42 2011
@@ -16,10 +16,12 @@
 # under the License.
 
 cmake_minimum_required (VERSION 2.6)
-project (Celix)
+project (Celix C)
 
 #SET(CMAKE_VERBOSE_MAKEFILE ON)
 
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
+
 SET(CMAKE_BUILD_TYPE "Debug")
 SET(CMAKE_C_FLAGS "-std=c99")
 SET(CMAKE_C_FLAGS "-D_GNU_SOURCE")
@@ -34,8 +36,8 @@ ADD_CUSTOM_TARGET(install-fw
 
 include_directories("framework/private/include")
 include_directories("framework/public/include")
-include_directories("/opt/local/include")
-link_directories("/opt/local/lib")
+#include_directories("/opt/local/include")
+#link_directories("/opt/local/lib")
 
 add_subdirectory(utils)
 add_subdirectory(framework)
@@ -44,7 +46,7 @@ add_subdirectory(framework)
 include(Packaging.cmake)
 #add_subdirectory(dependency_manager)
 add_subdirectory(launcher)
-#add_subdirectory(test)
+add_subdirectory(test)
 
 add_subdirectory(shell)
 add_subdirectory(shell_tui)
@@ -60,7 +62,7 @@ add_subdirectory(mongoose)
 #add_subdirectory(whiteboard)
 #add_subdirectory(echo_service)
 
-#add_subdirectory(celix_test)
+add_subdirectory(celix_test)
 
 include(target.cmake)
 enable_testing()
\ No newline at end of file

Modified: incubator/celix/trunk/celix Default.launch
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/celix%20Default.launch?rev=1102841&r1=1102840&r2=1102841&view=diff
==============================================================================
--- incubator/celix/trunk/celix Default.launch (original)
+++ incubator/celix/trunk/celix Default.launch Fri May 13 18:11:42 2011
@@ -42,7 +42,7 @@
 <intAttribute key="org.eclipse.linuxtools.valgrind.launch.GENERAL_NUMCALLERS" value="12"/>
 <listAttribute key="org.eclipse.linuxtools.valgrind.launch.GENERAL_SUPPFILES"/>
 <booleanAttribute key="org.eclipse.linuxtools.valgrind.launch.GENERAL_TRACECHILD" value="true"/>
-<stringAttribute key="org.eclipse.linuxtools.valgrind.launch.OUTPUT_DIR" value="/Users/alexanderb/Documents/Celix/.metadata/.plugins/org.eclipse.linuxtools.valgrind.launch"/>
+<stringAttribute key="org.eclipse.linuxtools.valgrind.launch.OUTPUT_DIR" value="/Users/alexander/Documents/Projects/Celix/.metadata/.plugins/org.eclipse.linuxtools.valgrind.launch"/>
 <stringAttribute key="org.eclipse.linuxtools.valgrind.launch.TOOL" value="org.eclipse.linuxtools.valgrind.launch.memcheck"/>
 <booleanAttribute key="org.eclipse.linuxtools.valgrind.massif.MASSIF_ALIGNMENT_BOOL" value="false"/>
 <intAttribute key="org.eclipse.linuxtools.valgrind.massif.MASSIF_ALIGNMENT_VAL" value="0"/>

Modified: incubator/celix/trunk/celix_test/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/celix_test/CMakeLists.txt?rev=1102841&r1=1102840&r2=1102841&view=diff
==============================================================================
--- incubator/celix/trunk/celix_test/CMakeLists.txt (original)
+++ incubator/celix/trunk/celix_test/CMakeLists.txt Fri May 13 18:11:42 2011
@@ -15,23 +15,24 @@
 # specific language governing permissions and limitations
 # under the License.
 
+include(FindCUnit)
+
 include_directories("${PROJECT_SOURCE_DIR}/celix")
-include_directories("/opt/local/include")
+include_directories(${CUNIT_INCLUDE_DIRS})
 include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 include_directories("${PROJECT_SOURCE_DIR}/utils/private/include")
-link_directories("/opt/local/lib")
 
 add_executable(hash_map_test hash_map_test.c)
-target_link_libraries(hash_map_test framework cunit ncurses)
+target_link_libraries(hash_map_test framework ${CUNIT_LIBRARIES})
 
 add_executable(hash_map_test_hash hash_map_test_hash.c)
-target_link_libraries(hash_map_test_hash framework cunit ncurses)
+target_link_libraries(hash_map_test_hash framework ${CUNIT_LIBRARIES})
 
 add_executable(array_list_test array_list_test.c)
-target_link_libraries(array_list_test framework cunit ncurses)
+target_link_libraries(array_list_test framework ${CUNIT_LIBRARIES})
 
 add_executable(framework_test framework_test.c)
-target_link_libraries(framework_test framework cunit ncurses)
+target_link_libraries(framework_test framework ${CUNIT_LIBRARIES})
 
 enable_testing()
 #add_test (tester ${EXECUTABLE_OUTPUT_PATH}/tester)

Added: incubator/celix/trunk/cmake/modules/FindAPR.cmake
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/cmake/modules/FindAPR.cmake?rev=1102841&view=auto
==============================================================================
--- incubator/celix/trunk/cmake/modules/FindAPR.cmake (added)
+++ incubator/celix/trunk/cmake/modules/FindAPR.cmake Fri May 13 18:11:42 2011
@@ -0,0 +1,94 @@
+# -*- cmake -*-
+
+# - Find Apache Portable Runtime
+# Find the APR includes and libraries
+# This module defines
+#  APR_INCLUDE_DIR and APRUTIL_INCLUDE_DIR, where to find apr.h, etc.
+#  APR_LIBRARIES and APRUTIL_LIBRARIES, the libraries needed to use APR.
+#  APR_FOUND and APRUTIL_FOUND, If false, do not try to use APR.
+# also defined, but not for general use are
+#  APR_LIBRARY and APRUTIL_LIBRARY, where to find the APR library.
+
+# APR first.
+
+FIND_PATH(APR_INCLUDE_DIR apr.h
+/usr/local/include/apr-1
+/usr/local/include/apr-1.0
+/usr/include/apr-1
+/usr/include/apr-1.0
+)
+
+SET(APR_NAMES ${APR_NAMES} apr-1)
+FIND_LIBRARY(APR_LIBRARY
+  NAMES ${APR_NAMES}
+  PATHS /usr/lib /usr/local/lib
+  )
+
+IF (APR_LIBRARY AND APR_INCLUDE_DIR)
+    SET(APR_LIBRARIES ${APR_LIBRARY})
+    SET(APR_FOUND "YES")
+ELSE (APR_LIBRARY AND APR_INCLUDE_DIR)
+  SET(APR_FOUND "NO")
+ENDIF (APR_LIBRARY AND APR_INCLUDE_DIR)
+
+
+IF (APR_FOUND)
+   IF (NOT APR_FIND_QUIETLY)
+      MESSAGE(STATUS "Found APR: ${APR_LIBRARIES}")
+   ENDIF (NOT APR_FIND_QUIETLY)
+ELSE (APR_FOUND)
+   IF (APR_FIND_REQUIRED)
+      MESSAGE(FATAL_ERROR "Could not find APR library")
+   ENDIF (APR_FIND_REQUIRED)
+ENDIF (APR_FOUND)
+
+# Deprecated declarations.
+SET (NATIVE_APR_INCLUDE_PATH ${APR_INCLUDE_DIR} )
+GET_FILENAME_COMPONENT (NATIVE_APR_LIB_PATH ${APR_LIBRARY} PATH)
+
+MARK_AS_ADVANCED(
+  APR_LIBRARY
+  APR_INCLUDE_DIR
+  )
+
+# Next, APRUTIL.
+
+FIND_PATH(APRUTIL_INCLUDE_DIR apu.h
+/usr/local/include/apr-1
+/usr/local/include/apr-1.0
+/usr/include/apr-1
+/usr/include/apr-1.0
+)
+
+SET(APRUTIL_NAMES ${APRUTIL_NAMES} aprutil-1)
+FIND_LIBRARY(APRUTIL_LIBRARY
+  NAMES ${APRUTIL_NAMES}
+  PATHS /usr/lib /usr/local/lib
+  )
+
+IF (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR)
+    SET(APRUTIL_LIBRARIES ${APRUTIL_LIBRARY})
+    SET(APRUTIL_FOUND "YES")
+ELSE (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR)
+  SET(APRUTIL_FOUND "NO")
+ENDIF (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR)
+
+
+IF (APRUTIL_FOUND)
+   IF (NOT APRUTIL_FIND_QUIETLY)
+      MESSAGE(STATUS "Found APRUTIL: ${APRUTIL_LIBRARIES}")
+   ENDIF (NOT APRUTIL_FIND_QUIETLY)
+ELSE (APRUTIL_FOUND)
+   IF (APRUTIL_FIND_REQUIRED)
+      MESSAGE(FATAL_ERROR "Could not find APRUTIL library")
+   ENDIF (APRUTIL_FIND_REQUIRED)
+ENDIF (APRUTIL_FOUND)
+
+# Deprecated declarations.
+SET (NATIVE_APRUTIL_INCLUDE_PATH ${APRUTIL_INCLUDE_DIR} )
+GET_FILENAME_COMPONENT (NATIVE_APRUTIL_LIB_PATH ${APRUTIL_LIBRARY} PATH)
+
+MARK_AS_ADVANCED(
+  APRUTIL_LIBRARY
+  APRUTIL_INCLUDE_DIR
+  )
\ No newline at end of file

Added: incubator/celix/trunk/cmake/modules/FindCUnit.cmake
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/cmake/modules/FindCUnit.cmake?rev=1102841&view=auto
==============================================================================
--- incubator/celix/trunk/cmake/modules/FindCUnit.cmake (added)
+++ incubator/celix/trunk/cmake/modules/FindCUnit.cmake Fri May 13 18:11:42 2011
@@ -0,0 +1,42 @@
+#
+# Find the CppUnit includes and library
+#
+# This module defines
+# CPPUNIT_INCLUDE_DIR, where to find tiff.h, etc.
+# CPPUNIT_LIBRARIES, the libraries to link against to use CppUnit.
+# CPPUNIT_FOUND, If false, do not try to use CppUnit.
+
+# also defined, but not for general use are
+# CPPUNIT_LIBRARY, where to find the CppUnit library.
+# CPPUNIT_DEBUG_LIBRARY, where to find the CppUnit library in debug mode.
+
+include(FindCurses)
+
+FIND_PATH(CUNIT_INCLUDE_DIR CUnit/Basic.h
+  /usr/local/include
+  /usr/include
+  /opt/local/include  
+)
+
+# On unix system, debug and release have the same name
+FIND_LIBRARY(CUNIT_LIBRARY cunit
+             ${CUNIT_INCLUDE_DIR}/../lib
+             /usr/local/lib
+             /usr/lib
+             )
+FIND_LIBRARY(CUNIT_DEBUG_LIBRARY cunit
+             ${CUNIT_INCLUDE_DIR}/../lib
+             /usr/local/lib
+             /usr/lib
+             )
+
+IF(CUNIT_INCLUDE_DIR)
+  IF(CUNIT_LIBRARY)
+    SET(CUNIT_FOUND "YES")
+    SET(CUNIT_LIBRARIES ${CUNIT_LIBRARY} ${CURSES_LIBRARY})
+    SET(CUNIT_DEBUG_LIBRARIES ${CUNIT_DEBUG_LIBRARY} ${CURSES_DEBUG_LIBRARY})
+  ENDIF(CUNIT_LIBRARY)
+  IF(CUNIT_INCLUDE_DIR)
+    SET(CUNIT_INCLUDE_DIRS ${CUNIT_INCLUDE_DIR} ${CURSES_INCLUDE_DIR})
+  ENDIF(CUNIT_INCLUDE_DIR)
+ENDIF(CUNIT_INCLUDE_DIR)

Modified: incubator/celix/trunk/framework/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/CMakeLists.txt?rev=1102841&r1=1102840&r2=1102841&view=diff
==============================================================================
--- incubator/celix/trunk/framework/CMakeLists.txt (original)
+++ incubator/celix/trunk/framework/CMakeLists.txt Fri May 13 18:11:42 2011
@@ -16,11 +16,22 @@
 # under the License.
 cmake_minimum_required(VERSION 2.8)
 
+include(FindZLIB)
+include(FindAPR)
+
+IF(ZLIB_FOUND)
+	MESSAGE(STATUS "Looking for Foo - found")
+ELSE(ZLIB_FOUND)
+	MESSAGE(FATAL_ERROR "Looking for Foo - not found")
+ENDIF(ZLIB_FOUND)
+
+
+
 add_definitions(-DUSE_FILE32API)
 aux_source_directory("private/src" SRC)
 include_directories("private/include")
 include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 add_library(framework SHARED ${SRC})
-target_link_libraries(framework utils z apr-1 curl)
+target_link_libraries(framework utils ${ZLIB_LIBRARY} apr-1 curl)
 
 install(TARGETS framework LIBRARY DESTINATION lib COMPONENT framework)

Modified: incubator/celix/trunk/mongoose/activator.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/mongoose/activator.c?rev=1102841&r1=1102840&r2=1102841&view=diff
==============================================================================
--- incubator/celix/trunk/mongoose/activator.c (original)
+++ incubator/celix/trunk/mongoose/activator.c Fri May 13 18:11:42 2011
@@ -51,9 +51,9 @@ celix_status_t bundleActivator_start(voi
 		"document_root", entry,
 		NULL
 	};
-	struct mg_context *ctx = mg_start(NULL, options);
+	data->ctx = mg_start(NULL, options);
 
-	printf("Mongoose startet: %p\n", ctx);
+	printf("Mongoose startet: %p\n", data->ctx);
 
 	return CELIX_SUCCESS;
 }