Author: rinrab
Date: Wed Jul  3 15:52:10 2024
New Revision: 1918884

URL: http://svn.apache.org/viewvc?rev=1918884&view=rev
Log:
On the 'cmake' branch: Add and compile resources for the targets.

* build/generator/gen_cmake.py
  (cmake_target): Add description field to the class.
  (Generator.write): Pass description from the target to ezt template.

* build/generator/templates/targets.cmake.ezt
  - Add comment with the description to the target header.
  - Add resource file to the targets by using target_sources() command. This
    is done only when targeting Win32.
  - Setup SVN_FILE_DESCRIPTION and SVN_FILE_NAME definitions for the targets.

Modified:
    subversion/branches/cmake/build/generator/gen_cmake.py
    subversion/branches/cmake/build/generator/templates/targets.cmake.ezt

Modified: subversion/branches/cmake/build/generator/gen_cmake.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/cmake/build/generator/gen_cmake.py?rev=1918884&r1=1918883&r2=1918884&view=diff
==============================================================================
--- subversion/branches/cmake/build/generator/gen_cmake.py (original)
+++ subversion/branches/cmake/build/generator/gen_cmake.py Wed Jul  3 15:52:10 
2024
@@ -31,7 +31,8 @@ class _eztdata(object):
 class cmake_target():
   def __init__(self, name: str, type: str, sources,
                libs, msvc_libs, msvc_objects, msvc_export,
-               enable_condition: str, group: str, build_type: str):
+               enable_condition: str, group: str, build_type: str,
+               description: str):
     self.name = name
     self.type = type
     self.sources = sources
@@ -44,6 +45,7 @@ class cmake_target():
     self.enable_condition = enable_condition
     self.group = group
     self.build_type = build_type
+    self.description = description
 
 def get_target_type(target: gen_base.Target):
   if isinstance(target, gen_base.TargetExe):
@@ -191,6 +193,7 @@ class Generator(gen_base.GeneratorBase):
           enable_condition = enable_condition,
           group = group,
           build_type = build_type,
+          description = target.desc,
         )
 
         if isinstance(target, gen_base.TargetExe):

Modified: subversion/branches/cmake/build/generator/templates/targets.cmake.ezt
URL: 
http://svn.apache.org/viewvc/subversion/branches/cmake/build/generator/templates/targets.cmake.ezt?rev=1918884&r1=1918883&r2=1918884&view=diff
==============================================================================
--- subversion/branches/cmake/build/generator/templates/targets.cmake.ezt 
(original)
+++ subversion/branches/cmake/build/generator/templates/targets.cmake.ezt Wed 
Jul  3 15:52:10 2024
@@ -20,6 +20,7 @@
 # targets.cmake -- list of CMake targets
 #
 [for targets]
+# [if-any targets.description][targets.description][else][targets.name][end]
 if ([targets.enable_condition])[is targets.type "lib"]
   add_library([targets.name][targets.build_type][for targets.sources]
     [targets.sources][end]
@@ -46,5 +47,12 @@ if ([targets.enable_condition])[is targe
   if (MSVC)
     set_target_properties([targets.name] PROPERTIES LINK_FLAGS[for 
targets.msvc_objects] [targets.msvc_objects][end])
   endif()[end]
+  target_compile_definitions([targets.name] PRIVATE
+    "SVN_FILE_DESCRIPTION=[targets.description]"
+    "SVN_FILE_NAME=$<TARGET_FILE_NAME:[targets.name]>"
+  )
+  if (WIN32)
+    target_sources([targets.name] PRIVATE build/win32/svn.rc)
+  endif()
 endif()
 [end]


Reply via email to