CMakeLists.txt 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
  2. PROJECT(ARTIS_STAR CXX C)
  3. ENABLE_TESTING()
  4. SET(ARTIS_MAJOR 1)
  5. SET(ARTIS_MINOR 0)
  6. SET(ARTIS_PATCH 0)
  7. SET(ARTIS_EXTRA "")
  8. SET(ARTIS_VERSION "${ARTIS_MAJOR}.${ARTIS_MINOR}.${ARTIS_PATCH}")
  9. SET(ARTIS_VERSION_SHORT "${ARTIS_MAJOR}.${ARTIS_MINOR}")
  10. SET(ARTIS_NAME "artis-star")
  11. SET(ARTIS_NAME_VERSION "${ARTIS_NAME}-${ARTIS_VERSION}")
  12. SET(ARTIS_LOCALE_NAME "${ARTIS_NAME}-${ARTIS_MAJOR}-${ARTIS_MINOR}")
  13. IF ("${ARTIS_EXTRA}" STREQUAL "")
  14. SET(ARTIS_COMPLETE "${ARTIS_MAJOR}.${ARTIS_MINOR}.${ARTIS_PATCH}")
  15. ELSE ("${ARTIS_EXTRA}" STREQUAL "")
  16. SET(ARTIS_COMPLETE "${ARTIS_MAJOR}.${ARTIS_MINOR}.${ARTIS_PATCH}-${ARTIS_EXTRA}")
  17. ENDIF ("${ARTIS_EXTRA}" STREQUAL "")
  18. SET(ARTIS_NAME_COMPLETE "${ARTIS_NAME}-${ARTIS_COMPLETE}")
  19. #
  20. # Installation variables
  21. #
  22. SET(ARTIS_LIBRARY_DIRS "lib/artis-star-${ARTIS_VERSION_SHORT}")
  23. SET(ARTIS_INCLUDE_DIRS "include/artis-star-${ARTIS_VERSION_SHORT}/artis-star")
  24. SET(ARTIS_INCLUDE_DIR "include/artis-star-${ARTIS_VERSION_SHORT}")
  25. SET(ARTIS_MANPAGE_PATH "share/man/man1")
  26. SET(ARTIS_SHARE_DIRS "share/artis-star-${ARTIS_VERSION_SHORT}")
  27. #
  28. # Append the library version information to the library target
  29. # properties.
  30. #
  31. SET (ARTIS_LIBRARY_PROPERTIES VERSION 0)
  32. SET (ARTIS_APP_PROPERTIES SOVERSION "${ARTIS_MAJOR}.${ARTIS_MINOR}"
  33. VERSION "${ARTIS_MAJOR}.${ARTIS_MINOR}")
  34. #
  35. # Debug mode
  36. #
  37. IF (CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX)
  38. SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
  39. SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -std=c++11 -pthread")
  40. IF (UNIX)
  41. SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic")
  42. SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
  43. ENDIF (UNIX)
  44. ENDIF (CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX)
  45. if (CMAKE_BUILD_TYPE STREQUAL "")
  46. SET(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build" FORCE)
  47. endif ()
  48. #
  49. # Modules
  50. #
  51. INCLUDE(CheckIncludeFileCXX)
  52. INCLUDE(CheckIncludeFile)
  53. INCLUDE(CheckLibraryExists)
  54. INCLUDE(CMakeDetermineCCompiler)
  55. #
  56. # Test the libboost header and libboost-text library.
  57. #
  58. OPTION(WITH_TEST "use the libboost test unit library [default: on]" ON)
  59. SET(Boost_USE_MULTITHREADED ON)
  60. SET(Boost_USE_STATIC_LIBS OFF)
  61. SET(Boost_NO_SYSTEM_PATHS OFF)
  62. SET(Boost_USE_STATIC_RUNTIME ON)
  63. IF (WIN32)
  64. SET(Boost_THREADAPI "win32")
  65. ENDIF (WIN32)
  66. SET(Boost_DETAILED_FAILURE_MSG FALSE)
  67. SET(Boost_DEBUG FALSE)
  68. FIND_PACKAGE(Boost COMPONENTS mpi timer serialization system)
  69. IF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "35")
  70. SET(Boost_SYSTEM_LIBRARY "")
  71. ENDIF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "35")
  72. IF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "41")
  73. SET(ARTIS_HAVE_BOOST_SPIRIT2 0 CACHE INTERNAL "" FORCE)
  74. ELSE (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "41")
  75. SET(ARTIS_HAVE_BOOST_SPIRIT2 1 CACHE INTERNAL "" FORCE)
  76. ENDIF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "41")
  77. #
  78. # Generate the config.h
  79. #
  80. CHECK_INCLUDE_FILE_CXX(cxxabi.h ARTIS_HAVE_GCC_ABI_DEMANGLE)
  81. CHECK_INCLUDE_FILE_CXX(execinfo.h ARTIS_HAVE_EXECINFO)
  82. CHECK_INCLUDE_FILE_CXX(signal.h ARTIS_HAVE_SIGNAL)
  83. INCLUDE_DIRECTORIES(${ARTIS_STAR_BINARY_DIR})
  84. #
  85. # Generate the artis.pc pkg-config file.
  86. #
  87. SET(ARTIS_PKGCONFIG_PREFIXPATH "${CMAKE_INSTALL_PREFIX}")
  88. SET(ARTIS_PKGCONFIG_BOOSTINCLUDE_DIRS "${Boost_INCLUDE_DIRS}")
  89. SET(ARTIS_PKGCONFIG_LIBDIR "lib")
  90. CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/src/artis-star.pc.in
  91. ${ARTIS_STAR_BINARY_DIR}/artis-star-${ARTIS_VERSION_SHORT}.pc @ONLY)
  92. INSTALL(FILES ${ARTIS_STAR_BINARY_DIR}/artis-star-${ARTIS_VERSION_SHORT}.pc
  93. DESTINATION lib/pkgconfig)
  94. #
  95. # Install the README
  96. #
  97. IF(UNIX)
  98. INSTALL(FILES "README" DESTINATION "${ARTIS_SHARE_DIRS}")
  99. INSTALL(FILES "COPYING" DESTINATION "${ARTIS_SHARE_DIRS}")
  100. ELSE(UNIX)
  101. INSTALL(FILES "README" DESTINATION "${ARTIS_SHARE_DIRS}" RENAME "Readme.txt")
  102. INSTALL(FILES "COPYING" DESTINATION "${ARTIS_SHARE_DIRS}" RENAME "CopyRight.txt")
  103. ENDIF(UNIX)
  104. #
  105. # Browse the src subdirectory
  106. #
  107. ADD_SUBDIRECTORY(src)
  108. #
  109. # Status
  110. #
  111. MESSAGE(STATUS "- - - -")
  112. MESSAGE(STATUS "${ARTIS_NAME_COMPLETE} configured successfully")
  113. MESSAGE(STATUS "Using ${CMAKE_INSTALL_PREFIX} for installation")
  114. MESSAGE(STATUS "Build type ${CMAKE_BUILD_TYPE}")
  115. IF (ARTIS_HAVE_GCC_ABI_DEMANGLE)
  116. MESSAGE(STATUS "Build with GCC ABI Demangle...: yes")
  117. ENDIF (ARTIS_HAVE_GCC_ABI_DEMANGLE)
  118. IF (ARTIS_HAVE_EXECINFO)
  119. MESSAGE(STATUS "Build with execinfo.h.........: yes")
  120. ENDIF (ARTIS_HAVE_EXECINFO)
  121. IF (Boost_FOUND)
  122. MESSAGE(STATUS "Build with boost..............: yes")
  123. ENDIF (Boost_FOUND)