changeset 583:7d431a751d6c

Added the ALL_EXTENSIONS build option; and simplified some CMakeFile directives
author Sebastien Decugis <sdecugis@nict.go.jp>
date Thu, 28 Oct 2010 12:59:03 +0900
parents 6e0b82b5977d
children 15b59f928383
files contrib/nightly_tests/allext.conf extensions/CMakeLists.txt extensions/app_diameap/plugins/CMakeLists.txt extensions/app_radgw/CMakeLists.txt
diffstat 4 files changed, 81 insertions(+), 128 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/nightly_tests/allext.conf	Wed Oct 27 14:21:47 2010 +0900
+++ b/contrib/nightly_tests/allext.conf	Thu Oct 28 12:59:03 2010 +0900
@@ -5,22 +5,6 @@
 set(WITH_COVERAGE TRUE)
 set(CTEST_BUILD_NAME "All extensions")
 
-set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DBUILD_ACL_WL:BOOL=ON")
-set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DBUILD_APP_ACCT:BOOL=ON -DTEST_APP_ACCT:BOOL=ON -DTEST_APP_ACCT_CONNINFO:STRING=user=test\\ dbname=test")
-set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DBUILD_APP_DIAMEAP:BOOL=ON -DBUILD_EAP_IDENTITY:BOOL=ON -DBUILD_EAP_MD5:BOOL=ON -DBUILD_EAP_TLS:BOOL=ON")
-set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DBUILD_APP_RADGW:BOOL=ON")
-set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DBUILD_APP_SIP:BOOL=ON")
-set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DBUILD_DBG_MONITOR:BOOL=ON")
-set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DBUILD_DBG_RT:BOOL=ON")
-set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DBUILD_DICT_EAP:BOOL=ON")
-set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DBUILD_DICT_NASREQ:BOOL=ON")
-set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DBUILD_DICT_SIP:BOOL=ON")
-set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DBUILD_RGWX_ACCT:BOOL=ON")
-set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DBUILD_RGWX_AUTH:BOOL=ON")
-set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DBUILD_RGWX_DEBUG:BOOL=ON")
-set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DBUILD_RGWX_ECHODROP:BOOL=ON")
-set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DBUILD_RGWX_SAMPLE:BOOL=ON")
-set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DBUILD_RT_DEFAULT:BOOL=ON")
-set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DBUILD_TEST_APP:BOOL=ON")
-set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DBUILD_TEST_SIP:BOOL=ON")
+set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DALL_EXTENSIONS:BOOL=ON")
+set(CTEST_BUILD_OPTIONS "${CTEST_BUILD_OPTIONS} -DTEST_APP_ACCT_CONNINFO:STRING=user=test\\ dbname=test")
 
--- a/extensions/CMakeLists.txt	Wed Oct 27 14:21:47 2010 +0900
+++ b/extensions/CMakeLists.txt	Thu Oct 28 12:59:03 2010 +0900
@@ -12,6 +12,20 @@
   SET_TARGET_PROPERTIES(${EXTNAME} PROPERTIES SUFFIX ".fdx" )
 ENDMACRO(FD_ADD_EXTENSION)
 
+# Use the macro FD_EXTENSION_SUBDIR(extmacroname subdir descr default) to 
+# add a new extension subdirectory.
+MACRO(FD_EXTENSION_SUBDIR EXTSUBDIR EXTDESCR EXTDEFAULT)
+   STRING(TOUPPER ${EXTSUBDIR} EXTMACRONAME)
+   IF (NOT ALL_EXTENSIONS)
+     OPTION(BUILD_${EXTMACRONAME} "Build ${EXTSUBDIR}.fdx? (${EXTDESCR})" ${EXTDEFAULT})
+   ENDIF (NOT ALL_EXTENSIONS)
+   IF (BUILD_${EXTMACRONAME} OR ALL_EXTENSIONS)
+      SUBDIRS(${EXTSUBDIR})
+   ENDIF (BUILD_${EXTMACRONAME} OR ALL_EXTENSIONS)
+ENDMACRO(FD_EXTENSION_SUBDIR)
+
+OPTION(ALL_EXTENSIONS "Build ALL available extensions? (disable to select individual components)" OFF)
+
 # The extensions include the headers of freeDiameter that contains gnutls objects
 FIND_PACKAGE(GnuTLS REQUIRED)
 INCLUDE_DIRECTORIES(${GNUTLS_INCLUDE_DIR})
