Skip to content

Commit

Permalink
refactor: remove version tags, ref #180
Browse files Browse the repository at this point in the history
  • Loading branch information
iboB committed Nov 15, 2024
1 parent 3bad767 commit 7c4b46e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 20 deletions.
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ project(ac-local
LANGUAGES C CXX
)

set(PROJECT_VERSION_TAG dev)

include(./get-ac-build.cmake)

#################
Expand Down
2 changes: 1 addition & 1 deletion ac-local-config-export.in.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: MIT
#
include("${CMAKE_CURRENT_LIST_DIR}/ac-local-targets.cmake")
message(STATUS "ac-local @PROJECT_VERSION@@PROJECT_VERSION_TAG@ @CMAKE_BUILD_TYPE@ found in ${CMAKE_CURRENT_LIST_DIR}")
message(STATUS "ac-local @PROJECT_VERSION@ @CMAKE_BUILD_TYPE@ found in ${CMAKE_CURRENT_LIST_DIR}")

if(WIN32 AND CMAKE_RUNTIME_OUTPUT_DIRECTORY)
# on windows we need to have the dlls in the runtime directory
Expand Down
7 changes: 3 additions & 4 deletions cmake/ac_local_plugin_util.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ function(add_ac_local_plugin)
#define ACLP_@nameSym@_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
#define ACLP_@nameSym@_VERSION_MINOR @PROJECT_VERSION_MINOR@
#define ACLP_@nameSym@_VERSION_PATCH @PROJECT_VERSION_PATCH@
#define ACLP_@nameSym@_VERSION_TAG "@PROJECT_VERSION_TAG@"

#define ACLP_@nameSym@_VERSION_STRING "@PROJECT_VERSION@@PROJECT_VERSION_TAG@"
#define ACLP_@nameSym@_VERSION_STRING "@PROJECT_VERSION@"
]=]
@ONLY
)
Expand Down Expand Up @@ -128,7 +127,7 @@ namespace ac::local {
extern "C" SYMBOL_EXPORT
PluginInterface acLocalPluginLoad() {
constexpr Version ownVersion(
ACLP_@nameSym@_VERSION_MAJOR, ACLP_@nameSym@_VERSION_MINOR, ACLP_@nameSym@_VERSION_PATCH, ACLP_@nameSym@_VERSION_TAG
ACLP_@nameSym@_VERSION_MAJOR, ACLP_@nameSym@_VERSION_MINOR, ACLP_@nameSym@_VERSION_PATCH
);

return {
Expand Down Expand Up @@ -358,4 +357,4 @@ function(make_ac_local_plugin_available)
cfg-${pluginId}
ac::local
)
endfunction()
endfunction()
14 changes: 6 additions & 8 deletions local/code/ac/local/Version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,25 @@
//
#pragma once
#include "version.h"
#include <string_view>
#include <compare>

namespace ac::local {
struct Version {
int major;
int minor;
int patch;
std::string_view tag;

constexpr Version(int major, int minor, int patch, std::string_view tag)
: major(major), minor(minor), patch(patch), tag(tag)
constexpr Version(int major, int minor, int patch)
: major(major), minor(minor), patch(patch)
{}

auto operator<=>(const Version&) const = default;
};

inline constexpr Version Project_Version(
AC_VERSION_MAJOR,
AC_VERSION_MINOR,
AC_VERSION_PATCH,
AC_VERSION_TAG
AC_LOCAL_VERSION_MAJOR,
AC_LOCAL_VERSION_MINOR,
AC_LOCAL_VERSION_PATCH
);

} // namespace ac::local
9 changes: 4 additions & 5 deletions local/code/version.in.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
//
#pragma once

#define AC_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
#define AC_VERSION_MINOR @PROJECT_VERSION_MINOR@
#define AC_VERSION_PATCH @PROJECT_VERSION_PATCH@
#define AC_VERSION_TAG "@PROJECT_VERSION_TAG@"
#define AC_LOCAL_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
#define AC_LOCAL_VERSION_MINOR @PROJECT_VERSION_MINOR@
#define AC_LOCAL_VERSION_PATCH @PROJECT_VERSION_PATCH@

#define AC_VERSION_STRING "@PROJECT_VERSION@@PROJECT_VERSION_TAG@"
#define AC_LOCAL_VERSION_STRING "@PROJECT_VERSION@"

0 comments on commit 7c4b46e

Please sign in to comment.