Browse Source

cmakelist update

Johannes Ruehle 12 years ago
parent
commit
332cf4fccd
5 changed files with 36 additions and 52 deletions
  1. 3 2
      CMakeLists.txt
  2. 27 44
      core/CMakeLists.txt
  3. 2 2
      core/corefiles.cmake
  4. 2 2
      core/progfiles.cmake
  5. 2 2
      core/testfiles.cmake

+ 3 - 2
CMakeLists.txt

@@ -67,6 +67,7 @@ endif()
 
 FIND_PACKAGE(Qt4)# COMPONENTS Qt3Support QtOpenGl)
 SET(QT_USE_QTOPENGL TRUE)
+SET(QT_USE_QTXML TRUE)
 SET(QT_USE_QT3SUPPORT TRUE)
 if(QT_FOUND)
 #  ADD_DEFINITIONS("-DQT3_SUPPORT")
@@ -129,8 +130,7 @@ set(BUILD_CORE_BASICS ON)
 #set(BUILD_CORE_IMAGE ON)
 #set(BUILD_CORE_MATLABACCESS ON)
 set(BUILD_CORE_TESTS ON)
-set(BUILD_CORE_TESTS_PERFORM_AS_POSTBUILD_STEP OFF)
-set(BUILD_CORE_PROGS OFF)
+set(BUILD_CORE_PROGS ON)
 
 if( BUILD_CORE_TESTS)
 	enable_testing()
