Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
9da5c2e
src/amrfinder/allelicmeth.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
f40c7a6
src/amrfinder/amrfinder.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
1e18f25
src/amrfinder/amrtester.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
97b8165
src/analysis/autocorr.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
f45e454
src/analysis/bsrate.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
fc99436
src/analysis/cpgbins.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
d5024b9
src/analysis/hmr-rep.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
be30488
src/analysis/hmr.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
13389a8
src/analysis/hypermr.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
629c7c9
src/analysis/levels.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
50b79d0
src/analysis/metagene.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
36a87b7
src/analysis/methcounts.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
2f8877b
src/analysis/methentropy.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
c2fcf3a
src/analysis/methstates.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
556e65e
src/analysis/multimethstat.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
92ece4d
src/analysis/nanopore.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
66c2830
src/analysis/pmd.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
61abb5d
src/analysis/roimethstat.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
9c61cba
src/common/BetaBin.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
ec17833
src/common/BetaBin.hpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
b7f2dd9
src/common/EmissionDistribution.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
fc09428
src/common/EmissionDistribution.hpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
89784de
src/common/Epiread.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
cc0795b
src/common/Epiread.hpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
1f3644f
src/common/EpireadStats.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
9d32587
src/common/EpireadStats.hpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
c2af9dd
src/common/Interval.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
a7af157
src/common/Interval6.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
5aa4694
src/common/LevelsCounter.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
9dcd30d
src/common/LevelsCounter.hpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
17d0943
src/common/MSite.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
56bd937
src/common/MSite.hpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
826f54f
src/common/Smoothing.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
ddf5c1b
src/common/ThreeStateHMM.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
441fb53
src/common/ThreeStateHMM.hpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
47b1282
src/common/TwoStateHMM.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
805d67e
src/common/TwoStateHMM.hpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
d0ae17f
src/common/TwoStateHMM_PMD.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
35ceb8f
src/common/TwoStateHMM_PMD.hpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
83cb6fc
src/common/bam_record_utils.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
cf7f895
src/common/bam_record_utils.hpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
74273db
src/common/bsutils.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
3451810
src/common/bsutils.hpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
fd6fc8c
src/common/counts_header.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
4f251b2
src/common/counts_header.hpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
5d9f503
src/common/dnmt_error.hpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
d8c9097
src/common/dnmtools_gaussinv.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
df96788
src/common/dnmtools_utils.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
5b84b00
src/common/dnmtools_utils.hpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
116d6fe
src/common/numerical_utils.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
94752cb
src/common/numerical_utils.hpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
64b0b71
src/common/xcounts_utils.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
1aed78b
src/common/xcounts_utils.hpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
9070676
src/radmeth/dmr.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
97521e2
src/radmeth/methdiff.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
39e3333
src/radmeth/radmeth-adjust.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
8b281c7
src/radmeth/radmeth-merge.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
8874cb4
src/radmeth/radmeth.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
e4ad44a
src/radmeth/radmeth_design.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
20543c8
src/radmeth/radmeth_design.hpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
7955dd9
src/radmeth/radmeth_nano.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
45e5a6f
src/radmeth/radmeth_optimize_gamma.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
e3587f5
src/radmeth/radmeth_optimize_series.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
a01de71
src/radmeth/radmeth_utils.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
cd37dfd
src/radmeth/radmeth_utils.hpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
aa6e06c
src/utils/clean-hairpins.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
7c1f417
src/utils/covered.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
246d7a1
src/utils/fast-liftover.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
9bc0f1e
src/utils/format-reads.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
09e9c21
src/utils/guessprotocol.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
3ed5a29
src/utils/kmersites.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
09335fa
src/utils/lc-approx.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
a8e0c69
src/utils/lift-filter.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
6424c68
src/utils/merge-bsrate.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
999c6e4
src/utils/merge-methcounts.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
2087ea0
src/utils/recovered.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
66271d2
src/utils/selectsites.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
1fff8fa
src/utils/symmetric-cpgs.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
c135b74
src/utils/uniq.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
9e6620c
src/utils/unxcounts.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
9942822
src/utils/xcounts.cpp: changes to add static analysis
andrewdavidsmith Nov 25, 2025
75f078c
adding static analysis config files
andrewdavidsmith Nov 25, 2025
e07a63d
cmake/FindHTSLIB.cmake cmake/static_analysis.cmake: adding the cmake …
andrewdavidsmith Nov 25, 2025
3576d9e
cmake/static_analysis.cmake: removing the hints for iwyu
andrewdavidsmith Nov 25, 2025
dc7d5f6
src/amrfinder/CMakeLists.txt: adding this cmake
andrewdavidsmith Nov 25, 2025
3bbe729
src/amrfinder/allelicmeth.cpp: linting
andrewdavidsmith Nov 25, 2025
c8a9f87
src/common/EpireadStats.hpp: adding a size function for std::size()
andrewdavidsmith Nov 25, 2025
8a2edba
src/amrfinder/amrfinder.cpp: linting
andrewdavidsmith Nov 25, 2025
bdd438b
src/amrfinder/amrtester.cpp: linting
andrewdavidsmith Nov 25, 2025
c88f69f
Adding CMakeLists.txt files
andrewdavidsmith Nov 25, 2025
9423830
data/config.h.in: adding file
andrewdavidsmith Nov 25, 2025
e9e0b23
src/amrfinder/amrfinder.cpp: more linting
andrewdavidsmith Nov 25, 2025
40132be
src/amrfinder/amrtester.cpp: more linting
andrewdavidsmith Nov 25, 2025
cbac212
src/mlml/CMakeLists.txt: adding
andrewdavidsmith Nov 25, 2025
03473c3
src/common/CMakeLists.txt: adding GSL dependency in cmake
andrewdavidsmith Nov 25, 2025
72f848d
src/CMakeLists.txt: Adding all the deps dnmtools binary
andrewdavidsmith Nov 25, 2025
e681b86
src/mlml/mlml.cpp: linting
andrewdavidsmith Nov 25, 2025
3808dcc
src/mlml/mlml.cpp: more linting
andrewdavidsmith Nov 25, 2025
3b6569a
src/dnmtools.cpp: more linting
andrewdavidsmith Nov 25, 2025
792757c
src/amrfinder/amrfinder.cpp: removing dead code
andrewdavidsmith Nov 25, 2025
04cf61b
src/common/EpireadStats.cpp: removing commented deadcode
andrewdavidsmith Nov 25, 2025
4d9fce3
src/radmeth/radmeth_design.cpp: removing commented deadcode
andrewdavidsmith Nov 25, 2025
e210954
src/utils/merge-methcounts.cpp: removing commented deadcode
andrewdavidsmith Nov 25, 2025
4c6ae5d
src/radmeth/CMakeLists.txt: removing commented deadcode
andrewdavidsmith Nov 25, 2025
ac787ce
src/analysis/pmd.cpp: removing commented deadcode
andrewdavidsmith Nov 25, 2025
326626c
src/common/EpireadStats.cpp: fixing bug with log_likelihood function …
andrewdavidsmith Nov 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
BasedOnStyle: LLVM
ColumnLimit: 80
IndentWidth: 2
AlwaysBreakAfterReturnType: All
ContinuationIndentWidth: 2
ConstructorInitializerIndentWidth: 2
BraceWrapping:
BeforeElse: true
BeforeCatch: true
BreakBeforeBraces: Custom
BreakConstructorInitializers: AfterColon
SpacesBeforeTrailingComments: 2
31 changes: 31 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Checks: 'cert-*,cppcoreguidelines-*,performance-*,clang-diagnostic-*,clang-analyzer-*,-clang-diagnostic-unqualified-std-cast-call,-clang-diagnostic-unknown-warning-option,-clang-analyzer-unix.BlockInCriticalSection,-cppcoreguidelines-pro-type-vararg'
WarningsAsErrors: '*'
HeaderFileExtensions:
- ''
- h
- hh
- hpp
- hxx
ImplementationFileExtensions:
- c
- cc
- cpp
- cxx
HeaderFilterRegex: ''
ExcludeHeaderFilterRegex: 'OptionParser.hpp'
FormatStyle: none
CheckOptions:
cert-dcl16-c.NewSuffixes: 'L;LL;LU;LLU'
cert-err33-c.AllowCastToVoid: 'true'
cert-err33-c.CheckedFunctions: '::aligned_alloc;::asctime_s;::at_quick_exit;::atexit;::bsearch;::bsearch_s;::btowc;::c16rtomb;::c32rtomb;::calloc;::clock;::cnd_broadcast;::cnd_init;::cnd_signal;::cnd_timedwait;::cnd_wait;::ctime_s;::fclose;::fflush;::fgetc;::fgetpos;::fgets;::fgetwc;::fopen;::fopen_s;::fprintf;::fprintf_s;::fputc;::fputs;::fputwc;::fputws;::fread;::freopen;::freopen_s;::fscanf;::fscanf_s;::fseek;::fsetpos;::ftell;::fwprintf;::fwprintf_s;::fwrite;::fwscanf;::fwscanf_s;::getc;::getchar;::getenv;::getenv_s;::gets_s;::getwc;::getwchar;::gmtime;::gmtime_s;::localtime;::localtime_s;::malloc;::mbrtoc16;::mbrtoc32;::mbsrtowcs;::mbsrtowcs_s;::mbstowcs;::mbstowcs_s;::memchr;::mktime;::mtx_init;::mtx_lock;::mtx_timedlock;::mtx_trylock;::mtx_unlock;::printf_s;::putc;::putwc;::raise;::realloc;::remove;::rename;::scanf;::scanf_s;::setlocale;::setvbuf;::signal;::snprintf;::snprintf_s;::sprintf;::sprintf_s;::sscanf;::sscanf_s;::strchr;::strerror_s;::strftime;::strpbrk;::strrchr;::strstr;::strtod;::strtof;::strtoimax;::strtok;::strtok_s;::strtol;::strtold;::strtoll;::strtoul;::strtoull;::strtoumax;::strxfrm;::swprintf;::swprintf_s;::swscanf;::swscanf_s;::thrd_create;::thrd_detach;::thrd_join;::thrd_sleep;::time;::timespec_get;::tmpfile;::tmpfile_s;::tmpnam;::tmpnam_s;::tss_create;::tss_get;::tss_set;::ungetc;::ungetwc;::vfprintf;::vfprintf_s;::vfscanf;::vfscanf_s;::vfwprintf;::vfwprintf_s;::vfwscanf;::vfwscanf_s;::vprintf_s;::vscanf;::vscanf_s;::vsnprintf;::vsnprintf_s;::vsprintf;::vsprintf_s;::vsscanf;::vsscanf_s;::vswprintf;::vswprintf_s;::vswscanf;::vswscanf_s;::vwprintf_s;::vwscanf;::vwscanf_s;::wcrtomb;::wcschr;::wcsftime;::wcspbrk;::wcsrchr;::wcsrtombs;::wcsrtombs_s;::wcsstr;::wcstod;::wcstof;::wcstoimax;::wcstok;::wcstok_s;::wcstol;::wcstold;::wcstoll;::wcstombs;::wcstombs_s;::wcstoul;::wcstoull;::wcstoumax;::wcsxfrm;::wctob;::wctrans;::wctype;::wmemchr;::wprintf_s;::wscanf;::wscanf_s;'
cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField: 'false'
cert-str34-c.DiagnoseSignedUnsignedCharComparisons: 'false'
cppcoreguidelines-non-private-member-variables-in-classes.IgnorePublicMemberVariables: 'true'
google-readability-braces-around-statements.ShortStatementLines: '1'
google-readability-function-size.StatementThreshold: '800'
google-readability-namespace-comments.ShortNamespaceLines: '10'
google-readability-namespace-comments.SpacesBeforeComments: '2'
llvm-else-after-return.WarnOnConditionVariables: 'false'
llvm-else-after-return.WarnOnUnfixable: 'false'
llvm-qualified-auto.AddConstToQualified: 'false'
SystemHeaders: 'false'
44 changes: 44 additions & 0 deletions .cppcheck_suppress
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# MIT License
#
# Copyright (c) 2024 Andrew Smith
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

