##// END OF EJS Templates
Correction on package.cmake to include COPYING file instead of LICENCE File. Remove message from cmake
perrinel -
r242:070194309ffd
parent child
Show More
@@ -1,59 +1,59
1 1 #
2 2 # Generate the source package of SciqLop.
3 3 #
4 4
5 5 install(DIRECTORY
6 6 ${EXECUTABLE_OUTPUT_PATH}
7 7 DESTINATION "."
8 8 USE_SOURCE_PERMISSIONS
9 9 COMPONENT CORE
10 10 PATTERN "*.a" EXCLUDE
11 11 )
12 12
13 13 set(EXECUTABLEDOTEXTENSION)
14 14 if(WIN32)
15 15 set(EXECUTABLEDOTEXTENSION ".exe")
16 16 endif(WIN32)
17 17 set (SCIQLOP_EXE_LOCATION ${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE_NAME}${EXECUTABLEDOTEXTENSION})
18 18
19 19 if(WIN32)
20 20 include ("cmake/sciqlop_package_qt.cmake")
21 21 endif(WIN32)
22 22
23 23
24 24 SET (CPACK_PACKAGE_VENDOR "CNRS")
25 25 SET (CPACK_PACKAGE_VERSION_MAJOR "${SCIQLOP_VERSION_MAJOR}")
26 26 SET (CPACK_PACKAGE_VERSION_MINOR "${SCIQLOP_VERSION_MINOR}")
27 27 SET (CPACK_PACKAGE_VERSION_PATCH "${SCIQLOP_VERSION_PATCH}${SCIQLOP_VERSION_SUFFIX}")
28 28 SET (CPACK_PACKAGE_VERSION "${SCIQLOP_VERSION}")
29 SET (CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE)
29 SET (CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING)
30 30 SET (CPACK_PACKAGE_CONTACT "nicolas.aunai@lpp.polytechnique.fr")
31 31 SET(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/README.md)
32 32 # SET(CPACK_RESOURCE_FILE_WELCOME ${CMAKE_CURRENT_SOURCE_DIR}/WARN.txt)
33 SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE)
33 SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/COPYING)
34 34 # SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${PROJECT_NAME}-${PROJECT_VERSION})
35 35 SET(FULLBUILD ON)
36 36
37 37 SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
38 38 SET(CPACK_GENERATOR "NSIS")
39 39 SET(CPACK_MONOLITHIC_INSTALL 1)
40 40 #SET(CPACK_COMPONENTS_ALL sciqlop qt)
41 41 SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Setup")
42 42 SET(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_NAME})
43 43
44 44 set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
45 45
46 46 if (WIN32)
47 47 SET(CPACK_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
48 48 SET(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
49 49 SET(CPACK_NSIS_COMPONENT_INSTALL ON)
50 50 SET(CPACK_SYSTEM_NAME "MinGW32")
51 51 SET(CPACK_PACKAGING_INSTALL_PREFIX "")
52 52 #SET(CPACK_GENERATOR "NSIS")
53 53 SET(CPACK_NSIS_DISPLAY_NAME ${PROJECT_NAME})
54 54 SET(CPACK_NSIS_MUI_FINISHPAGE_RUN ${SCIQLOP_EXECUTABLE_NAME})
55 55 SET(CPACK_NSIS_MUI_ICON ${SCIQLOP_EXECUTABLE_ICON_LOCATION})
56 56 SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\${SCIQLOP_EXECUTABLE_NAME}.exe")
57 57 endif (WIN32)
58 58
59 59 INCLUDE(CPack)
@@ -1,139 +1,138
1 1 #
2 2 # use_clangformat.cmake
3 3 #
4 4 # The following functions are defined in this document:
5 5 #
6 6
7 7 # ADD_CLANGFORMAT_TARGETS(<globExpression> ...
8 8 # [ADD_TO_ALL]
9 9 # [NAME <name>]
10 10 # [NAME_ALL <nameall>]
11 11 # [STYLE style]
12 12 # [RECURSE])
13 13 #
14 14 # Two custom targets will be created:
15 15 # * format_reports is run as part of the build, and is not rerun unless one of
16 16 # the file formatted is modified (only created if ADD_TO_ALL is provided);
17 17 # * format must be explicitely called (make format) and is rerun even if the
18 18 # files to format have not been modified. To achieve this behavior, the commands
19 19 # used in this target pretend to produce a file without actually producing it.
20 20 # Because the output file is not there after the run, the command will be rerun
21 21 # again at the next target build.
22 22 #
23 23 # If ADD_TO_ALL is provided then a target will be added to the default build
24 24 # targets so that each time a source file is compiled, it is formatted with
25 25 # clang-format.
26 26 #
27 27 # NAME and NAME_ALL customize the name of the targets (format and format_reports
28 28 # by default respectively).
29 29 #
30 30 # STYLE sets the style used by clang-format (default to "file").
31 31 #
32 32 # RECURSE selects if the glob expressions should be applied recursively or not.
33 33 FUNCTION(ADD_CLANGFORMAT_TARGETS)
34 34 # Default values
35 35 SET(target "format")
36 36 SET(target_all "format_all")
37 37 SET(style "file")
38 38 SET(recurse OFF)
39 39 SET(addToAll OFF)
40 40 SET(globs)
41 41
42 42 # Parse the options
43 43 MATH(EXPR lastIdx "${ARGC} - 1")
44 44 SET(i 0)
45 45 WHILE(i LESS ${ARGC})
46 46 SET(arg "${ARGV${i}}")
47 47 IF("${arg}" STREQUAL "ADD_TO_ALL")
48 48 SET(addToAll ON)
49 49 ELSEIF("${arg}" STREQUAL "NAME")
50 50 clangformat_incr(i)
51 51 SET(target "${ARGV${i}}")
52 52 ELSEIF("${arg}" STREQUAL "NAME_ALL")
53 53 clangformat_incr(i)
54 54 SET(target_all "${ARGV${i}}")
55 55 ELSEIF("${arg}" STREQUAL "STYLE")
56 56 clangformat_incr(i)
57 57 SET(style "${ARGV${i}}")
58 58 ELSEIF("${arg}" STREQUAL "RECURSE")
59 59 SET(recurse ON)
60 60 ELSE()
61 61 LIST(APPEND globs ${arg})
62 62 ENDIF()
63 63 clangformat_incr(i)
64 64 ENDWHILE()
65 65
66 66
67 67 # Retrieve source files to format
68 68 IF(recurse)
69 69 FILE(GLOB_RECURSE srcs ${globs})
70 70 ELSE()
71 71 FILE(GLOB srcs ${globs})
72 72 ENDIF()
73 73
74 74 IF(NOT CLANGFORMAT_EXECUTABLE)
75 75 MESSAGE(FATAL_ERROR "Unable to find clang-format executable")
76 76 ENDIF()
77 77
78 78 # Format each source file with clang-format
79 79 SET(touchedFiles)
80 80 SET(fakedTouchedFiles)
81 81 SET(reportNb 0)
82 82 # Create the directory where the touched files will be saved
83 83 SET(formatDirectory "${CMAKE_CURRENT_BINARY_DIR}/format")
84 84 FILE(MAKE_DIRECTORY ${formatDirectory})
85 85 # STRING(REPLACE "*.ui" "" srcs ${srcs})
86 86 FOREACH(item ${globs})
87 87 STRING(REGEX MATCH ".*\.ui$" item ${item})
88 88 IF(item)
89 89 LIST(APPEND UIS ${item})
90 90 ENDIF(item)
91 91 ENDFOREACH(item ${globs})
92 92
93 93 LIST(REMOVE_ITEM srcs ${UIS})
94 message("format lang: ${srcs}" )
95 94 FOREACH (s ${srcs})
96 95 SET(touchedFile ${formatDirectory}/format_touchedfile_${reportNb})
97 96 IF(addToAll)
98 97 ADD_CUSTOM_COMMAND(
99 98 OUTPUT ${touchedFile}
100 99 COMMAND ${CLANGFORMAT_EXECUTABLE}
101 100 -style="${style}"
102 101 -i
103 102 ${s}
104 103 # Create a file so that this command is executed only if the source
105 104 # file is modified
106 105 COMMAND ${CMAKE_COMMAND} -E touch ${touchedFile}
107 106 DEPENDS ${s}
108 107 COMMENT "Formatting code with clang-format of ${s}"
109 108 )
110 109 ENDIF()
111 110
112 111 SET(fakedTouchedFile ${formatDirectory}/format_fakedtouchedfile_${reportNb})
113 112 ADD_CUSTOM_COMMAND(
114 113 OUTPUT ${fakedTouchedFile}
115 114 COMMAND ${CLANGFORMAT_EXECUTABLE}
116 115 -style="${style}"
117 116 -i
118 117 ${s}
119 118 DEPENDS ${s}
120 119 COMMENT "Formatting code with clang-format of ${s}"
121 120 )
122 121
123 122 LIST(APPEND touchedFiles ${touchedFile})
124 123 LIST(APPEND fakedTouchedFiles ${fakedTouchedFile})
125 124 clangformat_incr(reportNb)
126 125 ENDFOREACH()
127 126
128 127 # Create the custom targets that will trigger the custom command created
129 128 # previously
130 129 IF(addToAll)
131 130 ADD_CUSTOM_TARGET(${target_all} ALL DEPENDS ${touchedFiles})
132 131 ENDIF()
133 132 ADD_CUSTOM_TARGET(${target} DEPENDS ${fakedTouchedFiles})
134 133
135 134 ENDFUNCTION(ADD_CLANGFORMAT_TARGETS)
136 135
137 136 macro(clangformat_incr var_name)
138 137 math(EXPR ${var_name} "${${var_name}} + 1")
139 138 endmacro()
General Comments 0
You need to be logged in to leave comments. Login now