efl

Форк
0
/
EolianHelper.cmake.in 
79 строк · 2.7 Кб
1
# macro to create a eolian generated c source file
2
#
3
# macro adds a generate rule, which depends on the original file the rule will output file.x
4
#
5
# The passed include snippet will just be added to the command
6

7
macro(_rule_eox file include deps)
8
    add_custom_command(
9
       OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${file}.x
10
       COMMAND eolian_gen ${include} -g c -o c:${CMAKE_CURRENT_SOURCE_DIR}/${file}.x ${CMAKE_CURRENT_SOURCE_DIR}/${file}
11
       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file}
12
       DEPENDS ${deps}
13
    )
14
endmacro()
15

16
# macro to create a eolian generated header file
17
#
18
# other details are like the eox rule
19
macro(_rule_eoh file include deps)
20
    add_custom_command(
21
       OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${file}.h
22
       COMMAND eolian_gen ${include} -g h -o h:${CMAKE_CURRENT_SOURCE_DIR}/${file}.h ${CMAKE_CURRENT_SOURCE_DIR}/${file}
23
       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file}
24
       DEPENDS ${deps}
25
    )
26
endmacro()
27

28
# Can be used to create .eo.x , .eo.h, .eot.h generator rules.
29
# <file>.eo files are generated into <file>.eo.x and <file>.eo.h files
30
# <file>.eot files are generated into <file>.eot.h files
31
# The standard include path of efl eolian files is automatically added to the includes
32
#
33
# build_files - A list of files
34
# relative_include_dirs - A list of dirs to include
35
#
36
# If one of the included files is changed the file will be rebuilded at the next
37
# make call
38
#
39
# The macro scans for .eo files, hey have to be in the build_files.
40
# The generator rules are just executed if the file is a dependecy of some lib/executable.
41

42
function(eo_rule_create build_files relative_include_dirs)
43
   string(REPLACE "\n" "" EOLIAN_EO_DIR_WITHOUT_NEWLINE "${EOLIAN_EO_DIR}")
44

45
   # add std includes
46
   list(APPEND include_dirs
47
      ${EOLIAN_EO_DIR_WITHOUT_NEWLINE}
48
    )
49

50
   # convert relative to absolute
51
   foreach(relative_include_dir ${relative_include_dirs})
52
      list(APPEND include_dirs
53
        ${CMAKE_CURRENT_SOURCE_DIR}/${relative_include_dir}
54
      )
55
   endforeach()
56

57
   # work with the absolute paths
58
   foreach(include_cmd ${include_dirs})
59
      # build include cmd
60
      string(CONCAT includes "${includes}" " -I${include_cmd}")
61
      # fetch dep files
62
      file(GLOB_RECURSE files "${include_cmd}/*.eo")
63
      foreach(file ${files})
64
        list(APPEND dep_files ${file})
65
      endforeach()
66
   endforeach()
67

68
   string(REPLACE " " ";" includes "${includes}")
69
   foreach(file ${build_files})
70
      get_filename_component(ext ${file} EXT)
71
      if (ext MATCHES "^\\.eo$")
72
         _rule_eoh("${file}" "${includes}" "${dep_files}")
73
         _rule_eox("${file}" "${includes}" "${dep_files}")
74
      endif()
75
      if (ext MATCHES "^\\.eot$")
76
         _rule_eoh("${file}" "${includes}" "${dep_files}")
77
      endif()
78
    endforeach()
79
endfunction()
80

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.