Skip to content

Commit

Permalink
Update set_version_number to set version in CMakeLists
Browse files Browse the repository at this point in the history
  • Loading branch information
Ortham committed Apr 28, 2024
1 parent b7f9dfe commit c94aae7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scripts/set_version_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ def update_resource_file(path, version):
replace_in_file(path, 'VERSION \\d+, \\d+, \\d+', 'VERSION {}'.format(comma_separated_version))
replace_in_file(path, 'Version", "\\d+\\.\\d+\\.\\d+"', 'Version", "{}"'.format(version))

def update_cmakelists(path, version):
version_parts = version.split('.')

replace_in_file(path, 'set\\(LIBLOOT_VERSION "\\d+\\.\\d+\\.\\d+"\\)', 'set(LIBLOOT_VERSION "{}")'.format(version))
replace_in_file(path, 'TARGET loot PROPERTY SOVERSION \\d+', 'TARGET loot PROPERTY SOVERSION {}'.format(version_parts[0]))
replace_in_file(path, 'INTERFACE_libloot_MAJOR_VERSION \\d+', 'INTERFACE_libloot_MAJOR_VERSION {}'.format(version_parts[0]))

if __name__ == "__main__":
parser = argparse.ArgumentParser(description = 'Set the libloot version number')
parser.add_argument('version', nargs='+')
Expand All @@ -44,3 +51,4 @@ def update_resource_file(path, version):

update_cpp_file(os.path.join('include', 'loot', 'loot_version.h'), arguments.version[0])
update_resource_file(os.path.join('src', 'api', 'resource.rc'), arguments.version[0])
update_cmakelists(os.path.join('CMakeLists.txt'), arguments.version[0])

0 comments on commit c94aae7

Please sign in to comment.