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