Eric Ramat il y a 1 an
Parent
commit
67d2ffad82
4 fichiers modifiés avec 94 ajouts et 97 suppressions
  1. 81 84
      CMakeLists.txt
  2. 0 11
      src/artis-addons.pc.in
  3. 11 0
      src/artis-star-addons.pc.in
  4. 2 2
      src/qss/CMakeLists.txt

+ 81 - 84
CMakeLists.txt

@@ -1,76 +1,62 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(ARTIS_ADDONS CXX C)
+CMAKE_MINIMUM_REQUIRED(VERSION 3.16)
+PROJECT(ARTIS_STAR_ADDONS CXX C)
 ENABLE_TESTING()
 
-SET(ARTIS_ADDONS_MAJOR 1)
-SET(ARTIS_ADDONS_MINOR 0)
-SET(ARTIS_ADDONS_PATCH 0)
-SET(ARTIS_ADDONS_EXTRA "-dev")
-SET(ARTIS_ADDONS_VERSION "${ARTIS_ADDONS_MAJOR}.${ARTIS_ADDONS_MINOR}.${ARTIS_ADDONS_PATCH}")
-SET(ARTIS_ADDONS_VERSION_SHORT "${ARTIS_ADDONS_MAJOR}.${ARTIS_ADDONS_MINOR}")
-SET(ARTIS_ADDONS_NAME "artis-addons")
-SET(ARTIS_ADDONS_NAME_VERSION "${ARTIS_ADDONS_NAME}-${ARTIS_ADDONS_VERSION}")
-SET(ARTIS_ADDONS_LOCALE_NAME "${ARTIS_ADDONS_NAME}-${ARTIS_ADDONS_MAJOR}-${ARTIS_ADDONS_MINOR}")
-IF ("${ARTIS_ADDONS_EXTRA}" STREQUAL "")
-    SET(ARTIS_ADDONS_COMPLETE "${ARTIS_ADDONS_MAJOR}.${ARTIS_ADDONS_MINOR}.${ARTIS_ADDONS_PATCH}")
-ELSE ("${ARTIS_ADDONS_EXTRA}" STREQUAL "")
-    SET(ARTIS_ADDONS_COMPLETE "${ARTIS_ADDONS_MAJOR}.${ARTIS_ADDONS_MINOR}.${ARTIS_ADDONS_PATCH}-${ARTIS_ADDONS_EXTRA}")
-ENDIF ("${ARTIS_ADDONS_EXTRA}" STREQUAL "")
-SET(ARTIS_ADDONS_NAME_COMPLETE "${ARTIS_ADDONS_NAME}-${ARTIS_ADDONS_COMPLETE}")
+SET(CMAKE_CXX_STANDARD 17)
+SET(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+SET(ARTIS_STAR_ADDONS_MAJOR 1)
+SET(ARTIS_STAR_ADDONS_MINOR 0)
+SET(ARTIS_STAR_ADDONS_PATCH 0)
+SET(ARTIS_STAR_ADDONS_EXTRA "")
+SET(ARTIS_STAR_ADDONS_VERSION "${ARTIS_STAR_ADDONS_MAJOR}.${ARTIS_STAR_ADDONS_MINOR}.${ARTIS_STAR_ADDONS_PATCH}")
+SET(ARTIS_STAR_ADDONS_VERSION_SHORT "${ARTIS_STAR_ADDONS_MAJOR}.${ARTIS_STAR_ADDONS_MINOR}")
+SET(ARTIS_STAR_ADDONS_NAME "artis-star-addons")
+SET(ARTIS_STAR_ADDONS_NAME_VERSION "${ARTIS_STAR_ADDONS_NAME}-${ARTIS_STAR_ADDONS_VERSION}")
+SET(ARTIS_STAR_ADDONS_LOCALE_NAME "${ARTIS_STAR_ADDONS_NAME}-${ARTIS_STAR_ADDONS_MAJOR}-${ARTIS_STAR_ADDONS_MINOR}")
+IF ("${ARTIS_STAR_ADDONS_EXTRA}" STREQUAL "")
+    SET(ARTIS_STAR_ADDONS_COMPLETE "${ARTIS_STAR_ADDONS_MAJOR}.${ARTIS_STAR_ADDONS_MINOR}.${ARTIS_STAR_ADDONS_PATCH}")
+ELSE ("${ARTIS_STAR_ADDONS_EXTRA}" STREQUAL "")
+    SET(ARTIS_STAR_ADDONS_COMPLETE "${ARTIS_STAR_ADDONS_MAJOR}.${ARTIS_STAR_ADDONS_MINOR}.${ARTIS_STAR_ADDONS_PATCH}-${ARTIS_STAR_ADDONS_EXTRA}")
+ENDIF ("${ARTIS_STAR_ADDONS_EXTRA}" STREQUAL "")
+SET(ARTIS_STAR_ADDONS_NAME_COMPLETE "${ARTIS_STAR_ADDONS_NAME}-${ARTIS_STAR_ADDONS_COMPLETE}")
 
 #
 # Installation variables
 #
 
-SET(ARTIS_ADDONS_LIBRARY_DIRS "lib/artis-addons-${ARTIS_ADDONS_VERSION_SHORT}")
-SET(ARTIS_ADDONS_INCLUDE_DIRS "include/artis-addons-${ARTIS_ADDONS_VERSION_SHORT}/artis-addons")
-SET(ARTIS_ADDONS_INCLUDE_DIR "include/artis-addons-${ARTIS_ADDONS_VERSION_SHORT}")
-SET(ARTIS_ADDONS_MANPAGE_PATH "share/man/man1")
-SET(ARTIS_ADDONS_SHARE_DIRS "share/artis-addons-${ARTIS_ADDONS_VERSION_SHORT}")
+SET(ARTIS_STAR_ADDONS_LIBRARY_DIRS "lib/artis-star-addons-${ARTIS_STAR_ADDONS_VERSION_SHORT}")
+SET(ARTIS_STAR_ADDONS_INCLUDE_DIRS "include/artis-star-addons-${ARTIS_STAR_ADDONS_VERSION_SHORT}/artis-star-addons")
+SET(ARTIS_STAR_ADDONS_INCLUDE_DIR "include/artis-star-addons-${ARTIS_STAR_ADDONS_VERSION_SHORT}")
+SET(ARTIS_STAR_ADDONS_MANPAGE_PATH "share/man/man1")
+SET(ARTIS_STAR_ADDONS_SHARE_DIRS "share/artis-star-addons-${ARTIS_STAR_ADDONS_VERSION_SHORT}")
 
 #
 # Append the library version information to the library target
 # properties.
 #
 
-SET (ARTIS_ADDONS_LIBRARY_PROPERTIES VERSION 0)
-
-#
-# CPack configuration
-#
-
-INCLUDE(CMakeCPack.cmake)
+SET(ARTIS_STAR_ADDONS_LIBRARY_PROPERTIES VERSION 0)
+SET(ARTIS_STAR_ADDONS_APP_PROPERTIES SOVERSION "${ARTIS_STAR_ADDONS_MAJOR}.${ARTIS_STAR_ADDONS_MINOR}"
+        VERSION "${ARTIS_STAR_ADDONS_MAJOR}.${ARTIS_STAR_ADDONS_MINOR}")
 
 #
 # Debug mode
 #
 
-IF (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR
-        ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
+IF (CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX)
     SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--no-as-needed -Wall -Wextra -std=c++11")
+    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -std=c++17 -pthread")
     IF (UNIX)
         SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic")
         SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
     ENDIF (UNIX)
-ENDIF ()
+ENDIF (CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX)
 
 if (CMAKE_BUILD_TYPE STREQUAL "")
     SET(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build" FORCE)
 endif ()
 
-#
-# Thread
-#
-
-message(STATUS "checking for a (p)thread library")
-find_package(Threads REQUIRED)
-if (NOT Threads_FOUND)
-    message(ERROR " failed to found a (p)thread support.")
-else ()
-    message(STATUS " threads support enabled (${CMAKE_THREAD_LIBS_INIT})")
-endif ()
-
 #
 # Modules
 #
@@ -89,60 +75,71 @@ FIND_PACKAGE(PkgConfig REQUIRED)
 PKG_CHECK_MODULES(ARTIS REQUIRED artis-star-1.0)
 
 #
-# Test the libboost header and libboost-text library.
+# Boost libraries.
 #
 
-OPTION(WITH_TEST "use the libboost test unit library [default: on]" ON)
-SET(Boost_USE_MULTITHREADED ON)
-SET(Boost_USE_STATIC_LIBS OFF)
-SET(Boost_NO_SYSTEM_PATHS OFF)
-SET(Boost_USE_STATIC_RUNTIME ON)
-IF (WIN32)
-    SET(Boost_THREADAPI "win32")
-ENDIF (WIN32)
+set(Boost_USE_STATIC_LIBS OFF)
+set(Boost_USE_MULTITHREADED ON)
+set(Boost_USE_STATIC_RUNTIME OFF)
 
-include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR})
-
-find_package(MPI REQUIRED)
-if (NOT MPI_CXX_FOUND)
-    message(ERROR " failed to found a C++ compiler with MPI support.")
-else ()
-    message(STATUS " MPI support enabled")
-    include_directories(${MPI_CXX_INCLUDE_PATH})
-endif ()
-
-message(STATUS "checking for Boost headers and libraries")
-find_package(Boost 1.55 REQUIRED COMPONENTS graph mpi timer serialization
-        system)
-if (NOT Boost_FOUND)
-    MESSAGE(FATAL_ERROR "The boost graph library is required")
-else ()
-    message(STATUS " Boost found")
-    include_directories(${Boost_INCLUDE_DIRS})
-    link_directories(${Boost_LIBRARY_DIRS})
-endif ()
+find_package(Boost 1.71.0 COMPONENTS mpi serialization)
 
 #
 # Generate the config.h
 #
 
-CHECK_INCLUDE_FILE_CXX(cxxabi.h ARTIS_HAVE_GCC_ABI_DEMANGLE)
-CHECK_INCLUDE_FILE_CXX(execinfo.h ARTIS_HAVE_EXECINFO)
-CHECK_INCLUDE_FILE_CXX(signal.h ARTIS_HAVE_SIGNAL)
+CHECK_INCLUDE_FILE_CXX(cxxabi.h ARTIS_STAR_ADDONS_HAVE_GCC_ABI_DEMANGLE)
+CHECK_INCLUDE_FILE_CXX(execinfo.h ARTIS_STAR_ADDONS_HAVE_EXECINFO)
+CHECK_INCLUDE_FILE_CXX(signal.h ARTIS_STAR_ADDONS_HAVE_SIGNAL)
+INCLUDE_DIRECTORIES(${ARTIS_STAR_ADDONS_STAR_BINARY_DIR})
 
 #
 # Generate the artis.pc pkg-config file.
 #
 
-SET(ARTIS_ADDONS_PKGCONFIG_PREFIXPATH "${CMAKE_INSTALL_PREFIX}")
-SET(ARTIS_ADDONS_PKGCONFIG_BOOSTINCLUDE_DIRS "${Boost_INCLUDE_DIRS}")
-SET(ARTIS_ADDONS_PKGCONFIG_LIBDIR "lib")
+SET(ARTIS_STAR_ADDONS_PKGCONFIG_PREFIXPATH "${CMAKE_INSTALL_PREFIX}")
+SET(ARTIS_STAR_ADDONS_PKGCONFIG_BOOSTINCLUDE_DIRS "${Boost_INCLUDE_DIRS}")
+SET(ARTIS_STAR_ADDONS_PKGCONFIG_LIBDIR "lib")
 
-CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/src/artis-addons.pc.in
-        ${ARTIS_ADDONS_BINARY_DIR}/artis-addons-${ARTIS_ADDONS_VERSION_SHORT}.pc @ONLY)
-INSTALL(FILES ${ARTIS_ADDONS_BINARY_DIR}/artis-addons-${ARTIS_ADDONS_VERSION_SHORT}.pc
+CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/src/artis-star-addons.pc.in
+        ${ARTIS_STAR_ADDONS_BINARY_DIR}/artis-star-addons-${ARTIS_STAR_ADDONS_VERSION_SHORT}.pc @ONLY)
+INSTALL(FILES ${ARTIS_STAR_ADDONS_BINARY_DIR}/artis-star-addons-${ARTIS_STAR_ADDONS_VERSION_SHORT}.pc
         DESTINATION lib/pkgconfig)
 