missingIncludeSystem
constVariablePointer
checkersReport
unknownMacro
unmatchedSuppression
# Ignore unused function because it's too hard to get right
unusedFunction
# Ignore unused struct member because this won't go unnoticed anyway
unusedStructMember
# Ignore missing includes because if they are real things won't build
missingInclude
# Exclude external files
*:*CLI11.hpp
*:*json.hpp
*:*asio*
*:*smithlab_cpp*
*:*ssl.hpp
*:*indicators.hpp
# Problem caused by external files
toomanyconfigs
# More problems caused by external files -- with too many ifdefs
normalCheckLevelMaxBranches
163 changes: 163 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
# This file is part of dnmtools
#
# Copyright (C) 2025 Andrew D. Smith
#
# Authors: Andrew D. Smith
#
# This is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This software is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.

# to find the version of cmake do
# $ cmake --version
cmake_minimum_required(VERSION 3.28)
project(
dnmtools
VERSION 1.4.4
DESCRIPTION
"Tools for analyzing DNA methylation data"
HOMEPAGE_URL https://github.com/smithlabcode/dnmtools
LANGUAGES CXX)

# Set language version used
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED on)
set(CMAKE_CXX_EXTENSIONS off) # prevents std=gnu++17
set(CMAKE_EXPORT_COMPILE_COMMANDS on)

