Move main programm to its own source directory.
authorHenning Rogge <henning.rogge@fkie.fraunhofer.de>
Thu, 8 Mar 2012 13:27:06 +0000 (14:27 +0100)
committerHenning Rogge <henning.rogge@fkie.fraunhofer.de>
Thu, 8 Mar 2012 13:27:06 +0000 (14:27 +0100)
Deactivate LTO for Debug compilation.
Fix warning in avl test

13 files changed:
CMake.flags
CMakeLists.txt
src-api/CMakeLists.txt
src-api/builddata/CMakeLists.txt
src/CMake.link_dynamic [moved from src-api/CMake.link_dynamic with 100% similarity]
src/CMake.link_static [moved from src-api/CMake.link_static with 100% similarity]
src/CMakeLists.txt [new file with mode: 0644]
src/olsr_main.c [moved from src-api/olsr_main.c with 100% similarity]
src/olsr_setup.c [moved from src-api/olsr_setup.c with 100% similarity]
src/olsr_setup.h [moved from src-api/olsr_setup.h with 100% similarity]
tests/common/CMakeLists.txt
tests/common/test_common_avl.c
tests/config/CMakeLists.txt

index 4b44b9a..2437452 100644 (file)
@@ -101,7 +101,8 @@ add_compiler_flag(-Wformat-security)
 
 # check for link time optimization
 check_c_compiler_flag("-flto" test_lto)
-if (${test_lto})
+string(COMPARE NOTEQUAL ${CMAKE_BUILD_TYPE} "Debug" IS_NOT_DEBUG)
+if (${test_lto} AND ${IS_NOT_DEBUG})
     ADD_DEFINITIONS(-flto -fuse-linker-plugin)
     SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto")
     SET(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} -flto")
index 42d2887..b7bf8b2 100644 (file)
@@ -37,6 +37,7 @@ include_directories(src-api/core)
 ENABLE_TESTING()
 
 # start compiling core and plugins
+add_subdirectory(src)
 add_subdirectory(src-api)
 add_subdirectory(src-plugins)
 add_subdirectory(tests)
index 84e6c5c..3de72f5 100644 (file)
@@ -6,16 +6,3 @@ add_subdirectory(core)
 IF (WIN32 OR ANDROID)
     add_subdirectory(regex)
 ENDIF(WIN32 OR ANDROID)
-
-# add main program
-set(OONF_SRCS ${OONF_SRCS} olsr_main.c olsr_setup.c)
-
-# create executable
-ADD_EXECUTABLE(${OONF_EXE} ${OONF_SRCS})
-
-# link framework libraries (choose one)
-IF (OONF_FRAMEWORD_DYNAMIC)
-    include(CMake.link_dynamic)
-ELSE (OONF_FRAMEWORD_DYNAMIC)
-    include(CMake.link_static)
-endif(OONF_FRAMEWORD_DYNAMIC)
index 320b65d..8c12619 100644 (file)
@@ -7,7 +7,6 @@ ADD_CUSTOM_TARGET(AppCleanData ALL
     COMMENT "Remove old builddata"
 )
 
-message ("Version trailer: '${OONF_VERSION_TRAILER}'")
 ADD_CUSTOM_COMMAND (
     OUTPUT ${GEN_DATA_C} ${GEN_PLUGIN_STATIC_C}
     COMMAND ${CMAKE_COMMAND}
@@ -37,5 +36,3 @@ ADD_LIBRARY(static_builddata STATIC ${GEN_DATA_C})
 ADD_LIBRARY(static_pluginloader STATIC ${GEN_PLUGIN_STATIC_C})
 ADD_DEPENDENCIES(static_builddata AppCleanData)
 ADD_DEPENDENCIES(static_pluginloader AppCleanData)
-
-message("Compiler: ${CMAKE_C_COMPILER_ID}")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644 (file)
index 0000000..525cee7
--- /dev/null
@@ -0,0 +1,13 @@
+# add main program
+set(OONF_SRCS olsr_main.c 
+              olsr_setup.c)
+
+# create executable
+ADD_EXECUTABLE(${OONF_EXE} ${OONF_SRCS})
+
+# link framework libraries (choose one)
+IF (OONF_FRAMEWORD_DYNAMIC)
+    include(CMake.link_dynamic)
+ELSE (OONF_FRAMEWORD_DYNAMIC)
+    include(CMake.link_static)
+endif(OONF_FRAMEWORD_DYNAMIC)
similarity index 100%
rename from src-api/olsr_main.c
rename to src/olsr_main.c
similarity index 100%
rename from src-api/olsr_setup.c
rename to src/olsr_setup.c
similarity index 100%
rename from src-api/olsr_setup.h
rename to src/olsr_setup.h
index b792e4e..cb7f8b5 100644 (file)
@@ -14,7 +14,7 @@ function(compile_common_test executable source)
         SET_TARGET_PROPERTIES(${executable} PROPERTIES ENABLE_EXPORTS true)
         TARGET_LINK_LIBRARIES(${executable} ws2_32 iphlpapi)
     ENDIF(WIN32)
-endfunction(add_compiler_flag)
+endfunction(compile_common_test)
 
 # just run all of these tests
 set(TESTS test_common_avl
@@ -27,4 +27,4 @@ set(TESTS test_common_avl
 foreach(TEST ${TESTS})
     compile_common_test(${TEST} ${TEST}.c)
     ADD_TEST(NAME ${TEST} COMMAND ${TEST})
-endforeach(OONF_EXE)
+endforeach(TEST)
index 32eed6f..40b8d29 100644 (file)
@@ -622,7 +622,8 @@ static void test_remove_all_macro(bool do_random) {
 
 static void test_for_each_key_macros(void) {
   struct tree_element *e, *p;
-  int i, key;
+  int key;
+  size_t i;
 
   START_TEST();
   avl_init(&head, avl_comp_uint32, true, NULL);
@@ -739,10 +740,9 @@ static void test_for_each_key_macros(void) {
     }
   }
 
-  CHECK_TRUE(i>=1, "Less than one nodes returned");
+  CHECK_TRUE(i>0, "Less than one nodes returned");
 
   key = 6;
-  i = 0;
   avl_for_each_elements_with_key(&head, e, node, p, &key) {
     CHECK_TRUE(false, "Element returned by loop over non-existing key");
   }
index 00cf3af..a27cb1d 100644 (file)
@@ -1,4 +1,4 @@
-function(compile_common_test executable source)
+function(compile_config_test executable source)
     # create executable
     ADD_EXECUTABLE(${executable} ${source})
 
@@ -10,7 +10,7 @@ function(compile_common_test executable source)
         SET_TARGET_PROPERTIES(${executable} PROPERTIES ENABLE_EXPORTS true)
         TARGET_LINK_LIBRARIES(${executable} ws2_32 iphlpapi)
     ENDIF(WIN32)
-endfunction(add_compiler_flag)
+endfunction(compile_config_test)
 
 set(TESTS test_config_list
           test_config_validation
@@ -20,6 +20,6 @@ set(TESTS test_config_list
           test_config_delta)
 
 foreach(TEST ${TESTS})
-    compile_common_test(${TEST} ${TEST}.c)
+    compile_config_test(${TEST} ${TEST}.c)
     ADD_TEST(NAME ${TEST} COMMAND ${TEST})
-endforeach(OONF_EXE)
+endforeach(TEST)