##// END OF EJS Templates
Initialisation de l'archi cmake
perrinel -
r0:5cbbc595e8f3
parent child
Show More
@@ -0,0 +1,2
1 build/
2 CMakeLists.txt.user No newline at end of file
@@ -0,0 +1,11
1 ο»Ώ
2
3 ## Main CMakeLists for SCIQLOP
4 CMAKE_MINIMUM_REQUIRED (VERSION 2.8.12)
5
6 PROJECT(SCIQLOP)
7
8 #
9 # build the project
10 #
11 INCLUDE("cmake/sciqlop.cmake") No newline at end of file
@@ -0,0 +1,1
1 TODO
@@ -0,0 +1,1
1 TODO No newline at end of file
@@ -0,0 +1,11
1 #
2 # compiler.cmake : configure the compilation flags
3 #
4
5 IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
6 INCLUDE("cmake/compiler/compiler_gnu.cmake")
7 ELSEIF(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
8 INCLUDE("cmake/compiler/compiler_msvc.cmake")
9 ELSE()
10 MESSAGE(FATAL_ERROR "Compiler not supported")
11 ENDIF()
@@ -0,0 +1,18
1 #
2 # compiler_gnu.cmake : specific configuration for GNU compilers
3 #
4
5 # Set the flag -Wall to activate all warnings
6 IF (${CMAKE_BUILD_TYPE} STREQUAL Debug)
7 SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -std=c++14")
8 SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall")
9
10 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}")
11 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG}")
12 ELSE()
13 SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall -O2 -std=c++14")
14 SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wall -O2")
15
16 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}")
17 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE}")
18 ENDIF()
@@ -0,0 +1,7
1 #
2 # compiler_msvc.cmake : specific configuration for MSVC compilers
3 #
4
5 ADD_DEFINITIONS( /D _USE_MATH_DEFINES)
6 ADD_DEFINITIONS( /D _VARIADIC_MAX=10 )
7 ADD_DEFINITIONS( /D _CRT_SECURE_NO_WARNINGS)
@@ -0,0 +1,30
1 #
2 # findslibs.cmake
3 #
4
5 #
6 # Qt
7 #
8 # Find Qt here so that a message is displayed in the console when executing
9 # cmake, but each application must call SCIQLOP_FIND_QT() to load the Qt modules that
10 # it needs.
11 FIND_PACKAGE(Qt5Core REQUIRED)
12 FIND_PACKAGE(Qt5Test REQUIRED)
13 FIND_PACKAGE(Qt5Gui REQUIRED)
14
15 #
16 # doxygen tools
17 #
18 FIND_PACKAGE(Doxygen)
19
20 #
21 # Cppcheck tool
22 #
23 FIND_PACKAGE(cppcheck)
24
25 #
26 # Formatting tools
27 #
28 LIST( APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/formatting/cmake")
29 FIND_PACKAGE(vera++)
30 FIND_PACKAGE(ClangFormat)
@@ -0,0 +1,39
1 #
2 # sciqlop.cmake
3 #
4
5 #
6 # Update the CMAKE_MODULE_PATH to use custom FindXXX files
7 #
8 LIST( APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/CMakeModules/")
9
10 # Include the sciqlop version file
11 INCLUDE("cmake/sciqlop_version.cmake")
12
13 # Include the sciqlop cmake macros
14 INCLUDE("cmake/sciqlop_macros.cmake")
15
16 #
17 # Define the project parameters
18 #
19 INCLUDE("cmake/sciqlop_params.cmake")
20
21 #
22 # Configure the compiler
23 #
24 INCLUDE("cmake/compiler/compiler.cmake")
25
26 #
27 # Find all necessary dependencies
28 #
29 INCLUDE("cmake/find_libs.cmake")
30
31 #
32 # Compile all applications
33 #
34 INCLUDE("cmake/sciqlop_applications.cmake")
35
36 #
37 # Package creation using CPack
38 #
39 INCLUDE("cmake/sciqlop_package.cmake")
@@ -0,0 +1,38
1 #
2 # Sciqlop_modules.cmake
3 #
4 # Set ouptut directories
5 #
6 SET (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist/${CMAKE_BUILD_TYPE})
7 SET (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist/${CMAKE_BUILD_TYPE})
8
9
10 #
11 # Compile the core
12 #
13 ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/sqpcore")
14
15 #
16 # Compile the gui
17 #
18 ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/sqpgui")
19
20 #
21 # Compile the app
22 #
23 ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/sqpapp")
24
25 #
26 # Code formatting
27 #
28 INCLUDE ("cmake/sciqlop_formatting.cmake")
29
30 #
31 # Documentation generation
32 #
33 INCLUDE ("cmake/sciqlop_doxygen.cmake")
34
35 #
36 # Source code analysis
37 #
38 INCLUDE ("cmake/sciqlop_code_analysis.cmake")
@@ -0,0 +1,52
1 #
2 # sciqlop_code_analysis.cmake
3
4 # Launch code source analysis with cppcheck. Can be activated with the
5 # ANALYZE_CODE option.
6 #
7 # The following CACHE variables are available:
8 # * CPPCHECK_EXTRA_ARGS: extra arguments for cppcheck;
9 # * CPPCHECK_OUTPUT: path to the xml report of cppcheck.
10 #
11 # The following variables are used (must be set by the cmake file calling this
12 # one):
13 # * ANALYSIS_INPUT_DIRS: directories to analyze;
14 # * ANALYSIS_EXCLUDE_DIRS: directories to exclude from the analysis.
15 #
16
17 #
18 # Analyze the source code with cppcheck
19 #
20 OPTION (ANALYZE_CODE "Analyze the source code with cppcheck" ON)
21 IF (ANALYZE_CODE)
22
23 # Make sure cppcheck has been found, otherwise the source code can't be
24 # analyzed
25 IF (CPPCHECK_FOUND)
26 SET (CPPCHECK_EXTRA_ARGS --inline-suppr --xml --enable=style --force -v
27 CACHE STRING "Extra arguments for cppcheck")
28 MARK_AS_ADVANCED (CPPCHECK_EXTRA_ARGS)
29
30 SET (CPPCHECK_OUTPUT "${CMAKE_BINARY_DIR}/cppcheck-report.xml"
31 CACHE STRING "Output file for the cppcheck report")
32 MARK_AS_ADVANCED (CPPCHECK_OUTPUT)
33
34 SET (CPPCHECK_EXCLUDE_DIRS)
35 FOREACH (dir ${ANALYSIS_EXCLUDE_DIRS})
36 LIST (APPEND CPPCHECK_EXCLUDE_DIRS "-i${dir}")
37 ENDFOREACH ()
38
39 # Add the analyze target to launch cppcheck
40 ADD_CUSTOM_TARGET (analyze
41 COMMAND
42 ${CPPCHECK_EXECUTABLE}
43 ${CPPCHECK_EXTRA_ARGS}
44 ${ANALYSIS_INPUT_DIRS}
45 ${CPPCHECK_EXCLUDE_DIRS}
46 2> ${CPPCHECK_OUTPUT}
47 )
48
49 ELSE (CPPCHECK_FOUND)
50 MESSAGE (STATUS "The source code won't be analyzed - Cppcheck not found")
51 ENDIF (CPPCHECK_FOUND)
52 ENDIF (ANALYZE_CODE)
@@ -0,0 +1,110
1 #
2 # sciqlop_doxygen.cmake
3 #
4 # Launch doxygen generation. Can be activated with the BUILD_DOCUMENTATION
5 # option.
6 #
7 # The following CACHE variables are available:
8 # * DOXYGEN_LANGUAGE: Documentation language;
9 #
10 # The following variables are used (must be set by the cmake file calling this
11 # one):
12 # * DOXYGEN_INPUT_DIRS: directories to document;
13 # * DOXYGEN_EXCLUDE_PATTERNS: directories to exclude from the documentation
14 # generation.
15 #
16
17 #
18 # Compile the doxygen documentation
19 #
20 OPTION (BUILD_DOCUMENTATION "Build the doxygen-based documentation" ON)
21 IF (BUILD_DOCUMENTATION)
22
23 # Make sure Doxygen is on the system, if not then the documentation can't be built
24 IF (DOXYGEN_FOUND)
25
26 # Append the global docs directory to the list of input directories
27 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_SOURCE_DIR}/docs")
28 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_BINARY_DIR}/gendocs")
29
30 # Exclude the "*_private.h" files by default
31 list(APPEND DOXYGEN_EXCLUDE_PATTERNS "*_private.h")
32 # Exclude cpp files
33 list(APPEND DOXYGEN_EXCLUDE_PATTERNS "*.cpp")
34
35 # Set the variables used by the Doxyfile template
36 SET (PROJECT_NAME "${CMAKE_PROJECT_NAME}")
37 SET (INPUT_DIRECTORIES)
38 FOREACH (dir ${DOXYGEN_INPUT_DIRS})
39 SET (INPUT_DIRECTORIES "${INPUT_DIRECTORIES}\\ \n \"${dir}\" ")
40 ENDFOREACH ()
41 SET (EXCLUDE_PATTERNS)
42 FOREACH (pattern ${DOXYGEN_EXCLUDE_PATTERNS})
43 SET (EXCLUDE_PATTERNS "${EXCLUDE_PATTERNS}\\ \n \"${pattern}\" ")
44 ENDFOREACH ()
45
46 SET (INDEX_LIST_MODULES "<ul>\n")
47 FOREACH(module ${ENABLED_MODULE_LIST})
48 SET (INDEX_LIST_MODULES "${INDEX_LIST_MODULES}<li>[${module}](@ref ${module})</li>\n")
49 ENDFOREACH()
50 SET (INDEX_LIST_MODULES "${INDEX_LIST_MODULES}</ul>\n")
51
52 # This is the doxyfile that will be used to generate the documentation
53 # You can use programs like doxywizard to edit the settings
54 SET (doxygenConfigFileIn "${CMAKE_SOURCE_DIR}/docs/Doxyfile.dox.in")
55 SET (doxygenConfigFile "${CMAKE_BINARY_DIR}/Doxyfile.dox")
56
57 SET (DOXYGEN_LANGUAGE "English" CACHE STRING "Documentation language")
58 MARK_AS_ADVANCED (DOXYGEN_LANGUAGE)
59
60 SET (doxygenIndexFileIn "${CMAKE_SOURCE_DIR}/docs/index.md.in")
61 SET (doxygenIndexFile "${CMAKE_BINARY_DIR}/gendocs/index.md")
62
63 # Using a .in file means we can use CMake to insert project settings
64 # into the doxyfile. For example, CMake will replace @PROJECT_NAME@ in
65 # a configured file with the CMake PROJECT_NAME variable's value.
66
67
68 CONFIGURE_FILE (${doxygenConfigFileIn} ${doxygenConfigFile} @ONLY)
69 CONFIGURE_FILE (${doxygenIndexFileIn} ${doxygenIndexFile} @ONLY)
70
71 # Add the documentation target. This lets you run "make docs" from the
72 # generated CMake makefiles
73 ADD_CUSTOM_TARGET (docs
74 ${DOXYGEN_EXECUTABLE} ${doxygenConfigFile}
75 DEPENDS ${doxygenConfigFile}
76 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
77 VERBATIM)
78
79 # You can add an "install" directive to install the resulting documentation
80 # if desired.
81 INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/documentation/html DESTINATION ${INSTALL_DOCUMENTATION_DIR} OPTIONAL COMPONENT binaries)
82
83 # Add a custom command to archive the current HTML documentation generated
84 # by doxygen
85 set(ARCHIVED_HTML_OUTPUT_FILE_NAME "${PROJECT_NAME}-${SCIQLOP_VERSION}-documentation-html.tar.bz2")
86 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/documentation/${ARCHIVED_HTML_OUTPUT_FILE_NAME}
87 COMMAND sh -c "tar --bzip2 -cf ${ARCHIVED_HTML_OUTPUT_FILE_NAME} html"
88 DEPENDS docs
89 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/documentation)
90 # Add a custom target to execute the above command
91 add_custom_target(htmldocs DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/documentation/${ARCHIVED_HTML_OUTPUT_FILE_NAME})
92
93 # Add a custom command to execute pdflatex on the latex documentation
94 # generated by doxygen
95 set(LATEX_OUTPUT_FILE_NAME "${PROJECT_NAME}-${SCIQLOP_VERSION}-documentation.pdf")
96 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/documentation/${LATEX_OUTPUT_FILE_NAME}
97 COMMAND make
98 COMMAND cp refman.pdf ../${LATEX_OUTPUT_FILE_NAME}
99 DEPENDS docs
100 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/documentation/latex)
101 # Add a custom target to execute the above command
102 add_custom_target(latexdocs DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/documentation/${LATEX_OUTPUT_FILE_NAME})
103
104 # Add a custom target to execute all the docs commands
105 add_custom_target(alldocs DEPENDS htmldocs latexdocs)
106
107 ELSE (DOXYGEN_FOUND)
108 MESSAGE (STATUS "Documentation will not be built - Doxygen not found")
109 ENDIF (DOXYGEN_FOUND)
110 ENDIF (BUILD_DOCUMENTATION)
@@ -0,0 +1,53
1 #
2 # sciqlop_formatting.cmake
3 #
4 # Launch code formatting tools. Can be activated with ENABLE_FORMATTING and
5 # ENABLE_CHECKSTYLE options.
6 #
7 # The following variables are used (must be set by the cmake file calling this
8 # one):
9 # * FORMATTING_INPUT_FILES: list of files to format;
10 # * CHECKSTYLE_INPUT_FILES: list of files to check for style;
11 # * CHECKSTYLE_EXCLUSION_FILES: list of vera++ exclusion files.
12 #
13
14 OPTION (ENABLE_FORMATTING "Format the source code while compiling" ON)
15 OPTION (ENABLE_CHECKSTYLE "Analyse the style of the code while compiling" ON)
16
17 IF (ENABLE_FORMATTING)
18 IF (CLANGFORMAT_FOUND)
19 INCLUDE(${CLANGFORMAT_USE_FILE})
20
21 ADD_CLANGFORMAT_TARGETS(${FORMATTING_INPUT_FILES}
22 ADD_TO_ALL)
23 ELSE()
24 MESSAGE (STATUS "Source code will not be formatted - clang-format not found")
25 ENDIF()
26 ENDIF()
27
28 IF (ENABLE_CHECKSTYLE)
29 IF (VERA++_FOUND)
30 INCLUDE(${VERA++_USE_FILE})
31
32 SET(EXCLUSIONS)
33 FOREACH (e ${CHECKSTYLE_EXCLUSION_FILES})
34 LIST(APPEND EXCLUSIONS EXCLUSION ${e})
35 ENDFOREACH()
36
37 ADD_VERA_TARGETS(${CHECKSTYLE_INPUT_FILES}
38 ADD_TO_ALL
39 PROFILE "sciqlop"
40 ROOT "${CMAKE_SOURCE_DIR}/formatting/vera-root"
41 PARAMETER "project-name=${PROJECT_NAME}"
42 ${EXCLUSIONS})
43
44 ADD_VERA_CHECKSTYLE_TARGET(${CHECKSTYLE_INPUT_FILES}
45 PROFILE "sciqlop"
46 ROOT "${CMAKE_SOURCE_DIR}/formatting/vera-root"
47 PARAMETER "project-name=${PROJECT_NAME}"
48 ${EXCLUSIONS})
49
50 ELSE()
51 MESSAGE (STATUS "Source code will not be checkstyled - vera++ not found")
52 ENDIF()
53 ENDIF()
@@ -0,0 +1,191
1 #
2 # sciqlop_macros.cmake
3 #
4 # The following functions or macros are defined in this document:
5 # - SUBDIRLIST
6 # - SCIQLOP_SET_TO_PARENT_SCOPE
7 # - SCIQLOP_PROCESS_EXTERN_DEPENDENCIES
8 # - SCIQLOP_COPY_TO_TARGET
9 # - SCIQLOP_READ_FILE
10 # - SCIQLOP_FIND_QT
11 # - SCIQLOP_ADD_EXTERN_DEPENDENCY
12
13 #
14 # Define a macro to retrieve all subdirectory names of a specific directory
15 #
16 MACRO(SUBDIRLIST result curdir)
17 FILE(GLOB children RELATIVE ${curdir} ${curdir}/*)
18 SET(dirlist "")
19 FOREACH(child ${children})
20 IF(IS_DIRECTORY ${curdir}/${child})
21 LIST(APPEND dirlist ${child})
22 ENDIF()
23 ENDFOREACH()
24 SET(${result} ${dirlist})
25 ENDMACRO()
26
27 # SCIQLOP_SET_TO_PARENT_SCOPE(variable)
28 #
29 # Set the given variable to the parent scope.
30 #
31 MACRO (SCIQLOP_SET_TO_PARENT_SCOPE variable)
32 SET(${variable} ${${variable}} PARENT_SCOPE)
33 ENDMACRO (SCIQLOP_SET_TO_PARENT_SCOPE)
34
35 MACRO(SCIQLOP_FIND_QT)
36 # Find includes in corresponding build directories
37 set(CMAKE_INCLUDE_CURRENT_DIR ON)
38 # Instruct CMake to run moc automatically when needed.
39 set(CMAKE_AUTOMOC ON)
40
41 # Find Qt5 and the modules asked
42 FOREACH(component ${ARGN})
43 FIND_PACKAGE(Qt5${component} QUIET REQUIRED)
44 INCLUDE_DIRECTORIES(${Qt5${component}_INCLUDE_DIRS})
45 ENDFOREACH(component)
46 ENDMACRO(SCIQLOP_FIND_QT)
47
48 # SCIQLOP_PROCESS_EXTERN_DEPENDENCIES(externFile externLibraries externSharedLibraries)
49 #
50 # Process the dependencies file for the modules. Each line of this file must
51 # contain the parameters to pass to the FIND_PACKAGE function. This function
52 # will append the libraries of the extern dependency found to the variable
53 # passed as a second parameter, and add the include directories of the extern
54 # dependency to the global include directories. Moreover, the extern shared
55 # libraries are stored in the variable passed as a third parameter. These shared
56 # libraries can then be copied to a target output path by using the
57 # SCIQLOP_COPY_TO_TARGET function.
58 #
59 # Examples:
60 #
61 # SCIQLOP_PROCESS_MODULE_DEPENDENCIES("path/to/extern.dependencies"
62 # EXTERN_LIBRARIES
63 # EXTERN_SHARED_LIBRARIES)
64 #
65 FUNCTION (SCIQLOP_PROCESS_EXTERN_DEPENDENCIES externFile librariesVar sharedLibrariesVar)
66
67 SCIQLOP_READ_FILE(${externFile} externDependencies)
68 SET (externLibraries)
69 SET (externSharedLibraries)
70 FOREACH (externDependency ${externDependencies})
71 # Check if the line is a comment (begins with #)
72 STRING(REGEX MATCH "^ *#.*$" matched "${externDependency}")
73 IF (NOT matched)
74 STRING(REGEX REPLACE " +" ";" externDependency "${externDependency}")
75 SCIQLOP_ADD_EXTERN_DEPENDENCY(externLibraries externSharedLibraries ${externDependency})
76 ENDIF()
77 ENDFOREACH()
78
79 LIST (APPEND ${librariesVar} ${externLibraries})
80 SCIQLOP_SET_TO_PARENT_SCOPE(${librariesVar})
81
82 LIST (APPEND ${sharedLibrariesVar} ${externSharedLibraries})
83 SCIQLOP_SET_TO_PARENT_SCOPE(${sharedLibrariesVar})
84 ENDFUNCTION (SCIQLOP_PROCESS_EXTERN_DEPENDENCIES)
85
86 # SCIQLOP_COPY_TO_TARGET copy the given files to the given target output path.
87 #
88 # The first parameter must be RUNTIME or LIBRARY, and it indicates the type of
89 # the target.
90 #
91 # The second parameter is the name of the target where the files must be copied.
92 # The RUNTIME_OUTPUT_DIRECTORY or LIBRARY_OUTPUT_DIRECTORY target properties
93 # will be used to find the output path of the copy. If these properties are
94 # empty, then the EXECUTABLE_OUTPUT_PATH or LIBRARY_OUTPUT_PATH variables will
95 # be used.
96 #
97 # The rest of the parameters are the files that must be copied.
98 FUNCTION (SCIQLOP_COPY_TO_TARGET runtimeOrLibrary targetName)
99 # Check RUNTIME or LIBRARY argument
100 IF (${runtimeOrLibrary} STREQUAL "RUNTIME")
101 SET (targetProperty "RUNTIME_OUTPUT_DIRECTORY")
102 SET (pathProperty ${EXECUTABLE_OUTPUT_PATH})
103 ELSEIF (${runtimeOrLibrary} STREQUAL "LIBRARY")
104 SET (targetProperty "LIBRARY_OUTPUT_DIRECTORY")
105 SET (pathProperty ${LIBRARY_OUTPUT_PATH})
106 ELSE ()
107 MESSAGE (FATAL "The first parameter of COPY_TO_TARGET must be either RUNTIME or LIBRARY, not \"${runtimeOrLibrary}\"")
108 ENDIF ()
109
110 # Select the output directory
111 GET_TARGET_PROPERTY(OUTPUT_DIR ${targetName} ${targetProperty})
112 IF (OUTPUT_DIR STREQUAL "OUTPUT_DIR-NOTFOUND")
113 SET (OUTPUT_DIR ${pathProperty})
114 ENDIF ()
115
116 # Retrieve the list of files to copy by listing the rest of the macro
117 # arguments
118 FOREACH (arg ${ARGN})
119 LIST(APPEND fileList ${arg})
120 ENDFOREACH()
121
122 # Only copy if the list isn't empty
123 IF (fileList)
124 FILE(COPY ${fileList} DESTINATION ${OUTPUT_DIR})
125 ENDIF()
126 ENDFUNCTION (SCIQLOP_COPY_TO_TARGET)
127
128 # SCIQLOP_READ_FILE(file contents)
129 #
130 # Read the given file line by line and store the resulting list inside the
131 # contents variable.
132 #
133 # /!\ If the file contains semicolons, the macro will escape them before
134 # returning the list.
135 #
136 # From <http://public.kitware.com/pipermail/cmake/2007-May/014222.html>
137 FUNCTION (SCIQLOP_READ_FILE file contentsVar)
138 FILE (READ ${file} contents)
139
140 # Convert file contents into a CMake list (where each element in the list
141 # is one line of the file)
142 #
143 STRING(REGEX REPLACE ";" "\\\\;" contents "${contents}")
144 STRING(REGEX REPLACE "\n" ";" contents "${contents}")
145
146 # Return file contents as a list
147 SET (${contentsVar} "${contents}" PARENT_SCOPE)
148 ENDFUNCTION (SCIQLOP_READ_FILE)
149
150 # SCIQLOP_ADD_EXTERN_DEPENDENCY(externLibrariesVar externSharedLibrariesVar dependencyName [EXTRA FIND_PACKAGE ARGS])
151 #
152 # SCIQLOP_ADD_EXTERN_DEPENDENCY can be used to add a dependency residing in the
153 # extern subdirectory to a module.
154 #
155 # The first parameter is the name of the variable where the found libraries will
156 # be added.
157 #
158 # The second parameter is the name of the variable where the found shared
159 # libraries will be added.
160 #
161 # The third parameter is the name of the dependency, and the rest of the
162 # arguments are the same than the FIND_PACKAGE command. In fact they are passed
163 # as-is to the command.
164 #
165 # If the dependency is found, then INCLUDE_DIRECTORIES is called for the
166 # dependency include directories, and the libraries are added to the
167 # externLibrariesVar variable. Moreover, if the dependency is a shared library,
168 # then the dynamic libraries are added to the externSharedLibrariesVar so that
169 # they can be copied and installed alongside the module. The libraries in this
170 # variable are ordered so that the real library is before the symlinks to the
171 # library, so that the copy and install works as expected.
172 FUNCTION (SCIQLOP_ADD_EXTERN_DEPENDENCY externLibrariesVar externSharedLibrariesVar dependencyName)
173 STRING (TOUPPER ${dependencyName} upperDependencyName)
174
175 FIND_PACKAGE(${dependencyName} ${ARGN})
176 IF (${upperDependencyName}_FOUND)
177 # Add the include directories of the dependency
178 INCLUDE_DIRECTORIES(${${upperDependencyName}_INCLUDE_DIRS})
179
180 # Add the libraries to the externLibrariesVar variable and export it to
181 # the parent scope
182 LIST(APPEND ${externLibrariesVar} ${${upperDependencyName}_LIBRARIES})
183 SCIQLOP_SET_TO_PARENT_SCOPE(${externLibrariesVar})
184
185 # Find the shared libraries
186 LIST(APPEND ${externSharedLibrariesVar} ${${upperDependencyName}_SHARED_LIBRARIES})
187
188 # Export the externSharedLibrariesVar variable to the parent scope
189 SCIQLOP_SET_TO_PARENT_SCOPE(${externSharedLibrariesVar})
190 ENDIF ()
191 ENDFUNCTION (SCIQLOP_ADD_EXTERN_DEPENDENCY)
1 NO CONTENT: new file 100644
NO CONTENT: new file 100644
@@ -0,0 +1,90
1 #
2 # sciqlop_params : Define compilation parameters
3 #
4 # Debug or release
5 #
6 # As the "NMake Makefiles" forces by default the CMAKE_BUILD_TYPE variable to Debug, SCIQLOP_BUILD_TYPE variable is used to be sure that the debug mode is a user choice
7 SET(SCIQLOP_BUILD_TYPE "Release" CACHE STRING "Choose to compile in Debug or Release mode")
8
9 IF(SCIQLOP_BUILD_TYPE MATCHES "Debug")
10 MESSAGE (STATUS "Build in Debug")
11 SET (CMAKE_BUILD_TYPE "Debug")
12 SET (DEBUG_SUFFIX "d")
13 ELSE()
14 MESSAGE (STATUS "Build in Release")
15 SET (CMAKE_BUILD_TYPE "Release")
16 SET (SCIQLOP_BUILD_TYPE "Release")
17 SET (DEBUG_SUFFIX "")
18 ENDIF()
19
20 #
21 # Need to compile tests?
22 #
23 OPTION (BUILD_TESTS "Build the tests" OFF)
24 ENABLE_TESTING(${BUILD_TESTS})
25
26 #
27 # Path to the folder for sciqlop's extern libraries.
28 #
29 # When looking for an external library in sciqlop, we look to the following
30 # folders:
31 # - The specific folder for the library (generally of the form <LIBRARY>_ROOT_DIR
32 # - The global Sciqlop extern folder
33 # - The system folders.
34 #
35 # If a dependency is found in the global extern folder or a specific folder for
36 # the library, then it is installed with the sciqlop libraries. If it is found
37 # in the system folders, it is not. This behavior can be overriden with the
38 # <LIBRARY>_COPY_SHARED_LIBRARIES flag.
39 #
40 set(SCIQLOP_EXTERN_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/extern"
41 CACHE PATH "Path to the folder for sciqlop's extern libraries")
42 option(SCIQLOP_FORCE_UPDATE_EXT_ROOT_DIR "Force the <LIBRARY>_ROOT_DIR to be updated to the global sciqlop extern folder"
43 OFF)
44
45 if (SCIQLOP_FORCE_UPDATE_EXT_ROOT_DIR)
46 set(libRootDirForceValue FORCE)
47 else()
48 set(libRootDirForceValue)
49 endif()
50
51
52
53 #
54 # Static or shared libraries
55 #
56 OPTION (BUILD_SHARED_LIBS "Build the shared libraries" ON)
57
58 # Generate position independant code (-fPIC)
59 SET(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
60
61 #
62 # Configure installation directories
63 #
64 IF (UNIX)
65 SET(defaultBin "bin")
66 SET(defaultInc "include/sciqlop")
67
68 # 32 or 64 bits compiler
69 IF( CMAKE_SIZEOF_VOID_P EQUAL 8 )
70 SET(defaultLib "lib64/sciqlop")
71 ELSE()
72 SET(defaultLib "lib/sciqlop")
73 ENDIF()
74
75 SET(defaultDoc "share/docs/sciqlop")
76 ELSE()
77 SET(defaultBin "bin")
78 SET(defaultInc "include/sciqlop")
79 SET(defaultLib "lib/sciqlop")
80 SET(defaultDoc "docs/sciqlop")
81 ENDIF()
82
83 SET(INSTALL_BINARY_DIR "${defaultBin}" CACHE STRING
84 "Installation directory for binaries")
85 SET(INSTALL_LIBRARY_DIR "${defaultLib}" CACHE STRING
86 "Installation directory for libraries")
87 SET(INSTALL_INCLUDE_DIR "${defaultInc}" CACHE STRING
88 "Installation directory for headers")
89 SET(INSTALL_DOCUMENTATION_DIR "${defaultDoc}" CACHE STRING
90 "Installation directory for documentations")
@@ -0,0 +1,22
1 #
2 # sciqlop_version.cmake
3 #
4 # Holds the version of sciqlop.
5 #
6 # These variables are used to generate the
7 # "Version.h" and "Version.cpp" files so that the version number is available
8 # inside of sciqlop source code.
9 #
10 # Moreover, they're used with CPack to display the version number in the setups.
11 #
12
13 # Version number parts. These variables must be updated when the version change.
14 SET (SCIQLOP_VERSION_MAJOR 0)
15 SET (SCIQLOP_VERSION_MINOR 1)
16 SET (SCIQLOP_VERSION_PATCH 0)
17 SET (SCIQLOP_VERSION_SUFFIX "")
18
19 # Version number as a string. This variable is automatically generated from the
20 # above variables to build a version number of the form: MAJOR.MINOR.PATCH. If
21 # SCIQLOP_VERSION_SUFFIX isn't empty, it is appended to the version number.
22 SET (SCIQLOP_VERSION "${SCIQLOP_VERSION_MAJOR}.${SCIQLOP_VERSION_MINOR}.${SCIQLOP_VERSION_PATCH}${SCIQLOP_VERSION_SUFFIX}")
@@ -0,0 +1,141
1
2 ## sciqlop - CMakeLists.txt
3 SET(EXECUTABLE_NAME "sciqlop")
4 SET(SOURCES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/)
5 SET(INCLUDE_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/include)
6 SET(UI_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/src)
7 SET(RES_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/resources)
8
9 #
10 # Find Qt modules
11 #
12 SCIQLOP_FIND_QT(Core Widgets)
13
14 #
15 # Find dependent libraries
16 # ========================
17 SET(LIBRARIES)
18 SET(EXTERN_LIBRARIES)
19 SET(EXTERN_SHARED_LIBRARIES)
20
21 # Add sqpcore to the list of libraries to use
22 list(APPEND LIBRARIES ${SQPCORE_LIBRARY_NAME})
23
24 # Include sqpcore directory
25 include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../sqpcore/src")
26
27 # Add dependent shared libraries
28 list(APPEND SHARED_LIBRARIES ${SQPCORE_SHARED_LIBRARIES})
29
30 # Retrieve the location of the dynamic library to copy it to the output path
31 get_property(sqpcoreLocation TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY LOCATION)
32 list(APPEND SHARED_LIBRARIES_FROM_TARGETS ${sqpcoreLocation})
33
34 #
35 # Compile the application
36 #
37 FILE (GLOB_RECURSE APPLICATION_SOURCES
38 ${SOURCES_DIR}/*.c
39 ${SOURCES_DIR}/*.cpp
40 ${SOURCES_DIR}/*.h)
41
42 # Headers files (.h)
43 FILE (GLOB_RECURSE PROJECT_HEADERS ${INCLUDE_FOLDER}/*.h)
44
45 # Ui files
46 FILE (GLOB_RECURSE PROJECT_FORMS ${UI_FOLDER}/*.ui)
47
48 # Resources files
49 FILE (GLOB_RECURSE PROJECT_RESOURCES ${RES_FOLDER}/*.qrc)
50
51 # Retrieve resources files
52 FILE (GLOB_RECURSE APPLICATION_RESOURCES ${RES_FOLDER}/*.qrc)
53
54 QT5_ADD_RESOURCES(RCC_HDRS ${APPLICATION_RESOURCES} )
55
56 QT5_WRAP_UI(UIS_HDRS
57 ${PROJECT_FORMS}
58 )
59
60
61 ADD_EXECUTABLE(${EXECUTABLE_NAME} ${APPLICATION_SOURCES} ${RCC_HDRS} ${UIS_HDRS})
62 target_link_libraries(${EXECUTABLE_NAME}
63 ${LIBRARIES})
64
65 # Link with Qt5 modules
66 qt5_use_modules(${EXECUTABLE_NAME} Core Widgets)
67
68
69 # Add the files to the list of files to be analyzed
70 LIST(APPEND CHECKSTYLE_INPUT_FILES ${APPLICATION_SOURCES})
71 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
72 # Vera++ exclusion files
73 #LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/path/to/exclusionFiles.tcl)
74 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
75
76 #
77 # Compile the tests
78 #
79 IF(BUILD_TESTS)
80 INCLUDE_DIRECTORIES(${SOURCES_DIR})
81 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
82 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
83 SET( TEST_LIBRARIES ${LIBRARIES} ${EXTERN_LIBRARIES})
84
85 FOREACH( testFile ${TESTS_SOURCES} )
86 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
87 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
88
89 # Add to the list of sources files all the sources in the same
90 # directory that aren't another test
91 FILE (GLOB currentTestSources
92 ${testDirectory}/*.c
93 ${testDirectory}/*.cpp
94 ${testDirectory}/*.h)
95 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
96 LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
97
98 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
99 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} )
100 qt5_use_modules(${testName} Test)
101
102 ADD_TEST( NAME ${testName} COMMAND ${testName} )
103
104 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES})
105 ENDFOREACH( testFile )
106
107 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
108 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
109 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
110 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
111 ENDIF(BUILD_TESTS)
112
113 #
114 # Set the files that must be formatted by clang-format.
115 #
116 LIST (APPEND FORMATTING_INPUT_FILES ${APPLICATION_SOURCES})
117 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
118
119 #
120 # Set the directories that doxygen must browse to generate the
121 # documentation.
122 #
123 # Source directories:
124 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
125 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
126 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
127 # Source directories to exclude from the documentation generation
128 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
129 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
130
131 #
132 # Set the directories with the sources to analyze and propagate the
133 # modification to the parent scope
134 #
135 # Source directories to analyze:
136 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
137 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
138 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
139 # Source directories to exclude from the analysis
140 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
141 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
@@ -0,0 +1,121
1
2 ## sqpcore - CMakeLists.txt
3 STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX)
4 SET(SQPCORE_LIBRARY_NAME "${LIBRARY_PREFFIX}_sqpcore${DEBUG_SUFFIX}")
5 SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/")
6
7 # Set a variable to display a warning in the version files.
8 SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.")
9 # Generate the version file from the cmake version variables. The version
10 # variables are defined in the cmake/sciqlop_version.cmake file.
11 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.h.in"
12 "${SOURCES_DIR}/Version.h")
13 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.cpp.in"
14 "${SOURCES_DIR}/Version.cpp")
15
16 #
17 # Find Qt modules
18 #
19 SCIQLOP_FIND_QT(Core)
20
21 #
22 # Compile the library library
23 #
24 FILE (GLOB_RECURSE MODULE_SOURCES
25 ${SOURCES_DIR}/*.c
26 ${SOURCES_DIR}/*.cpp
27 ${SOURCES_DIR}/*.h)
28
29 ADD_LIBRARY(${SQPCORE_LIBRARY_NAME} ${MODULE_SOURCES})
30 TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME} ${EXTERN_LIBRARIES})
31 qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core)
32
33 # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html
34 # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order.
35 # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets
36 IF(BUILD_SHARED_LIBS)
37 SET_TARGET_PROPERTIES(${SQPCORE_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT")
38 ELSE()
39 TARGET_COMPILE_DEFINITIONS(${SQPCORE_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES")
40 ENDIF()
41
42 # Set the variable to parent scope so that the other projects can copy the
43 # dependent shared libraries
44 SCIQLOP_SET_TO_PARENT_SCOPE(SQPCORE_LIBRARY_NAME)
45
46 # Copy extern shared libraries to the lib folder
47 SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES})
48
49 # Add the files to the list of files to be analyzed
50 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
51 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
52 # Vera++ exclusion files
53 #LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/path/to/exclusionFiles.tcl)
54 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
55
56 #
57 # Compile the tests
58 #
59 IF(BUILD_TESTS)
60 INCLUDE_DIRECTORIES(${SOURCES_DIR})
61 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
62 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
63 SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME} ${EXTERN_LIBRARIES})
64
65 FOREACH( testFile ${TESTS_SOURCES} )
66 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
67 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
68
69 # Add to the list of sources files all the sources in the same
70 # directory that aren't another test
71 FILE (GLOB currentTestSources
72 ${testDirectory}/*.c
73 ${testDirectory}/*.cpp
74 ${testDirectory}/*.h)
75 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
76 LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
77
78 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
79 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} )
80 qt5_use_modules(${testName} Test)
81
82 ADD_TEST( NAME ${testName} COMMAND ${testName} )
83
84 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES})
85 ENDFOREACH( testFile )
86
87 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
88 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
89 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
90 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
91 ENDIF(BUILD_TESTS)
92
93 #
94 # Set the files that must be formatted by clang-format.
95 #
96 LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
97 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
98
99 #
100 # Set the directories that doxygen must browse to generate the
101 # documentation.
102 #
103 # Source directories:
104 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
105 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
106 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
107 # Source directories to exclude from the documentation generation
108 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
109 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
110
111 #
112 # Set the directories with the sources to analyze and propagate the
113 # modification to the parent scope
114 #
115 # Source directories to analyze:
116 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
117 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
118 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
119 # Source directories to exclude from the analysis
120 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
121 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
@@ -0,0 +1,138
1
2 ## sqpgui - CMakeLists.txt
3 STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX)
4 SET(SQPGUI_LIBRARY_NAME "${LIBRARY_PREFFIX}_sqpgui${DEBUG_SUFFIX}")
5 SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
6 SET(INCLUDE_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/include)
7 SET(UI_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/ui)
8 SET(RES_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/resources)
9
10 # Set a variable to display a warning in the version files.
11 SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.")
12
13 #
14 # Find Qt modules
15 #
16 SCIQLOP_FIND_QT(Core Widgets)
17
18 #
19 # Compile the library library
20 #
21 FILE (GLOB_RECURSE MODULE_SOURCES
22 ${SOURCES_DIR}/*.c
23 ${SOURCES_DIR}/*.cpp
24 ${SOURCES_DIR}/*.h)
25
26 # Headers files (.h)
27 FILE (GLOB_RECURSE PROJECT_HEADERS ${INCLUDE_FOLDER}/*.h)
28
29 # Ui files
30 FILE (GLOB_RECURSE PROJECT_FORMS ${UI_FOLDER}/*.ui)
31
32 # Resources files
33 FILE (GLOB_RECURSE PROJECT_RESOURCES ${RES_FOLDER}/*.qrc)
34
35 QT5_ADD_RESOURCES(RCC_HDRS
36 ${PROJECT_RESOURCES}
37 )
38
39 QT5_WRAP_UI(UIS_HDRS
40 ${PROJECT_FORMS}
41 )
42
43 include_directories("${CMAKE_CURRENT_BINARY_DIR}")
44 message(CURRENT INCLUDE : ${CMAKE_CURRENT_BINARY_DIR})
45
46 ADD_LIBRARY(${SQPGUI_LIBRARY_NAME} ${MODULE_SOURCES} ${UIS_HDRS})
47 TARGET_LINK_LIBRARIES(${SQPGUI_LIBRARY_NAME} ${EXTERN_LIBRARIES})
48 qt5_use_modules(${SQPGUI_LIBRARY_NAME} Core Widgets)
49
50 # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html
51 # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order.
52 # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets
53 IF(BUILD_SHARED_LIBS)
54 SET_TARGET_PROPERTIES(${SQPGUI_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT")
55 ELSE()
56 TARGET_COMPILE_DEFINITIONS(${SQPGUI_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES")
57 ENDIF()
58
59 # Set the variable to parent scope so that the other projects can copy the
60 # dependent shared libraries
61 SCIQLOP_SET_TO_PARENT_SCOPE(SQPGUI_LIBRARY_NAME)
62
63 # Copy extern shared libraries to the lib folder
64 SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPGUI_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES})
65
66 # Add the files to the list of files to be analyzed
67 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
68 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
69 # Vera++ exclusion files
70 #LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/path/to/exclusionFiles.tcl)
71 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
72
73 #
74 # Compile the tests
75 #
76 IF(BUILD_TESTS)
77 INCLUDE_DIRECTORIES(${SOURCES_DIR})
78 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
79 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
80 SET( TEST_LIBRARIES ${SQPGUI_LIBRARY_NAME} ${EXTERN_LIBRARIES})
81
82 FOREACH( testFile ${TESTS_SOURCES} )
83 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
84 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
85
86 # Add to the list of sources files all the sources in the same
87 # directory that aren't another test
88 FILE (GLOB currentTestSources
89 ${testDirectory}/*.c
90 ${testDirectory}/*.cpp
91 ${testDirectory}/*.h)
92 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
93 LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
94
95 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
96 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} )
97 qt5_use_modules(${testName} Test)
98
99 ADD_TEST( NAME ${testName} COMMAND ${testName} )
100
101 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES})
102 ENDFOREACH( testFile )
103
104 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
105 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
106 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
107 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
108 ENDIF(BUILD_TESTS)
109
110 #
111 # Set the files that must be formatted by clang-format.
112 #
113 LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
114 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
115
116 #
117 # Set the directories that doxygen must browse to generate the
118 # documentation.
119 #
120 # Source directories:
121 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
122 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
123 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
124 # Source directories to exclude from the documentation generation
125 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
126 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
127
128 #
129 # Set the directories with the sources to analyze and propagate the
130 # modification to the parent scope
131 #
132 # Source directories to analyze:
133 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
134 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
135 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
136 # Source directories to exclude from the analysis
137 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
138 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
General Comments 0
You need to be logged in to leave comments. Login now