Advertisement
mijc

cmake_myLib

Mar 1st, 2012
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 2.45 KB | None | 0 0
  1. #########
  2. #
  3. # Readme
  4. #
  5. # This file creates several things...
  6. # - some external libraries
  7. # - the libct2d library
  8. # - the application program
  9. # ... and links them against each other
  10.  
  11.  
  12. ###############
  13. # Define the minimum Version of cmake, you can use
  14.  
  15. cmake_minimum_required(VERSION 2.8)
  16.  
  17. ###############
  18. # set some variables
  19.  
  20. set(project_name example_ct_project)
  21. set(exe_name example_ct_application)
  22.  
  23. ###############
  24. # change the project name
  25.  
  26. project(${project_name})
  27.  
  28. ###############
  29. # all include files which are needed
  30.  
  31. include_directories(../../libct2d/include)
  32. include_directories(../../libct2d/external_libs/matIO)
  33. include_directories(../../libct2d/external_libs/KissFFT)
  34.  
  35. ###############
  36. # this creates libct2d
  37.  
  38. AUX_SOURCE_DIRECTORY(../../libct2d/src libct2d)
  39. AUX_SOURCE_DIRECTORY(../../libct2d/src/projectors libct2d_projectors)
  40.  
  41. FILE(GLOB libct2d_include ../../libct2d/include/*.h)
  42.  
  43. add_library(libct2d SHARED ${libct2d} ${libct2d_projectors} ${libct2d_include})
  44.  
  45. ###############
  46. # this creates matio
  47. AUX_SOURCE_DIRECTORY(../../libct2d/external_libs/matIO lib_matio)
  48.  
  49. add_library(matio SHARED ${lib_matio})
  50.  
  51. ###############
  52. # this creates KissFFT
  53. AUX_SOURCE_DIRECTORY(../../libct2d/external_libs/KissFFT lib_kissfft)
  54.  
  55. add_library(kissfft SHARED ${lib_kissfft})
  56.  
  57.  
  58. ###############
  59. # this creates the application exe
  60.  
  61. FILE(GLOB application_cpp_files *.cpp)
  62.  
  63. ADD_EXECUTABLE(${exe_name} ${application_cpp_files} )
  64.  
  65. # for the exe two libraries must be linked against it
  66. target_link_libraries(${exe_name} libct2d)
  67. target_link_libraries(${exe_name} matio)
  68. target_link_libraries(${exe_name} kissfft)
  69.  
  70.  
  71.  
  72. ##############################
  73. #options for swig and python
  74.  
  75.  
  76. #this pretty much sucks...dunno why it is not enabled by default
  77. SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
  78.  
  79. #this is only for linux/gcc
  80. #different cases needed for windows/linux
  81. SET(CMAKE_CXX_FLAGS "-std=c++0x")
  82.  
  83. FIND_PACKAGE(SWIG REQUIRED)
  84. INCLUDE(${SWIG_USE_FILE})
  85.  
  86. #finding the PythonLibs is not working on my machine, probably some Path problems
  87. FIND_PACKAGE(PythonLibs)
  88. INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS})
  89.  
  90. INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
  91.  
  92. SET(CMAKE_SWIG_FLAGS "")
  93.  
  94. SET_SOURCE_FILES_PROPERTIES(kissCT.i PROPERTIES CPLUSPLUS ON)
  95. SET_SOURCE_FILES_PROPERTIES(kissCT.i PROPERTIES SWIG_FLAGS "-includeall")
  96.  
  97. SWIG_ADD_MODULE(kissCT python kissCT.i main.cpp)
  98. SWIG_LINK_LIBRARIES(kissCT ${PYTHON_LIBRARIES})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement