From eda2a4ec628dcfec0069ce55e4008536380863cd Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Mon, 19 Sep 2016 12:51:08 +0200 Subject: [PATCH 01/21] Add CMake-based build system --- .clang-format | 21 ++ .gitignore | 13 + CMakeLists.txt | 385 +++++++++++++++++++++++ Makefile.am | 12 +- README | 18 ++ cmake/FindGmp.cmake | 21 ++ cmake/GetGitRevisionDescription.cmake | 130 ++++++++ cmake/GetGitRevisionDescription.cmake.in | 41 +++ configure.ac | 6 +- doc/Makefile.am | 14 + gitversion.h.cmake | 1 + interface/Makefile.am | 8 +- isl_config.h.cmake | 56 ++++ 13 files changed, 716 insertions(+), 10 deletions(-) create mode 100644 .clang-format create mode 100644 CMakeLists.txt create mode 100644 cmake/FindGmp.cmake create mode 100644 cmake/GetGitRevisionDescription.cmake create mode 100644 cmake/GetGitRevisionDescription.cmake.in create mode 100644 gitversion.h.cmake create mode 100644 isl_config.h.cmake diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..262a6cbcb --- /dev/null +++ b/.clang-format @@ -0,0 +1,21 @@ +BasedOnStyle: GNU + +ColumnLimit: 80 +SortIncludes: false + +TabWidth: 4 +UseTab: Always +IndentWidth: 4 +ContinuationIndentWidth: 4 + +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +SpaceBeforeParens: ControlStatements +BreakBeforeBraces: Custom +BraceWrapping: { AfterFunction: true } +AlignAfterOpenBracket: DontAlign +SpaceAfterCStyleCast: true +AllowShortFunctionsOnASingleLine: false + +BinPackParameters: true +AllowAllParametersOfDeclarationOnNextLine: false diff --git a/.gitignore b/.gitignore index 99a7db388..233ec5455 100644 --- a/.gitignore +++ b/.gitignore @@ -53,3 +53,16 @@ test-driver bound_test.sh pip_test.sh + +# Build artifacts +/isl_test_imath +/isl_test_int +/isl_codegen + +# CMake generated files +/CMakeCache.txt +/CMakeFiles/ +/CTestTestfile.cmake +/cmake_install.cmake +/build.ninja +/rules.ninja diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..c81d7b735 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,385 @@ +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +cmake_minimum_required(VERSION 3.2) + +project("isl" C) +if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/isl/isl_ctx.c") + set(ISL_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/isl") +elseif (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/isl_ctx.c") + set(ISL_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") +else () + message(FATAL_ERROR "Cannot find ISL source dir") +endif () +set(ISL_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}") + +set(IMATH_SOURCE_DIR "${ISL_SOURCE_DIR}/imath") +set(IMATH_BINARY_DIR "${ISL_BINARY_DIR}/imath") + + +## Configure options +set(ISL_INT "imath" CACHE STRING "Which package to use to represent multi-precision integers (gmp|imath)") +option(ISL_SMALL_INT_OPT "Use small integer optimization" ON) + + +# Process configure options +if (NOT ISL_INT MATCHES "^imath|gmp$") + message(FATAL_ERROR "Unsupported option for ISL_INT: ${ISL_INT}") +endif () + +set(USE_GMP_FOR_MP OFF) +if (ISL_INT STREQUAL "gmp") + set(USE_GMP_FOR_MP ON) +endif () + +set(USE_IMATH_FOR_MP OFF) +if (ISL_INT STREQUAL "imath") + set(USE_IMATH_FOR_MP ON) +endif () + +if (USE_SMALL_INT_OPT) + set(USE_SMALL_INT_OPT ON) +endif () + + +## Search for libraries +if (USE_GMP_FOR_MP) + find_package(Gmp REQUIRED) +endif () +find_package(PipLib QUIET) + + +## Platform introspection +# Determine version of isl +if (EXISTS "${ISL_SOURCE_DIR}/GIT_HEAD_ID") + # The source comes from a 'make dist' archive + file(READ "${ISL_SOURCE_DIR}/GIT_HEAD_ID" ISL_GIT_HEAD_ID) + string(STRIP "${ISL_GIT_HEAD_ID}" ISL_GIT_HEAD_ID) +elseif (EXISTS "${ISL_SOURCE_DIR}/gitversion.h") + # The source directory is preconfigured + file(READ "${ISL_SOURCE_DIR}/gitversion.h" GITVERSION_H) + string(REGEX REPLACE ".*\\\"([^\\\"]*)\\\".*" "\\1" ISL_GIT_HEAD_ID "${GITVERSION_H}") +elseif () + # Unknown revision + # TODO: We could look for a .git and get the revision from HEAD + set(ISL_GIT_HEAD_ID "UNKNOWN") +endif () + +message(STATUS "ISL version: ${GIT_HEAD_ID}") + +# Determine compiler characteristics +if ("${CMAKE_C_COMPILER_ID}" MATCHES "Clang") + set(CMAKE_COMPILER_IS_CLANGCC ON) +endif() + +include(CheckCSourceCompiles) + +# Like check_c_source_compiles, but sets the result to either +# 0 (error while compiling) or 1 (compiled successfully) +# Required for compatibility with autotool's AC_CHECK_DECLS +function (check_c_source_compiles_numeric _prog _var) + check_c_source_compiles("${_prog}" "${_var}") + if ("${${_var}}") + set("${_var}" 1 PARENT_SCOPE) + else () + set("${_var}" 0 PARENT_SCOPE) + endif () +endfunction () + +# Check for the existance of a type +function (check_c_type_exists _type _files _variable) + set(_includes "") + foreach (file_name ${_files}) + set(_includes "${_includes}#include<${file_name}>\n") + endforeach() + check_c_source_compiles(" + ${_includes} + ${_type} typeVar; + int main() { + return 0; + } + " ${_variable}) +endfunction () + + +check_c_source_compiles(" + int func(void) __attribute__((__warn_unused_result__)); + int main() { return 0; } + " HAS_ATTRIBUTE_WARN_UNUSED_RESULT) +set(GCC_WARN_UNUSED_RESULT) +if (HAS_ATTRIBUTE_WARN_UNUSED_RESULT) + set(GCC_WARN_UNUSED_RESULT "__attribute__((__warn_unused_result__))") +endif () + +check_c_source_compiles(" + static void foo(void) __attribute__ ((unused)); + int main() { return 0; } + " HAVE___ATTRIBUTE__) + + +check_c_source_compiles_numeric(" + #include + int main() { (void)ffs(0); return 0; } + " HAVE_DECL_FFS) + +check_c_source_compiles_numeric(" + int main() { __builtin_ffs(0); return 0; } + " HAVE_DECL___BUILTIN_FFS) + +check_c_source_compiles_numeric(" + #include + int main() { _BitScanForward(NULL, 0); return 0; } + " HAVE_DECL__BITSCANFORWARD) + +if (NOT HAVE_DECL_FFS AND + NOT HAVE_DECL___BUILTIN_FFS AND + NOT HAVE_DECL__BITSCANFORWARD) + message(FATAL_ERROR "No ffs implementation found") +endif () + + +check_c_source_compiles_numeric(" + #include + int main() { (void)strcasecmp(\"\", \"\"); return 0; } + " HAVE_DECL_STRCASECMP) + +check_c_source_compiles_numeric(" + #include + int main() { _stricmp(\"\", \"\"); return 0; } + " HAVE_DECL__STRICMP) + +if (NOT HAVE_DECL_STRCASECMP AND NOT HAVE_DECL__STRICMP) + message(FATAL_ERROR "No strcasecmp implementation found") +endif () + + +check_c_source_compiles_numeric(" + #include + int main() { (void)strncasecmp(\"\", \"\", 0); return 0; } + " HAVE_DECL_STRNCASECMP) + +check_c_source_compiles_numeric(" + #include + int main() { _strnicmp(\"\", \"\", 0); return 0; } + " HAVE_DECL__STRNICMP) + +if (NOT HAVE_DECL_STRNCASECMP AND NOT HAVE_DECL__STRNICMP) + message(FATAL_ERROR "No strncasecmp implementation found") +endif () + + +check_c_source_compiles_numeric(" + #include + int main() { snprintf((void*)0, 0, \"\"); return 0; } + " HAVE_DECL_SNPRINTF) + +check_c_source_compiles_numeric(" + #include + int main() { _snprintf((void*)0, 0, \"\"); return 0; } + " HAVE_DECL__SNPRINTF) + +if (NOT HAVE_DECL_SNPRINTF AND NOT HAVE_DECL__SNPRINTF) + message(FATAL_ERROR "No snprintf implementation found") +endif () + + +check_c_type_exists(uint8_t "" HAVE_UINT8T) +check_c_type_exists(uint8_t "stdint.h" HAVE_STDINT_H) +check_c_type_exists(uint8_t "inttypes.h" HAVE_INTTYPES_H) +check_c_type_exists(uint8_t "sys/types.h" HAVE_SYS_INTTYPES_H) +if (HAVE_UINT8T) + set(INCLUDE_STDINT_H "") +elseif (HAVE_STDINT_H) + set(INCLUDE_STDINT_H "#include ") +elseif (HAVE_INTTYPES_H) + set(INCLUDE_STDINT_H "#include ") +elseif (HAVE_SYS_INTTYPES_H) + set(INCLUDE_STDINT_H "#include ") +else () + message(FATAL_ERROR "No stdint.h or compatible found") +endif () + +# Write configure result +# configure_file(... COPYONLY) avoids that the time stamp changes if the file is identical +file(WRITE "${ISL_BINARY_DIR}/gitversion.h.tmp" + "#define GIT_HEAD_ID \"${ISL_GIT_HEAD_ID}\"") +configure_file("${ISL_BINARY_DIR}/gitversion.h.tmp" + "${ISL_BINARY_DIR}/gitversion.h" COPYONLY) + +file(WRITE "${ISL_BINARY_DIR}/include/isl/stdint.h.tmp" + "${INCLUDE_STDINT_H}\n") +configure_file("${ISL_BINARY_DIR}/include/isl/stdint.h.tmp" + "${ISL_BINARY_DIR}/include/isl/stdint.h" COPYONLY) + +configure_file("isl_config.h.cmake" "${ISL_BINARY_DIR}/isl_config.h") + +# ISL files to compile +set (libisl_common_sources + ${ISL_SOURCE_DIR}/basis_reduction_tab.c + ${ISL_SOURCE_DIR}/isl_aff.c + ${ISL_SOURCE_DIR}/isl_affine_hull.c + ${ISL_SOURCE_DIR}/isl_arg.c + ${ISL_SOURCE_DIR}/isl_ast_build.c + ${ISL_SOURCE_DIR}/isl_ast_build_expr.c + ${ISL_SOURCE_DIR}/isl_ast.c + ${ISL_SOURCE_DIR}/isl_ast_codegen.c + ${ISL_SOURCE_DIR}/isl_ast_graft.c + ${ISL_SOURCE_DIR}/isl_band.c + ${ISL_SOURCE_DIR}/isl_bernstein.c + ${ISL_SOURCE_DIR}/isl_blk.c + ${ISL_SOURCE_DIR}/isl_bound.c + ${ISL_SOURCE_DIR}/isl_coalesce.c + ${ISL_SOURCE_DIR}/isl_constraint.c + ${ISL_SOURCE_DIR}/isl_convex_hull.c + ${ISL_SOURCE_DIR}/isl_ctx.c + ${ISL_SOURCE_DIR}/isl_deprecated.c + ${ISL_SOURCE_DIR}/isl_dim_map.c + ${ISL_SOURCE_DIR}/isl_equalities.c + ${ISL_SOURCE_DIR}/isl_factorization.c + ${ISL_SOURCE_DIR}/isl_farkas.c + ${ISL_SOURCE_DIR}/isl_ffs.c + ${ISL_SOURCE_DIR}/isl_flow.c + ${ISL_SOURCE_DIR}/isl_fold.c + ${ISL_SOURCE_DIR}/isl_hash.c + ${ISL_SOURCE_DIR}/isl_id.c + ${ISL_SOURCE_DIR}/isl_id_to_ast_expr.c + ${ISL_SOURCE_DIR}/isl_id_to_id.c + ${ISL_SOURCE_DIR}/isl_id_to_pw_aff.c + ${ISL_SOURCE_DIR}/isl_ilp.c + ${ISL_SOURCE_DIR}/isl_input.c + ${ISL_SOURCE_DIR}/isl_local.c + ${ISL_SOURCE_DIR}/isl_local_space.c + ${ISL_SOURCE_DIR}/isl_lp.c + ${ISL_SOURCE_DIR}/isl_map.c + ${ISL_SOURCE_DIR}/isl_map_list.c + ${ISL_SOURCE_DIR}/isl_map_simplify.c + ${ISL_SOURCE_DIR}/isl_map_subtract.c + ${ISL_SOURCE_DIR}/isl_map_to_basic_set.c + ${ISL_SOURCE_DIR}/isl_mat.c + ${ISL_SOURCE_DIR}/isl_morph.c + ${ISL_SOURCE_DIR}/isl_obj.c + ${ISL_SOURCE_DIR}/isl_options.c + ${ISL_SOURCE_DIR}/isl_output.c + ${ISL_SOURCE_DIR}/isl_point.c + ${ISL_SOURCE_DIR}/isl_polynomial.c + ${ISL_SOURCE_DIR}/isl_printer.c + ${ISL_SOURCE_DIR}/isl_range.c + ${ISL_SOURCE_DIR}/isl_reordering.c + ${ISL_SOURCE_DIR}/isl_sample.c + ${ISL_SOURCE_DIR}/isl_scan.c + ${ISL_SOURCE_DIR}/isl_schedule.c + ${ISL_SOURCE_DIR}/isl_schedule_band.c + ${ISL_SOURCE_DIR}/isl_schedule_node.c + ${ISL_SOURCE_DIR}/isl_schedule_read.c + ${ISL_SOURCE_DIR}/isl_schedule_tree.c + ${ISL_SOURCE_DIR}/isl_scheduler.c + ${ISL_SOURCE_DIR}/isl_schedule_constraints.c + ${ISL_SOURCE_DIR}/isl_seq.c + ${ISL_SOURCE_DIR}/isl_set_list.c + ${ISL_SOURCE_DIR}/isl_sort.c + ${ISL_SOURCE_DIR}/isl_space.c + ${ISL_SOURCE_DIR}/isl_stream.c + ${ISL_SOURCE_DIR}/isl_tab.c + ${ISL_SOURCE_DIR}/isl_tab_pip.c + ${ISL_SOURCE_DIR}/isl_tarjan.c + ${ISL_SOURCE_DIR}/isl_transitive_closure.c + ${ISL_SOURCE_DIR}/isl_union_map.c + ${ISL_SOURCE_DIR}/isl_val.c + ${ISL_SOURCE_DIR}/isl_vec.c + ${ISL_SOURCE_DIR}/isl_version.c + ${ISL_SOURCE_DIR}/isl_vertices.c + ${ISL_SOURCE_DIR}/print.c +) + +set(libisl_gmp_sources + ${ISL_SOURCE_DIR}/isl_gmp.c + ${ISL_SOURCE_DIR}/isl_val_gmp.c +) + +set(libisl_imath_sources + ${ISL_SOURCE_DIR}/imath/gmp_compat.c + ${ISL_SOURCE_DIR}/imath/imath.c + ${ISL_SOURCE_DIR}/imath/imrat.c + ${ISL_SOURCE_DIR}/isl_imath.c +) + +set(libisl_imath32_sources + ${ISL_SOURCE_DIR}/imath/gmp_compat.c + ${ISL_SOURCE_DIR}/imath/imath.c + ${ISL_SOURCE_DIR}/imath/imrat.c + ${ISL_SOURCE_DIR}/isl_imath.c + ${ISL_SOURCE_DIR}/isl_int_sioimath.c + ${ISL_SOURCE_DIR}/isl_val_sioimath.c +) + +set(libisl_sources ${libisl_common_sources}) +if (USE_GMP_FOR_MP) + list(APPEND libisl_sources ${libisl_gmp_sources}) +elseif (USE_IMATH_FOR_MP) + if (USE_SMALL_INT_OPT) + list(APPEND libisl_sources ${libisl_imath32_sources}) + else () + list(APPEND libisl_sources ${libisl_imath_sources}) + endif () +endif () + + +add_library(isl ${libisl_sources}) + +target_include_directories(isl PRIVATE "${ISL_BINARY_DIR}" "${ISL_SOURCE_DIR}" ${PIPLIB_INCLUDE_DIRS}) +target_include_directories(isl PUBLIC "${ISL_BINARY_DIR}/include" "${ISL_SOURCE_DIR}/include") +if (USE_GMP_FOR_MP) + target_include_directories(isl PUBLIC ${GMP_INCLUDE_DIRS}) + target_link_libraries(isl PUBLIC ${GMP_LIBRARIES}) +endif () +if (USE_IMATH_FOR_MP) + target_include_directories(isl PUBLIC "${ISL_SOURCE_DIR}/imath") +endif () + +# General compiler options +if (CMAKE_COMPILER_IS_CLANGCC OR CMAKE_COMPILER_IS_GNUCC) + target_definitions(isl -Wall) +endif () + + +# Auxiliary executables +macro (add_isl_executable _name) + set(_sources ${ARGN}) + add_executable("${_name}" ${_sources}) + target_include_directories("${_name}" PRIVATE "${ISL_SOURCE_DIR}" "${ISL_BINARY_DIR}" ${GMP_INCLUDE_DIRS} ${PIPLIB_INCLUDE_DIRS}) + target_link_libraries("${_name}" isl) +endmacro () + + +add_isl_executable(isl_test "${ISL_SOURCE_DIR}/isl_test.c") +add_isl_executable(isl_test_int "${ISL_SOURCE_DIR}/isl_test_int.c") +if (USE_IMATH_FOR_MP) + add_isl_executable(isl_test_imath "${ISL_SOURCE_DIR}/isl_test_imath.c") +endif () +add_isl_executable(isl_polyhedron_sample "${ISL_SOURCE_DIR}/polyhedron_sample.c") +add_isl_executable(isl_pip "${ISL_SOURCE_DIR}/pip.c") +add_isl_executable(isl_polyhedron_minimize "${ISL_SOURCE_DIR}/polyhedron_minimize.c") +add_isl_executable(isl_polytope_scan "${ISL_SOURCE_DIR}/polytope_scan.c") +add_isl_executable(isl_polyhedron_detect_equalities "${ISL_SOURCE_DIR}/polyhedron_detect_equalities.c") +add_isl_executable(isl_cat "${ISL_SOURCE_DIR}/cat.c") +add_isl_executable(isl_closure "${ISL_SOURCE_DIR}/closure.c") +add_isl_executable(isl_bound "${ISL_SOURCE_DIR}/bound.c") +add_isl_executable(isl_codegen "${ISL_SOURCE_DIR}/codegen.c") + +# Testing +enable_testing() + +add_test(NAME isl_test_int + COMMAND "$" +) +if (USE_IMATH_FOR_MP) + add_test(NAME isl_test_imath + COMMAND "$" + ) +endif () +add_test(NAME isl_test + COMMAND "$" +) +add_test(NAME codegen_test + COMMAND "${ISL_SOURCE_DIR}/codegen_test.sh" +) +set_tests_properties(isl_test codegen_test PROPERTIES ENVIRONMENT "srcdir=${ISL_SOURCE_DIR}") + diff --git a/Makefile.am b/Makefile.am index c5c81dff4..ba981737d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,7 +2,7 @@ if HAVE_CLANG MAYBE_INTERFACE = interface endif SUBDIRS = . $(MAYBE_INTERFACE) doc -DIST_SUBDIRS = $(MAYBE_INTERFACE) doc +DIST_SUBDIRS = interface doc ACLOCAL_AMFLAGS = -I m4 AUTOMAKE_OPTIONS = nostdinc subdir-objects @@ -189,6 +189,7 @@ libisl_la_SOURCES = \ isl_vertices_private.h \ isl_vertices.c \ isl_yaml.h + libisl_la_LIBADD = @MP_LIBS@ libisl_la_LDFLAGS = -version-info @versioninfo@ \ @MP_LDFLAGS@ @@ -380,12 +381,17 @@ EXTRA_DIST = \ imath/imrat.h \ interface/all.h \ interface/isl.py.top \ + interface/extract_interface.cc \ + interface/extract_interface.h \ + interface/isl.py \ + interface/Makefile.am \ + interface/Makefile.in \ + interface/python.cc \ + interface/python.h \ test_inputs dist-hook: echo @GIT_HEAD_VERSION@ > $(distdir)/GIT_HEAD_ID - (cd doc; make manual.pdf) - cp doc/manual.pdf $(distdir)/doc/ pkgconfigdir=$(pkgconfig_libdir) pkgconfig_DATA = $(pkgconfig_libfile) diff --git a/README b/README index 9f48a0a76..cea6eb9ad 100644 --- a/README +++ b/README @@ -1,3 +1,21 @@ +Integer Set Library (ISL) +branch with CMake build system +------------------------- + +The orignal project's website can be found at http://isl.gforge.inria.fr/ and +its discussion takes place on the mailing list isl-development@googlegroups.com. + +For discussions about this branch please use the Github tools +(https://github.com/Meinersbur/isl) or contact the author (isl@meinersbur.de). + +This branch adds the files necessary to compile ISL using CMake. It is not a +feature-complete replacement of the autotools build system, but has been created +for convinience in order to user builder such as Ninja or Visual Studio. The +autotools-based build system remains in place. + + +Original README +------------------------- isl is a thread-safe C library for manipulating sets and relations of integer points bounded by affine constraints. The descriptions of the sets and relations may involve both parameters and existentially diff --git a/cmake/FindGmp.cmake b/cmake/FindGmp.cmake new file mode 100644 index 000000000..72fa09e55 --- /dev/null +++ b/cmake/FindGmp.cmake @@ -0,0 +1,21 @@ + +set(GMP_DEFINITIONS) + +find_path(GMP_INCLUDE_DIR gmp.h + PATHS ENV GMP_INCLUDE ENV GMP_DIR + NO_DEFAULT_PATH +) +find_path(GMP_INCLUDE_DIR gmp.h) +mark_as_advanced(GMP_INCLUDE_DIR) +set(GMP_INCLUDE_DIRS ${GMP_INCLUDE_DIR}) + +find_library(GMP_LIBRARY NAMES gmp mpir + HINTS ENV GMP_LIB ENV GMP_DIR + NO_DEFAULT_PATH +) +find_library(GMP_LIBRARY NAMES gmp mpir) +mark_as_advanced(GMP_LIBRARY) +set(GMP_LIBRARIES ${GMP_LIBRARY}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Gmp DEFAULT_MSG GMP_LIBRARY GMP_INCLUDE_DIR) diff --git a/cmake/GetGitRevisionDescription.cmake b/cmake/GetGitRevisionDescription.cmake new file mode 100644 index 000000000..310b47ebc --- /dev/null +++ b/cmake/GetGitRevisionDescription.cmake @@ -0,0 +1,130 @@ +# - Returns a version string from Git +# +# These functions force a re-configure on each git commit so that you can +# trust the values of the variables in your build system. +# +# get_git_head_revision( [ ...]) +# +# Returns the refspec and sha hash of the current head revision +# +# git_describe( [ ...]) +# +# Returns the results of git describe on the source tree, and adjusting +# the output so that it tests false if an error occurs. +# +# git_get_exact_tag( [ ...]) +# +# Returns the results of git describe --exact-match on the source tree, +# and adjusting the output so that it tests false if there was no exact +# matching tag. +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__get_git_revision_description) + return() +endif() +set(__get_git_revision_description YES) + +# We must run the following at "include" time, not at function call time, +# to find the path to this module rather than the path to a calling list file +get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH) + +function(get_git_head_revision _refspecvar _hashvar) + set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + set(GIT_DIR "${GIT_PARENT_DIR}/.git") + while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories + set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}") + get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH) + if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT) + # We have reached the root directory, we are not in git + set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE) + set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE) + return() + endif() + set(GIT_DIR "${GIT_PARENT_DIR}/.git") + endwhile() + # check if this is a submodule + if(NOT IS_DIRECTORY ${GIT_DIR}) + file(READ ${GIT_DIR} submodule) + string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule}) + get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH) + get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE) + endif() + set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data") + if(NOT EXISTS "${GIT_DATA}") + file(MAKE_DIRECTORY "${GIT_DATA}") + endif() + + if(NOT EXISTS "${GIT_DIR}/HEAD") + return() + endif() + set(HEAD_FILE "${GIT_DATA}/HEAD") + configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY) + + configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in" + "${GIT_DATA}/grabRef.cmake" + @ONLY) + include("${GIT_DATA}/grabRef.cmake") + + set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE) + set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE) +endfunction() + +function(git_describe _var) + if(NOT GIT_FOUND) + find_package(Git QUIET) + endif() + get_git_head_revision(refspec hash) + if(NOT GIT_FOUND) + set(${_var} "GIT-NOTFOUND" PARENT_SCOPE) + return() + endif() + if(NOT hash) + set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE) + return() + endif() + + # TODO sanitize + #if((${ARGN}" MATCHES "&&") OR + # (ARGN MATCHES "||") OR + # (ARGN MATCHES "\\;")) + # message("Please report the following error to the project!") + # message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}") + #endif() + + #message(STATUS "Arguments to execute_process: ${ARGN}") + + execute_process(COMMAND + "${GIT_EXECUTABLE}" + describe + ${hash} + ${ARGN} + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}" + RESULT_VARIABLE + res + OUTPUT_VARIABLE + out + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT res EQUAL 0) + set(out "${out}-${res}-NOTFOUND") + endif() + + set(${_var} "${out}" PARENT_SCOPE) +endfunction() + +function(git_get_exact_tag _var) + git_describe(out --exact-match ${ARGN}) + set(${_var} "${out}" PARENT_SCOPE) +endfunction() \ No newline at end of file diff --git a/cmake/GetGitRevisionDescription.cmake.in b/cmake/GetGitRevisionDescription.cmake.in new file mode 100644 index 000000000..6d8b708ef --- /dev/null +++ b/cmake/GetGitRevisionDescription.cmake.in @@ -0,0 +1,41 @@ +# +# Internal file for GetGitRevisionDescription.cmake +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(HEAD_HASH) + +file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024) + +string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS) +if(HEAD_CONTENTS MATCHES "ref") + # named branch + string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}") + if(EXISTS "@GIT_DIR@/${HEAD_REF}") + configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) + else() + configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY) + file(READ "@GIT_DATA@/packed-refs" PACKED_REFS) + if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}") + set(HEAD_HASH "${CMAKE_MATCH_1}") + endif() + endif() +else() + # detached HEAD + configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY) +endif() + +if(NOT HEAD_HASH) + file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024) + string(STRIP "${HEAD_HASH}" HEAD_HASH) +endif() diff --git a/configure.ac b/configure.ac index d948790aa..1ded8d896 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([isl], [0.17.1], [isl-development@googlegroups.com]) +AC_INIT([isl], [0.17.1], [isl@meinersbur.de]) AC_CONFIG_AUX_DIR([.]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([foreign]) @@ -276,9 +276,7 @@ AH_BOTTOM([#include ]) AC_CONFIG_HEADERS(isl_config.h) AC_CONFIG_FILES(Makefile) AC_CONFIG_FILES(doc/Makefile) -if test $with_clang = system; then - AC_CONFIG_FILES(interface/Makefile) -fi +AC_CONFIG_FILES(interface/Makefile) AC_CONFIG_FILES([bound_test.sh], [chmod +x bound_test.sh]) AC_CONFIG_FILES([codegen_test.sh], [chmod +x codegen_test.sh]) AC_CONFIG_FILES([pip_test.sh], [chmod +x pip_test.sh]) diff --git a/doc/Makefile.am b/doc/Makefile.am index 1d61dd777..eb9e9109b 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -13,6 +13,17 @@ CLEANFILES = \ manual.bcf \ manual.run.xml +EXTRA_DIST = \ + CodingStyle \ + SubmittingPatches \ + implementation.tex \ + isl.bib \ + mypod2latex \ + manual.tex \ + reading.tex \ + user.pod \ + manual.pdf + if GENERATE_DOC export TEXINPUTS := $(srcdir):$(TEXINPUTS) export BIBINPUTS := $(srcdir):$(BIBINPUTS) @@ -20,13 +31,16 @@ export BSTINPUTS := $(srcdir):$(BSTINPUTS) user.tex: user.pod $(PERL) $(srcdir)/mypod2latex $< $@ + manual.pdf: manual.tex user.tex $(srcdir)/implementation.tex reading.tex (cd ..; echo "@GIT_HEAD_VERSION@") > version.tex $(PDFLATEX) $< biber manual $(PDFLATEX) $< $(PDFLATEX) $< + user.html: user.pod (cd ..; echo "@GIT_HEAD_VERSION@") > version $(POD2HTML) --infile=$< --outfile=$@ --title="Integer Set Library: Manual [version `cat version`]" + endif diff --git a/gitversion.h.cmake b/gitversion.h.cmake new file mode 100644 index 000000000..8a6f36ec9 --- /dev/null +++ b/gitversion.h.cmake @@ -0,0 +1 @@ +#define GIT_HEAD_ID "@GIT_HEAD_ID@" diff --git a/interface/Makefile.am b/interface/Makefile.am index 242294e2f..554c2bd87 100644 --- a/interface/Makefile.am +++ b/interface/Makefile.am @@ -22,6 +22,11 @@ extract_interface_LDADD = \ CLEANFILES = isl.py +EXTRA_DIST = \ + all.h \ + isl.py.top \ + isl.py + test: extract_interface ./extract_interface$(EXEEXT) $(includes) $(srcdir)/all.h @@ -29,6 +34,3 @@ isl.py: extract_interface isl.py.top (cat $(srcdir)/isl.py.top; \ ./extract_interface$(EXEEXT) $(includes) $(srcdir)/all.h) \ > isl.py - -dist-hook: isl.py - cp isl.py $(distdir)/ diff --git a/isl_config.h.cmake b/isl_config.h.cmake new file mode 100644 index 000000000..d93e84697 --- /dev/null +++ b/isl_config.h.cmake @@ -0,0 +1,56 @@ +/* define if your compiler has __attribute__ */ +#cmakedefine HAVE___ATTRIBUTE__ /**/ + +/* most gcc compilers know a function __attribute__((__warn_unused_result__)) */ +#define GCC_WARN_UNUSED_RESULT @GCC_WARN_UNUSED_RESULT@ + + +/* Define to 1 if you have the declaration of `ffs', and to 0 if you don't. */ +#define HAVE_DECL_FFS @HAVE_DECL_FFS@ + +/* Define to 1 if you have the declaration of `__builtin_ffs', and to 0 if you + don't. */ +#define HAVE_DECL___BUILTIN_FFS @HAVE_DECL___BUILTIN_FFS@ + +/* Define to 1 if you have the declaration of `_BitScanForward', and to 0 if + you don't. */ +#define HAVE_DECL__BITSCANFORWARD @HAVE_DECL__BITSCANFORWARD@ + + +/* Define to 1 if you have the declaration of `strcasecmp', and to 0 if you + don't. */ +#define HAVE_DECL_STRCASECMP @HAVE_DECL_STRCASECMP@ + +/* Define to 1 if you have the declaration of `_stricmp', and to 0 if you + don't. */ +#define HAVE_DECL__STRICMP @HAVE_DECL__STRICMP@ + + +/* Define to 1 if you have the declaration of `strncasecmp', and to 0 if you + don't. */ +#define HAVE_DECL_STRNCASECMP @HAVE_DECL_STRNCASECMP@ + +/* Define to 1 if you have the declaration of `_strnicmp', and to 0 if you + don't. */ +#define HAVE_DECL__STRNICMP @HAVE_DECL__STRNICMP@ + + +/* Define to 1 if you have the declaration of `snprintf', and to 0 if you + don't. */ +#define HAVE_DECL_SNPRINTF @HAVE_DECL_SNPRINTF@ + +/* Define to 1 if you have the declaration of `_snprintf', and to 0 if you + don't. */ +#define HAVE_DECL__SNPRINTF @HAVE_DECL__SNPRINTF@ + + +/* use gmp to implement isl_int */ +#cmakedefine USE_GMP_FOR_MP + +/* use imath to implement isl_int */ +#cmakedefine USE_IMATH_FOR_MP + +/* Use small integer optimization */ +#cmakedefine USE_SMALL_INT_OPT + +#include From 7c7c573bdc06f5a26609278a23b93cfad3c26bce Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Wed, 14 Dec 2016 16:51:11 +0100 Subject: [PATCH 02/21] Update cmake build system --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c81d7b735..e174b0ba5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") cmake_minimum_required(VERSION 3.2) project("isl" C) +set_property(GLOBAL PROPERTY USE_FOLDERS ON) if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/isl/isl_ctx.c") set(ISL_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/isl") elseif (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/isl_ctx.c") @@ -57,6 +58,11 @@ elseif (EXISTS "${ISL_SOURCE_DIR}/gitversion.h") # The source directory is preconfigured file(READ "${ISL_SOURCE_DIR}/gitversion.h" GITVERSION_H) string(REGEX REPLACE ".*\\\"([^\\\"]*)\\\".*" "\\1" ISL_GIT_HEAD_ID "${GITVERSION_H}") +elseif (EXISTS "${ISL_SOURCE_DIR}/.git" AND "${ISL_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") + # This is the GIT repository itself + # GetGitRevisionDescription uses CMAKE_CURRENT_SOURCE_DIR to look for the .git directory, so it must refer to ISL's source directory + include(GetGitRevisionDescription) + git_describe(ISL_GIT_HEAD_ID) elseif () # Unknown revision # TODO: We could look for a .git and get the revision from HEAD @@ -210,6 +216,7 @@ configure_file("${ISL_BINARY_DIR}/include/isl/stdint.h.tmp" "${ISL_BINARY_DIR}/include/isl/stdint.h" COPYONLY) configure_file("isl_config.h.cmake" "${ISL_BINARY_DIR}/isl_config.h") +configure_file("isl_srcdir.c.cmake" "${ISL_BINARY_DIR}/isl_srcdir.c") # ISL files to compile set (libisl_common_sources @@ -323,6 +330,7 @@ endif () add_library(isl ${libisl_sources}) +set_target_properties(isl PROPERTIES FOLDER "Integer Set Library") target_include_directories(isl PRIVATE "${ISL_BINARY_DIR}" "${ISL_SOURCE_DIR}" ${PIPLIB_INCLUDE_DIRS}) target_include_directories(isl PUBLIC "${ISL_BINARY_DIR}/include" "${ISL_SOURCE_DIR}/include") @@ -344,6 +352,7 @@ endif () macro (add_isl_executable _name) set(_sources ${ARGN}) add_executable("${_name}" ${_sources}) + set_target_properties("${_name}" PROPERTIES FOLDER "Integer Set Library") target_include_directories("${_name}" PRIVATE "${ISL_SOURCE_DIR}" "${ISL_BINARY_DIR}" ${GMP_INCLUDE_DIRS} ${PIPLIB_INCLUDE_DIRS}) target_link_libraries("${_name}" isl) endmacro () From bb5336a6a44d51d50d4f64f65e0a05629417fd85 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Mon, 6 Mar 2017 18:04:52 +0100 Subject: [PATCH 03/21] Leftover --- isl_srcdir.c.cmake | 1 + 1 file changed, 1 insertion(+) create mode 100644 isl_srcdir.c.cmake diff --git a/isl_srcdir.c.cmake b/isl_srcdir.c.cmake new file mode 100644 index 000000000..34ef890f5 --- /dev/null +++ b/isl_srcdir.c.cmake @@ -0,0 +1 @@ +static const char *srcdir = "@ISL_SOURCE_DIR@"; From 633492b4e9115b8decd353de6f3ef001aa4e5133 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Fri, 9 Feb 2018 15:42:22 -0600 Subject: [PATCH 04/21] Undo non-CMake related changes --- Makefile.am | 12 +++--------- configure.ac | 4 +++- doc/Makefile.am | 14 -------------- interface/Makefile.am | 9 +-------- isl_version.c | 2 +- 5 files changed, 8 insertions(+), 33 deletions(-) diff --git a/Makefile.am b/Makefile.am index 5dd1d5899..265311547 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,7 +2,7 @@ if HAVE_CLANG MAYBE_INTERFACE = interface endif SUBDIRS = . $(MAYBE_INTERFACE) doc -DIST_SUBDIRS = interface doc +DIST_SUBDIRS = $(MAYBE_INTERFACE) doc ACLOCAL_AMFLAGS = -I m4 AUTOMAKE_OPTIONS = nostdinc subdir-objects @@ -187,7 +187,6 @@ libisl_la_SOURCES = \ isl_vertices_private.h \ isl_vertices.c \ isl_yaml.h - libisl_la_LIBADD = @MP_LIBS@ libisl_la_LDFLAGS = -version-info @versioninfo@ \ @MP_LDFLAGS@ @@ -396,17 +395,12 @@ EXTRA_DIST = \ interface/isl-noexceptions.h.bot \ interface/isl.py.top \ interface/isl_test_python.py \ - interface/extract_interface.cc \ - interface/extract_interface.h \ - interface/isl.py \ - interface/Makefile.am \ - interface/Makefile.in \ - interface/python.cc \ - interface/python.h \ test_inputs dist-hook: echo @GIT_HEAD_VERSION@ > $(distdir)/GIT_HEAD_ID + (cd doc; make manual.pdf) + cp doc/manual.pdf $(distdir)/doc/ pkgconfigdir=$(pkgconfig_libdir) pkgconfig_DATA = $(pkgconfig_libfile) diff --git a/configure.ac b/configure.ac index 3099c94bd..ee51162a9 100644 --- a/configure.ac +++ b/configure.ac @@ -135,7 +135,9 @@ AC_CONFIG_HEADERS(isl_config.h) AC_CONFIG_FILES(isl_srcdir.c) AC_CONFIG_FILES(Makefile) AC_CONFIG_FILES(doc/Makefile) -AC_CONFIG_FILES(interface/Makefile) +if test $with_clang = system; then + AC_CONFIG_FILES(interface/Makefile) +fi AC_CONFIG_FILES([bound_test.sh], [chmod +x bound_test.sh]) AC_CONFIG_FILES([codegen_test.sh], [chmod +x codegen_test.sh]) AC_CONFIG_FILES([pip_test.sh], [chmod +x pip_test.sh]) diff --git a/doc/Makefile.am b/doc/Makefile.am index eb9e9109b..1d61dd777 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -13,17 +13,6 @@ CLEANFILES = \ manual.bcf \ manual.run.xml -EXTRA_DIST = \ - CodingStyle \ - SubmittingPatches \ - implementation.tex \ - isl.bib \ - mypod2latex \ - manual.tex \ - reading.tex \ - user.pod \ - manual.pdf - if GENERATE_DOC export TEXINPUTS := $(srcdir):$(TEXINPUTS) export BIBINPUTS := $(srcdir):$(BIBINPUTS) @@ -31,16 +20,13 @@ export BSTINPUTS := $(srcdir):$(BSTINPUTS) user.tex: user.pod $(PERL) $(srcdir)/mypod2latex $< $@ - manual.pdf: manual.tex user.tex $(srcdir)/implementation.tex reading.tex (cd ..; echo "@GIT_HEAD_VERSION@") > version.tex $(PDFLATEX) $< biber manual $(PDFLATEX) $< $(PDFLATEX) $< - user.html: user.pod (cd ..; echo "@GIT_HEAD_VERSION@") > version $(POD2HTML) --infile=$< --outfile=$@ --title="Integer Set Library: Manual [version `cat version`]" - endif diff --git a/interface/Makefile.am b/interface/Makefile.am index f6acaed8d..9e67bfa42 100644 --- a/interface/Makefile.am +++ b/interface/Makefile.am @@ -48,13 +48,6 @@ isl_test_cpp_noexceptions_LDADD = ../libisl.la @MP_LIBS@ BUILT_SOURCES = isl-noexceptions.h CLEANFILES = isl.py isl-noexceptions.h -EXTRA_DIST = \ - all.h \ - isl.py.top \ - isl.py \ - isl-noexceptions.h - - # dummy library that captures the dependencies on all headers # that are relevant for the bindings noinst_LIBRARIES = libdep.a @@ -77,4 +70,4 @@ isl-noexceptions.h: extract_interface libdep.a isl-noexceptions.h.top \ > isl-noexceptions.h dist-hook: isl.py isl-noexceptions.h - cp isl.py isl-noexceptions.h $(distdir)/ \ No newline at end of file + cp isl.py isl-noexceptions.h $(distdir)/ diff --git a/isl_version.c b/isl_version.c index 114323d64..8cd9e669f 100644 --- a/isl_version.c +++ b/isl_version.c @@ -13,5 +13,5 @@ const char *isl_version(void) "-32" #endif #endif - "\n"; + "-cmake\n"; } From 84c3f6bff485c6354fc1fbe379d4224867eeff52 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Fri, 9 Feb 2018 17:05:54 -0600 Subject: [PATCH 05/21] update file list --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e174b0ba5..64bb544cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -229,7 +229,6 @@ set (libisl_common_sources ${ISL_SOURCE_DIR}/isl_ast.c ${ISL_SOURCE_DIR}/isl_ast_codegen.c ${ISL_SOURCE_DIR}/isl_ast_graft.c - ${ISL_SOURCE_DIR}/isl_band.c ${ISL_SOURCE_DIR}/isl_bernstein.c ${ISL_SOURCE_DIR}/isl_blk.c ${ISL_SOURCE_DIR}/isl_bound.c @@ -274,11 +273,11 @@ set (libisl_common_sources ${ISL_SOURCE_DIR}/isl_scan.c ${ISL_SOURCE_DIR}/isl_schedule.c ${ISL_SOURCE_DIR}/isl_schedule_band.c + ${ISL_SOURCE_DIR}/isl_schedule_constraints.c ${ISL_SOURCE_DIR}/isl_schedule_node.c ${ISL_SOURCE_DIR}/isl_schedule_read.c ${ISL_SOURCE_DIR}/isl_schedule_tree.c ${ISL_SOURCE_DIR}/isl_scheduler.c - ${ISL_SOURCE_DIR}/isl_schedule_constraints.c ${ISL_SOURCE_DIR}/isl_seq.c ${ISL_SOURCE_DIR}/isl_set_list.c ${ISL_SOURCE_DIR}/isl_sort.c From 568237fcf107d05a1834fcf6fcf5ceabc88bf2f5 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Sat, 10 Feb 2018 23:01:56 -0600 Subject: [PATCH 06/21] Link fix --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 64bb544cb..31a8e9dfc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,8 +36,10 @@ if (ISL_INT STREQUAL "imath") set(USE_IMATH_FOR_MP ON) endif () -if (USE_SMALL_INT_OPT) +if (ISL_SMALL_INT_OPT) set(USE_SMALL_INT_OPT ON) +else () + set(USE_SMALL_INT_OPT OFF) endif () @@ -283,6 +285,7 @@ set (libisl_common_sources ${ISL_SOURCE_DIR}/isl_sort.c ${ISL_SOURCE_DIR}/isl_space.c ${ISL_SOURCE_DIR}/isl_stream.c + ${ISL_SOURCE_DIR}/isl_stride.c ${ISL_SOURCE_DIR}/isl_tab.c ${ISL_SOURCE_DIR}/isl_tab_pip.c ${ISL_SOURCE_DIR}/isl_tarjan.c @@ -318,11 +321,14 @@ set(libisl_imath32_sources set(libisl_sources ${libisl_common_sources}) if (USE_GMP_FOR_MP) + message(STATUS "Integer implementation: GNU MP") list(APPEND libisl_sources ${libisl_gmp_sources}) elseif (USE_IMATH_FOR_MP) if (USE_SMALL_INT_OPT) + message(STATUS "Integer implementation: imath with sio32") list(APPEND libisl_sources ${libisl_imath32_sources}) else () + message(STATUS "Integer implementation: imath") list(APPEND libisl_sources ${libisl_imath_sources}) endif () endif () From d10caba3adb52a9ac82a7a4ee8b850cf06626a45 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Wed, 18 Apr 2018 17:35:03 -0500 Subject: [PATCH 07/21] Fix compile option --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 31a8e9dfc..60ef3f189 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -349,7 +349,7 @@ endif () # General compiler options if (CMAKE_COMPILER_IS_CLANGCC OR CMAKE_COMPILER_IS_GNUCC) - target_definitions(isl -Wall) + target_compile_options(isl PRIVATE -Wall) endif () From 438a28a28b526ee8502c741b6e1894aa3ae5581a Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Wed, 18 Apr 2018 17:44:26 -0500 Subject: [PATCH 08/21] Repair isl_codegen.sh test --- CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 60ef3f189..41c88a1e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -220,6 +220,10 @@ configure_file("${ISL_BINARY_DIR}/include/isl/stdint.h.tmp" configure_file("isl_config.h.cmake" "${ISL_BINARY_DIR}/isl_config.h") configure_file("isl_srcdir.c.cmake" "${ISL_BINARY_DIR}/isl_srcdir.c") +set(EXEEXT "${CMAKE_EXECUTABLE_SUFFIX}") +set(srcdir "${ISL_SOURCE_DIR}") +configure_file("codegen_test.sh.in" "${ISL_BINARY_DIR}/codegen_test.sh" @ONLY) + # ISL files to compile set (libisl_common_sources ${ISL_SOURCE_DIR}/basis_reduction_tab.c @@ -393,7 +397,5 @@ add_test(NAME isl_test COMMAND "$" ) add_test(NAME codegen_test - COMMAND "${ISL_SOURCE_DIR}/codegen_test.sh" + COMMAND "${ISL_BINARY_DIR}/codegen_test.sh" ) -set_tests_properties(isl_test codegen_test PROPERTIES ENVIRONMENT "srcdir=${ISL_SOURCE_DIR}") - From 5dcb59b6bff25d0c9610482643e51fc7b54e22aa Mon Sep 17 00:00:00 2001 From: Tian Jin Date: Wed, 23 May 2018 21:44:02 -0400 Subject: [PATCH 09/21] fix permission denied --- codegen_test.sh.in | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 codegen_test.sh.in diff --git a/codegen_test.sh.in b/codegen_test.sh.in old mode 100644 new mode 100755 From 57b910d80b0008d5cb7aefb39aa292a8c5156667 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Thu, 5 Jul 2018 15:40:14 -0500 Subject: [PATCH 10/21] [cmake] add new compilation units --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 41c88a1e7..835eb96d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -228,6 +228,7 @@ configure_file("codegen_test.sh.in" "${ISL_BINARY_DIR}/codegen_test.sh" @ONLY) set (libisl_common_sources ${ISL_SOURCE_DIR}/basis_reduction_tab.c ${ISL_SOURCE_DIR}/isl_aff.c + ${ISL_SOURCE_DIR}/isl_aff_map.c ${ISL_SOURCE_DIR}/isl_affine_hull.c ${ISL_SOURCE_DIR}/isl_arg.c ${ISL_SOURCE_DIR}/isl_ast_build.c @@ -238,6 +239,7 @@ set (libisl_common_sources ${ISL_SOURCE_DIR}/isl_bernstein.c ${ISL_SOURCE_DIR}/isl_blk.c ${ISL_SOURCE_DIR}/isl_bound.c + ${ISL_SOURCE_DIR}/isl_box.c ${ISL_SOURCE_DIR}/isl_coalesce.c ${ISL_SOURCE_DIR}/isl_constraint.c ${ISL_SOURCE_DIR}/isl_convex_hull.c @@ -300,6 +302,10 @@ set (libisl_common_sources ${ISL_SOURCE_DIR}/isl_version.c ${ISL_SOURCE_DIR}/isl_vertices.c ${ISL_SOURCE_DIR}/print.c + ${ISL_SOURCE_DIR}/set_to_map.c + ${ISL_SOURCE_DIR}/set_from_map.c + ${ISL_SOURCE_DIR}/uset_to_umap.c + ${ISL_SOURCE_DIR}/uset_from_umap.c ) set(libisl_gmp_sources From 7010e19277be7bad3d0f49b7dbbc4335eca7dc51 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Sat, 19 Dec 2020 00:38:48 -0600 Subject: [PATCH 11/21] Build fix --- CMakeLists.txt | 157 ++++++++++++++++++++++++------------------------- imath | 2 +- 2 files changed, 78 insertions(+), 81 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 835eb96d0..6a2e11425 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -226,86 +226,83 @@ configure_file("codegen_test.sh.in" "${ISL_BINARY_DIR}/codegen_test.sh" @ONLY) # ISL files to compile set (libisl_common_sources - ${ISL_SOURCE_DIR}/basis_reduction_tab.c - ${ISL_SOURCE_DIR}/isl_aff.c - ${ISL_SOURCE_DIR}/isl_aff_map.c - ${ISL_SOURCE_DIR}/isl_affine_hull.c - ${ISL_SOURCE_DIR}/isl_arg.c - ${ISL_SOURCE_DIR}/isl_ast_build.c - ${ISL_SOURCE_DIR}/isl_ast_build_expr.c - ${ISL_SOURCE_DIR}/isl_ast.c - ${ISL_SOURCE_DIR}/isl_ast_codegen.c - ${ISL_SOURCE_DIR}/isl_ast_graft.c - ${ISL_SOURCE_DIR}/isl_bernstein.c - ${ISL_SOURCE_DIR}/isl_blk.c - ${ISL_SOURCE_DIR}/isl_bound.c - ${ISL_SOURCE_DIR}/isl_box.c - ${ISL_SOURCE_DIR}/isl_coalesce.c - ${ISL_SOURCE_DIR}/isl_constraint.c - ${ISL_SOURCE_DIR}/isl_convex_hull.c - ${ISL_SOURCE_DIR}/isl_ctx.c - ${ISL_SOURCE_DIR}/isl_deprecated.c - ${ISL_SOURCE_DIR}/isl_dim_map.c - ${ISL_SOURCE_DIR}/isl_equalities.c - ${ISL_SOURCE_DIR}/isl_factorization.c - ${ISL_SOURCE_DIR}/isl_farkas.c - ${ISL_SOURCE_DIR}/isl_ffs.c - ${ISL_SOURCE_DIR}/isl_flow.c - ${ISL_SOURCE_DIR}/isl_fold.c - ${ISL_SOURCE_DIR}/isl_hash.c - ${ISL_SOURCE_DIR}/isl_id.c - ${ISL_SOURCE_DIR}/isl_id_to_ast_expr.c - ${ISL_SOURCE_DIR}/isl_id_to_id.c - ${ISL_SOURCE_DIR}/isl_id_to_pw_aff.c - ${ISL_SOURCE_DIR}/isl_ilp.c - ${ISL_SOURCE_DIR}/isl_input.c - ${ISL_SOURCE_DIR}/isl_local.c - ${ISL_SOURCE_DIR}/isl_local_space.c - ${ISL_SOURCE_DIR}/isl_lp.c - ${ISL_SOURCE_DIR}/isl_map.c - ${ISL_SOURCE_DIR}/isl_map_list.c - ${ISL_SOURCE_DIR}/isl_map_simplify.c - ${ISL_SOURCE_DIR}/isl_map_subtract.c - ${ISL_SOURCE_DIR}/isl_map_to_basic_set.c - ${ISL_SOURCE_DIR}/isl_mat.c - ${ISL_SOURCE_DIR}/isl_morph.c - ${ISL_SOURCE_DIR}/isl_obj.c - ${ISL_SOURCE_DIR}/isl_options.c - ${ISL_SOURCE_DIR}/isl_output.c - ${ISL_SOURCE_DIR}/isl_point.c - ${ISL_SOURCE_DIR}/isl_polynomial.c - ${ISL_SOURCE_DIR}/isl_printer.c - ${ISL_SOURCE_DIR}/isl_range.c - ${ISL_SOURCE_DIR}/isl_reordering.c - ${ISL_SOURCE_DIR}/isl_sample.c - ${ISL_SOURCE_DIR}/isl_scan.c - ${ISL_SOURCE_DIR}/isl_schedule.c - ${ISL_SOURCE_DIR}/isl_schedule_band.c - ${ISL_SOURCE_DIR}/isl_schedule_constraints.c - ${ISL_SOURCE_DIR}/isl_schedule_node.c - ${ISL_SOURCE_DIR}/isl_schedule_read.c - ${ISL_SOURCE_DIR}/isl_schedule_tree.c - ${ISL_SOURCE_DIR}/isl_scheduler.c - ${ISL_SOURCE_DIR}/isl_seq.c - ${ISL_SOURCE_DIR}/isl_set_list.c - ${ISL_SOURCE_DIR}/isl_sort.c - ${ISL_SOURCE_DIR}/isl_space.c - ${ISL_SOURCE_DIR}/isl_stream.c - ${ISL_SOURCE_DIR}/isl_stride.c - ${ISL_SOURCE_DIR}/isl_tab.c - ${ISL_SOURCE_DIR}/isl_tab_pip.c - ${ISL_SOURCE_DIR}/isl_tarjan.c - ${ISL_SOURCE_DIR}/isl_transitive_closure.c - ${ISL_SOURCE_DIR}/isl_union_map.c - ${ISL_SOURCE_DIR}/isl_val.c - ${ISL_SOURCE_DIR}/isl_vec.c - ${ISL_SOURCE_DIR}/isl_version.c - ${ISL_SOURCE_DIR}/isl_vertices.c - ${ISL_SOURCE_DIR}/print.c - ${ISL_SOURCE_DIR}/set_to_map.c - ${ISL_SOURCE_DIR}/set_from_map.c - ${ISL_SOURCE_DIR}/uset_to_umap.c - ${ISL_SOURCE_DIR}/uset_from_umap.c + isl_aff.c + isl_aff_map.c + isl_affine_hull.c + isl_arg.c + isl_ast.c + isl_ast_build.c + isl_ast_build_expr.c + isl_ast_codegen.c + isl_ast_graft.c + basis_reduction_tab.c + isl_bernstein.c + isl_blk.c + isl_bound.c + isl_box.c + isl_coalesce.c + isl_constraint.c + isl_convex_hull.c + isl_ctx.c + isl_deprecated.c + isl_dim_map.c + isl_equalities.c + isl_factorization.c + isl_farkas.c + isl_ffs.c + isl_flow.c + isl_fold.c + isl_hash.c + isl_id_to_ast_expr.c + isl_id_to_id.c + isl_id_to_pw_aff.c + isl_ilp.c + isl_input.c + isl_local.c + isl_local_space.c + isl_lp.c + isl_map.c + isl_map_list.c + isl_map_simplify.c + isl_map_subtract.c + isl_map_to_basic_set.c + isl_mat.c + isl_morph.c + isl_id.c + isl_obj.c + isl_options.c + isl_output.c + isl_point.c + isl_polynomial.c + isl_printer.c + print.c + isl_range.c + isl_reordering.c + isl_sample.c + isl_scan.c + isl_schedule.c + isl_schedule_band.c + isl_schedule_node.c + isl_schedule_read.c + isl_schedule_tree.c + isl_schedule_constraints.c + isl_scheduler.c + isl_set_list.c + isl_sort.c + isl_space.c + isl_stream.c + isl_seq.c + isl_set_to_ast_graft_list.c + isl_stride.c + isl_tab.c + isl_tab_pip.c + isl_tarjan.c + isl_transitive_closure.c + isl_union_map.c + isl_val.c + isl_vec.c + isl_version.c + isl_vertices.c ) set(libisl_gmp_sources diff --git a/imath b/imath index 48932bf24..e8052bd17 160000 --- a/imath +++ b/imath @@ -1 +1 @@ -Subproject commit 48932bf246a758929e00bee4ef2c0e0dd91a81c2 +Subproject commit e8052bd179c455cb07b6f256b8613f6cf56a500e From 8bee467c7170c47653e04e16e49a2e190d1440f4 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Sun, 20 Dec 2020 00:59:30 -0600 Subject: [PATCH 12/21] cmake: generate interfaces --- CMakeLists.txt | 14 ++++++++--- interface/CMakeLists.txt | 53 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 interface/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a2e11425..f07c54e94 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,8 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -cmake_minimum_required(VERSION 3.2) +cmake_minimum_required(VERSION 3.12) + +project("isl" C CXX) -project("isl" C) set_property(GLOBAL PROPERTY USE_FOLDERS ON) if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/isl/isl_ctx.c") set(ISL_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/isl") @@ -12,10 +13,12 @@ else () endif () set(ISL_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}") +#find_package(LLVM REQUIRED NO_DEFAULT_PATH) +find_package(Clang QUIET) + set(IMATH_SOURCE_DIR "${ISL_SOURCE_DIR}/imath") set(IMATH_BINARY_DIR "${ISL_BINARY_DIR}/imath") - ## Configure options set(ISL_INT "imath" CACHE STRING "Which package to use to represent multi-precision integers (gmp|imath)") option(ISL_SMALL_INT_OPT "Use small integer optimization" ON) @@ -385,6 +388,11 @@ add_isl_executable(isl_closure "${ISL_SOURCE_DIR}/closure.c") add_isl_executable(isl_bound "${ISL_SOURCE_DIR}/bound.c") add_isl_executable(isl_codegen "${ISL_SOURCE_DIR}/codegen.c") +if (Clang_FOUND) + add_subdirectory(interface) +endif () + + # Testing enable_testing() diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt new file mode 100644 index 000000000..77a5643f0 --- /dev/null +++ b/interface/CMakeLists.txt @@ -0,0 +1,53 @@ + +add_executable(extract_interface extract_interface.cc generator.cc python.cc cpp.cc cpp_conversion.cc) + +target_include_directories(extract_interface PRIVATE "${ISL_SOURCE_DIR}" "${ISL_BINARY_DIR}" ${CLANG_INCLUDE_DIRS}) +target_compile_options(extract_interface PUBLIC -fno-rtti) +target_compile_definitions(extract_interface PRIVATE + ADDPATH_TAKES_4_ARGUMENTS + "CLANG_PREFIX=\"${CLANG_INSTALL_PREFIX}\"" + CREATEPREPROCESSOR_TAKES_TUKIND + CREATETARGETINFO_TAKES_SHARED_PTR + CREATE_FROM_ARGS_TAKES_ARRAYREF + HAVE_BASIC_DIAGNOSTICOPTIONS_H + HAVE_DLFCN_H=1 + HAVE_INTTYPES_H=1 + HAVE_LEX_PREPROCESSOROPTIONS_H + HAVE_LLVM_OPTION_ARG_H + HAVE_MEMORY_H=1 + HAVE_SETMAINFILEID + HAVE_STDINT_H=1 + HAVE_STDLIB_H=1 + HAVE_STRINGS_H=1 + HAVE_STRING_H=1 + HAVE_SYS_STAT_H=1 + HAVE_SYS_TYPES_H=1 + HAVE_UNISTD_H=1 + HandleTopLevelDeclContinue=true + HandleTopLevelDeclReturn=bool + "IK_C=Language::C" + SETINVOCATION_TAKES_SHARED_PTR + SETLANGDEFAULTS_TAKES_5_ARGUMENTS + STDC_HEADERS=1 + USE_ARRAYREF + getArgType=getParamType + getNumArgs=getNumParams +) +target_link_libraries(extract_interface PRIVATE clangBasic clangAnalysis clangAST clangLex clangEdit clangParse clangSema clangFrontend clangSerialization) + + +add_custom_target(interface-python ALL + COMMAND extract_interface --language=python "-I${ISL_BINARY_DIR}/include" "-I${ISL_SOURCE_DIR}/include" "${ISL_SOURCE_DIR}/all.h" > python.h +) + +add_custom_target(interface-cpp ALL + COMMAND extract_interface --language=cpp "-I${ISL_BINARY_DIR}/include" "-I${ISL_SOURCE_DIR}/include" "${ISL_SOURCE_DIR}/all.h" > cpp.h +) + +add_custom_target(interface-cpp-checked ALL + COMMAND extract_interface --language=cpp-checked "-I${ISL_BINARY_DIR}/include" "-I${ISL_SOURCE_DIR}/include" "${ISL_SOURCE_DIR}/all.h" > cpp-checked.h +) + +add_custom_target(interface-cpp-checked-conversion ALL + COMMAND extract_interface --language=cpp-checked-conversion "-I${ISL_BINARY_DIR}/include" "-I${ISL_SOURCE_DIR}/include" "${ISL_SOURCE_DIR}/all.h" > cpp-checked-conversion.h +) From 73f13fdb0a01731ae4af25dbc681eecffaf3f453 Mon Sep 17 00:00:00 2001 From: miheer vaidya Date: Wed, 6 Jan 2021 22:13:25 -0700 Subject: [PATCH 13/21] Cmake enhacements 1. set USE_SMALL_INT_OPT to false if using GMP (See https://github.com/Meinersbur/isl/issues/4#issuecomment-755880015 2. add install directives to install library and headers to appropriate locations --- CMakeLists.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f07c54e94..4448501b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,7 @@ if (ISL_INT STREQUAL "imath") set(USE_IMATH_FOR_MP ON) endif () -if (ISL_SMALL_INT_OPT) +if (ISL_SMALL_INT_OPT AND (NOT USE_GMP_FOR_MP)) set(USE_SMALL_INT_OPT ON) else () set(USE_SMALL_INT_OPT OFF) @@ -410,3 +410,14 @@ add_test(NAME isl_test add_test(NAME codegen_test COMMAND "${ISL_BINARY_DIR}/codegen_test.sh" ) + +include(GNUInstallDirs) +install(TARGETS isl + EXPORT islTargets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +) + +install(DIRECTORY include/isl + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) \ No newline at end of file From 842584c47ef1d8b12ff475a961a0bbab8002fabc Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Tue, 31 Aug 2021 15:00:59 -0500 Subject: [PATCH 14/21] Update CMakeLists --- CMakeLists.txt | 98 +++++++++++++++++++++++++++++++---- cmake/islConfig.cmake.in | 2 + interface/CMakeLists.txt | 51 ++++++++++++------ interface/redirect_to_file.py | 25 +++++++++ 4 files changed, 151 insertions(+), 25 deletions(-) create mode 100644 cmake/islConfig.cmake.in create mode 100644 interface/redirect_to_file.py diff --git a/CMakeLists.txt b/CMakeLists.txt index 4448501b5..47c5d8784 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,12 @@ cmake_minimum_required(VERSION 3.12) project("isl" C CXX) +# TODO: Extract from configure.ac +set(ISL_VERSION_MAJOR 0) +set(ISL_VERSION_MINOR 24) +set(ISL_VERSION_PATCH 0) + + set_property(GLOBAL PROPERTY USE_FOLDERS ON) if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/isl/isl_ctx.c") set(ISL_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/isl") @@ -13,8 +19,11 @@ else () endif () set(ISL_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}") -#find_package(LLVM REQUIRED NO_DEFAULT_PATH) find_package(Clang QUIET) +find_package(Python QUIET) + +# See https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html +include(GNUInstallDirs) set(IMATH_SOURCE_DIR "${ISL_SOURCE_DIR}/imath") set(IMATH_BINARY_DIR "${ISL_BINARY_DIR}/imath") @@ -348,13 +357,13 @@ add_library(isl ${libisl_sources}) set_target_properties(isl PROPERTIES FOLDER "Integer Set Library") target_include_directories(isl PRIVATE "${ISL_BINARY_DIR}" "${ISL_SOURCE_DIR}" ${PIPLIB_INCLUDE_DIRS}) -target_include_directories(isl PUBLIC "${ISL_BINARY_DIR}/include" "${ISL_SOURCE_DIR}/include") +target_include_directories(isl PUBLIC "$" "$") if (USE_GMP_FOR_MP) target_include_directories(isl PUBLIC ${GMP_INCLUDE_DIRS}) - target_link_libraries(isl PUBLIC ${GMP_LIBRARIES}) + target_link_libraries(isl PRIVATE ${GMP_LIBRARIES}) endif () if (USE_IMATH_FOR_MP) - target_include_directories(isl PUBLIC "${ISL_SOURCE_DIR}/imath") + target_include_directories(isl PUBLIC "$") endif () # General compiler options @@ -373,7 +382,12 @@ macro (add_isl_executable _name) endmacro () + add_isl_executable(isl_test "${ISL_SOURCE_DIR}/isl_test.c") +if (Clang_FOUND AND Python_FOUND) + add_isl_executable(isl_test2 "${ISL_SOURCE_DIR}/isl_test2.cc") + add_dependencies(isl_test2 interface-cpp) +endif () add_isl_executable(isl_test_int "${ISL_SOURCE_DIR}/isl_test_int.c") if (USE_IMATH_FOR_MP) add_isl_executable(isl_test_imath "${ISL_SOURCE_DIR}/isl_test_imath.c") @@ -388,7 +402,7 @@ add_isl_executable(isl_closure "${ISL_SOURCE_DIR}/closure.c") add_isl_executable(isl_bound "${ISL_SOURCE_DIR}/bound.c") add_isl_executable(isl_codegen "${ISL_SOURCE_DIR}/codegen.c") -if (Clang_FOUND) +if (Clang_FOUND AND Python_FOUND) add_subdirectory(interface) endif () @@ -396,6 +410,7 @@ endif () # Testing enable_testing() +set(check_depends isl_test isl_test_int isl_codegen) add_test(NAME isl_test_int COMMAND "$" ) @@ -403,21 +418,84 @@ if (USE_IMATH_FOR_MP) add_test(NAME isl_test_imath COMMAND "$" ) + list(APPEND check_depends isl_test_imath) endif () add_test(NAME isl_test COMMAND "$" ) +if (Clang_FOUND AND Python_FOUND) + add_test(NAME isl_test2 + COMMAND "$" + ) + list(APPEND check_depends isl_test2) +endif () add_test(NAME codegen_test COMMAND "${ISL_BINARY_DIR}/codegen_test.sh" ) -include(GNUInstallDirs) -install(TARGETS isl + +set(ctest_test_args --output-on-failure) + +include(ProcessorCount) +ProcessorCount(JOBS) +if(NOT JOBS EQUAL 0) + list(APPEND ctest_test_args --jobs ${JOBS}) +endif() + +if(CMAKE_CONFIGURATION_TYPES) + list(APPEND check_command --build-config "$") +endif() + +# CMake also has a "test" target, but it does not build dependencies/ +add_custom_target(check + COMMAND "${CMAKE_CTEST_COMMAND}" ${ctest_test_args} + VERBATIM + USES_TERMINAL +) +add_dependencies(check ${check_depends}) + + + + +# Installing + +install(TARGETS isl EXPORT islTargets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) - -install(DIRECTORY include/isl +install( + FILES + include/isl/ctx.h + include/isl/aff.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} -) \ No newline at end of file +# COMPONENT Devel +) + +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/islConfigVersion.cmake" + VERSION "${ISL_VERSION_MAJOR}.${ISL_VERSION_MINOR}.${ISL_VERSION_PATCH}" + COMPATIBILITY AnyNewerVersion +) + + +set(ConfigPackageLocation lib/cmake/isl) +set(targets_export_name "islTargets") +configure_package_config_file( + "cmake/islConfig.cmake.in" + "islConfig.cmake" + INSTALL_DESTINATION "${ConfigPackageLocation}" + PATH_VARS CMAKE_INSTALL_LIBDIR +) + + +install(EXPORT islTargets + FILE + islTargets.cmake + DESTINATION + ${ConfigPackageLocation} +) + diff --git a/cmake/islConfig.cmake.in b/cmake/islConfig.cmake.in new file mode 100644 index 000000000..8d66f2506 --- /dev/null +++ b/cmake/islConfig.cmake.in @@ -0,0 +1,2 @@ +@PACKAGE_INIT@ +include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake") diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 77a5643f0..731336df1 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -1,8 +1,11 @@ -add_executable(extract_interface extract_interface.cc generator.cc python.cc cpp.cc cpp_conversion.cc) +add_executable(extract_interface extract_interface.cc generator.cc python.cc cpp.cc cpp_conversion.cc plain_cpp.cc template_cpp.cc) -target_include_directories(extract_interface PRIVATE "${ISL_SOURCE_DIR}" "${ISL_BINARY_DIR}" ${CLANG_INCLUDE_DIRS}) -target_compile_options(extract_interface PUBLIC -fno-rtti) +target_include_directories(extract_interface PRIVATE "${ISL_SOURCE_DIR}" "${ISL_BINARY_DIR}" ${LLVM_INCLUDE_DIRS} ${CLANG_INCLUDE_DIRS}) +if (MSVC) +else () + target_compile_options(extract_interface PUBLIC -fno-rtti) +endif () target_compile_definitions(extract_interface PRIVATE ADDPATH_TAKES_4_ARGUMENTS "CLANG_PREFIX=\"${CLANG_INSTALL_PREFIX}\"" @@ -36,18 +39,36 @@ target_compile_definitions(extract_interface PRIVATE target_link_libraries(extract_interface PRIVATE clangBasic clangAnalysis clangAST clangLex clangEdit clangParse clangSema clangFrontend clangSerialization) -add_custom_target(interface-python ALL - COMMAND extract_interface --language=python "-I${ISL_BINARY_DIR}/include" "-I${ISL_SOURCE_DIR}/include" "${ISL_SOURCE_DIR}/all.h" > python.h -) -add_custom_target(interface-cpp ALL - COMMAND extract_interface --language=cpp "-I${ISL_BINARY_DIR}/include" "-I${ISL_SOURCE_DIR}/include" "${ISL_SOURCE_DIR}/all.h" > cpp.h -) +function(gen_interface TARGET GENERATOR OUTFILE) + cmake_parse_arguments(ARG "" "" "PREPEND;APPEND" ${ARGN}) + set(_outpath "${ISL_BINARY_DIR}/include/isl/${OUTFILE}") -add_custom_target(interface-cpp-checked ALL - COMMAND extract_interface --language=cpp-checked "-I${ISL_BINARY_DIR}/include" "-I${ISL_SOURCE_DIR}/include" "${ISL_SOURCE_DIR}/all.h" > cpp-checked.h -) + set(_more) + foreach (_prepend IN LISTS ARG_PREPEND) + list(APPEND _more --prepend ${_prepend}) + endforeach () + foreach (_append IN LISTS ARG_APPEND) + list(APPEND _more --append ${_append}) + endforeach () + add_custom_command( + OUTPUT "${_outpath}" + COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/redirect_to_file.py" "${_outpath}" ${_more} $ --language=${GENERATOR} "-I${ISL_BINARY_DIR}/include" "-I${ISL_SOURCE_DIR}/include" "${ISL_SOURCE_DIR}/all.h" + DEPENDS redirect_to_file.py + IMPLICIT_DEPENDS "${ISL_SOURCE_DIR}/all.h" + ) + + add_custom_target(${TARGET} + DEPENDS "${_outpath}" + ) + add_dependencies(${TARGET} extract_interface) + add_dependencies(interface ${TARGET} ) +endfunction() + +add_custom_target(interface ALL) +gen_interface(interface-python python python.h) +gen_interface(interface-cpp cpp cpp.h PREPEND "${ISL_SOURCE_DIR}/cpp/cpp.h.top" "${ISL_SOURCE_DIR}/all.h" APPEND "${ISL_SOURCE_DIR}/cpp/cpp.h.bot") +gen_interface(interface-cpp-checked cpp-checked cpp-checked.h PREPEND "${ISL_SOURCE_DIR}/cpp/cpp-checked.h.top" "${ISL_SOURCE_DIR}/all.h" APPEND "${ISL_SOURCE_DIR}/cpp/cpp-checked.h.bot") +gen_interface(interface-cpp-checked-conversion cpp-checked-conversion cpp-checked-conversion.h PREPEND "${ISL_SOURCE_DIR}/cpp/cpp-checked-conversion.h.top" APPEND "${ISL_SOURCE_DIR}/cpp/cpp-checked-conversion.h.bot") +gen_interface(interface-template-cpp template-cpp typed_cpp.h PREPEND "${ISL_SOURCE_DIR}/cpp/typed_cpp.h.top" APPEND "${ISL_SOURCE_DIR}/cpp/typed_cpp.h.bot") -add_custom_target(interface-cpp-checked-conversion ALL - COMMAND extract_interface --language=cpp-checked-conversion "-I${ISL_BINARY_DIR}/include" "-I${ISL_SOURCE_DIR}/include" "${ISL_SOURCE_DIR}/all.h" > cpp-checked-conversion.h -) diff --git a/interface/redirect_to_file.py b/interface/redirect_to_file.py new file mode 100644 index 000000000..c1bdf680a --- /dev/null +++ b/interface/redirect_to_file.py @@ -0,0 +1,25 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- + +import subprocess +import sys +import argparse + +parser = argparse.ArgumentParser(allow_abbrev=False) +parser.add_argument('output') +parser.add_argument('--prepend',action='append',default=[]) +parser.add_argument('--append',action='append',default=[]) + +args,cmdline = parser.parse_known_intermixed_args() + +with open(args.output,'w+') as fd: + for pre in args.prepend: + with open(pre,'r') as pfd: + fd.write(pfd.read()) + + p = subprocess.run(cmdline,check=True,stdout=subprocess.PIPE,text=True) + fd.write(p.stdout) + + for app in args.append: + with open(app,'r') as pfd: + fd.write(pfd.read()) From b998608f7eb3990d43c7d27027879d598d530e76 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Mon, 28 Mar 2022 22:13:38 -0500 Subject: [PATCH 15/21] Add isl_scheduler_clustering.c to CMakeLists.txt --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 47c5d8784..7f0796483 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -299,6 +299,7 @@ set (libisl_common_sources isl_schedule_tree.c isl_schedule_constraints.c isl_scheduler.c + isl_scheduler_clustering.c isl_set_list.c isl_sort.c isl_space.c From 703f06b0e7888d761456c2131ff0566dbd6681f6 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Sun, 25 Jan 2026 22:45:00 +0100 Subject: [PATCH 16/21] Fix make build --- CMakeLists.txt | 8 +++++++- interface/CMakeLists.txt | 12 ++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f0796483..ffa39ba19 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -232,6 +232,11 @@ configure_file("${ISL_BINARY_DIR}/include/isl/stdint.h.tmp" configure_file("isl_config.h.cmake" "${ISL_BINARY_DIR}/isl_config.h") configure_file("isl_srcdir.c.cmake" "${ISL_BINARY_DIR}/isl_srcdir.c") +# FIXME: codegen_test.sh passes -w option that cmake's compare_files rejects +#set(DIFF "${CMAKE_COMMAND}") +#set(DIFF_OPTIONS "-E compare_files --ignore-eol") +set(DIFF "diff") +set(DIFF_OPTIONS "-u") set(EXEEXT "${CMAKE_EXECUTABLE_SUFFIX}") set(srcdir "${ISL_SOURCE_DIR}") configure_file("codegen_test.sh.in" "${ISL_BINARY_DIR}/codegen_test.sh" @ONLY) @@ -300,6 +305,7 @@ set (libisl_common_sources isl_schedule_constraints.c isl_scheduler.c isl_scheduler_clustering.c + isl_scheduler_scc.c isl_set_list.c isl_sort.c isl_space.c @@ -460,7 +466,7 @@ add_dependencies(check ${check_depends}) # Installing -install(TARGETS isl +install(TARGETS isl EXPORT islTargets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 731336df1..e24214c36 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -1,14 +1,16 @@ add_executable(extract_interface extract_interface.cc generator.cc python.cc cpp.cc cpp_conversion.cc plain_cpp.cc template_cpp.cc) -target_include_directories(extract_interface PRIVATE "${ISL_SOURCE_DIR}" "${ISL_BINARY_DIR}" ${LLVM_INCLUDE_DIRS} ${CLANG_INCLUDE_DIRS}) +configure_file("../isl_config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/include/isl-interface/config.h") + +target_include_directories(extract_interface PRIVATE "${ISL_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include" "${ISL_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/include" ${LLVM_INCLUDE_DIRS} ${CLANG_INCLUDE_DIRS}) if (MSVC) else () target_compile_options(extract_interface PUBLIC -fno-rtti) endif () -target_compile_definitions(extract_interface PRIVATE +target_compile_definitions(extract_interface PRIVATE ADDPATH_TAKES_4_ARGUMENTS - "CLANG_PREFIX=\"${CLANG_INSTALL_PREFIX}\"" + "ISL_CLANG_PREFIX=\"${CLANG_INSTALL_PREFIX}\"" CREATEPREPROCESSOR_TAKES_TUKIND CREATETARGETINFO_TAKES_SHARED_PTR CREATE_FROM_ARGS_TAKES_ARRAYREF @@ -16,7 +18,7 @@ target_compile_definitions(extract_interface PRIVATE HAVE_DLFCN_H=1 HAVE_INTTYPES_H=1 HAVE_LEX_PREPROCESSOROPTIONS_H - HAVE_LLVM_OPTION_ARG_H + HAVE_LLVM_OPTION_ARG_H HAVE_MEMORY_H=1 HAVE_SETMAINFILEID HAVE_STDINT_H=1 @@ -26,6 +28,8 @@ target_compile_definitions(extract_interface PRIVATE HAVE_SYS_STAT_H=1 HAVE_SYS_TYPES_H=1 HAVE_UNISTD_H=1 + HAVE_TARGETPARSER_HOST_H=1 + SETLANGDEFAULTS=LangOptions HandleTopLevelDeclContinue=true HandleTopLevelDeclReturn=bool "IK_C=Language::C" From 56c6a0c19ca19808e27125522363162568ebc14e Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Sun, 5 Apr 2026 16:35:09 +0200 Subject: [PATCH 17/21] Revise CMake code --- CMakeLists.txt | 76 +++++++++++++++++++++++++--------------- interface/CMakeLists.txt | 11 ++++-- 2 files changed, 56 insertions(+), 31 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ffa39ba19..c32934fe0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,12 +3,6 @@ cmake_minimum_required(VERSION 3.12) project("isl" C CXX) -# TODO: Extract from configure.ac -set(ISL_VERSION_MAJOR 0) -set(ISL_VERSION_MINOR 24) -set(ISL_VERSION_PATCH 0) - - set_property(GLOBAL PROPERTY USE_FOLDERS ON) if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/isl/isl_ctx.c") set(ISL_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/isl") @@ -19,6 +13,16 @@ else () endif () set(ISL_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}") + +# TODO: Extract from configure.ac +#set(ISL_VERSION_MAJOR 0) +#set(ISL_VERSION_MINOR 24) +#set(ISL_VERSION_PATCH 0) + +file(STRINGS "${ISL_SOURCE_DIR}/configure.ac" configure_ac_init REGEX "AC\_INIT") +string(REGEX MATCH "\\\[([0-9.]+)\\\]" configure_ac_init_ver "${configure_ac_init}") +set(ISL_VERSION "${CMAKE_MATCH_1}") + find_package(Clang QUIET) find_package(Python QUIET) @@ -29,29 +33,23 @@ set(IMATH_SOURCE_DIR "${ISL_SOURCE_DIR}/imath") set(IMATH_BINARY_DIR "${ISL_BINARY_DIR}/imath") ## Configure options -set(ISL_INT "imath" CACHE STRING "Which package to use to represent multi-precision integers (gmp|imath)") +set(ISL_INT "gmp" CACHE STRING "Which package to use to represent multi-precision integers (gmp|imath)") option(ISL_SMALL_INT_OPT "Use small integer optimization" ON) # Process configure options -if (NOT ISL_INT MATCHES "^imath|gmp$") - message(FATAL_ERROR "Unsupported option for ISL_INT: ${ISL_INT}") -endif () - set(USE_GMP_FOR_MP OFF) -if (ISL_INT STREQUAL "gmp") - set(USE_GMP_FOR_MP ON) -endif () - set(USE_IMATH_FOR_MP OFF) -if (ISL_INT STREQUAL "imath") +set(USE_SMALL_INT_OPT OFF) +if (ISL_INT STREQUAL "gmp$") + set(USE_GMP_FOR_MP ON) +elseif (ISL_INT STREQUAL "imath") set(USE_IMATH_FOR_MP ON) -endif () - -if (ISL_SMALL_INT_OPT AND (NOT USE_GMP_FOR_MP)) - set(USE_SMALL_INT_OPT ON) + if (ISL_SMALL_INT_OPT) + set(USE_SMALL_INT_OPT ON) + endif () else () - set(USE_SMALL_INT_OPT OFF) + message(FATAL_ERROR "Unsupported option for ISL_INT: ${ISL_INT}") endif () @@ -83,11 +81,11 @@ elseif () set(ISL_GIT_HEAD_ID "UNKNOWN") endif () -message(STATUS "ISL version: ${GIT_HEAD_ID}") + # Determine compiler characteristics if ("${CMAKE_C_COMPILER_ID}" MATCHES "Clang") - set(CMAKE_COMPILER_IS_CLANGCC ON) + set(CMAKE_COMPILER_IS_CLANGCC ON) # TODO: rename, not a cmake var endif() include(CheckCSourceCompiles) @@ -242,7 +240,7 @@ set(srcdir "${ISL_SOURCE_DIR}") configure_file("codegen_test.sh.in" "${ISL_BINARY_DIR}/codegen_test.sh" @ONLY) # ISL files to compile -set (libisl_common_sources +set(libisl_common_sources isl_aff.c isl_aff_map.c isl_affine_hull.c @@ -347,14 +345,11 @@ set(libisl_imath32_sources set(libisl_sources ${libisl_common_sources}) if (USE_GMP_FOR_MP) - message(STATUS "Integer implementation: GNU MP") list(APPEND libisl_sources ${libisl_gmp_sources}) elseif (USE_IMATH_FOR_MP) if (USE_SMALL_INT_OPT) - message(STATUS "Integer implementation: imath with sio32") list(APPEND libisl_sources ${libisl_imath32_sources}) else () - message(STATUS "Integer implementation: imath") list(APPEND libisl_sources ${libisl_imath_sources}) endif () endif () @@ -409,7 +404,12 @@ add_isl_executable(isl_closure "${ISL_SOURCE_DIR}/closure.c") add_isl_executable(isl_bound "${ISL_SOURCE_DIR}/bound.c") add_isl_executable(isl_codegen "${ISL_SOURCE_DIR}/codegen.c") -if (Clang_FOUND AND Python_FOUND) + +if (NOT Clang_FOUND) + message(STATUS "Not generating non-C bindings: No Clang") +elseif (NOT Python_FOUND) + message(STATUS "Not generating non-C bindings: No Python") +else () add_subdirectory(interface) endif () @@ -484,7 +484,7 @@ install( include(CMakePackageConfigHelpers) write_basic_package_version_file( "${CMAKE_CURRENT_BINARY_DIR}/islConfigVersion.cmake" - VERSION "${ISL_VERSION_MAJOR}.${ISL_VERSION_MINOR}.${ISL_VERSION_PATCH}" + VERSION "${ISL_VERSION}" COMPATIBILITY AnyNewerVersion ) @@ -506,3 +506,21 @@ install(EXPORT islTargets ${ConfigPackageLocation} ) + + +message("################################################################################") +message("# Configuration summary:") +message("# ISL version: ${ISL_VERSION} (${ISL_GIT_HEAD_ID})") +if (USE_GMP_FOR_MP) + message("# Integer implementation: GNU MP") +elseif (USE_IMATH_FOR_MP AND USE_SMALL_INT_OPT) + message("# Integer implementation: imath with sio32") +elseif (USE_IMATH_FOR_MP) + message("# Integer implementation: imath") +endif () +if (TARGET extract_interface) + message("# Language bindings generation: yes") +else () + message("# Language bindings generation: no") +endif () +message("################################################################################") diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index e24214c36..760e8c74a 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -1,5 +1,12 @@ - -add_executable(extract_interface extract_interface.cc generator.cc python.cc cpp.cc cpp_conversion.cc plain_cpp.cc template_cpp.cc) +add_executable(extract_interface + extract_interface.cc + generator.cc + python.cc + cpp.cc + cpp_conversion.cc + plain_cpp.cc + template_cpp.cc +) configure_file("../isl_config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/include/isl-interface/config.h") From ed8b11ca3385768e9c1a8ebfda244e72ff4dab94 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Mon, 6 Apr 2026 12:29:02 +0200 Subject: [PATCH 18/21] Backport changes --- CMakeLists.txt | 12 ++++++++---- interface/CMakeLists.txt | 22 ++++++++++++++++------ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c32934fe0..a4dc9e9be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.20) project("isl" C CXX) @@ -41,7 +41,7 @@ option(ISL_SMALL_INT_OPT "Use small integer optimization" ON) set(USE_GMP_FOR_MP OFF) set(USE_IMATH_FOR_MP OFF) set(USE_SMALL_INT_OPT OFF) -if (ISL_INT STREQUAL "gmp$") +if (ISL_INT STREQUAL "gmp") set(USE_GMP_FOR_MP ON) elseif (ISL_INT STREQUAL "imath") set(USE_IMATH_FOR_MP ON) @@ -320,6 +320,8 @@ set(libisl_common_sources isl_vec.c isl_version.c isl_vertices.c + isl_scheduler_clustering.c + isl_scheduler_scc.c ) set(libisl_gmp_sources @@ -518,8 +520,10 @@ elseif (USE_IMATH_FOR_MP AND USE_SMALL_INT_OPT) elseif (USE_IMATH_FOR_MP) message("# Integer implementation: imath") endif () -if (TARGET extract_interface) - message("# Language bindings generation: yes") +if (TARGET interface) + get_property(_interfaces GLOBAL PROPERTY ISL_INTERFACES) + string(JOIN " " _interfaces ${_interfaces}) + message("# Language bindings: ${_interfaces}") else () message("# Language bindings generation: no") endif () diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 760e8c74a..32a945fe6 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -10,7 +10,9 @@ add_executable(extract_interface configure_file("../isl_config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/include/isl-interface/config.h") -target_include_directories(extract_interface PRIVATE "${ISL_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include" "${ISL_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/include" ${LLVM_INCLUDE_DIRS} ${CLANG_INCLUDE_DIRS}) +target_include_directories(extract_interface PRIVATE "${ISL_SOURCE_DIR}" "${ISL_SOURCE_DIR}/include" "${ISL_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/include" ${LLVM_INCLUDE_DIRS} ${CLANG_INCLUDE_DIRS}) +target_include_directories(extract_interface PRIVATE "include/" "${ISL_BINARY_DIR}/include") + if (MSVC) else () target_compile_options(extract_interface PUBLIC -fno-rtti) @@ -50,10 +52,14 @@ target_compile_definitions(extract_interface PRIVATE target_link_libraries(extract_interface PRIVATE clangBasic clangAnalysis clangAST clangLex clangEdit clangParse clangSema clangFrontend clangSerialization) +set_property(GLOBAL + PROPERTY ISL_INTERFACES "" +) + function(gen_interface TARGET GENERATOR OUTFILE) cmake_parse_arguments(ARG "" "" "PREPEND;APPEND" ${ARGN}) - set(_outpath "${ISL_BINARY_DIR}/include/isl/${OUTFILE}") + cmake_path(APPEND "${ISL_BINARY_DIR}/include/isl/" "${OUTFILE}" OUTPUT_VARIABLE _outpath) set(_more) foreach (_prepend IN LISTS ARG_PREPEND) @@ -64,16 +70,20 @@ function(gen_interface TARGET GENERATOR OUTFILE) endforeach () add_custom_command( OUTPUT "${_outpath}" - COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/redirect_to_file.py" "${_outpath}" ${_more} $ --language=${GENERATOR} "-I${ISL_BINARY_DIR}/include" "-I${ISL_SOURCE_DIR}/include" "${ISL_SOURCE_DIR}/all.h" - DEPENDS redirect_to_file.py + COMMAND "${Python_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/redirect_to_file.py" "${_outpath}" ${_more} $ --language=${GENERATOR} "-I${ISL_BINARY_DIR}/include" "-I${ISL_SOURCE_DIR}/include" "${ISL_SOURCE_DIR}/all.h" + DEPENDS redirect_to_file.py IMPLICIT_DEPENDS "${ISL_SOURCE_DIR}/all.h" ) add_custom_target(${TARGET} - DEPENDS "${_outpath}" + DEPENDS "${_outpath}" ) add_dependencies(${TARGET} extract_interface) - add_dependencies(interface ${TARGET} ) + add_dependencies(interface ${TARGET}) + + set_property(GLOBAL + APPEND PROPERTY ISL_INTERFACES "${GENERATOR}" + ) endfunction() add_custom_target(interface ALL) From 5d67c81c7d87e2ce29cad986a72bbcc1172b2e5a Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Mon, 6 Apr 2026 13:51:16 +0200 Subject: [PATCH 19/21] Update README --- README | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/README b/README index 1ddf32064..e5e856e8a 100644 --- a/README +++ b/README @@ -1,21 +1,23 @@ -Integer Set Library (ISL) -branch with CMake build system -------------------------- +Integer Set Library (ISL) branch with CMake build system +-------------------------------------------------------- -The orignal project's website can be found at http://isl.gforge.inria.fr/ and +The orignal project's website can be found at https://libisl.sourceforge.io/ and its discussion takes place on the mailing list isl-development@googlegroups.com. +Web frontend: https://groups.google.com/g/isl-development + +For discussions about this branch please use the GitHub tools +(https://github.com/Meinersbur/isl), and the pull request tied to this branch: +https://github.com/Meinersbur/isl/pull/11 -For discussions about this branch please use the Github tools -(https://github.com/Meinersbur/isl) or contact the author (isl@meinersbur.de). This branch adds the files necessary to compile ISL using CMake. It is not a feature-complete replacement of the autotools build system, but has been created -for convinience in order to user builder such as Ninja or Visual Studio. The +for convenience in order to use builders such as Ninja or Visual Studio. The autotools-based build system remains in place. Original README -------------------------- +--------------- isl is a thread-safe C library for manipulating sets and relations of integer points bounded by affine constraints. The descriptions of the sets and relations may involve both parameters and existentially From 3d71c19fcad7888848316a8cc1483ed54b4b8ea1 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Mon, 6 Apr 2026 13:59:10 +0200 Subject: [PATCH 20/21] Update .gitignore --- .gitignore | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index e2331b667..23f9a6c1e 100644 --- a/.gitignore +++ b/.gitignore @@ -59,11 +59,6 @@ isl_srcdir.c bound_test.sh pip_test.sh -# Build artifacts -/isl_test_imath -/isl_test_int -/isl_codegen - # CMake generated files /CMakeCache.txt /CMakeFiles/ @@ -71,3 +66,31 @@ pip_test.sh /cmake_install.cmake /build.ninja /rules.ninja +/.ninja_deps +/.ninja_log + +# Configure-written files +*.tmp +/codegen_test.sh +/interface/cmake_install.cmake +/interface/include/isl-interface/config.h +/islConfig.cmake +/islConfigVersion.cmake + +# Build artifacts +/isl_test_imath +/isl_test_int +/isl_codegen +/isl_test2 +/interface/extract_interface + +# Generated bindings +# Some of them have been added to the repository, but we do not want to diverge +# from the upstream-provided version, so do not check them in. +# git update-index --assume-unchanged interface/cpp.h +# git update-index --assume-unchanged interface/python.h +/interface/cpp.h +/interface/python.h +/interface/cpp-checked-conversion.h +/interface/cpp-checked.h +/interface/typed_cpp.h From 8ea3dd8adf9d9bc13ad0423b27af0ab9167acb54 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Tue, 7 Apr 2026 00:47:52 +0200 Subject: [PATCH 21/21] Fix interface includes --- .gitignore | 11 ++--------- interface/CMakeLists.txt | 37 ++++++++++++++++++++++++++----------- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index 23f9a6c1e..081192dda 100644 --- a/.gitignore +++ b/.gitignore @@ -85,12 +85,5 @@ pip_test.sh /interface/extract_interface # Generated bindings -# Some of them have been added to the repository, but we do not want to diverge -# from the upstream-provided version, so do not check them in. -# git update-index --assume-unchanged interface/cpp.h -# git update-index --assume-unchanged interface/python.h -/interface/cpp.h -/interface/python.h -/interface/cpp-checked-conversion.h -/interface/cpp-checked.h -/interface/typed_cpp.h +# This is the only one not checked into the repository -- forgotten? +/include/isl/python.h diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 32a945fe6..b9c7f2420 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -8,10 +8,17 @@ add_executable(extract_interface template_cpp.cc ) -configure_file("../isl_config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/include/isl-interface/config.h") +# I think extract_interface is supposed to have its own header config.h separate from ${ISL_BINARY_DIR}/isl_config.h, but that seems to have been applied inconsistently +# These include paths are such as mess +configure_file("${ISL_SOURCE_DIR}/isl_config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/include/isl-interface/config.h") +target_include_directories(extract_interface PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/include" #include "isl-interface/clang_wrap.h" + "${CMAKE_CURRENT_BINARY_DIR}/include" #include + "${ISL_BINARY_DIR}" #include "isl_config.h" + "${ISL_SOURCE_DIR}" #include + ${CLANG_INCLUDE_DIRS} +) -target_include_directories(extract_interface PRIVATE "${ISL_SOURCE_DIR}" "${ISL_SOURCE_DIR}/include" "${ISL_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/include" ${LLVM_INCLUDE_DIRS} ${CLANG_INCLUDE_DIRS}) -target_include_directories(extract_interface PRIVATE "include/" "${ISL_BINARY_DIR}/include") if (MSVC) else () @@ -56,10 +63,17 @@ set_property(GLOBAL PROPERTY ISL_INTERFACES "" ) - +# Note that some header files have the same name: +# +# * ${CMAKE_CURRENT_SOURCE_DIR}/python.h used by extract_interface and the generated ${ISL_BINARY_DIR}/include/isl/python.h +# * ${CMAKE_CURRENT_SOURCE_DIR}/cpp.h used by extract_interface and the generated ${ISL_BINARY_DIR}/include/isl/cpp.h +# +# Totally not confusing! function(gen_interface TARGET GENERATOR OUTFILE) cmake_parse_arguments(ARG "" "" "PREPEND;APPEND" ${ARGN}) - cmake_path(APPEND "${ISL_BINARY_DIR}/include/isl/" "${OUTFILE}" OUTPUT_VARIABLE _outpath) + + cmake_path(SET _outpath "${ISL_BINARY_DIR}/include/isl/") + cmake_path(APPEND _outpath "${OUTFILE}") set(_more) foreach (_prepend IN LISTS ARG_PREPEND) @@ -70,7 +84,7 @@ function(gen_interface TARGET GENERATOR OUTFILE) endforeach () add_custom_command( OUTPUT "${_outpath}" - COMMAND "${Python_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/redirect_to_file.py" "${_outpath}" ${_more} $ --language=${GENERATOR} "-I${ISL_BINARY_DIR}/include" "-I${ISL_SOURCE_DIR}/include" "${ISL_SOURCE_DIR}/all.h" + COMMAND "${Python_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/redirect_to_file.py" "${_outpath}" ${_more} "$" --language=${GENERATOR} "-I${ISL_BINARY_DIR}/include" "-I${ISL_SOURCE_DIR}/include" "${ISL_SOURCE_DIR}/all.h" DEPENDS redirect_to_file.py IMPLICIT_DEPENDS "${ISL_SOURCE_DIR}/all.h" ) @@ -86,10 +100,11 @@ function(gen_interface TARGET GENERATOR OUTFILE) ) endfunction() + add_custom_target(interface ALL) -gen_interface(interface-python python python.h) -gen_interface(interface-cpp cpp cpp.h PREPEND "${ISL_SOURCE_DIR}/cpp/cpp.h.top" "${ISL_SOURCE_DIR}/all.h" APPEND "${ISL_SOURCE_DIR}/cpp/cpp.h.bot") -gen_interface(interface-cpp-checked cpp-checked cpp-checked.h PREPEND "${ISL_SOURCE_DIR}/cpp/cpp-checked.h.top" "${ISL_SOURCE_DIR}/all.h" APPEND "${ISL_SOURCE_DIR}/cpp/cpp-checked.h.bot") -gen_interface(interface-cpp-checked-conversion cpp-checked-conversion cpp-checked-conversion.h PREPEND "${ISL_SOURCE_DIR}/cpp/cpp-checked-conversion.h.top" APPEND "${ISL_SOURCE_DIR}/cpp/cpp-checked-conversion.h.bot") -gen_interface(interface-template-cpp template-cpp typed_cpp.h PREPEND "${ISL_SOURCE_DIR}/cpp/typed_cpp.h.top" APPEND "${ISL_SOURCE_DIR}/cpp/typed_cpp.h.bot") +gen_interface(interface-python python "python.h") +gen_interface(interface-cpp cpp "cpp.h" PREPEND "${ISL_SOURCE_DIR}/cpp/cpp.h.top" "${ISL_SOURCE_DIR}/all.h" APPEND "${ISL_SOURCE_DIR}/cpp/cpp.h.bot") +gen_interface(interface-cpp-checked cpp-checked "cpp-checked.h" PREPEND "${ISL_SOURCE_DIR}/cpp/cpp-checked.h.top" "${ISL_SOURCE_DIR}/all.h" APPEND "${ISL_SOURCE_DIR}/cpp/cpp-checked.h.bot") +gen_interface(interface-cpp-checked-conversion cpp-checked-conversion "cpp-checked-conversion.h" PREPEND "${ISL_SOURCE_DIR}/cpp/cpp-checked-conversion.h.top" APPEND "${ISL_SOURCE_DIR}/cpp/cpp-checked-conversion.h.bot") +gen_interface(interface-template-cpp template-cpp "typed_cpp.h" PREPEND "${ISL_SOURCE_DIR}/cpp/typed_cpp.h.top" APPEND "${ISL_SOURCE_DIR}/cpp/typed_cpp.h.bot")