Author: rinrab
Date: Sat Aug 17 14:37:07 2024
New Revision: 1919953

URL: http://svn.apache.org/viewvc?rev=1919953&view=rev
Log:
On the 'cmake' branch: Setup output names of Python SWIG binary modules to be
underscored, like _core.pyd or _client.pyd.

* build/generator/gen_cmake.py
  (get_output_name, write): Do little refactoring to change input parameter
   type to Target.
  (get_output_name): Change output name for Python SWIG bindings.

* build/generator/templates/targets.cmake.ezt
  (swig): Setup OUTPUT_NAME property.

See also a thread about r1919757 on dev where it was discussed. It is
archived at [1].

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=1919953&r1=1919952&r2=1919953&view=diff
==============================================================================
--- subversion/branches/cmake/build/generator/gen_cmake.py (original)
+++ subversion/branches/cmake/build/generator/gen_cmake.py Sat Aug 17 14:37:07 
2024
@@ -53,11 +53,17 @@ def get_module_name(name):
 
   return name[7:].upper()
 
-def get_output_name(name):
-  if name.startswith("lib"):
-    return name[3:] + "-1"
+def get_output_name(target):
+  if target.name.startswith("lib"):
+    return target.name[3:] + "-1"
+  elif isinstance(target, gen_base.TargetSWIG):
+    module_name = target.name[len(target.lang + "_"):]
+    if target.lang == "python":
+      return module_name
+    else:
+      return target.name
   else:
-    return name
+    return target.name
 
 def get_target_conditions(target):
   enable_condition = []
@@ -197,7 +203,7 @@ class Generator(gen_base.GeneratorBase):
 
         new_target = _eztdata(
           name = target.name,
-          output_name = get_output_name(target.name),
+          output_name = get_output_name(target),
           type = target_type,
           sources = sources,
           libs = libs,

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=1919953&r1=1919952&r2=1919953&view=diff
==============================================================================
--- subversion/branches/cmake/build/generator/templates/targets.cmake.ezt 
(original)
+++ subversion/branches/cmake/build/generator/templates/targets.cmake.ezt Sat 
Aug 17 14:37:07 2024
@@ -33,6 +33,7 @@ if ([targets.enable_condition])[is targe
   set_target_properties([targets.name] PROPERTIES
     SWIG_INCLUDE_DIRECTORIES "${SWIG_INCLUDE_DIRECTORIES}"
     INCLUDE_DIRECTORIES "${SWIG_INCLUDE_DIRECTORIES}"
+    OUTPUT_NAME [targets.output_name]
   )[is targets.swig_lang "python"]
   set_target_properties([targets.name] PROPERTIES
     SWIG_COMPILE_OPTIONS "-nofastunpack"


Reply via email to