@@ -22,114 +36,53 @@
 MARK_AS_ADVANCED(GCRYPT_INCLUDE_DIR)
 INCLUDE_DIRECTORIES(${GCRYPT_INCLUDE_DIR})
 
+
 ###########################
 # Extensions section
 
 ####
-# Diameter applications dictionary
-
-OPTION(BUILD_DICT_NASREQ "Build NASREQ (RFC4005) Dictionary definitions?" ON)
-	IF (BUILD_DICT_NASREQ)
-	   SUBDIRS(dict_nasreq)
-	ENDIF (BUILD_DICT_NASREQ)
+# Diameter applications dictionaries
 
-OPTION(BUILD_DICT_EAP "Build Diameter EAP (RFC4072) Dictionary definitions?" ON)
-	IF (BUILD_DICT_EAP)
-	   SUBDIRS(dict_eap)
-	ENDIF (BUILD_DICT_EAP)
-
-OPTION(BUILD_DICT_SIP "Build Diameter SIP (RFC4740) Dictionary definitions?" ON)
-	IF (BUILD_DICT_SIP)
-	   SUBDIRS(dict_sip)
-	ENDIF (BUILD_DICT_SIP)
-
+FD_EXTENSION_SUBDIR(dict_nasreq "NASREQ (RFC4005) Dictionary definitions?"       ON)
+FD_EXTENSION_SUBDIR(dict_eap    "Diameter EAP (RFC4072) Dictionary definitions?" ON)
+FD_EXTENSION_SUBDIR(dict_sip    "Diameter SIP (RFC4740) Dictionary definitions?" ON)
 
 
 ####
 # Diameter applications
 
-OPTION(BUILD_APP_RADGW "Build app_radgw? (one-way RADIUS/Diameter gateway - RADIUS NAS <-> Diameter server)" OFF)
-	IF (BUILD_APP_RADGW)
-	   SUBDIRS(app_radgw)
-	ENDIF (BUILD_APP_RADGW)
-
-OPTION(BUILD_APP_ACCT "Build app_acct? (simple accounting application that stores accounting records in flat database)" OFF)
-	IF (BUILD_APP_ACCT)
-	   SUBDIRS(app_acct)
-	ENDIF (BUILD_APP_ACCT)
+FD_EXTENSION_SUBDIR(app_acct    "Simple accounting application that stores accounting records in flat database" OFF)
+FD_EXTENSION_SUBDIR(app_diameap "Diameter EAP Application server (RFC 4072)" 					OFF)
+FD_EXTENSION_SUBDIR(app_radgw   "RADIUS/Diameter gateway translation - RADIUS client to Diameter server" 	OFF)
+FD_EXTENSION_SUBDIR(app_sip     "Diameter SIP Authentication and Authorization server (RFC 4740)" 		OFF)
 
-OPTION(BUILD_APP_SIP "Build app_sip? (Authentication and Authorization for Diameter SIP RFC4740)" OFF)
-	IF (BUILD_APP_SIP)
-	   SUBDIRS(app_sip)
-	ENDIF (BUILD_APP_SIP)
-
-OPTION(BUILD_APP_DIAMEAP "Build app_diameap? (Diameter EAP Application - RFC 4072 )" OFF)
-	IF (BUILD_APP_DIAMEAP)
-	   SUBDIRS(app_diameap)
-	ENDIF (BUILD_APP_DIAMEAP)
 
 ####
 # Routing extensions
 
-OPTION(BUILD_RT_DEFAULT "Build rt_default? (Configurable routing rules for freeDiameter)" ON)
-	IF (BUILD_RT_DEFAULT)
-	   SUBDIRS(rt_default)
-	ENDIF (BUILD_RT_DEFAULT)
-
-OPTION(BUILD_RT_EREG "Build rt_ereg? (Configurable routing based on regexp matching of AVP values)" OFF)
-	IF (BUILD_RT_EREG)
-	   SUBDIRS(rt_ereg)
-	ENDIF (BUILD_RT_EREG)
+FD_EXTENSION_SUBDIR(rt_default "Configurable routing rules for freeDiameter" 		     ON)
+FD_EXTENSION_SUBDIR(rt_ereg    "Configurable routing based on regexp matching of AVP values" OFF)
 
 
 ####
 # Peers security extensions
 