+#
+# Install the README
+#
+
+IF (UNIX)
+    INSTALL(FILES "README" DESTINATION "${ARTIS_STAR_ADDONS_SHARE_DIRS}")
+    INSTALL(FILES "COPYING" DESTINATION "${ARTIS_STAR_ADDONS_SHARE_DIRS}")
+ELSE (UNIX)
+    INSTALL(FILES "README" DESTINATION "${ARTIS_STAR_ADDONS_SHARE_DIRS}" RENAME "Readme.txt")
+    INSTALL(FILES "COPYING" DESTINATION "${ARTIS_STAR_ADDONS_SHARE_DIRS}" RENAME "CopyRight.txt")
+ENDIF (UNIX)
+
+#
+# Add sources for a target
+# add_sources(<target> <source1> [<source2> ...])
+#
+function(ADD_SOURCES target)
+    get_property(prop_defined GLOBAL PROPERTY ${target}_SRCS DEFINED)
+    if(NOT prop_defined)
+        define_property(GLOBAL PROPERTY ${target}_SRCS
+                BRIEF_DOCS "Sources for the ${target} target"
+                FULL_DOCS "List of source files for the ${target} target")
+    endif()
+
+    set(SRCS)
+    foreach(src ${ARGN})
+        if(NOT IS_ABSOLUTE "${src}")
+            get_filename_component(src "${src}" ABSOLUTE)
+        endif()
+        list(APPEND SRCS "${src}")
+    endforeach()
+    set_property(GLOBAL APPEND PROPERTY "${target}_SRCS" "${SRCS}")
+endfunction()
+
 #
 # Browse the src subdirectory
 #
