Author: rinrab
Date: Tue Jul 2 21:38:09 2024
New Revision: 1918859
URL: http://svn.apache.org/viewvc?rev=1918859&view=rev
Log:
On the 'cmake' branch: Support per-target build target customizations.
It is required to build some libraries in the static configuration even if
targeting shared libraries. There is a field in the build.conf file named
`msvc_static` for this.
In the CMake generator it is implemented by adding a build_type variable to the
cmake_target and later passing it to the ezt template where it will be added
to the library declaration. Currently it supports only the msvc_static field
from the build.conf file, but in feature, will be added additional options
for configuring the build type for the specific targets (for example, to build
FS modules statically).
* build/generator/gen_cmake.py
(cmake_target): Add the build_type field.
(Generator.write): Initialize the build_type variable and pass it to the
ezt template as explained above.
* build/generator/templates/CMakeLists.txt.ezt
(): Use build_type variable for the library targets.
Modified:
subversion/branches/cmake/build/generator/gen_cmake.py
subversion/branches/cmake/build/generator/templates/CMakeLists.txt.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=1918859&r1=1918858&r2=1918859&view=diff
==============================================================================
--- subversion/branches/cmake/build/generator/gen_cmake.py (original)
+++ subversion/branches/cmake/build/generator/gen_cmake.py Tue Jul 2 21:38:09
2024
@@ -31,7 +31,7 @@ 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):
+ enable_condition: str, group: str, build_type: str):
self.name = name
self.type = type
self.sources = sources
@@ -43,6 +43,7 @@ class cmake_target():
self.enable_condition = enable_condition
self.group = group
+ self.build_type = build_type
def get_target_type(target: gen_base.Target):
if isinstance(target, gen_base.TargetExe):
@@ -100,6 +101,7 @@ class Generator(gen_base.GeneratorBase):
target: gen_base.Target
group = None
enable_condition = "TRUE"
+ build_type = ""
if isinstance(target, gen_base.TargetScript):
# there is nothing to build
@@ -126,6 +128,9 @@ class Generator(gen_base.GeneratorBase):
path = "subversion/include/" + export.replace("\\", "/")
msvc_export.append(path)
+ if target.msvc_static:
+ build_type = " STATIC"
+
sources = []
libs = []
@@ -178,7 +183,8 @@ class Generator(gen_base.GeneratorBase):
msvc_objects = msvc_objects,
msvc_export = msvc_export,
enable_condition = enable_condition,
- group = group
+ group = group,
+ build_type = build_type,
)
if isinstance(target, gen_base.TargetExe):
Modified: subversion/branches/cmake/build/generator/templates/CMakeLists.txt.ezt
URL:
http://svn.apache.org/viewvc/subversion/branches/cmake/build/generator/templates/CMakeLists.txt.ezt?rev=1918859&r1=1918858&r2=1918859&view=diff
==============================================================================
--- subversion/branches/cmake/build/generator/templates/CMakeLists.txt.ezt
(original)
+++ subversion/branches/cmake/build/generator/templates/CMakeLists.txt.ezt Tue
Jul 2 21:38:09 2024
@@ -43,7 +43,7 @@ if (WIN32)
endif()
[for targets]
if ([targets.enable_condition])[is targets.type "lib"]
- add_library([targets.name][for targets.sources]
+ add_library([targets.name][targets.build_type][for targets.sources]
[targets.sources][end]
)[if-any targets.msvc_export]
target_exports([targets.name][for targets.msvc_export]