@@ -12,14 +12,8 @@ endif()
12
12
string (REGEX REPLACE "\\ .cpp$" ".hpp" OUTPUT_HPP "${OUTPUT} " )
13
13
get_filename_component (OUTPUT_HPP_NAME "${OUTPUT_HPP} " NAME )
14
14
15
- if ("${MODULE_NAME} " STREQUAL "ocl" )
16
- set (nested_namespace_start "" )
17
- set (nested_namespace_end "" )
18
- else ()
19
- set (new_mode ON )
20
- set (nested_namespace_start "namespace ${MODULE_NAME} \n {" )
21
- set (nested_namespace_end "}" )
22
- endif ()
15
+ set (nested_namespace_start "namespace ${MODULE_NAME} \n {" )
16
+ set (nested_namespace_end "}" )
23
17
24
18
set (STR_CPP "// This file is auto-generated. Do not edit!
25
19
@@ -35,6 +29,8 @@ namespace ocl
35
29
{
36
30
${nested_namespace_start}
37
31
32
+ static const char* const moduleName = \" ${MODULE_NAME} \" ;
33
+
38
34
" )
39
35
40
36
set (STR_HPP "// This file is auto-generated. Do not edit!
@@ -76,27 +72,23 @@ foreach(cl ${cl_list})
76
72
77
73
string (MD5 hash "${lines} " )
78
74
79
- set (STR_CPP_DECL "const struct ProgramEntry ${cl_filename} ={\" ${cl_filename} \" ,\n\" ${lines} , \" ${hash} \" };\n " )
80
- set (STR_HPP_DECL "extern const struct ProgramEntry ${cl_filename} ;\n " )
81
- if (new_mode )
82
- set (STR_CPP_DECL "${STR_CPP_DECL} ProgramSource ${cl_filename} _oclsrc(${cl_filename} .programStr);\n " )
83
- set (STR_HPP_DECL "${STR_HPP_DECL} extern ProgramSource ${cl_filename} _oclsrc;\n " )
84
- endif ()
75
+ set (STR_CPP_DECL "struct cv::ocl::internal::ProgramEntry ${cl_filename} _oclsrc={moduleName, \" ${cl_filename} \" ,\n\" ${lines} , \" ${hash} \" , NULL};\n " )
76
+ set (STR_HPP_DECL "extern struct cv::ocl::internal::ProgramEntry ${cl_filename} _oclsrc;\n " )
85
77
86
78
set (STR_CPP "${STR_CPP}${STR_CPP_DECL} " )
87
79
set (STR_HPP "${STR_HPP}${STR_HPP_DECL} " )
88
80
endforeach ()
89
81
90
- set (STR_CPP "${STR_CPP} } \n ${nested_namespace_end} }\n #endif\n " )
91
- set (STR_HPP "${STR_HPP} } \n ${nested_namespace_end} }\n #endif\n " )
82
+ set (STR_CPP "${STR_CPP} \n ${nested_namespace_end} }}\n #endif\n " )
83
+ set (STR_HPP "${STR_HPP} \n ${nested_namespace_end} }}\n #endif\n " )
92
84
93
85
file (WRITE "${OUTPUT} " "${STR_CPP} " )
94
86
95
87
if (EXISTS "${OUTPUT_HPP} " )
96
88
file (READ "${OUTPUT_HPP} " hpp_lines )
97
89
endif ()
98
90
if ("${hpp_lines} " STREQUAL "${STR_HPP} " )
99
- message (STATUS "${OUTPUT_HPP} contains same content" )
91
+ message (STATUS "${OUTPUT_HPP} contains the same content" )
100
92
else ()
101
93
file (WRITE "${OUTPUT_HPP} " "${STR_HPP} " )
102
94
endif ()
0 commit comments