@@ -154,7 +151,7 @@ ADD_SUBDIRECTORY(src)
 #
 
 MESSAGE(STATUS "- - - -")
-MESSAGE(STATUS "${ARTIS_ADDONS_NAME} configured successfully")
+MESSAGE(STATUS "${ARTIS_STAR_ADDONS_NAME} configured successfully")
 MESSAGE(STATUS "Using ${CMAKE_INSTALL_PREFIX} for installation")
 MESSAGE(STATUS "Build type ${CMAKE_BUILD_TYPE}")
 IF (ARTIS_HAVE_GCC_ABI_DEMANGLE)

+ 0 - 11
src/artis-addons.pc.in

@@ -1,11 +0,0 @@
-prefix=@ARTIS_ADDONS_PKGCONFIG_PREFIXPATH@
-exec_prefix=${prefix}
-libdir=${exec_prefix}/@ARTIS_ADDONS_PKGCONFIG_LIBDIR@
-includedir=${prefix}/include
-
-Name: artis-addons
-Description: Addons for ARTIS* Multimodeling and Simulation tools
-Requires: artis-star-1.0
-Version: @ARTIS_ADDONS_VERSION@
-Libs:	-L${libdir}
-Cflags: -I${includedir}/artis-addons-@ARTIS_ADDONS_VERSION_SHORT@ -I@ARTIS_ADDONS_PKGCONFIG_BOOSTINCLUDE_DIRS@

