Lemma is an Electromagnetics API
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

CMakeLists.txt 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. cmake_minimum_required (VERSION 2.8.7)
  2. project (Lemma)
  3. ###################
  4. # External Projects
  5. ###################
  6. include(ExternalProject)
  7. # Eigen, this header-library is used extensively for linear algebra, matrices, and arrays
  8. # Mercurial (hg) repo pull, Would it be better to just download latest stable?
  9. #ExternalProject_Add(EIGEN
  10. # HG_REPOSITORY "https://bitbucket.org/eigen/eigen/"
  11. # UPDATE_COMMAND ""
  12. # PATCH_COMMAND ""
  13. # PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/eigen
  14. # CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
  15. #)
  16. # Stable Eigen, requires manual updating when new releases, but lighter weight.
  17. ExternalProject_Add(EIGEN
  18. URL "http://bitbucket.org/eigen/eigen/get/3.2.7.tar.gz"
  19. PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/eigen
  20. CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
  21. )
  22. # Yaml-cpp, this library is used extensively for serialisation of classes (class persistence)
  23. ExternalProject_Add(YAML-CPP
  24. GIT_REPOSITORY "https://github.com/jbeder/yaml-cpp.git"
  25. GIT_TAG "master"
  26. UPDATE_COMMAND ""
  27. PATCH_COMMAND ""
  28. PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/yaml-cpp
  29. CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
  30. )
  31. add_compile_options(-DHAVE_YAMLCPP)
  32. # tinyxml2, this library is used for XML IO
  33. option(TINYXML_SUPPORT "MATIO library support for MATLAB .mat files" OFF)
  34. if ( TINYXML_SUPPORT )
  35. ExternalProject_Add(TINYXML2
  36. GIT_REPOSITORY "https://github.com/leethomason/tinyxml2.git"
  37. GIT_TAG "master"
  38. UPDATE_COMMAND ""
  39. PATCH_COMMAND ""
  40. PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/tinyxml2
  41. CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
  42. )
  43. add_compile_options(-DTINYXMLSUPPORT)
  44. endif()
  45. option(MATIO_SUPPORT "MATIO library support for MATLAB .mat files" OFF)
  46. if ( MATIO_SUPPORT )
  47. add_compile_options(-DHAVE_MATIO)
  48. # matio, this library is used for MATLAB file IO
  49. ExternalProject_ADD(MATIO
  50. GIT_REPOSITORY "git://git.code.sf.net/p/matio/matio"
  51. GIT_TAG "master"
  52. UPDATE_COMMAND ""
  53. PATCH_COMMAND ""
  54. PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/matio
  55. #CONFIGURE_COMMAND ${CMAKE_CURRENT_BINARY_DIR}/external/matio/src/MATIO/autogen.sh && configure
  56. CONFIGURE_COMMAND ./autogen.sh && ./configure --prefix=${CMAKE_INSTALL_PREFIX}
  57. BUILD_IN_SOURCE 1
  58. BUILD_COMMAND ${MAKE}
  59. )
  60. endif()
  61. #####################
  62. # Lemma Configuration
  63. #####################
  64. project(LEMMA_CXX)
  65. # We don't Build VTK, it is too much.
  66. option (VTK_SUPPORT "VTK library for visualisation and grids" OFF)
  67. if (VTK_SUPPORT)
  68. find_package(VTK 6 REQUIRED NO_MODULE)
  69. include(${VTK_USE_FILE})
  70. add_compile_options(-DLEMMAUSEVTK)
  71. endif()
  72. add_compile_options(-std=c++11)
  73. set(LEMMA_VERSION_MAJOR "0")
  74. set(LEMMA_VERSION_MINOR "0")
  75. set(LEMMA_VERSION_PATCH "0")
  76. #set(LEMMA_VERSION "${LEMMA_CPP_VERSION_MAJOR}_${LEMMA_CPP_VERSION_MINOR}_${LEMMA_CPP_VERSION_PATCH}")
  77. configure_file (
  78. "${PROJECT_SOURCE_DIR}/include/LemmaConfig.h.in"
  79. "${PROJECT_BINARY_DIR}/include/LemmaConfig.h"
  80. )
  81. include_directories("${PROJECT_BINARY_DIR}/include")
  82. include_directories ("${PROJECT_SOURCE_DIR}/LemmaCore/include")
  83. include_directories ("${CMAKE_INSTALL_PREFIX}/include/eigen3")
  84. include_directories ("${CMAKE_INSTALL_PREFIX}/include/")
  85. link_directories ("${CMAKE_INSTALL_PREFIX}/lib/")
  86. add_subdirectory (LemmaCore)
  87. # TODO add compiler specific instructions
  88. include_directories(${CMAKE_INSTALL_PREFIX}/include)
  89. add_executable(Hello "${PROJECT_SOURCE_DIR}/src/test.cpp")
  90. target_link_libraries(Hello lemmacore)
  91. add_dependencies(Hello YAML-CPP)