@@ -158,6 +158,7 @@ set(NICE_CURR_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
 	# endif()
 # endforeach()
 ADD_SUBDIRECTORY(core)
+ADD_SUBDIRECTORY(vislearning)
   
 
 # doxygen support

+ 27 - 44
core/CMakeLists.txt

@@ -1,22 +1,37 @@
+####################################################
+## library individual settings
+
+#library name (name is appended to "nice_" to form the target library name)
+set(the_library "core")
+
+#define variable nice_<libname>_HDR and nice_<libname>_SRC for library header and source files (don't include progs and test source files here)
 include( corefiles.cmake)
+
+#define variable nice_<libname>_PROGFILES_HDR and nice_<libname>_PROGFILES_SRC for program header and source files (don't include library and test source files here)
 include( progfiles.cmake)
-include( testfiles.cmake)
 
-#message(STATUS "nice_core_hdr:${NICE_CORE_HDR}")
+#define variable nice_<libname>_TESTFILES_HDR and nice_<libname>_TESTFILES_SRC for unit test header and source files (don't include library and progs source files here)
+include( testfiles.cmake)	
+
+#add linkage dependencies to other libraries here
+set("nice_${the_library}_LINKING_DEPENDENCIES" "")
 
-ADD_LIBRARY(nice_core ${NICE_BUILD_LIBS_STATIC_SHARED} ${NICE_CORE_HDR} ${NICE_CORE_SRC})
-TARGET_LINK_LIBRARIES(nice_core ${Boost_LIBRARIES} ${OPENGL_LIBRARY} ${GLUT_LIBRARY} ${QT_LIBRARIES})
-SET_PROPERTY(TARGET nice_core PROPERTY FOLDER "library")
-INSTALL(TARGETS nice_core DESTINATION lib)
+#####################################################
+message(STATUS "adding library ${the_library}")
+
+ADD_LIBRARY("nice_${the_library}" ${NICE_BUILD_LIBS_STATIC_SHARED} ${nice_${the_library}_HDR} ${nice_${the_library}_SRC})
+TARGET_LINK_LIBRARIES("nice_${the_library}" "${nice_${the_library}_LINKING_DEPENDENCIES}" ${Boost_LIBRARIES} ${OPENGL_LIBRARY} ${GLUT_LIBRARY} ${QT_LIBRARIES})
+SET_PROPERTY(TARGET "nice_${the_library}" PROPERTY FOLDER "library")
+INSTALL(TARGETS "nice_${the_library}" DESTINATION lib)
 
 
 if(BUILD_CORE_PROGS)
   message(STATUS "building progs:")
-  foreach(__progcpp ${NICE_PROGFILES_SRC})
+  foreach(__progcpp ${nice_${the_library}_PROGFILES_SRC})
     get_filename_component(__progname ${__progcpp} NAME_WE )
     message(STATUS "progname: ${__progname} ${__progcpp}")
     ADD_EXECUTABLE( ${__progname} ${__progcpp})
-    TARGET_LINK_LIBRARIES(${__progname} nice_core)
+    TARGET_LINK_LIBRARIES(${__progname} "nice_${the_library}")
     INSTALL(TARGETS ${__progname} DESTINATION bin)
 	SET_PROPERTY(TARGET ${__progname} PROPERTY FOLDER "programs")
   endforeach()
@@ -25,12 +40,12 @@ endif()
 if(BUILD_CORE_TESTS)
   INCLUDE_DIRECTORIES(${CPPUNIT_INCLUDE_DIR})
   message(STATUS "building tests:")
-  foreach(__testcpp ${NICE_TESTFILES_SRC})
+  foreach(__testcpp ${nice_${the_library}_TESTFILES_SRC})
     get_filename_component(__testname ${__testcpp} NAME_WE )
     message(STATUS "unittest: ${__testname} ${__testcpp}")
     
     ADD_EXECUTABLE( ${__testname} ../templates/cppUnitTestRunner.cpp ${__testcpp})
-    TARGET_LINK_LIBRARIES(${__testname} nice_core ${CPPUNIT_LIBRARIES} )
+    TARGET_LINK_LIBRARIES(${__testname} "nice_${the_library}" ${CPPUNIT_LIBRARIES} )
 
     INSTALL(TARGETS ${__testname} DESTINATION tests)
 	SET_PROPERTY(TARGET ${__testname} PROPERTY FOLDER "unittests")
@@ -39,7 +54,7 @@ if(BUILD_CORE_TESTS)
 endif()
 
 #####
- set(the_module "nice_core")
+ set(the_module "nice_${the_library}")
  if(ENABLE_SOLUTION_FOLDERS)
     set_target_properties(${the_module} PROPERTIES FOLDER "modules")
   endif()
@@ -81,36 +96,4 @@ endif()
 #         install(FILES ${hdr} DESTINATION "${OPENCV_INCLUDE_INSTALL_PATH}/${CMAKE_MATCH_1}" COMPONENT main)
 #       endif()
 #     endforeach()
-#   endif()
-
-
-#############################################################
-# set(NICE_CURR_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
-# ocv_glob_modules(${NICE_CURR_DIR})
-#ocv_add_module(core)
-
-#ocv_module_include_directories()
-#ocv_glob_module_sources()
-#ocv_create_module()
-
-
-# set(NICE_CURR_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
-# ocv_glob_modules(${NICE_CURR_DIR})
-
-# ADD_EXECUTABLE(testConfig ./basics/progs/testConfig.cpp)
-# ADD_EXECUTABLE(testMemoryUsage ./basics/progs/testMemoryUsage.cpp)
-
-# TARGET_LINK_LIBRARIES(testConfig libnice_core_basics libnice_core_vector)
-# TARGET_LINK_LIBRARIES(testMemoryUsage libnice_core_basics)
-
-# INSTALL(TARGETS testConfig DESTINATION bin)
-# INSTALL(TARGETS testMemoryUsage DESTINATION bin)
-
-
-###
-
-#CONFIGURE_FILE(
-#  "CMakeDefinesConfig.h.in"
-#  "${PROJECT_BINARY_DIR}/CMakeDefinesConfig.h"
-#)
-#include_directories("${PROJECT_BINARY_DIR}")
+#   endif()

+ 2 - 2
core/corefiles.cmake

@@ -1,5 +1,5 @@
 # find . -name "*.cpp" -not -ipath "*tests*" -not -ipath "*progs*" > corefiles.cmake.t
-SET(NICE_CORE_SRC
+SET(nice_core_SRC
 ./image/DeprecatedConverter.cpp
 ./image/Histogram.cpp
 ./image/Fourier.cpp
@@ -93,7 +93,7 @@ SET(NICE_CORE_SRC
 ./vector/ippwrapper.cpp
 )
 
-set(NICE_CORE_HDR
+set(nice_core_HDR
 ./image/ColorImageT.h
 ./image/ImageT.h
 ./image/Region.h

+ 2 - 2
core/progfiles.cmake

@@ -1,5 +1,5 @@
 # find . -name "*.cpp" -ipath "*progs*" > progfiles.cmake.t
-set(NICE_PROGFILES_SRC 
+set(nice_core_PROGFILES_SRC 
 ./image/progs/compareImages.cpp
 ./image/progs/convertImageNice.cpp
 ./image/progs/testApproxGaussFilter.cpp
@@ -18,5 +18,5 @@ set(NICE_PROGFILES_SRC
 ./vector/progs/testCholeskySpeed.cpp
 )
 
-set(NICE_PROGFILES_HDR
+set(nice_core_PROGFILES_HDR
 )

+ 2 - 2
core/testfiles.cmake

@@ -1,5 +1,5 @@
 #generated by find . -name "*.cpp" -ipath "*tests*" > testfiles.cmake.t 
-SET(NICE_TESTFILES_SRC 
+SET(nice_core_TESTFILES_SRC 
 ./image/tests/ImageTest.cpp
 ./image/tests/TestImageFile.cpp
 ./image/tests/TestRect.cpp
@@ -39,7 +39,7 @@ SET(NICE_TESTFILES_SRC
 ./vector/tests/TestEMatrix.cpp
 )
 
-SET(NICE_TESTFILES_HDR
+SET(nice_core_TESTFILES_HDR
 ./image/tests/TestRect.h
 ./image/tests/ImageTest.h
 ./image/tests/TestMorph.h