-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Purge WAF cruft * Add hstio library * Ignore cmake * Add tables * Add libraries * applib * cvos * "lib" * One library, one mind * Futher consolidation * Install those libraries * Reorg wfc3 -- 2d is broken * It wants an ACS structure... Hmm. * Add stis * Fix wfc3 build * Remove left over Makefiles * Drop nested directories * Remove HAVE_OPENMP define. Pointless. * Modify INSTALL.md * Purge WAF. * Consolidate fft * Compile with -fPIC * Enable warnings * Move source around * Implement additional changes required to rebase cleanly * Just keep swimming * Move dofwsat to library * rpath: use $ORIGIN on linux * Integrate GitHub Actions * Linux * MacOS * Remove errant conflict marker from .gitignore * Update RT to use cmake * Adjust RPATH * Add missing dependencies * Add MacOS * Drop extra name prefix * Linux matters more * Added functionality to build system * autotools-like source distributions * version information retained in source distributions * git_version emits version to stdout * add WITH_CFITSIO to change path to CFITSIO * pkg-config is optional (but highly recommended) * Disable debug output * Install to the conda prefix * See if the tests influence the weird jenkins workflow * Task order might affect Jenkins workflow * Add wfc3 computelimit.c to source list * Fix DISTINFO and version.h creation * Consolidate required project metadata * Always check for git repository status * Fix bogus include * Improve checking to see if we are operating inside of a repository * Ignore CPack artifacts * Ignore more CPack artifacts * Add system architectdure to cpack output file name * Add copyright text to CPack installer * Strip whitespace * Fix unintentional RPATH mangling on Darwin * Apply fix for missing PATH_MAX on Darwin PATH_MAX moved from limits.h to sys/syslimits.h * Disable Apple Clang check until I can find a better way to handle it * Update installation instructions * Fix code blocks * Add conda section * Change rpath argument format * Update INSTALL.md
- Loading branch information
Showing
712 changed files
with
1,660 additions
and
2,105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
if [ ! -f CMakeCache.txt ]; then | ||
echo "Run cmake first" >&2 | ||
exit 1 | ||
fi | ||
|
||
read -r VERSION COMMIT BRANCH <<< $(<DISTINFO) | ||
|
||
prefix=hstcal-$VERSION | ||
srcdir=$1 | ||
blddir=$2 | ||
install -m 644 "$blddir"/DISTINFO "$srcdir" | ||
install -m 644 "$blddir"/version.h "$srcdir" | ||
|
||
pushd "$srcdir" | ||
git archive \ | ||
-v \ | ||
--format=tar.gz \ | ||
--output "$blddir/$prefix.tar.gz" \ | ||
--prefix="$prefix/" \ | ||
--add-file DISTINFO \ | ||
--add-file version.h \ | ||
HEAD . | ||
popd | ||
rm -f "$srcdir"/DISTINFO | ||
rm -f "$srcdir"/version.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#!/usr/bin/env bash | ||
vcfile="DISTINFO" | ||
hfile="version.h" | ||
srcdir="$1" | ||
blddir="$2" | ||
tempfile= | ||
|
||
if [ -z "$srcdir" ]; then | ||
echo "Source directory path required" >&2 | ||
exit 1 | ||
fi | ||
|
||
if [ ! -f "$srcdir/CMakeLists.txt" ]; then | ||
echo "Not a cmake source directory: $srcdir" >&2 | ||
exit 1 | ||
fi | ||
|
||
if [ -f "$srcdir/DISTINFO" ]; then | ||
vcfile="$srcdir/DISTINFO" | ||
fi | ||
|
||
if [ -f "$vcfile" ] && ! git status &>/dev/null ; then | ||
read -r VERSION COMMIT BRANCH <<< $(<${vcfile}) | ||
else | ||
if git --version &>/dev/null; then | ||
VERSION=$(git describe --first-parent --always --dirty --long --tags --abbrev=8) | ||
COMMIT=$(git rev-parse HEAD) | ||
BRANCH=$(git rev-parse --abbrev-ref HEAD) | ||
else | ||
echo "Git not found. Using default version values." >&2 | ||
fi | ||
fi | ||
|
||
if [ -z "$VERSION" ]; then | ||
VERSION="unknown" | ||
fi | ||
|
||
if [ -z "$COMMIT" ]; then | ||
COMMIT="unknown" | ||
fi | ||
|
||
if [ -z "$BRANCH" ]; then | ||
BRANCH="unknown" | ||
fi | ||
|
||
write_distinfo() { | ||
cat << EOF > "$1" | ||
$VERSION $COMMIT $BRANCH | ||
EOF | ||
} | ||
|
||
write_header() { | ||
cat << EOF > "$1" | ||
#ifndef HSTCAL_VERSION_H | ||
#define HSTCAL_VERSION_H | ||
#define VERSION "$VERSION" | ||
#define COMMIT "$COMMIT" | ||
#define BRANCH "$BRANCH" | ||
#endif // HSTCAL_VERSION_H | ||
EOF | ||
} | ||
|
||
if [ -f "$vcfile" ]; then | ||
tempfile=$(mktemp) | ||
|
||
write_distinfo "$tempfile" | ||
if ! diff "$vcfile" "$tempfile" >&2; then | ||
write_distinfo "$vcfile" | ||
write_header "$hfile" | ||
fi | ||
rm -f "$tempfile" | ||
else | ||
write_distinfo "$vcfile" | ||
write_header "$hfile" | ||
fi | ||
|
||
printf "$VERSION" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: CMake | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
env: | ||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | ||
BUILD_TYPE: Release | ||
INSTALL_PREFIX: /tmp/hstcal | ||
|
||
jobs: | ||
build_matrix: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
gcc: [12] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Linux dependencies | ||
if: matrix.os == 'ubuntu-latest' | ||
run: | | ||
sudo apt update | ||
sudo apt install -y libcfitsio-dev gfortran pkg-config | ||
- name: MacOS dependencies | ||
if: matrix.os == 'macos-latest' | ||
run: | | ||
brew update | ||
brew install gcc@${{ matrix.gcc }} cfitsio | ||
- name: Linux build | ||
if: matrix.os == 'ubuntu-latest' | ||
run: | | ||
mkdir -p build | ||
cd build | ||
cmake .. \ | ||
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ | ||
-DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_PREFIX }} | ||
make | ||
- name: MacOS build | ||
if: matrix.os == 'macos-latest' | ||
env: | ||
CC: gcc-${{ matrix.gcc }} | ||
CXX: g++-${{ matrix.gcc }} | ||
FC: gfortran-${{ matrix.gcc }} | ||
|
||
run: | | ||
mkdir -p build | ||
cd build | ||
cmake .. \ | ||
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ | ||
-DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_PREFIX }} | ||
make | ||
- name: Install | ||
run: | | ||
cd build | ||
make install | ||
- name: Test | ||
working-directory: ${{github.workspace}}/build | ||
# Execute tests defined by the CMake configuration. | ||
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | ||
run: ctest -C ${{env.BUILD_TYPE}} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,28 @@ | ||
DISTINFO | ||
version.h | ||
*.tar.* | ||
CMakeCache.txt | ||
CMakeFiles | ||
CMakeScripts | ||
CPackConfig.cmake | ||
CPackSourceConfig.cmake | ||
_CPack_Packages/ | ||
Testing | ||
Makefile | ||
cmake_install.cmake | ||
install_manifest.txt | ||
compile_commands.json | ||
CTestTestfile.cmake | ||
.lock-waf* | ||
.waf* | ||
bin.* | ||
*build | ||
build | ||
build.* | ||
Makefile | ||
__pycache__ | ||
.cache | ||
*.e | ||
*.a | ||
*.so | ||
hstcal-*.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
cmake_minimum_required(VERSION 3.11) | ||
project(hstcal) | ||
enable_language(C) | ||
set(CMAKE_C_STANDARD 99) | ||
|
||
option(ENABLE_WARNINGS "Enable compiler warnings" ON) | ||
option(ENABLE_OPENMP "Enable OpenMP" ON) | ||
set(WITH_CFITSIO "" CACHE STRING "Path to cfitsio (if empty pkg-config is used)") | ||
set(WITH_CFITSIO_CFLAGS "" CACHE STRING "CFITSIO compiler flags") | ||
set(WITH_CFITSIO_LDFLAGS "-lcfitsio" CACHE STRING "CFITSIO linker flags") | ||
|
||
|
||
# Use git to set package version | ||
# Caveat: unix-only | ||
execute_process( | ||
COMMAND ${CMAKE_SOURCE_DIR}/.ci/bin/git_version "${CMAKE_SOURCE_DIR}" | ||
OUTPUT_VARIABLE version | ||
) | ||
|
||
add_custom_target(distinfo ALL | ||
COMMAND ${CMAKE_COMMAND} -E time ${CMAKE_SOURCE_DIR}/.ci/bin/git_version "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" | ||
BYPRODUCTS | ||
"${CMAKE_CURRENT_BINARY_DIR}/version.h" | ||
"${CMAKE_CURRENT_BINARY_DIR}/DISTINFO" | ||
) | ||
|
||
# Hack to produce autotools-like distribution archives | ||
# Use: make dist | ||
# Caveat: unix-only | ||
add_custom_target(dist | ||
COMMAND ${CMAKE_COMMAND} -E time ${CMAKE_SOURCE_DIR}/.ci/bin/dist "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" | ||
BYPRODUCTS | ||
"${CMAKE_CURRENT_BINARY_DIR}/version.h" | ||
"${CMAKE_CURRENT_BINARY_DIR}/DISTINFO" | ||
) | ||
|
||
set(PROJECT_VERSION "${version}") | ||
|
||
include(CheckSymbolExists) | ||
check_symbol_exists(snprintf "stdio.h" HAVE_SNPRINTF) | ||
check_symbol_exists(strdup "string.h" HAVE_STRDUP) | ||
check_symbol_exists(INT_MAX "limits.h" HAVE_INT_MAX) | ||
check_symbol_exists(PATH_MAX "limits.h" HAVE_LIMITS__PATH_MAX) | ||
check_symbol_exists(PATH_MAX "sys/limits.h" HAVE_SYS_LIMITS__PATH_MAX) | ||
check_symbol_exists(PATH_MAX "sys/syslimits.h" HAVE_SYS_SYSLIMITS__PATH_MAX) | ||
|
||
configure_file(config.h.in config.h @ONLY) | ||
|
||
if(NOT HAVE_SNPRINTF OR NOT HAVE_STRDUP OR NOT HAVE_INT_MAX) | ||
message(FATAL_ERROR "Required symbol is missing!") | ||
endif() | ||
|
||
if(ENABLE_WARNINGS) | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra") | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Wall -Wextra") | ||
endif() | ||
|
||
# Initialize pkg-config whether it is used or not | ||
find_package(PkgConfig) | ||
|
||
# Figure out where cfitsio should come from | ||
if("${WITH_CFITSIO}" STREQUAL "") | ||
pkg_check_modules(cfitsio cfitsio REQUIRED) | ||
set(CMAKE_INSTALL_RPATH "${cfitsio_LIBRARY_DIRS}:${CMAKE_INSTALL_RPATH}") | ||
else() | ||
set(cfitsio_INCLUDE_DIRS "${WITH_CFITSIO}/include") | ||
set(cfitsio_LIBRARY_DIRS "${WITH_CFITSIO}/lib") | ||
set(cfitsio_CFLAGS_OTHER "-I${cfitsio_INCLUDE_DIRS} ${WITH_CFITSIO_CFLAGS}") | ||
set(cfitsio_LDFLAGS "-L${cfitsio_LIBRARY_DIRS} ${WITH_CFITSIO_LDFLAGS}") | ||
set(CMAKE_INSTALL_RPATH "${cfitsio_LIBRARY_DIRS}:${CMAKE_INSTALL_RPATH}") | ||
endif() | ||
|
||
# Keep things looking the way they used to | ||
set(CMAKE_EXECUTABLE_SUFFIX_C ".e") | ||
|
||
# Set up include directories | ||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/include) | ||
include_directories("${CMAKE_SOURCE_DIR}/include") | ||
include_directories("${CMAKE_CURRENT_BINARY_DIR}/include") | ||
include_directories("${CMAKE_CURRENT_BINARY_DIR}") | ||
|
||
# use, i.e. don't skip the full RPATH for the build tree | ||
set(CMAKE_SKIP_BUILD_RPATH FALSE) | ||
|
||
# when building, don't use the install RPATH already | ||
# (but later on when installing) | ||
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) | ||
|
||
# add the automatically determined parts of the RPATH | ||
# which point to directories outside the build tree to the install RPATH | ||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) | ||
|
||
# the RPATH to be used by installed binaries | ||
if(APPLE) | ||
set(CMAKE_MACOSX_RPATH 1) | ||
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib) | ||
else() | ||
set(CMAKE_INSTALL_RPATH $ORIGIN/../lib:${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_RPATH}) | ||
endif() | ||
|
||
|
||
set(CPACK_SOURCE_GENERATOR "TGZ") | ||
set(CPACK_PACKAGE_NAME ${PROJECT_NAME}) | ||
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) | ||
set(CPACK_PACKAGE_VENDOR "Association of Universities for Research in Astronomy (AURA)") | ||
set(CPACK_SYSTEM_NAME ${CMAKE_HOST_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}) | ||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt") | ||
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md") | ||
set(CPACK_SOURCE_IGNORE_FILES | ||
.git.* | ||
build/ | ||
".*~$" | ||
) | ||
set(CPACK_VERBATIM_VARIABLES YES) | ||
include(CPack) | ||
|
||
add_subdirectory(ctegen2) | ||
add_subdirectory(cvos) | ||
add_subdirectory(hstio) | ||
add_subdirectory(lib) | ||
add_subdirectory(tables) | ||
add_subdirectory(pkg) | ||
|
Oops, something went wrong.