Skip to content

Commit

Permalink
Merge pull request #1059 from sstsimulator/devel
Browse files Browse the repository at this point in the history
Automatically Merged using SST Master Branch Merger
  • Loading branch information
sst-autotester committed Mar 13, 2024
2 parents 6bc0ceb + 08e1a33 commit d7ccb4b
Show file tree
Hide file tree
Showing 11 changed files with 159 additions and 37 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: ci

# yamllint disable-line rule:truthy
on:
push:
pull_request:

concurrency:
group: ci-${{github.ref}}-${{github.event.pull_request.number || github.run_number}}
cancel-in-progress: true

jobs:
prechecks:
uses: ./.github/workflows/pre-commit.yml
all-prechecks:
needs: [prechecks]
runs-on: ubuntu-latest
steps:
- name: Success
run: "true"
18 changes: 18 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: pre-commit

# yamllint disable-line rule:truthy
on:
workflow_call:

concurrency:
group: style-${{github.ref}}-${{github.event.pull_request.number || github.run_number}}
cancel-in-progress: true

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: pre-commit/[email protected]
37 changes: 37 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
fail_fast: false
repos:
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.5.0"
hooks:
- id: check-case-conflict
- id: check-merge-conflict
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: "v0.6.13"
hooks:
- id: cmake-format
args: [--config-files, experimental/.cmake-format.yaml]
additional_dependencies:
- pyyaml
- id: cmake-lint
additional_dependencies:
- pyyaml
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: "v12.0.1"
hooks:
- id: clang-format
types_or: [c++, c]
exclude: |
(?x)(
build/|
src/sst/core/libltdl/|
external/
)
- repo: https://github.com/Mateusz-Grzelinski/actionlint-py
rev: "v1.6.26.11"
hooks:
- id: actionlint
79 changes: 47 additions & 32 deletions config/sst_check_curses.m4
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,58 @@ AC_DEFUN([SST_CHECK_CURSES],
sst_check_curses_happy="yes"
AC_ARG_WITH([curses],
[AS_HELP_STRING([--with-ncurses@<:@=DIR@:>@],
[Use ncurses library found in DIR])])
[AS_HELP_STRING([--with-ncurses@<:@=DIR or EXEC@:>@],
[Use ncurses library found in DIR or associated with the ncursesN-config utility specified by EXEC])])
AS_IF([test "$with_curses" = "no"], [sst_check_curses_happy="no"])
CPPFLAGS_saved="$CPPFLAGS"
LDFLAGS_saved="$LDFLAGS"
dnl Use user-defined curses library
AS_IF([test "$sst_check_curses_happy" = "yes"], [
AS_IF([test ! -z "$with_curses" -a "$with_curses" != "yes"],
[CURSES_CPPFLAGS="-I$with_curses/include"
CPPFLAGS="$CURSES_CPPFLAGS $CPPFLAGS"
CURSES_LDFLAGS="-L$with_curses/lib"
CURSES_LIBS="-lncurses",
LDFLAGS="$CURSES_LDFLAGS $LDFLAGS"],
[CURSES_CPPFLAGS=
CURSES_CPPFLAGS_LDFLAGS=
CURSES_LIBS=])])
dnl Check for curses.h header
AC_LANG_PUSH([C++])
AC_CHECK_HEADER([curses.h], [], [sst_check_curses_happy="no"])
AC_LANG_POP([C++])
dnl Check that library is usable
AS_IF([test "$sst_check_curses_happy" != "no"],
[AC_CHECK_LIB([ncursesw], [wprintw], [CURSES_LIBS="-lncursesw"],
[AC_CHECK_LIB([ncurses], [wprintw], [CURSES_LIBS="-lncurses"],
[AC_CHECK_LIB([curses], [wprintw], [CURSES_LIBS="-lcurses"], [sst_check_curses_happy = "no"])])])
])
CPPFLAGS="$CPPFLAGS_saved"
LDFLAGS="$LDFLAGS_saved"
NCURSES_CONFIG_EXE="no"
dnl check if user provided a specific ncursesN-config
AS_IF([test ! -d "$with_curses"],
[AS_IF([test -x "$with_curses"],
[NCURSES_CONFIG_EXE=$with_curses])])
dnl test ncursesN-config
AS_IF([test $NCURSES_CONFIG_EXE = "no"],
[AS_IF([test -n "$with_curses"],
[AC_PATH_PROGS([NCURSES_CONFIG_EXE], ["ncurses6-config" "ncurses5.4-config" "ncurses5-config"], ["no"], ["$with_curses/bin"])],
[AC_PATH_PROGS([NCURSES_CONFIG_EXE], ["ncurses6-config" "ncurses5.4-config" "ncurses5-config"], ["no"])])])
dnl don't continue if ncursesN-config can't be found rather than look for the
dnl specific libraries
AS_IF([test $NCURSES_CONFIG_EXE = "no"],
[
CURSES_CPPFLAGS=
CURSES_LIBS=
sst_check_curses_happy="no"
],
[
dnl Older versions only have --libs, not --libs-only-l and --libs-only-L,
dnl which combines the two. Ideally, CURSES_LDFLAGS (sstinfo_x_LDFLAGS)
dnl contains --libs-only-L and CURSES_LIBS (sstinfo_x_LDADD) contains
dnl --libs-only-l, but rather than complicated logic testing the above,
dnl combining everything into LDADD seems acceptable..
CURSES_CPPFLAGS=`$NCURSES_CONFIG_EXE --cflags`
CURSES_LIBS=`$NCURSES_CONFIG_EXE --libs`
CPPFLAGS_saved="$CPPFLAGS"
LDFLAGS_saved="$LDFLAGS"
CPPFLAGS="$CPPFLAGS $CURSES_CPPFLAGS"
LDFLAGS="$LDFLAGS $CURSES_LIBS"
dnl Check for specific header
AC_LANG_PUSH([C++])
AC_CHECK_HEADER([ncurses.h], [], [sst_check_curses_happy="no"])
AC_LANG_POP([C++])
CPPFLAGS="$CPPFLAGS_saved"
LDFLAGS="$LDFLAGS_saved"
]
)
AC_SUBST([CURSES_CPPFLAGS])
AC_SUBST([CURSES_LDFLAGS])
AC_SUBST([CURSES_LIBS])
AS_IF([test "x$sst_check_curses_happy" = "xyes"], [AC_DEFINE([HAVE_CURSES], [1], [Defines whether we have the curses library])])
AM_CONDITIONAL([USE_CURSES], [test "x$sst_check_curses_happy" = "xyes"])
Expand Down
6 changes: 3 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ SST_CHECK_MPI([], [AC_MSG_ERROR([Could not find MPI package])])
SST_CHECK_PYTHON([], [AC_MSG_ERROR([Could not find Python, this is required for SST to build])])
SST_CHECK_LIBZ([have_zlib="yes"],[have_zlib="no"],[AC_MSG_ERROR([zlib was requested but could not be found.])])
SST_CHECK_CURSES()
dnl AC_MSG_ERROR([Could not find curses, this is required for utility sst-info to build])])
SST_CHECK_BACKTRACE()
SST_CHECK_HDF5()
SST_CHECK_MEM_POOL()
Expand Down Expand Up @@ -228,6 +227,7 @@ echo "Configuration Information (Dependencies):"
echo ""

