Просмотр исходного кода

Remove prologue/epilogue from yexport code, remove platform CNameLists from code
d6bb959adffd2a72bb6b3020d69de20211bec6a6

dimdim11 10 месяцев назад
Родитель
Сommit
f12862d327

+ 4 - 4
build/export_generators/hardcoded-cmake/common_cmake_lists.jinja

@@ -2,9 +2,9 @@
 {% include '[generator]/disclaimer.jinja' -%}
 {% set platforms_count = platform_names|length -%}
 {% if platforms_count > 0 -%}
-{% for i in range(platforms_count) %}
-{% if i != 0 %}else{% endif %}if ({{ platforms[platform_names[i]] }})
-  include({{ platform_cmakelists[i] }})
-{%- endfor %}
+{%     for i in range(platforms_count) %}
+{%         if i != 0 %}else{% endif %}if ({{ platforms[platform_names[i]] }})
+  include(CMakeLists.{{ platform_names[i] }}.txt)
+{%-    endfor %}
 endif()
 {% endif -%}

+ 20 - 12
build/export_generators/hardcoded-cmake/dir_cmake_lists.jinja

@@ -1,4 +1,7 @@
+{# DEPRECATED -#}
 {% include prologue ignore missing %}
+{#- ENABLE AFTER yexport RELEASE #}
+{#- include 'prologue.cmake' ignore missing #}
 {% include '[generator]/disclaimer.jinja' -%}
 
 {% for package in packages -%}
@@ -8,9 +11,11 @@ find_package({{ package[0] }} REQUIRED
         {%- endfor %}
     {%- endif %})
 {% endfor -%}
-{% for incl in includes -%}
+{% if includes is defined -%}
+{%     for incl in includes -%}
 include({{ incl }})
-{% endfor -%}
+{%     endfor -%}
+{% endif -%}
 {% for subdir in subdirs -%}
 add_subdirectory({{ subdir }})
 {% endfor -%}
@@ -21,15 +26,18 @@ add_subdirectory({{ subdir }})
 
 {% endfor -%}
 {% for target in targets %}
-{%- set macro = target.macro -%}
-    {%- set name = target.name -%}
-    {%- set is_interface = target.is_interface -%}
-    {%- set macro_args = target.macro_args -%}
-    {%- set properties = target.properties -%}
-    {%- set attributes = target.attributes -%}
-    {%- set target_dir_macros = target.target_dir_macros -%}
-    {%- set target_macros = target.target_macros -%}
-    {%- set dependencies = target.dependencies -%}
-    {%- include '[generator]/target_cmake_lists.jinja' %}{{"\n"}}
+{%-     set macro = target.macro -%}
+{%-     set name = target.name -%}
+{%-     set is_interface = target.is_interface -%}
+{%-     set macro_args = target.macro_args -%}
+{%-     set properties = target.properties -%}
+{%-     set attributes = target.attributes -%}
+{%-     set target_dir_macros = target.target_dir_macros -%}
+{%-     set target_macros = target.target_macros -%}
+{%-     set dependencies = target.dependencies -%}
+{%-     include '[generator]/target_cmake_lists.jinja' %}{{"\n"}}
 {%- endfor %}
+{# DEPRECATED -#}
 {% include epilogue ignore missing %}
+{#- ENABLE AFTER yexport RELEASE #}
+{#- include 'epilogue.cmake' ignore missing #}

+ 1 - 1
build/export_generators/hardcoded-cmake/generator.toml

@@ -49,13 +49,13 @@ template={ path="dir_cmake_lists.jinja", dest="CMakeLists{PLATFORM}.txt" }
 [attrs.root]
 project_name="str"
 project_language_list="list"
-platform_cmakelists="list"
 platform_vars="list"
 includes="sorted_set"
 use_conan="bool"
 vanilla_protobuf="flag"
 
 [attrs.dir]
+# DEPRECATED
 prologue="str"
 epilogue="str"
 

+ 7 - 3
build/export_generators/hardcoded-cmake/root_cmake_lists.jinja

@@ -23,8 +23,12 @@ cmake_policy(SET CMP0104 OLD)
 
 include(cmake/global_flags.cmake)
 include(cmake/global_vars.cmake)
-{% for path in includes %}include({{path}})
-{%endfor%}{% if use_conan %}
+{% if includes is defined -%}
+{%     for incl in includes -%}
+include({{ incl }})
+{%     endfor -%}
+{% endif -%}
+{% if use_conan %}
 if (CMAKE_CROSSCOMPILING)
   include(${PROJECT_BINARY_DIR}/conan_paths.cmake)
 else()
@@ -49,7 +53,7 @@ set(vanilla_protobuf "yes")
 {%  if platforms_count > 0 -%}
 {%      for i in range(platforms_count) -%}
 {%          if i != 0 %}else{% endif %}if ({{ platforms[platform_names[i]] }})
-  include({{ platform_cmakelists[i] }})
+  include(CMakeLists.{{ platform_names[i] }}.txt)
 {%      endfor -%}
 endif()
 {%  endif %}

+ 22 - 22
build/export_generators/hardcoded-cmake/target_cmake_lists.jinja

@@ -1,9 +1,9 @@
 {{ macro }}({{ name }}
 {%- if is_interface %} INTERFACE{% endif %}
 {%- if macro_args|length > 0 %}
-{%- for arg in macro_args %}
+{%-     for arg in macro_args %}
   {{ arg }}
-{%- endfor -%}
+{%-     endfor -%}
 {% endif %})
 
 {% for property in properties -%}
@@ -13,39 +13,39 @@ set_property(TARGET {{ name }} PROPERTY
 )
 {% endfor -%}
 {% for attribute in attributes %}
-{%- if attribute[1].iface is defined %}
+{%-    if attribute[1].iface is defined %}
 {{ attribute[0] }}({{ name }} INTERFACE
-{% for val in attribute[1].iface %}  {{ val }}
-{% endfor %})
-{%- endif %}
-{%- if attribute[1].pub is defined %}
+{%         for val in attribute[1].iface %}  {{ val }}
+{%         endfor %})
+{%-    endif %}
+{%-    if attribute[1].pub is defined %}
 {{ attribute[0] }}({{ name }} PUBLIC
-{% for val in attribute[1].pub %}  {{ val }}
-{% endfor %})
-{%- endif %}
-{%- if attribute[1].priv is defined %}
+{%         for val in attribute[1].pub %}  {{ val }}
+{%         endfor %})
+{%-    endif %}
+{%-    if attribute[1].priv is defined %}
 {{ attribute[0] }}({{ name }} PRIVATE
-{% for val in attribute[1].priv %}  {{ val }}
-{% endfor %})
-{%- endif %}
+{%         for val in attribute[1].priv %}  {{ val }}
+{%         endfor %})
+{%-    endif %}
 {% endfor %}
 {% for dir_macro in target_dir_macros %}
 {{ dir_macro[0] }}(
-{% for value in dir_macro[1] %}  {{ value }}
-{% endfor %})
+{%     for value in dir_macro[1] %}  {{ value }}
+{%     endfor %})
 {% endfor %}
 {% for target_macro in target_macros %}
 {{ target_macro[0] }}({{ name }}
-{%- if target_macro[1]|length > 0 %}
-{% for value in target_macro[1] -%}
+{%-     if target_macro[1]|length > 0 %}
+{%          for value in target_macro[1] -%}
   {{ value }}
-{% endfor %}
-{%- endif %})
+{%          endfor %}
+{%-     endif %})
 {% endfor %}
 {% if dependencies|length > 0 -%}
 if(NOT CMAKE_CROSSCOMPILING)
   add_dependencies({{ name }}
-{% for dep in dependencies %}    {{ dep }}
-{% endfor %})
+{%     for dep in dependencies %}    {{ dep }}
+{%     endfor %})
 endif()
 {%- endif -%}