##// END OF EJS Templates
Add CatalogueAPI external project with SciQLop cmake configuration
perrinel -
r1062:53bdb3e416f0
parent child
Show More
@@ -0,0 +1,50
1 # - Clone and build CatalogueAPI Module
2 include(ExternalProject)
3
4 find_package(Git REQUIRED)
5
6 SET(CATALOGUEAPI_SOURCES_PATH ${CMAKE_SOURCE_DIR}/3rdparty/CatalogueAPI)
7 SET(CATALOGUEAPI_BUILD_PATH ${CATALOGUEAPI_SOURCES_PATH}/build)
8 SET(CATALOGUEAPI_QXORM_LIB_PATH ${CATALOGUEAPI_BUILD_PATH}/subprojects/QxOrm)
9 SET(CatalogueAPI_build_type plain)
10
11 string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER)
12
13 ExternalProject_Add(
14 CatalogueAPI
15
16 GIT_REPOSITORY https://perrinel@hephaistos.lpp.polytechnique.fr/rhodecode/GIT_REPOSITORIES/LPP/Users/mperrinel/CatalogueAPI
17 GIT_TAG develop
18
19 UPDATE_COMMAND git pull
20 PATCH_COMMAND ""
21
22 SOURCE_DIR "${CATALOGUEAPI_SOURCES_PATH}"
23 CONFIGURE_COMMAND meson --prefix=${CATALOGUEAPI_SOURCES_PATH} --buildtype=${CMAKE_BUILD_TYPE_TOLOWER} "${CATALOGUEAPI_SOURCES_PATH}" "${CATALOGUEAPI_BUILD_PATH}"
24
25 BUILD_COMMAND ninja -C "${CATALOGUEAPI_BUILD_PATH}"
26 INSTALL_COMMAND ninja -C "${CATALOGUEAPI_BUILD_PATH}" install
27 TEST_COMMAND ninja -C "${CATALOGUEAPI_BUILD_PATH}" test
28 LOG_DOWNLOAD 1
29 LOG_UPDATE 1
30 )
31
32 ExternalProject_Add_Step(
33 CatalogueAPI CopyToBin
34 COMMAND ${CMAKE_COMMAND} -E copy_directory ${CATALOGUEAPI_SOURCES_PATH}/lib64 ${CATALOGUEAPI_SOURCES_PATH}/lib
35 COMMAND ${CMAKE_COMMAND} -E copy_directory ${CATALOGUEAPI_QXORM_LIB_PATH} ${CATALOGUEAPI_SOURCES_PATH}/lib
36 DEPENDEES install
37 )
38
39
40 set(CATALOGUEAPI_INCLUDE ${CATALOGUEAPI_SOURCES_PATH}/src)
41 set(CATALOGUEAPI_LIBRARIES ${CATALOGUEAPI_SOURCES_PATH}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}CatalogueAPI${CMAKE_SHARED_LIBRARY_SUFFIX})
42 list(APPEND CATALOGUEAPI_LIBRARIES ${CATALOGUEAPI_SOURCES_PATH}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}QxOrm${CMAKE_SHARED_LIBRARY_SUFFIX})
43
44 #message("CMAKE_SHARED_LIBRARY_PREFIX: ${CMAKE_SHARED_LIBRARY_PREFIX}")
45 #message("CMAKE_SHARED_LIBRARY_SUFFIX: ${CMAKE_SHARED_LIBRARY_SUFFIX}")
46 #message("CATALOGUEAPI_INCLUDE: ${CATALOGUEAPI_INCLUDE}")
47 #message("CATALOGUEAPI_LIBRARIES: ${CATALOGUEAPI_LIBRARIES}")
48
49 mark_as_advanced(CATALOGUEAPI_INCLUDE)
50 mark_as_advanced(CATALOGUEAPI_LIBRARIES)
@@ -1,12 +1,18
1 1 ο»Ώ
2 2
3 3 ## Main CMakeLists for SCIQLOP
4 4 CMAKE_MINIMUM_REQUIRED (VERSION 3.6.1)
5 5 cmake_policy(VERSION 3.6)
6 6
7 7 PROJECT(SCIQLOP)
8 8
9
10 #
11 # build the CatalogueAPI dependencu
12 #
13 INCLUDE("extern/CatalogueAPI.cmake")
14
9 15 #
10 16 # build the project
11 17 #
12 INCLUDE("cmake/sciqlop.cmake") No newline at end of file
18 INCLUDE("cmake/sciqlop.cmake")
@@ -1,39 +1,32
1 1 #
2 2 # findslibs.cmake
3 3 #
4 4
5 5 #
6 6 # Qt
7 7 #
8 8 # Find Qt here so that a message is displayed in the console when executing
9 9 # cmake, but each application must call SCIQLOP_FIND_QT() to load the Qt modules that
10 10 # it needs.
11 11 FIND_PACKAGE(Qt5Core REQUIRED)
12 12 FIND_PACKAGE(Qt5Test REQUIRED)
13 13 FIND_PACKAGE(Qt5Gui REQUIRED)
14 14
15 15 #
16 # CatalogueAPI
17 #
18 LIST( APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
19 FIND_PACKAGE(CatalogueAPI)
20
21
22 #
23 16 # doxygen tools
24 17 #
25 18 FIND_PACKAGE(Doxygen)
26 19
27 20 #
28 21 # Analyzer tools
29 22 #
30 23 LIST( APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/analyzer/cmake")
31 24 FIND_PACKAGE(cppcheck)
32 25 FIND_PACKAGE(ClangAnalyzer)
33 26
34 27 #
35 28 # Formatting tools
36 29 #
37 30 LIST( APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/formatting/cmake")
38 31 FIND_PACKAGE(vera++)
39 32 FIND_PACKAGE(ClangFormat)
@@ -1,171 +1,170
1
2 1 ## core - CMakeLists.txt
3 2 STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX)
4 3 SET(SQPCORE_LIBRARY_NAME "${LIBRARY_PREFFIX}_core${DEBUG_SUFFIX}")
5 4 SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/")
6 5 SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/")
7 6 SET(TESTS_RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tests-resources")
8 7
9 8 # Include core directory
10 9 include_directories("${INCLUDES_DIR}")
11 10
12 11 # Set a variable to display a warning in the version files.
13 12 SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.")
14 13 # Generate the version file from the cmake version variables. The version
15 14 # variables are defined in the cmake/sciqlop_version.cmake file.
16 15 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.h.in"
17 16 "${INCLUDES_DIR}/Version.h")
18 17 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.cpp.in"
19 18 "${SOURCES_DIR}/Version.cpp")
20 19
21 20 # Find dependent modules
22 21 find_package(sciqlop-plugin)
23 22 INCLUDE_DIRECTORIES(${SCIQLOP-PLUGIN_INCLUDE_DIR})
24 23
25 24 #
26 25 # Find Qt modules
27 26 #
28 27 SCIQLOP_FIND_QT(Core Network)
29 28
30 29 #
31 30 # Compile the library library
32 31 #
33 32
34 33 ADD_DEFINITIONS(-DCORE_LIB)
35 34
36 35 FILE (GLOB_RECURSE MODULE_SOURCES
37 36 ${INCLUDES_DIR}/*.h
38 37 ${SOURCES_DIR}/*.c
39 38 ${SOURCES_DIR}/*.cpp
40 39 ${SOURCES_DIR}/*.h)
41 40
42 41 ADD_LIBRARY(${SQPCORE_LIBRARY_NAME} ${MODULE_SOURCES})
43 42 set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD 14)
44 43 set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
45 44 TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME})
46 45 qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core Network)
47 46
48 47 # Find CATALOGUE_API
49 if(CATALOGUEAPI_FOUND)
50 include_directories("${CATALOGUEAPI_INCLUDE_DIRS}")
51 TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES})
52 endif()
53
48 include_directories("${CATALOGUEAPI_INCLUDE}")
49 TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES})
54 50 INSTALL(TARGETS ${SQPCORE_LIBRARY_NAME}
55 51 RUNTIME DESTINATION ${INSTALL_BINARY_DIR}
56 52 LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
57 53 ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR}
58 54 )
59 55
56 add_dependencies(${SQPCORE_LIBRARY_NAME} CatalogueAPI)
57
60 58 # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html
61 59 # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order.
62 60 # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets
63 61 IF(BUILD_SHARED_LIBS)
64 62 SET_TARGET_PROPERTIES(${SQPCORE_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT")
65 63 ELSE()
66 64 TARGET_COMPILE_DEFINITIONS(${SQPCORE_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES")
67 65 ENDIF()
68 66
69 67 # Set the variable to parent scope so that the other projects can copy the
70 68 # dependent shared libraries
71 69 SCIQLOP_SET_TO_PARENT_SCOPE(SQPCORE_LIBRARY_NAME)
72 70
73 # Copy extern shared libraries to the lib folder
74 LIST (APPEND ${EXTERN_SHARED_LIBRARIES} ${CATALOGUEAPI_LIBRARIES})
71 ## Copy extern shared libraries to the lib folder
72 #LIST (APPEND ${EXTERN_SHARED_LIBRARIES} ${CATALOGUEAPI_LIBRARIES})
75 73
76 SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES})
77 if(APPLE)
78 SCIQLOP_COPY_TO_TARGET(RUNTIME ${SQPCORE_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES})
79 endif()
80 SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES})
74 #SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES})
75 #if(APPLE)
76 #SCIQLOP_COPY_TO_TARGET(RUNTIME ${SQPCORE_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES})
77 #endif()
78 #SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES})
81 79
82 80 # Add the files to the list of files to be analyzed
83 81 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
84 82 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
85 83 # Vera++ exclusion files
86 84 LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
87 85 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
88 86
89 87 #
90 88 # Compile the tests
91 89 #
92 90 IF(BUILD_TESTS)
93 91 INCLUDE_DIRECTORIES(${SOURCES_DIR})
94 92 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
95 93 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
96 94 SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME})
95 list(APPEND TEST_LIBRARIES ${CATALOGUEAPI_LIBRARIES})
97 96
98 97 SET(TARGETS_COV)
99 98 FOREACH( testFile ${TESTS_SOURCES} )
100 99 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
101 100 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
102 101
103 102 # Add to the list of sources files all the sources in the same
104 103 # directory that aren't another test
105 104 FILE (GLOB currentTestSources
106 105 ${testDirectory}/*.c
107 106 ${testDirectory}/*.cpp
108 107 ${testDirectory}/*.h)
109 108 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
110 109 # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
111 110
112 111 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
113 112 set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14)
114 113 set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON)
115 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} )
114 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES})
116 115 qt5_use_modules(${testName} Test)
117 116
118 117 ADD_TEST( NAME ${testName} COMMAND ${testName} )
119 118
120 119 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES})
121 120 set(Coverage_NAME ${testName})
122 121 if(UNIX)
123 122 SETUP_TARGET_FOR_COVERAGE(TARGET ${testName}_coverage OUTPUT ${testFile}-path NAME ${testFile} EXECUTABLE ${testName})
124 123 LIST( APPEND TARGETS_COV ${testName}_coverage)
125 124 endif(UNIX)
126 125
127 126 ENDFOREACH( testFile )
128 127
129 128 add_custom_target(coverage)
130 129
131 130 FOREACH( target_cov ${TARGETS_COV} )
132 131 add_custom_command(TARGET coverage PRE_BUILD COMMAND make ${target_cov})
133 132 ENDFOREACH( target_cov )
134 133
135 134 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
136 135 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
137 136 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
138 137 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
139 138
140 139 ADD_DEFINITIONS(-DCORE_TESTS_RESOURCES_DIR="${TESTS_RESOURCES_DIR}")
141 140 ENDIF(BUILD_TESTS)
142 141
143 142 #
144 143 # Set the files that must be formatted by clang-format.
145 144 #
146 145 LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
147 146 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
148 147
149 148 #
150 149 # Set the directories that doxygen must browse to generate the
151 150 # documentation.
152 151 #
153 152 # Source directories:
154 153 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
155 154 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
156 155 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
157 156 # Source directories to exclude from the documentation generation
158 157 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
159 158 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
160 159
161 160 #
162 161 # Set the directories with the sources to analyze and propagate the
163 162 # modification to the parent scope
164 163 #
165 164 # Source directories to analyze:
166 165 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
167 166 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
168 167 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
169 168 # Source directories to exclude from the analysis
170 169 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
171 170 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
General Comments 0
You need to be logged in to leave comments. Login now