From a9dafe5ef4751b64fd6a61a7aa6cd41d1c12f263 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Wed, 18 Oct 2023 09:56:58 -0500 Subject: [PATCH] Expose isl version as isl_version --- CMakeLists.txt | 4 +++- MANIFEST.in | 1 + doc/reference.rst | 7 +++++++ isl-supplementary/gitversion.h | 1 - islpy/__init__.py | 2 ++ setup.py | 9 +++++++++ src/wrapper/wrap_isl.cpp | 2 ++ src/wrapper/wrap_isl.hpp | 1 + 8 files changed, 25 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 424e3f0..eed3c64 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,7 +53,9 @@ endif() target_include_directories(_isl PRIVATE ${ISL_INC_DIRS}) -if(NOT USE_SHIPPED_ISL) +if(USE_SHIPPED_ISL) + target_compile_definitions(_isl PRIVATE GIT_HEAD_ID="${ISL_GIT_HEAD_ID}") +else() target_link_directories(_isl PRIVATE ${ISL_LIB_DIRS}) target_link_libraries(_isl PRIVATE ${ISL_LIB_NAMES}) endif() diff --git a/MANIFEST.in b/MANIFEST.in index c417490..676dbb1 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,4 @@ +include isl/*.ac include isl/*.c include isl/*.h include isl/imath/*.c diff --git a/doc/reference.rst b/doc/reference.rst index 095ab06..6bec390 100644 --- a/doc/reference.rst +++ b/doc/reference.rst @@ -69,6 +69,13 @@ Called with Argument Type as well as casts contained in the transitive closure of this 'casting graph'. +Version Info +------------ + +.. data:: version + +.. function:: isl_version + Error Reporting --------------- diff --git a/isl-supplementary/gitversion.h b/isl-supplementary/gitversion.h index 68fd952..e69de29 100644 --- a/isl-supplementary/gitversion.h +++ b/isl-supplementary/gitversion.h @@ -1 +0,0 @@ -#define GIT_HEAD_ID "isl-0.00-0-included-with-islpy" diff --git a/islpy/__init__.py b/islpy/__init__.py index 8208543..9f8dc95 100644 --- a/islpy/__init__.py +++ b/islpy/__init__.py @@ -87,6 +87,8 @@ Error = _isl.Error # {{{ name imports +isl_version = _isl.isl_version + Context = _isl.Context IdList = _isl.IdList ValList = _isl.ValList diff --git a/setup.py b/setup.py index 148b2b6..c54a796 100644 --- a/setup.py +++ b/setup.py @@ -221,6 +221,15 @@ def main(): cmake_args.append(f"-DISL_INC_DIRS:LIST={';'.join(isl_inc_dirs)}") cmake_args.append(f"-DISL_SOURCES:list={';'.join(extra_objects)}") + + with open("isl/configure.ac") as inf: + isl_version_line, = [ln for ln in inf + if ln.strip().startswith("versioninfo")] + + _, isl_version = isl_version_line.strip().split("=") + isl_version = isl_version.replace(":", ".") + + cmake_args.append(f"-DISL_GIT_HEAD_ID=isl-{isl_version}-included-with-islpy") else: if conf["ISL_INC_DIR"]: cmake_args.append(f"-DISL_INC_DIRS:LIST=" diff --git a/src/wrapper/wrap_isl.cpp b/src/wrapper/wrap_isl.cpp index a1962d5..13e1c23 100644 --- a/src/wrapper/wrap_isl.cpp +++ b/src/wrapper/wrap_isl.cpp @@ -219,6 +219,8 @@ NB_MODULE(_isl, m) ADD_MACRO_ATTR(cls_schedule_algorithm, ISL_SCHEDULE_ALGORITHM_, ISL); ADD_MACRO_ATTR(cls_schedule_algorithm, ISL_SCHEDULE_ALGORITHM_, FEAUTRIER); + m.def("isl_version", [] () { return isl_version(); }); + islpy_expose_part1(m); islpy_expose_part2(m); islpy_expose_part3(m); diff --git a/src/wrapper/wrap_isl.hpp b/src/wrapper/wrap_isl.hpp index 4dc51f7..082560e 100644 --- a/src/wrapper/wrap_isl.hpp +++ b/src/wrapper/wrap_isl.hpp @@ -23,6 +23,7 @@ #include #include #include +#include #ifdef ISLPY_INCLUDE_BARVINOK #include -- GitLab