Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a margo-version.h header generated #252

Merged
merged 1 commit into from
May 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ include_HEADERS = \
include/margo-util.h \
include/margo-bulk-util.h \
include/margo-timer.h \
include/margo-monitoring.h
include/margo-monitoring.h \
include/margo-version.h

TESTS_ENVIRONMENT =

EXTRA_DIST += \
prepare.sh

AM_CPPFLAGS = -I$(top_srcdir)/include
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include

AM_CFLAGS =

Expand Down
18 changes: 17 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,23 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.63])

# IMPORTANT: when editing the version number, edit both the
# MARGO_VERSION_ variables and the argument provided to AC_INIT
AC_INIT([margo], [0.13.1], [],[],[])

MARGO_VERSION_MAJOR=0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like having a version.h. I think it might be possible with an m4 macro to reuse one version number definition though, to make sure we don't accidentally get them out of sync. I'll tinker a little and report back.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, Argobots is a good place to look for this. I was thinking of doing it but got side-tracked looking into ways to get the version from git. Feel free to change this PR, I also don't really like that the version number is in two places (even though they are close by).

MARGO_VERSION_MINOR=13
MARGO_VERSION_PATCH=1
MARGO_VERSION="$MARGO_VERSION_MAJOR.$MARGO_VERSION_MINOR.$MARGO_VERSION_PATCH"
MARGO_VERSION_NUM=$((MARGO_VERSION_MAJOR*100000+MARGO_VERSION_MINOR*100+MARGO_VERSION_PATCH))

AC_SUBST([MARGO_VERSION], ["$MARGO_VERSION"])
AC_SUBST([MARGO_VERSION_MAJOR], ["$MARGO_VERSION_MAJOR"])
AC_SUBST([MARGO_VERSION_MINOR], ["$MARGO_VERSION_MINOR"])
AC_SUBST([MARGO_VERSION_PATCH], ["$MARGO_VERSION_PATCH"])
AC_SUBST([MARGO_VERSION_NUM], ["$MARGO_VERSION_NUM"])

AC_CONFIG_MACRO_DIR([m4])
LT_INIT

Expand Down Expand Up @@ -183,5 +199,5 @@ fi

AC_CONFIG_LINKS([tests/unit-tests/test-configs.json:tests/unit-tests/test-configs.json])

AC_CONFIG_FILES([Makefile maint/margo.pc])
AC_CONFIG_FILES([Makefile maint/margo.pc include/margo-version.h])
AC_OUTPUT
17 changes: 17 additions & 0 deletions include/margo-version.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* @file margo-version.h
*
* (C) The University of Chicago
*
* See COPYRIGHT in top-level directory.
*/
#ifndef __MARGO_VERSION
#define __MARGO_VERSION

#define MARGO_VERSION @MARGO_VERSION@
#define MARGO_VERSION_MAJOR @MARGO_VERSION_MAJOR@
#define MARGO_VERSION_MINOR @MARGO_VERSION_MINOR@
#define MARGO_VERSION_PATCH @MARGO_VERSION_PATCH@
#define MARGO_VERSION_NUM @MARGO_VERSION_NUM@

#endif /* __MARGO_VERSION */
1 change: 1 addition & 0 deletions include/margo.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ extern "C" {
#include <mercury_bulk.h>
#include <mercury_macros.h>
#include <abt.h>
#include <margo-version.h>
#include <margo-logging.h>
#include <margo-monitoring.h>
#include <margo-config.h>
Expand Down