include(CheckIncludeFileCXX)
include(CheckFunctionExists)
include(CheckCXXCompilerFlag)

include(GNUInstallDirs)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

configure_file(data/config.h.in config.h)

# Collect any global linker options as needed and then apply them
# individually to targets
set(GLOBAL_COMPILE_OPTIONS "")
set(GLOBAL_LINKER_OPTIONS "")

if(USE_STATIC_LIBS)
# This needs to come before finding any libraries so that the static
# versions are identified
message(STATUS "Enabling static linkage for all non-system libraries")
message(STATUS "Configuring to clone ZLib")
include(ExternalProject)
set(ZLIB_CMAKE_ARGS
-DZLIB_BUILD_EXAMPLES=off
-DSKIP_INSTALL_FILES=on
-DCMAKE_POSITION_INDEPENDENT_CODE=on
-DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/src/zlib
-DCMAKE_BUILD_TYPE=Release
)
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
list(APPEND ZLIB_CMAKE_ARGS
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
)
endif()
ExternalProject_Add(
ZLIB
GIT_REPOSITORY https://github.com/madler/zlib.git
GIT_TAG master
CMAKE_ARGS ${ZLIB_CMAKE_ARGS}
)
# Include the built zlib headers and link against the built zlib library
set(ZLIB_INCLUDE_DIR "${PROJECT_BINARY_DIR}/src/zlib/include")
set(ZLIB_LIBRARY "${PROJECT_BINARY_DIR}/src/zlib/lib/libz.a")

