Skip to content
Commits on Source (2)
BasedOnStyle: Google
BreakBeforeBraces: Mozilla
AllowShortLoopsOnASingleLine: false
AccessModifierOffset: -4
BreakConstructorInitializersBeforeComma: true
ColumnLimit: 100
IndentWidth: 4
PointerAlignment: Left
TabWidth: 4
ReflowComments: false # protect ASCII art in comments
KeepEmptyLinesAtTheStartOfBlocks: true
......@@ -76,3 +76,7 @@ CMakeLists.txt.user
bin
build
lib
# Meson WrapDB stuff
subprojects/packagecache/
subprojects/googletest*
......@@ -3,9 +3,25 @@
## Active
### TODO
- Interface groups
- Initial sequence-related data structures
## [0.3.0] - 2018-04-30
### Changed
- Minor ToolContract::Config API change.
## [0.2.0] - 2017-12-03
### Added
- WorkQueue for parallel execution
## [0.1.1] - 2017-09-26
### Changed
- UNUSED macro to no-op method
## [0.1.0] - 2017-01-13
### Added
- Encapsulate project version and git sha1
- RSMovieName & RSReadName: Sequel and RSII movie names are composed of
......@@ -13,6 +29,10 @@ different data, and thus need to be handled separately. MovieName & ReadName
handle Sequel-style data as the default.
- GoogleTest/GoogleMock in third-party/googletest
- Access to input command line from PacBio::CLI::Results
- QGramIndex & seed results
- Added support for new tool contract data model: option choices & modified JSON
format.
- Added basic option groups to CLI::Interface.
## [0.0.1] - 2016-06-22
......@@ -29,21 +49,21 @@ handle Sequel-style data as the default.
- MovieName - query parts of a PacBio movie name
- ReadName - query parts of a PacBio read name
- **PacBio::JSON** : JSON support
- Json - wrapper around nlohmann::json
- Json - wrapper around nlohmann::json
- **PacBio::Logging** : logging utilities
- Logger, LogMessage, etc - basic logging (same as pbccs)
- **PacBio::Stream** : functional-programming-like data streaming
- data Source, Sink, & Transform typedefs
- instantiated with client-defined 'callables' (lambdas, free functions,
static public member functions)
- connected via operator >>
- connected via operator >>
- **PacBio::Utility** : miscellaneous utilities
- CallbackTimer - schedule periodic callback invokation (or delayed
single-shot)
- EnumClassHash - allows enums/enum classes to be used as STL hash keys
- Stopwatch - timer for benchmarking, logging, etc
- StringUtils - string dicing & splicing utilities
- SystemInfo - currently provides endianness
- SystemInfo - currently provides endianness
- Examples
- cli_demo - playground for testing the command line interface
- Tests
......
......@@ -2,9 +2,9 @@
# CMake build script for PacBio pbcopper library.
########################################################################
cmake_policy(SET CMP0048 NEW) # lets us set version in project()
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.2)
project(pbcopper VERSION 0.0.1 LANGUAGES CXX C)
project(pbcopper VERSION 0.4.0 LANGUAGES CXX C)
enable_testing()
# project options
......@@ -40,8 +40,12 @@ include(pbcopper-libtype)
include(pbcopper-gitsha1)
find_git_sha1(COPPER_GIT_SHA1)
configure_file(
${pbcopper_IncludeDir}/pbcopper/utility/Version.h.in
${CMAKE_BINARY_DIR}/generated/pbcopper/utility/Version.h
${pbcopper_SourceDir}/utility/PbcopperGitHash.cpp.in
${CMAKE_BINARY_DIR}/generated/utility/PbcopperGitHash.cpp
)
configure_file(
${pbcopper_SourceDir}/utility/PbcopperVersion.cpp.in
${CMAKE_BINARY_DIR}/generated/utility/PbcopperVersion.cpp
)
# main library
......
Copyright (c) 2016, Pacific Biosciences of California, Inc.
Copyright (c) 2016-2018, Pacific Biosciences of California, Inc.
All rights reserved.
......
# pbcopper [![CircleCI](https://circleci.com/gh/PacificBiosciences/pbcopper.svg?style=svg&circle-token=4fe4468113a44b8b76019c901f1b6930ef26944b)](https://circleci.com/gh/PacificBiosciences/pbcopper)
The **pbcopper** library provides a suite of data structures, algorithms, and utilities
for C++ applications.
The **pbcopper** library provides a suite of data structures, algorithms, and utilities
for C++ applications.
## Getting Started
......@@ -13,7 +13,7 @@ mkdir build && cd build
cmake ..
make
```
To build & run tests:
```sh
......@@ -32,7 +32,7 @@ To build Doxygen API documentation: (**not yet available**)
make docs
```
## API Overview - main modules
## API Overview - main modules
- **PacBio::CLI** : command-line parsing & tool-contract integration
- CLI - entry-point methods for parsing args & invoking application callback
......@@ -44,19 +44,19 @@ make docs
- MovieName - query parts of a PacBio movie name
- ReadName - query parts of a PacBio read name
- **PacBio::JSON** : JSON support
- Json - wrapper around [nlohmann::json](https://github.com/nlohmann/json)
- Json - wrapper around [nlohmann::json](https://github.com/nlohmann/json)
- **PacBio::Logging** : logging utilities
- Logger, LogMessage, etc - basic logging (same as pbccs)
- **PacBio::Stream** : functional-programming-like data streaming
- data Source, Sink, & Transform typedefs
- instantiated with client-defined 'callables' (lambdas, free functions, static public member functions)
- connected via operator >>
- connected via operator >>
- **PacBio::Utility** : miscellaneous utilities
- CallbackTimer - schedule periodic callback invokation (or delayed single-shot)
- EnumClassHash - allows enums/enum classes to be used as STL hash keys
- Stopwatch - timer for benchmarking, logging, etc
- StringUtils - string dicing & splicing utilities
- SystemInfo - currently provides endianness
- SystemInfo - currently provides endianness
## Documentation
......@@ -66,3 +66,7 @@ make docs
## License
- [PacBio open source license](https://github.com/PacificBiosciences/pbcopper/blob/master/LICENSE.txt)
DISCLAIMER
----------
THIS WEBSITE AND CONTENT AND ALL SITE-RELATED SERVICES, INCLUDING ANY DATA, ARE PROVIDED "AS IS," WITH ALL FAULTS, WITH NO REPRESENTATIONS OR WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTIES OF MERCHANTABILITY, SATISFACTORY QUALITY, NON-INFRINGEMENT OR FITNESS FOR A PARTICULAR PURPOSE. YOU ASSUME TOTAL RESPONSIBILITY AND RISK FOR YOUR USE OF THIS SITE, ALL SITE-RELATED SERVICES, AND ANY THIRD PARTY WEBSITES OR APPLICATIONS. NO ORAL OR WRITTEN INFORMATION OR ADVICE SHALL CREATE A WARRANTY OF ANY KIND. ANY REFERENCES TO SPECIFIC PRODUCTS OR SERVICES ON THE WEBSITES DO NOT CONSTITUTE OR IMPLY A RECOMMENDATION OR ENDORSEMENT BY PACIFIC BIOSCIENCES.
#!/usr/bin/env bash
set -vex
################
# DEPENDENCIES #
################
## Load modules
type module >& /dev/null || . /mnt/software/Modules/current/init/bash
module purge
module load meson
module load ninja
module load boost
module load doxygen
BOOST_ROOT="${BOOST_ROOT%/include}"
# unset these variables to have meson discover all
# boost-dependent variables from BOOST_ROOT alone
unset BOOST_INCLUDEDIR
unset BOOST_LIBRARYDIR
export CC="ccache gcc"
export CXX="ccache g++"
export CCACHE_BASEDIR="${PWD}"
if [[ $USER == bamboo ]]; then
export CCACHE_DIR=/mnt/secondary/Share/tmp/bamboo.${bamboo_shortPlanKey}.ccachedir
export CCACHE_TEMPDIR=/scratch/bamboo.ccache_tempdir
fi
case "${bamboo_planRepository_branchName}" in
develop|master)
export PREFIX_ARG="/mnt/software/p/pbcopper/${bamboo_planRepository_branchName}"
export BUILD_NUMBER="${bamboo_globalBuildNumber:-0}"
;;
*)
export BUILD_NUMBER="0"
;;
esac
# in order to make shared libraries consumable
# by conda and other package managers
export LDFLAGS="-static-libstdc++ -static-libgcc"
for i in "system-gcc" "gcc/8.1.0" "gcc"; do
# 1. load either current MOBS GCC or RHEL-default GCC
if [[ ${i} == system-gcc ]]; then
module load gtest/gcc48
else
module load ${i} gtest
fi
module load ccache
export CURRENT_BUILD_DIR="build_gcc=${i/\//_}"
export ENABLED_TESTS="true"
bash scripts/ci/build.sh
bash scripts/ci/test.sh
module unload ccache gtest
[[ ${i} != system-gcc ]] && module unload gcc
done
# create symlink so Bamboo can find the xunit output
ln -s "${CURRENT_BUILD_DIR}" build
if [[ -z ${PREFIX_ARG+x} ]]; then
echo "Not installing anything (branch: ${bamboo_planRepository_branchName}), exiting."
exit 0
fi
# reload GCC to prevent default `g++` from mis-linking
module load gcc
bash scripts/ci/install.sh
if [[ ${BUILD_NUMBER} == 0 ]]; then
echo "Build number is 0, hence not creating artifact"
exit 0
fi
## Creating artifact
# install into staging dir with --prefix /usr/local
# in order to sidestep all the artifact policy
rm -rf staging
meson configure -Dprefix=/usr/local -Dtests=false "${CURRENT_BUILD_DIR}"
DESTDIR="${PWD}/staging" ninja -C "${CURRENT_BUILD_DIR}" -v install
( cd staging && tar zcf ../pbcopper-SNAPSHOT.tgz . )
md5sum pbcopper-SNAPSHOT.tgz | awk -e '{print $1}' >| pbcopper-SNAPSHOT.tgz.md5
sha1sum pbcopper-SNAPSHOT.tgz | awk -e '{print $1}' >| pbcopper-SNAPSHOT.tgz.sha1
UNSUPPORTED_URL=http://ossnexus.pacificbiosciences.com/repository/unsupported
curl -vn --upload-file pbcopper-SNAPSHOT.tgz $UNSUPPORTED_URL/gcc-6.4.0/pbcopper-SNAPSHOT.tgz
curl -vn --upload-file pbcopper-SNAPSHOT.tgz.md5 $UNSUPPORTED_URL/gcc-6.4.0/pbcopper-SNAPSHOT.tgz.md5
curl -vn --upload-file pbcopper-SNAPSHOT.tgz.sha1 $UNSUPPORTED_URL/gcc-6.4.0/pbcopper-SNAPSHOT.tgz.sha1
#!/usr/bin/env bash
set -vex
## Load modules
type module >& /dev/null || . /mnt/software/Modules/current/init/bash
module purge
module load gcc
module load ccache
module load meson
module load ninja
module load boost
module load doxygen
module load gcov
module load gtest
#####################
# BUILD & RUN TESTS #
#####################
rm -rf build
mkdir build
cd build
meson \
--werror \
--backend ninja \
--buildtype debug \
--default-library shared \
--libdir lib \
--wrap-mode nofallback \
--prefix "${PREFIX_ARG:-/usr/local}" \
-Db_coverage=true \
..
ninja test
############
# COVERAGE #
############
find . -type f -iname '*.o' | xargs gcov -acbrfu {} \; >/dev/null && \
mkdir coverage && pushd coverage && mv ../*.gcov . && \
sed -i -e 's@Source:@Source:../@' *.gcov && \
sed -i -e 's@Graph:@Graph:../@' *.gcov && \
sed -i -e 's@Data:@Data:../@' *.gcov
#!/usr/bin/env bash
echo "################"
echo "# DEPENDENCIES #"
echo "################"
echo "## Load modules"
source /mnt/software/Modules/current/init/bash
module load gcc meson ccache ninja gtest
if [[ $USER == "bamboo" ]]; then
export CCACHE_DIR=/mnt/secondary/Share/tmp/bamboo.mobs.ccachedir
export CCACHE_TEMPDIR=/scratch/bamboo.ccache_tempdir
fi
export CCACHE_COMPILERCHECK='%compiler% -dumpversion'
export CCACHE_BASEDIR=$PWD
echo "#########"
echo "# TESTS #"
echo "#########"
echo "## Unit tests"
ninja -C build test
......@@ -3,7 +3,8 @@
echo "# DEPENDENCIES"
echo "## Load modules"
source /mnt/software/Modules/current/init/bash
module load gcc/5.3.0 cmake ccache ninja boost doxygen
module load gcc cmake ccache ninja boost doxygen
export CC=gcc CXX=g++
echo "# BUILD"
echo "## Create build directory "
......@@ -18,4 +19,4 @@ echo "## Build source"
echo "# TEST"
echo "# Run unit tests"
( cd build && ninja check-xunit )
\ No newline at end of file
( cd build && ninja check-xunit )
machine:
pre:
pre:
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20
......
include(CheckCXXCompilerFlag)
# shared CXX flags for all source code & tests
if (MSVC)
set(pbcopper_CXX_FLAGS "/Wall")
else()
set(pbcopper_CXX_FLAGS "-std=c++11 -Wall")
endif()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# NOTE: quash clang warnings w/ Boost
check_cxx_compiler_flag("-Wno-unused-local-typedefs" HAS_NO_UNUSED_LOCAL_TYPEDEFS)
......
error('pbcopper doesn\'t support Doxygen yet')
......@@ -4,17 +4,16 @@
#include <string>
using namespace PacBio;
using namespace PacBio::CLI;
using namespace std;
struct MyAppSettings {
bool progress;
bool force;
bool verbose;
string tempDir;
std::string tempDir;
int timeout;
string source;
string dest;
vector<string> extras;
std::string source;
std::string dest;
std::vector<std::string> extras;
};
static inline
......@@ -23,20 +22,20 @@ int RunMain(const MyAppSettings& s)
// this is where your normal app would take its settings and start rocking
// here, we just print out what we received from the CL
cout << "--------------------" << endl
<< "App Settings: " << endl
<< "--------------------" << endl
<< "progress? " << (s.progress ? "on" : "off") << endl
<< "force? " << (s.force ? "on" : "off") << endl
<< "verbose? " << (s.verbose ? "on" : "off") << endl
<< "tempDir: " << s.tempDir << endl
<< "timeout: " << s.timeout << endl
<< "source: " << s.source << endl
<< "dest: " << s.dest << endl
std::cout << "--------------------\n"
<< "App Settings: \n"
<< "--------------------\n"
<< "progress? " << (s.progress ? "on" : "off") << '\n'
<< "force? " << (s.force ? "on" : "off") << '\n'
<< "verbose? " << (s.verbose ? "on" : "off") << '\n'
<< "tempDir: " << s.tempDir << '\n'
<< "timeout: " << s.timeout << '\n'
<< "source: " << s.source << '\n'
<< "dest: " << s.dest << '\n'
<< "extras: ";
for (const auto& extra : s.extras )
cout << extra << ", ";
cout << endl;
std::cout << extra << ", ";
std::cout << '\n';
return EXIT_SUCCESS;
}
......@@ -85,7 +84,7 @@ int argRunner(const PacBio::CLI::Results& args)
const auto positionalArgs = args.PositionalArguments();
if (positionalArgs.size() < 2) {
cerr << "ERROR: source & dest args are required" << endl;
std::cerr << "ERROR: source & dest args are required\n";
PacBio::CLI::PrintHelp(args.ApplicationInterface(), std::cout);
return EXIT_FAILURE;
}
......
executable(
'cli_demo',
files('main.cpp'),
install : false,
include_directories : pbcopper_include_directories,
link_with : pbcopper_lib,
dependencies : pbcopper_thread_dep)
subdir('cli_demo')
###########
# headers #
###########
if not meson.is_subproject()
# pbcopper
install_headers(
files([
'pbcopper/PbcopperConfig.h',
'pbcopper/PbcopperMakeUnique.h']),
subdir : 'pbcopper')
# pbcopper/align
install_headers(
files([
'pbcopper/align/Seed.h',
'pbcopper/align/Seeds.h']),
subdir : 'pbcopper/align')
# pbcopper/align/internal
install_headers(
files([
'pbcopper/align/internal/Seed-inl.h',
'pbcopper/align/internal/Seeds-inl.h']),
subdir : 'pbcopper/align/internal')
# pbcopper/cli
install_headers(
files([
'pbcopper/cli/CLI.h',
'pbcopper/cli/HelpPrinter.h',
'pbcopper/cli/Interface.h',
'pbcopper/cli/Option.h',
'pbcopper/cli/OptionFlags.h',
'pbcopper/cli/Parser.h',
'pbcopper/cli/PositionalArg.h',
'pbcopper/cli/Results.h',
'pbcopper/cli/SingleDashMode.h',
'pbcopper/cli/VersionPrinter.h']),
subdir : 'pbcopper/cli')
# pbcopper/cli/internal
install_headers(
files([
'pbcopper/cli/internal/Option-inl.h']),
subdir : 'pbcopper/cli/internal')
# pbcopper/cli/toolcontract
install_headers(
files([
'pbcopper/cli/toolcontract/Config.h',
'pbcopper/cli/toolcontract/Driver.h',
'pbcopper/cli/toolcontract/InputFileType.h',
'pbcopper/cli/toolcontract/JsonPrinter.h',
'pbcopper/cli/toolcontract/OutputFileType.h',
'pbcopper/cli/toolcontract/ResolvedToolContract.h',
'pbcopper/cli/toolcontract/ResourceType.h',
'pbcopper/cli/toolcontract/Task.h',
'pbcopper/cli/toolcontract/TaskType.h']),
subdir : 'pbcopper/cli/toolcontract')
# pbcopper/cli/toolcontract/internal
install_headers(
files([
'pbcopper/cli/toolcontract/internal/Driver-inl.h',
'pbcopper/cli/toolcontract/internal/InputFileType-inl.h',
'pbcopper/cli/toolcontract/internal/OutputFileType-inl.h',
'pbcopper/cli/toolcontract/internal/Task-inl.h']),
subdir : 'pbcopper/cli/toolcontract/internal')
# pbcopper/data
install_headers(
files([
'pbcopper/data/CCSTag.h',
'pbcopper/data/Cigar.h',
'pbcopper/data/CigarOperation.h',
'pbcopper/data/Interval.h',
'pbcopper/data/MovieName.h',
'pbcopper/data/Position.h',
'pbcopper/data/ReadName.h',
'pbcopper/data/RSMovieName.h',
'pbcopper/data/RSReadName.h',
'pbcopper/data/Zmw.h']),
subdir : 'pbcopper/data')
# pbcopper/data/internal
install_headers(
files([
'pbcopper/data/internal/CigarOperation-inl.h',
'pbcopper/data/internal/Interval-inl.h',
'pbcopper/data/internal/MovieName-inl.h',
'pbcopper/data/internal/ReadNameBase-inl.h',
'pbcopper/data/internal/ReadNameBase.h',
'pbcopper/data/internal/RSMovieName-inl.h']),
subdir : 'pbcopper/data/internal')
# pbcopper/json
install_headers(
files([
'pbcopper/json/JSON.h']),
subdir : 'pbcopper/json')
# pbcopper/json/internal
install_headers(
files([
'pbcopper/json/internal/json.hpp']),
subdir : 'pbcopper/json/internal')
# pbcopper/logging
install_headers(
files([
'pbcopper/logging/Logging.h']),
subdir : 'pbcopper/logging')
# pbcopper/logging/internal
install_headers(
files([
'pbcopper/logging/internal/Logging-inl.h']),
subdir : 'pbcopper/logging/internal')
# pbcopper/parallel
install_headers(
files([
'pbcopper/parallel/FireAndForget.h',
'pbcopper/parallel/WorkQueue.h']),
subdir : 'pbcopper/parallel')
# pbcopper/qgram
install_headers(
files([
'pbcopper/qgram/Index.h',
'pbcopper/qgram/IndexHit.h',
'pbcopper/qgram/IndexHits.h']),
subdir : 'pbcopper/qgram')
# pbcopper/qgram/internal
install_headers(
files([
'pbcopper/qgram/internal/Hashing-inl.h',
'pbcopper/qgram/internal/Index-inl.h']),
subdir : 'pbcopper/qgram/internal')
# pbcopper/stream
install_headers(
files([
'pbcopper/stream/Stream.h']),
subdir : 'pbcopper/stream')
# pbcopper/utility
install_headers(
files([
'pbcopper/utility/CallbackTimer.h',
'pbcopper/utility/EnumClassHash.h',
'pbcopper/utility/FileUtils.h',
'pbcopper/utility/MoveAppend.h',
'pbcopper/utility/PbcopperVersion.h',
'pbcopper/utility/SafeSubtract.h',
'pbcopper/utility/Stopwatch.h',
'pbcopper/utility/StringUtils.h',
'pbcopper/utility/SystemInfo.h',
'pbcopper/utility/Unused.h']),
subdir : 'pbcopper/utility')
# pbcopper/utility/internal
install_headers(
files([
'pbcopper/utility/internal/CallbackTimer-inl.h',
'pbcopper/utility/internal/FileUtils-inl.h',
'pbcopper/utility/internal/Stopwatch-inl.h',
'pbcopper/utility/internal/StringUtils-inl.h',
'pbcopper/utility/internal/SystemInfo-inl.h']),
subdir : 'pbcopper/utility/internal')
endif
pbcopper_include_directories = include_directories('.')
#ifndef PBCOPPER_CONFIG_H
#define PBCOPPER_CONFIG_H
#include <cstddef>
#include <cstdint>
#define UNUSED(x) (void)x
namespace PacBio {
///// \internal
//enum class Initialization
//{
// Uninitialized
//};
///// \internal
//static constexpr Initialization Uninitialized = Initialization::Uninitialized;
} // namespace PacBio
#endif // PBCOPPER_CONFIG_H
// Author: David Seifert, Derek Barnett
// Reduce the number of exposed symbols in order to speed up
// DSO load times
// https://gcc.gnu.org/wiki/Visibility
#ifndef PBCOPPER_PBCOPPERCONFIG_H
#define PBCOPPER_PBCOPPERCONFIG_H
// clang-format off
#if defined _WIN32 || defined __CYGWIN__
# ifdef PBCOPPER_BUILDING_LIBRARY
# ifdef __GNUC__
# define PBCOPPER_PUBLIC_API __attribute__((dllexport))
# else
# define PBCOPPER_PUBLIC_API __declspec(dllexport) // Note: gcc seems to also supports this syntax
# endif
# else
# ifdef __GNUC__
# define PBCOPPER_PUBLIC_API __attribute__((dllimport))
# else
# define PBCOPPER_PUBLIC_API __declspec(dllimport) // Note: gcc seems to also supports this syntax
# endif
# endif
# define PBCOPPER_PRIVATE_API
#else
# if __GNUC__ >= 4
# define PBCOPPER_PUBLIC_API __attribute__((visibility("default")))
# define PBCOPPER_PRIVATE_API __attribute__((visibility("hidden")))
# else
# define PBCOPPER_PUBLIC_API
# define PBCOPPER_PRIVATE_API
# endif
#endif
// clang-format on
#endif // PBCOPPER_PBCOPPERCONFIG_H
// File Description
//
// Author: Derek Barnett, David Seifert
// Yes, this include guard needs to be called
// "PBBAM_MAKE_UNIQUE_H", in order to prevent
// clashes with the same wrapper in pbbam
#ifndef PBBAM_MAKE_UNIQUE_H
#define PBBAM_MAKE_UNIQUE_H
// Only include if in pre-C++14 mode
//
#if __cplusplus < 201402L
#include <cstddef>
#include <memory>
namespace std {
template <typename T, typename... Args>
inline std::unique_ptr<T> make_unique(Args&&... args)
{
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
} // namespace std
#endif // < C++14
#endif // PBBAM_MAKE_UNIQUE_H