-OPTION(BUILD_ACL_WL "Build acl_wl? (White-list of remote connecting peers)" ON)
-	IF (BUILD_ACL_WL)
-		SUBDIRS(acl_wl)
- 	ENDIF (BUILD_ACL_WL)
-
+FD_EXTENSION_SUBDIR(acl_wl "White-list based authorization of incoming connections" ON)
 
 
 ####
 # Debug & test extensions
 
-OPTION(BUILD_DBG_MONITOR "Build dbg_monitor.fdx? (display periodical debug information on the console)" OFF)
-	IF (BUILD_DBG_MONITOR)
-	   SUBDIRS(dbg_monitor)
-	ENDIF (BUILD_DBG_MONITOR)
-
-OPTION(BUILD_DBG_RT "Build dbg_rt.fdx? (Routing extension for debugging the routing module)" OFF)
- 	IF (BUILD_DBG_RT)
- 	   SUBDIRS(dbg_rt)
- 	ENDIF (BUILD_DBG_RT)
+FD_EXTENSION_SUBDIR(dbg_monitor "Outputs periodical status information"              OFF)
+FD_EXTENSION_SUBDIR(dbg_rt      "Routing extension for debugging the routing module" OFF)
+FD_EXTENSION_SUBDIR(test_app    "Testing application to send dummy message to another peer, like a Diameter 'ping'" OFF)
+FD_EXTENSION_SUBDIR(test_sip    "Testing application to simulate Diameter-SIP client (RFC4740)" OFF)
 
-OPTION(BUILD_TEST_APP "Build test_app.fdx? (Testing application to send dummy message to another peer, for testing purpose only)" OFF)
- 	IF (BUILD_TEST_APP)
- 	   SUBDIRS(test_app)
- 	ENDIF (BUILD_TEST_APP)
 
-OPTION(BUILD_TEST_SIP "Build test_sip.fdx? (Testing application to simulate Diameter-SIP client (RFC4740), for testing purpose only)" OFF)
- 	IF (BUILD_TEST_SIP)
- 	   SUBDIRS(test_sip)
- 	ENDIF (BUILD_TEST_SIP)
- 	
 # The following extension have very little use except for specific tests, so we disable them except in Debug configurations.
 IF (CMAKE_BUILD_TYPE MATCHES "Debug")
-	OPTION(BUILD_SAMPLE "Build sample.fdx? (Simple extension to demonstrate extension mechanism, for developpers only)" OFF)
-		IF (BUILD_SAMPLE)
-		   SUBDIRS(_sample)
-		ENDIF (BUILD_SAMPLE)
-
-	OPTION(BUILD_TEST_ACCT "Build test_acct.fdx? (Receive Accounting-Requests and display the data, but no storage)" OFF)
-		IF (BUILD_TEST_ACCT)
-		   SUBDIRS(test_acct)
-		ENDIF (BUILD_TEST_ACCT)
-		
-	OPTION(BUILD_TEST_RT_ANY "Build test_rt_any.fdx? (Routing extension randomly sending message to any peer available, for testing purpose only)" OFF)
- 		IF (BUILD_TEST_RT_ANY)
- 		   SUBDIRS(test_rt_any)
- 		ENDIF (BUILD_TEST_RT_ANY)
+	FD_EXTENSION_SUBDIR(_sample     "Simple extension to demonstrate extension mechanism, for developpers" OFF)
+	FD_EXTENSION_SUBDIR(test_acct   "Receive Accounting-Requests and display the data, but no storage" OFF)
+	FD_EXTENSION_SUBDIR(test_rt_any "Routing extension randomly sending message to any peer available, for testing purpose" OFF)
 ENDIF (CMAKE_BUILD_TYPE MATCHES "Debug")
 
