##// END OF EJS Templates
Cmakes for AMDA plugin
Alexandre Leroux -
r322:3585c3c11ab5
parent child
Show More
@@ -0,0 +1,154
1 ## amda - CMakeLists.txt
2 STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX)
3 SET(SQPAMDA_LIBRARY_NAME "${LIBRARY_PREFFIX}_amda${DEBUG_SUFFIX}")
4 SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
5 SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
6 SET(RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/resources")
7
8 # Include amda directory
9 INCLUDE_DIRECTORIES(${INCLUDES_DIR})
10 INCLUDE_DIRECTORIES(${RESOURCES_DIR})
11
12 #
13 # Find Qt modules
14 #
15 SCIQLOP_FIND_QT(Core Widgets)
16
17 #
18 # Find dependent libraries
19 # ========================
20
21 # sciqlop plugin
22 find_package(sciqlop-plugin)
23 INCLUDE_DIRECTORIES(${SCIQLOP-PLUGIN_INCLUDE_DIR})
24
25 # sciqlop core
26 find_package(sciqlop-core)
27 INCLUDE_DIRECTORIES(${SCIQLOP-CORE_INCLUDE_DIR})
28 list(APPEND LIBRARIES ${SCIQLOP-CORE_LIBRARIES})
29
30 # sciqlop gui
31 find_package(sciqlop-gui)
32 INCLUDE_DIRECTORIES(${SCIQLOP-GUI_INCLUDE_DIR})
33 list(APPEND LIBRARIES ${SCIQLOP-GUI_LIBRARIES})
34
35 # Description file
36 FILE (GLOB_RECURSE PLUGIN_FILE ${RESOURCES_DIR}/amda.json)
37
38 #
39 # Compile the library
40 #
41 FILE (GLOB_RECURSE MODULE_SOURCES
42 ${INCLUDES_DIR}/*.h
43 ${SOURCES_DIR}/*.c
44 ${SOURCES_DIR}/*.cpp
45 ${SOURCES_DIR}/*.h
46 ${PLUGIN_FILE})
47
48 ADD_LIBRARY(${SQPAMDA_LIBRARY_NAME} ${MODULE_SOURCES})
49 set_property(TARGET ${SQPAMDA_LIBRARY_NAME} PROPERTY CXX_STANDARD 14)
50 set_property(TARGET ${SQPAMDA_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
51
52 INSTALL(TARGETS ${SQPAMDA_LIBRARY_NAME}
53 RUNTIME DESTINATION ${INSTALL_BINARY_DIR}
54 LIBRARY DESTINATION ${INSTALL_PLUGINS_LIBRARY_DIR}
55 ARCHIVE DESTINATION ${INSTALL_PLUGINS_LIBRARY_DIR}
56 )
57
58
59 TARGET_LINK_LIBRARIES(${SQPAMDA_LIBRARY_NAME} ${LIBRARIES})
60 qt5_use_modules(${SQPAMDA_LIBRARY_NAME} Core Widgets)
61
62 add_dependencies(${SQPAMDA_LIBRARY_NAME} ${SQPPLUGIN_LIBRARY_NAME} ${SQPGUI_LIBRARY_NAME} ${SQPCORE_LIBRARY_NAME})
63
64 # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html
65 # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order.
66 # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets
67 IF(BUILD_SHARED_LIBS)
68 SET_TARGET_PROPERTIES(${SQPAMDA_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT")
69 ELSE()
70 TARGET_COMPILE_DEFINITIONS(${SQPAMDA_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES")
71 ENDIF()
72
73 # Set the variable to parent scope so that the other projects can copy the
74 # dependent shared libraries
75 SCIQLOP_SET_TO_PARENT_SCOPE(SQPAMDA_LIBRARY_NAME)
76
77 # Copy extern shared libraries to the lib folder
78 SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPAMDA_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES})
79
80 # Add the files to the list of files to be analyzed
81 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
82 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
83 # Vera++ exclusion files
84 #LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
85 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
86
87 #
88 # Compile the tests
89 #
90 IF(BUILD_TESTS)
91 INCLUDE_DIRECTORIES(${SOURCES_DIR})
92 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
93 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
94 SET( TEST_LIBRARIES ${SQPAMDA_LIBRARY_NAME})
95
96 FOREACH( testFile ${TESTS_SOURCES} )
97 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
98 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
99
100 # Add to the list of sources files all the sources in the same
101 # directory that aren't another test
102 FILE (GLOB currentTestSources
103 ${testDirectory}/*.c
104 ${testDirectory}/*.cpp
105 ${testDirectory}/*.h)
106 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
107 # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
108
109 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
110 set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14)
111 set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON)
112 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} )
113 qt5_use_modules(${testName} Test)
114
115 ADD_TEST( NAME ${testName} COMMAND ${testName} )
116
117 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES})
118 ENDFOREACH( testFile )
119
120 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
121 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
122 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
123 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
124 ENDIF(BUILD_TESTS)
125
126 #
127 # Set the files that must be formatted by clang-format.
128 #
129 LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
130 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
131
132 #
133 # Set the directories that doxygen must browse to generate the
134 # documentation.
135 #
136 # Source directories:
137 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
138 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
139 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
140 # Source directories to exclude from the documentation generation
141 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
142 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
143
144 #
145 # Set the directories with the sources to analyze and propagate the
146 # modification to the parent scope
147 #
148 # Source directories to analyze:
149 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
150 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
151 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
152 # Source directories to exclude from the analysis
153 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
154 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
@@ -0,0 +1,22
1 # - Try to find sciqlop-amda
2 # Once done this will define
3 # SCIQLOP-AMDA_FOUND - System has sciqlop-amda
4 # SCIQLOP-AMDA_INCLUDE_DIR - The sciqlop-amda include directories
5 # SCIQLOP-AMDA_LIBRARIES - The libraries needed to use sciqlop-amda
6
7 if(SCIQLOP-AMDA_FOUND)
8 return()
9 endif(SCIQLOP-AMDA_FOUND)
10
11 set(SCIQLOP-AMDA_INCLUDE_DIR ${sciqlop-amda_DIR}/../include)
12
13 set (OS_LIB_EXTENSION "so")
14
15 if(WIN32)
16 set (OS_LIB_EXTENSION "dll")
17 endif(WIN32)
18 # TODO: Add Mac Support
19 set(SCIQLOP-AMDA_LIBRARIES_NAME "libsciqlop_amda${DEBUG_SUFFIX}.${OS_LIB_EXTENSION}")
20 set(SCIQLOP-AMDA_LIBRARIES "${LIBRARY_OUTPUT_PATH}/${SCIQLOP-AMDA_LIBRARIES_NAME}")
21
22 set(SCIQLOP-AMDA_FOUND TRUE)
@@ -26,6 +26,18 IF(BUILD_PLUGINS)
26 26 set(sciqlop-mockplugin_DIR "${CMAKE_SOURCE_DIR}/plugins/mockplugin/cmake")
27 27 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${sciqlop-mockplugin_DIR}")
28 28 ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/plugins/mockplugin")
29
30 set(sciqlop-amda_DIR "${CMAKE_SOURCE_DIR}/plugins/amda/cmake")
31 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${sciqlop-amda_DIR}")
32 ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/plugins/amda")
33
34 # Temporary target to copy to plugins dir
35 find_package(sciqlop-mockplugin)
36 find_package(sciqlop-amda)
37 ADD_CUSTOM_TARGET(plugins
38 COMMAND ${CMAKE_COMMAND} -E copy ${SCIQLOP-MOCKPLUGIN_LIBRARIES} "${LIBRARY_OUTPUT_PATH}/plugins/${SCIQLOP-MOCKPLUGIN_LIBRARIES_NAME}"
39 COMMAND ${CMAKE_COMMAND} -E copy ${SCIQLOP-AMDA_LIBRARIES} "${LIBRARY_OUTPUT_PATH}/plugins/${SCIQLOP-AMDA_LIBRARIES_NAME}"
40 )
29 41 ENDIF(BUILD_PLUGINS)
30 42
31 43 # LOGGER
@@ -32,8 +32,8 find_package(sciqlop-gui)
32 32 INCLUDE_DIRECTORIES(${SCIQLOP-GUI_INCLUDE_DIR})
33 33 list(APPEND LIBRARIES ${SCIQLOP-GUI_LIBRARIES})
34 34
35 # Resources files
36 FILE (GLOB_RECURSE PROJECT_RESOURCES ${RESOURCES_DIR}/*.json)
35 # Description file
36 FILE (GLOB_RECURSE PLUGIN_FILE ${RESOURCES_DIR}/mockplugin.json)
37 37
38 38 #
39 39 # Compile the library
@@ -43,7 +43,7 FILE (GLOB_RECURSE MODULE_SOURCES
43 43 ${SOURCES_DIR}/*.c
44 44 ${SOURCES_DIR}/*.cpp
45 45 ${SOURCES_DIR}/*.h
46 ${PROJECT_RESOURCES})
46 ${PLUGIN_FILE})
47 47
48 48 ADD_LIBRARY(${SQPMOCKPLUGIN_LIBRARY_NAME} ${MODULE_SOURCES})
49 49 set_property(TARGET ${SQPMOCKPLUGIN_LIBRARY_NAME} PROPERTY CXX_STANDARD 14)
@@ -84,12 +84,6 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
84 84 #LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
85 85 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
86 86
87 # Temporary target to copy to plugins dir
88 find_package(sciqlop-mockplugin)
89 ADD_CUSTOM_TARGET(plugins
90 COMMAND ${CMAKE_COMMAND} -E copy ${SCIQLOP-MOCKPLUGIN_LIBRARIES} "${LIBRARY_OUTPUT_PATH}/plugins/${SCIQLOP-MOCKPLUGIN_LIBRARIES_NAME}"
91 )
92
93 87 #
94 88 # Compile the tests
95 89 #
General Comments 0
You need to be logged in to leave comments. Login now