Bläddra i källkod

add CMake build system

Johannes Ruehle 11 år sedan
förälder
incheckning
1c80728aa3
4 ändrade filer med 133 tillägg och 0 borttagningar
  1. 71 0
      CMakeLists.txt
  2. 42 0
      corefiles.cmake
  3. 8 0
      progfiles.cmake
  4. 12 0
      testfiles.cmake

+ 71 - 0
CMakeLists.txt

@@ -0,0 +1,71 @@
+####################################################
+## library individual settings
+
+#library name (name is appended to "nice_" to form the target library name)
+set(the_library "gp-hik-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)
+
+#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" "nice_core")
+
+#####################################################
+message(STATUS "adding library ${the_library}")
+
+nice_build_library()
+
+nice_add_progs()
+
+nice_add_unittests()
+
+#####
+ set(the_module "nice_${the_library}")
+ if(ENABLE_SOLUTION_FOLDERS)
+    set_target_properties(${the_module} PROPERTIES FOLDER "modules")
+  endif()
+	
+  set_target_properties(${the_module} PROPERTIES
+    OUTPUT_NAME "${the_module}${OPENCV_DLLVERSION}"
+    DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
+    ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
+    RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
+    INSTALL_NAME_DIR lib
+  )
+  
+  if(BUILD_SHARED_LIBS)
+    if(MSVC)
+      set_target_properties(${the_module} PROPERTIES DEFINE_SYMBOL CVAPI_EXPORTS)
+    else()
+      add_definitions(-DCVAPI_EXPORTS)
+    endif()
+  endif()
+
+  if(MSVC)
+    if(CMAKE_CROSSCOMPILING)
+      set_target_properties(${the_module} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:secchk")
+    endif()
+    set_target_properties(${the_module} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:libc /DEBUG")
+  endif()
+
+  install(TARGETS ${the_module}
+    RUNTIME DESTINATION bin COMPONENT main
+    LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main
+    ARCHIVE DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main
+    )
+
+#   # only "public" headers need to be installed
+#   if(OPENCV_MODULE_${the_module}_HEADERS AND ";${OPENCV_MODULES_PUBLIC};" MATCHES ";${the_module};")
+#     foreach(hdr ${OPENCV_MODULE_${the_module}_HEADERS})
+#       string(REGEX REPLACE "^.*opencv2/" "opencv2/" hdr2 "${hdr}")
+#       if(hdr2 MATCHES "^(opencv2/.*)/[^/]+.h(..)?$")
+#         install(FILES ${hdr} DESTINATION "${OPENCV_INCLUDE_INSTALL_PATH}/${CMAKE_MATCH_1}" COMPONENT main)
+#       endif()
+#     endforeach()
+#   endif()

+ 42 - 0
corefiles.cmake

@@ -0,0 +1,42 @@
+SET(nice_gp-hik-core_SRC
+./GMHIKernel.cpp
+./IKMNoise.cpp
+./kernels/IntersectionKernelFunction.cpp
+./FastMinKernel.cpp
+./GPHIKClassifier.cpp
+./FMKGPHyperparameterOptimization.cpp
+./Quantization.cpp
+./VectorSorter.cpp
+./algebra/LogDetApproxBaiAndGolub.cpp
+./IKMLinearCombination.cpp
+./GPLikelihoodApprox.cpp
+./ImplicitKernelMatrix.cpp
+./parameterizedFunctions/ParameterizedFunction.cpp
+)
+
+SET(nice_gp-hik-core_HDR
+./kernels/GeneralizedIntersectionKernelFunction.h
+./kernels/IntersectionKernelFunction.h
+./kernels/GenericKernelFunction.h
+./IKMNoise.h
+./FeatureMatrixT.h
+./GPHIKClassifier.h
+./ImplicitKernelMatrix.h
+./FMKGPHyperparameterOptimization.h
+./FastMinKernel.h
+./SortedVectorSparse.h
+./Quantization.h
+./tools.h
+./algebra/LogDetApproxBaiAndGolub.h
+./algebra/LogDetApprox.h
+./VectorSorter.h
+./GPLikelihoodApprox.h
+./GMHIKernel.h
+./IKMLinearCombination.h
+./parameterizedFunctions/ParameterizedFunction.h
+./parameterizedFunctions/PFExp.h
+./parameterizedFunctions/PFMKL.h
+./parameterizedFunctions/PFAbsExp.h
+./parameterizedFunctions/PFWeightedDim.h
+)
+

+ 8 - 0
progfiles.cmake

@@ -0,0 +1,8 @@
+# find . -name "*.cpp" -ipath "*/progs/*" > progfiles.cmake.t
+set(nice_segmentation_PROGFILES_SRC 
+./progs/toyExample.cpp
+./progs/completeEvaluationFastMinkernel.cpp
+)
+
+set(nice_segmentation_PROGFILES_HDR
+)

+ 12 - 0
testfiles.cmake

@@ -0,0 +1,12 @@
+#generated by find . -name "*.cpp" -ipath "*/tests/*" > testfiles.cmake.t 
+SET(nice_gp-hik-core_TESTFILES_SRC 
+./tests/TestVectorSorter.cpp
+./tests/TestFeatureMatrixT.cpp
+./tests/TestFastHIK.cpp
+)
+
+SET(nice_gp-hik-core_TESTFILES_HDR
+./tests/TestFastHIK.h
+./tests/TestVectorSorter.h
+./tests/TestFeatureMatrixT.h
+)