+ 11 - 0
src/artis-star-addons.pc.in

@@ -0,0 +1,11 @@
+prefix=@ARTIS_STAR_ADDONS_PKGCONFIG_PREFIXPATH@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/@ARTIS_STAR_ADDONS_PKGCONFIG_LIBDIR@
+includedir=${prefix}/include
+
+Name: artis-star-addons
+Description: Addons for ARTIS* Multimodeling and Simulation tools
+Requires: artis-star-1.0
+Version: @ARTIS_STAR_ADDONS_VERSION@
+Libs:	-L${libdir}
+Cflags: -I${includedir}/artis-star-addons-@ARTIS_STAR_ADDONS_VERSION_SHORT@ -I@ARTIS_STAR_ADDONS_PKGCONFIG_BOOSTINCLUDE_DIRS@

+ 2 - 2
src/qss/CMakeLists.txt

@@ -1,5 +1,5 @@
 INCLUDE_DIRECTORIES(
-        ${ARTIS_ADDONS_SOURCE_DIR}/src
+        ${ARTIS_STAR_ADDONS_SOURCE_DIR}/src
         ${Boost_INCLUDE_DIRS})
 
 LINK_DIRECTORIES(
@@ -7,4 +7,4 @@ LINK_DIRECTORIES(
 
 SET(QSS_HPP GraphManager.hpp MultiGraphManager.hpp)
 
-INSTALL(FILES ${QSS_HPP} DESTINATION ${ARTIS_ADDONS_INCLUDE_DIRS}/qss)
+INSTALL(FILES ${QSS_HPP} DESTINATION ${ARTIS_STAR_ADDONS_INCLUDE_DIRS}/qss)