--- a/extensions/app_diameap/plugins/CMakeLists.txt	Wed Oct 27 14:21:47 2010 +0900
+++ b/extensions/app_diameap/plugins/CMakeLists.txt	Thu Oct 28 12:59:03 2010 +0900
@@ -9,23 +9,26 @@
 	COMPONENT freeDiameter-eap-server)
 ENDMACRO(EAP_ADD_METHOD)
 
+# Use the macro FD_EAP_PLUGIN(extmacroname subdir descr default) to 
+# add a new extension subdirectory.
+MACRO(FD_EAP_PLUGIN EXTSUBDIR EXTDESCR EXTDEFAULT)
+   STRING(TOUPPER ${EXTSUBDIR} EXTMACRONAME)
+   IF (NOT ALL_EXTENSIONS)
+     OPTION(BUILD_${EXTMACRONAME} ${EXTDESCR} ${EXTDEFAULT})
+   ENDIF (NOT ALL_EXTENSIONS)
+   IF (BUILD_${EXTMACRONAME} OR ALL_EXTENSIONS)
+      ADD_SUBDIRECTORY(${EXTSUBDIR})
+   ENDIF (BUILD_${EXTMACRONAME} OR ALL_EXTENSIONS)
+ENDMACRO(FD_EAP_PLUGIN)
+
 ###########################
 # EAP Methods Plugins Section
 
 # EAP Identity plugin
-OPTION(BUILD_EAP_IDENTITY "Build EAP Identity Plugin " ON)
-	IF (BUILD_EAP_IDENTITY)
-	   ADD_SUBDIRECTORY(eap_identity)
-	ENDIF (BUILD_EAP_IDENTITY)
+FD_EAP_PLUGIN(eap_identity "Build EAP Identity Plugin " ON)
 
 # EAP MD5 plugin
-OPTION(BUILD_EAP_MD5 "Build EAP-MD5 Plugin " OFF)
-	IF (BUILD_EAP_MD5)
-	   ADD_SUBDIRECTORY(eap_md5)
-	ENDIF (BUILD_EAP_MD5)
+FD_EAP_PLUGIN(eap_md5 "Build EAP-MD5 Plugin " OFF)
 
 # EAP TLS plugin
-OPTION(BUILD_EAP_TLS "Build EAP-TLS Plugin " OFF)
-	IF (BUILD_EAP_TLS)
-	   ADD_SUBDIRECTORY(eap_tls)
-	ENDIF (BUILD_EAP_TLS)
+FD_EAP_PLUGIN(eap_tls "Build EAP-TLS Plugin " OFF)
--- a/extensions/app_radgw/CMakeLists.txt	Wed Oct 27 14:21:47 2010 +0900
+++ b/extensions/app_radgw/CMakeLists.txt	Thu Oct 28 12:59:03 2010 +0900
@@ -59,50 +59,63 @@
 	COMPONENT freeDiameter-radius-gateway)
 ENDMACRO(RGWX_ADD_PLUGIN)
 
+# Ask unless ALL_EXTENSIONS is set:
+MACRO(FD_OPTION_PLUGIN PLGVAR DESCR DEFLT)
+   IF (NOT ALL_EXTENSIONS)
+     OPTION(BUILD_${PLGVAR} ${DESCR} ${DEFLT})
+   ENDIF (NOT ALL_EXTENSIONS)
+   IF (BUILD_${PLGVAR} OR ALL_EXTENSIONS)
+     SET(${PLGVAR} TRUE)
+   ELSE (BUILD_${PLGVAR} OR ALL_EXTENSIONS)
+     SET(${PLGVAR} FALSE)
+   ENDIF (BUILD_${PLGVAR} OR ALL_EXTENSIONS)
+ENDMACRO(FD_OPTION_PLUGIN PLGVAR DESCR DEFLT)
+
 
 ### Debug 
 # Example of plugin:
-OPTION(BUILD_RGWX_SAMPLE "Build sample plugin? (for developers only)" OFF)
- 	IF (BUILD_RGWX_SAMPLE)
+
+FD_OPTION_PLUGIN(RGWX_SAMPLE "Build sample plugin? (for developers only)" OFF)
+ 	IF (RGWX_SAMPLE)
  	   RGWX_ADD_PLUGIN(sample ${RG_COMMON_HEADER} rgwx_sample.c)
