Main Lemma Repository
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

CMakeLists.txt 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. cmake_minimum_required (VERSION 2.8.7)
  2. project (Lemma CXX)
  3. # required external programs (for runtime of nix, not buildtime)
  4. FIND_PROGRAM(HAVEGIT git
  5. PATHS /usr/bin/ /bin ENV PATH NO_DEFAULT_PATH
  6. )
  7. if(NOT HAVEGIT)
  8. message(FATAL_ERROR "Lemma requires that git is installed and in the path of your machine")
  9. endif(NOT HAVEGIT)
  10. # FIND_PROGRAM(HAVEHG hg
  11. # PATHS /usr/bin/ /bin ENV PATH NO_DEFAULT_PATH
  12. # )
  13. # if(NOT HAVEHG)
  14. # message(STATUS "Mercurial (hg) was not found.")
  15. # endif(NOT HAVEHG)
  16. ###################
  17. # External Projects
  18. ###################
  19. include(ExternalProject)
  20. # Eigen, this header-library is used extensively for linear algebra, matrices, and arrays
  21. # Mercurial (hg) repo pull, Would it be better to just download latest stable?
  22. #ExternalProject_Add(EIGEN
  23. # HG_REPOSITORY "https://bitbucket.org/eigen/eigen/"
  24. # UPDATE_COMMAND ""
  25. # PATCH_COMMAND ""
  26. # PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/eigen
  27. # CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
  28. #)
  29. # Stable Eigen, requires manual updating when new releases, but lighter weight.
  30. ExternalProject_Add(EIGEN
  31. URL "http://bitbucket.org/eigen/eigen/get/3.2.7.tar.gz"
  32. PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/eigen
  33. CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
  34. )
  35. # Yaml-cpp, this library is used extensively for serialisation of classes (class persistence)
  36. ExternalProject_Add(YAML-CPP
  37. GIT_REPOSITORY "https://github.com/jbeder/yaml-cpp.git"
  38. GIT_TAG "master"
  39. UPDATE_COMMAND ""
  40. PATCH_COMMAND ""
  41. PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/yaml-cpp
  42. CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
  43. )
  44. add_compile_options(-DHAVE_YAMLCPP)
  45. # tinyxml2, this library is used for XML IO
  46. option(TINYXML_SUPPORT "MATIO library support for MATLAB .mat files" OFF)
  47. if ( TINYXML_SUPPORT )
  48. ExternalProject_Add(TINYXML2
  49. GIT_REPOSITORY "https://github.com/leethomason/tinyxml2.git"
  50. GIT_TAG "master"
  51. UPDATE_COMMAND ""
  52. PATCH_COMMAND ""
  53. PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/tinyxml2
  54. CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
  55. )
  56. add_compile_options(-DTINYXMLSUPPORT)
  57. endif()
  58. option(MATIO_SUPPORT "MATIO library support for MATLAB .mat files" OFF)
  59. if ( MATIO_SUPPORT )
  60. add_compile_options(-DHAVE_MATIO)
  61. # matio, this library is used for MATLAB file IO
  62. ExternalProject_ADD(MATIO
  63. GIT_REPOSITORY "git://git.code.sf.net/p/matio/matio"
  64. GIT_TAG "master"
  65. UPDATE_COMMAND ""
  66. PATCH_COMMAND ""
  67. PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/matio
  68. #CONFIGURE_COMMAND ${CMAKE_CURRENT_BINARY_DIR}/external/matio/src/MATIO/autogen.sh && configure
  69. CONFIGURE_COMMAND ./autogen.sh && ./configure --prefix=${CMAKE_INSTALL_PREFIX}
  70. BUILD_IN_SOURCE 1
  71. BUILD_COMMAND ${MAKE}
  72. )
  73. endif()
  74. #####################
  75. # Lemma Configuration
  76. #####################
  77. project(LEMMA_CXX)
  78. # We don't Build VTK, it is too much.
  79. option (VTK_SUPPORT "VTK library for visualisation and grids" OFF)
  80. if (VTK_SUPPORT)
  81. find_package(VTK 6 REQUIRED NO_MODULE)
  82. include(${VTK_USE_FILE})
  83. add_compile_options(-DLEMMAUSEVTK)
  84. # Compile Matplot_vtk if VTK is present
  85. add_subdirectory(Matplot_vtk)
  86. include_directories ("${PROJECT_SOURCE_DIR}/Matplot_vtk")
  87. endif()
  88. # Add the c++11 flag
  89. include(CheckCXXCompilerFlag)
  90. CHECK_CXX_COMPILER_FLAG(-std=c++11 COMPILER_SUPPORTS_CXX11)
  91. CHECK_CXX_COMPILER_FLAG(-std=c++0x COMPILER_SUPPORTS_CXX0X)
  92. if(COMPILER_SUPPORTS_CXX11)
  93. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
  94. elseif(COMPILER_SUPPORTS_CXX0X)
  95. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
  96. else()
  97. message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
  98. endif()
  99. #add_compile_options(-std=c++11)
  100. set(LEMMA_VERSION_MAJOR "0")
  101. set(LEMMA_VERSION_MINOR "0")
  102. set(LEMMA_VERSION_PATCH "0")
  103. #set(LEMMA_VERSION "${LEMMA_CPP_VERSION_MAJOR}_${LEMMA_CPP_VERSION_MINOR}_${LEMMA_CPP_VERSION_PATCH}")
  104. configure_file (
  105. "${PROJECT_SOURCE_DIR}/include/LemmaConfig.h.in"
  106. "${PROJECT_BINARY_DIR}/include/LemmaConfig.h"
  107. )
  108. include_directories("${PROJECT_BINARY_DIR}/include")
  109. include_directories ("${PROJECT_SOURCE_DIR}/LemmaCore/include")
  110. include_directories ("${CMAKE_INSTALL_PREFIX}/include/eigen3")
  111. include_directories ("${CMAKE_INSTALL_PREFIX}/include/")
  112. link_directories ("${CMAKE_INSTALL_PREFIX}/lib/")
  113. add_subdirectory (LemmaCore)
  114. # TODO add compiler specific instructions
  115. include_directories(${CMAKE_INSTALL_PREFIX}/include)
  116. add_executable(Hello "${PROJECT_SOURCE_DIR}/src/test.cpp")
  117. target_link_libraries(Hello lemmacore)
  118. add_dependencies(Hello YAML-CPP)