# Create the CMake target for the built zlib
add_library(ZLIB_IMPORTED INTERFACE)
set_target_properties(ZLIB_IMPORTED PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${ZLIB_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${ZLIB_LIBRARY}
)

# This alias means we don't need to worry where zlib came from
add_library(ZLIB::ZLIB ALIAS ZLIB_IMPORTED)

ExternalProject_Add(
HTSLIB
GIT_REPOSITORY https://github.com/samtools/htslib.git
GIT_TAG master
CONFIGURE_COMMAND ""
# "autoreconf -i <SOURCE_DIR>; <SOURCE_DIR>/configure"
BUILD_COMMAND make -C <SOURCE_DIR> lib-static -j
INSTALL_COMMAND ""
# make install
TEST_COMMAND ""
BUILD_BYPRODUCTS libhts.a
)
# ExternalProject_Add_Step(HTSLIB
# bootstrap
# COMMAND autoreconf -i <SOURCE_DIR>
# DEPENDEES download
# DEPENDERS configure
# )
ExternalProject_Get_Property(HTSLIB SOURCE_DIR)
message(STATUS "SOURCE_DIR: ${SOURCE_DIR}")

# Include the built zlib headers and link against the built zlib library
set(HTSLIB_INCLUDE_DIR "${SOURCE_DIR}/src/htslib/htslib")
set(HTSLIB_LIBRARY "${SOURCE_DIR}/htslib.a")

# Create the CMake target for the built zlib
add_library(HTSLIB_IMPORTED INTERFACE)
set_target_properties(HTSLIB_IMPORTED PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${HTSLIB_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${HTSLIB_LIBRARY}
)
set_target_properties(HTSLIB_IMPORTED PROPERTIES IMPORTED_LOCATION ${HTSLIB_LIBRARY})

# This alias means we don't need to worry where htslib came from
add_library(HTSLIB::HTSLIB ALIAS HTSLIB_IMPORTED)

# Set static for the linker so the compiler's libraries will be static
## ADS: using this instead of forcing -static for everything avoids the
## static linkage that Aiso warns against, but also means it's not 100%
## static linked ADS: can't do this if the compiler is AppleClang because
## they don't have the libc++.a and the libgcc wouldn't make sense anyway.
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") # macOS
list(APPEND GLOBAL_LINKER_OPTIONS -static-libgcc -static-libstdc++)
endif()

endif()

if(ENABLE_LTO)
# Turn on LTO if we are building for distribution
include(CheckIPOSupported)
check_ipo_supported(RESULT result OUTPUT output)
if(result)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
else()
message(FATAL_ERROR "IPO is not supported: ${output}")
endif()
endif()

if(STATIC_ANALYSIS)
include(cmake/static_analysis.cmake)
endif()

# ADS: set the most stringent warnings we can
list(APPEND GLOBAL_COMPILE_OPTIONS
-Wall -Wextra -Wpedantic -Werror -Wfatal-errors
)

if(STRIP_PATHS_FROM_BINARIES)
# This is set if we have configured to distribute
set(PREFIX_MAP_ARG -ffile-prefix-map=)
list(TRANSFORM STRIP_SUB_LIST PREPEND ${PREFIX_MAP_ARG})
list(APPEND GLOBAL_COMPILE_OPTIONS ${STRIP_SUB_LIST})
endif()

message(STATUS "Finished global compile and linker configuration")

add_subdirectory(src)
36 changes: 36 additions & 0 deletions CPPLINT.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# MIT License
#
# Copyright (c) 2025 Andrew Smith
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
set noparent
filter=-runtime/references
filter=-build/include_subdir
filter=-build/include_order
filter=-build/c++11
filter=-build/c++17
# Formatting below handled by clang-format
filter=-whitespace/line_length
filter=-whitespace/newline
filter=-readability/braces
filter=-whitespace/semicolon
filter=-whitespace/indent
filter=-whitespace/braces
filter=-whitespace/parens
filter=-readability/nolint
Loading