- 	ENDIF (BUILD_RGWX_SAMPLE)
+ 	ENDIF (RGWX_SAMPLE)
 
 # A plugin for debug: dumps RADIUS and Diameter messages state at the time the plugin is called.
-OPTION(BUILD_RGWX_DEBUG "Build debug plugin? (display status of RADIUS and Diameter messages)" ON)
- 	IF (BUILD_RGWX_DEBUG)
+FD_OPTION_PLUGIN(RGWX_DEBUG "Build debug plugin? (display status of RADIUS and Diameter messages)" ON)
+ 	IF (RGWX_DEBUG)
  	   RGWX_ADD_PLUGIN(debug ${RG_COMMON_HEADER} rgwx_debug.c)
- 	ENDIF (BUILD_RGWX_DEBUG)
+ 	ENDIF (RGWX_DEBUG)
 
 
 ### Authentication, Authorization messages translation.
-OPTION(BUILD_RGWX_AUTH "Build Authentication & Authorization RADIUS translation plugin? (RFC2865, RFC3579)" ON)
-	IF (BUILD_RGWX_AUTH)
+FD_OPTION_PLUGIN(RGWX_AUTH "Build Authentication & Authorization RADIUS translation plugin? (RFC2865, RFC3579)" ON)
+	IF (RGWX_AUTH)
  	   RGWX_ADD_PLUGIN(auth ${RG_COMMON_HEADER} rgwx_auth.c)
-	ENDIF (BUILD_RGWX_AUTH)
+	ENDIF (RGWX_AUTH)
 
 ### SIP Authentication, Authorization messages translation.
-OPTION(BUILD_RGWX_SIP "Build SIP RADIUS translation plugin? (RFC4740 or RFC5090)" OFF)
-        IF (BUILD_RGWX_SIP)
+FD_OPTION_PLUGIN(RGWX_SIP "Build SIP RADIUS translation plugin? (RFC4740 or RFC5090)" OFF)
+        IF (RGWX_SIP)
            RGWX_ADD_PLUGIN(sip ${RG_COMMON_HEADER} rgwx_sip.c)
-        ENDIF (BUILD_RGWX_SIP)
+        ENDIF (RGWX_SIP)
 
 
 
 ### Accounting messages translation.
-OPTION(BUILD_RGWX_ACCT "Build Accounting RADIUS translation plugin? (RFC2866)" ON)
-	IF (BUILD_RGWX_ACCT)
+FD_OPTION_PLUGIN(RGWX_ACCT "Build Accounting RADIUS translation plugin? (RFC2866)" ON)
+	IF (RGWX_ACCT)
  	   RGWX_ADD_PLUGIN(acct ${RG_COMMON_HEADER} rgwx_acct.c)
-	ENDIF (BUILD_RGWX_ACCT)
+	ENDIF (RGWX_ACCT)
 
 
 ### Generic plugin to handle some attributes (either delete them or simply echo them in the answer) 
-OPTION(BUILD_RGWX_ECHODROP "Build 'echo/drop' plugin? (drop specific RADIUS attributes or echo them in RADIUS answer)" ON)
-  	IF (BUILD_RGWX_ECHODROP)
+FD_OPTION_PLUGIN(RGWX_ECHODROP "Build 'echo/drop' plugin? (drop specific RADIUS attributes or echo them in RADIUS answer)" ON)
+  	IF (RGWX_ECHODROP)
   	   BISON_FILE(rgwx_echodrop.y)
   	   FLEX_FILE(rgwx_echodrop.l)
   	   SET_SOURCE_FILES_PROPERTIES(lex.rgwx_echodrop.c rgwx_echodrop.tab.c PROPERTIES COMPILE_FLAGS "-I ${CMAKE_CURRENT_SOURCE_DIR}")
  	   RGWX_ADD_PLUGIN(echodrop ${RG_COMMON_HEADER} rgwx_echodrop.h rgwx_echodrop.c lex.rgwx_echodrop.c rgwx_echodrop.tab.c rgwx_echodrop.tab.h )
-  	ENDIF (BUILD_RGWX_ECHODROP)
+  	ENDIF (RGWX_ECHODROP)
 	
 	
 ####
"Welcome to our mercurial repository"