printf "%38s : %s (%s)\n" "Found Python" "$PYTHON_EXE" "$PYTHON_VERSION"

if test "x$sst_check_hdf5_happy" = "xyes" ; then
printf "%38s : Yes\n" "HDF5 Support"
else
Expand All @@ -240,9 +240,9 @@ else
fi

if test "x$sst_check_curses_happy" = "xyes" ; then
printf "%38s : Yes\n" "curses library"
printf "%38s : %s %s\n" "curses library" "$CURSES_LIBS"
else
printf "%38s : No\n" "curses library"
printf "%38s : Not found\n" "curses library"
fi

echo "-------------------------------------------------------"
13 changes: 13 additions & 0 deletions experimental/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,19 @@ if(NOT SST_DISABLE_ZLIB)
find_package(ZLIB)
endif()

option(SST_DISABLE_CURSES
"Use curses library (needed for interactive sst-info)" OFF)
if(NOT SST_DISABLE_CURSES)
# https://gitlab.kitware.com/cmake/cmake/-/issues/23236
set(CURSES_NEED_NCURSES 1)
find_package(Curses)
if(NOT CURSES_HAVE_NCURSES_H)
message(
FATAL_ERROR
"Curses was found, but the specific header <ncurses.h> was not")
endif()
endif()

option(SST_ENABLE_HDF5 "Use HDF5 library" OFF)
if(SST_ENABLE_HDF5)
find_package(HDF5 REQUIRED)
Expand Down
4 changes: 4 additions & 0 deletions experimental/cmake/sst.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ if(ZLIB_FOUND)
set(HAVE_LIBZ ON)
endif(ZLIB_FOUND)

if(CURSES_FOUND)
set(HAVE_CURSES ON)
endif(CURSES_FOUND)

check_include_file(execinfo.h HAVE_EXECINFO_H)
check_symbol_exists(backtrace "execinfo.h" HAVE_BACKTRACE)
check_include_file(mach/mach_time.h HAVE_MACH_MACH_TIME_H)
Expand Down
3 changes: 3 additions & 0 deletions experimental/cmake_configure_files/sst_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
/* Define to 1 if you have the <c_asm.h> header file. */
#cmakedefine HAVE_C_ASM_H 1

/* Defines whether we have the curses library */
#cmakedefine HAVE_CURSES 1

/* Define to 1 if you have the declaration of `cygwin_conv_path', and to 0 if
you don't. */
#cmakedefine HAVE_DECL_CYGWIN_CONV_PATH 1
Expand Down
7 changes: 7 additions & 0 deletions src/sst/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,13 @@ if(Threads_FOUND)
target_link_libraries(sstsim.x PRIVATE Threads::Threads)
endif()

if(CURSES_FOUND)
target_link_libraries(sstinfo.x PRIVATE ${CURSES_LIBRARIES})
# Before means no chance of interfering with a system curses if a
# user-provided one was specified.
target_include_directories(sstinfo.x BEFORE PRIVATE ${CURSES_INCLUDE_DIRS})
endif()

add_executable(sst bootsst.cc)
target_link_libraries(sst PRIVATE sst-boot-lib sst-env-lib sst-config-lib)

Expand Down
3 changes: 1 addition & 2 deletions src/sst/core/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,8 @@ sstinfo_x_LDADD += $(LIBZ_LIBS)
endif

if USE_CURSES
AM_CPPFLAGS += $(CURSES_CFPPLAGS)
AM_CPPFLAGS += $(CURSES_CPPFLAGS)
sstinfo_x_LDADD += $(CURSES_LIBS)
sstinfo_x_LDFLAGS += $(CURSES_LDFLAGS)
endif

if USE_HDF5
Expand Down
5 changes: 5 additions & 0 deletions src/sst/core/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
#include "sst/core/warnmacros.h"

DISABLE_WARN_DEPRECATED_REGISTER
// The Python header already defines this and should override one from the
// command line.
#ifdef _XOPEN_SOURCE
#undef _XOPEN_SOURCE
#endif
#include <Python.h>
REENABLE_WARNING

Expand Down

0 comments on commit d7ccb4b

Please sign in to comment.