Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 7 additions & 7 deletions .github/workflows/trx-cpp-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ jobs:
--output-file coverage.info
lcov --summary coverage.info

# - name: Upload to Codecov
# uses: codecov/codecov-action@v4
# with:
# files: coverage.info
# flags: linux
# fail_ci_if_error: true
# token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload to Codecov
uses: codecov/codecov-action@v4
with:
files: coverage.info
flags: linux
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Upload coverage report
uses: actions/upload-artifact@v4
Expand Down
19 changes: 12 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.16)
cmake_policy(SET CMP0074 NEW)
cmake_policy(SET CMP0079 NEW)

Expand All @@ -8,17 +8,20 @@ include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
include(FetchContent)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE Debug)
endif()

option(TRX_USE_CONAN "Should Conan package manager be used?" ON)
option(TRX_USE_CONAN "Should Conan package manager be used?" OFF)
option(TRX_BUILD_TESTS "Build trx tests" OFF)
option(TRX_BUILD_EXAMPLES "Build trx example commandline programs" ON)

if(MSVC)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
add_compile_definitions(NOMINMAX)
endif()

find_package(libzip REQUIRED)
Expand Down Expand Up @@ -57,6 +60,8 @@ add_library(trx
)
add_library(trx-cpp::trx ALIAS trx)

target_compile_features(trx PUBLIC cxx_std_17)

if(TRX_USE_CONAN AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/ConanSetup.cmake")
include(cmake/ConanSetup.cmake)
elseif(TRX_USE_CONAN)
Expand Down Expand Up @@ -110,11 +115,11 @@ endif()

if(TRX_BUILD_EXAMPLES)
FetchContent_Declare(
CLI11
GIT_REPOSITORY https://github.com/CLIUtils/CLI11.git
GIT_TAG v2.4.2
cxxopts
GIT_REPOSITORY https://github.com/jarro2783/cxxopts.git
GIT_TAG v3.2.0
)
FetchContent_MakeAvailable(CLI11)
FetchContent_MakeAvailable(cxxopts)
add_subdirectory(examples)
endif()

Expand Down
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def layout(self):

def generate(self):
tc = CMakeToolchain(self)
tc.variables["CMAKE_CXX_STANDARD"] = 11
tc.variables["CMAKE_CXX_STANDARD"] = 17
tc.variables["CMAKE_CXX_STANDARD_REQUIRED"] = "ON"
tc.variables["CMAKE_CXX_EXTENSIONS"] = "OFF"
tc.generate()
Expand Down
4 changes: 2 additions & 2 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
add_executable(trxinfo trxinfo.cpp)
target_link_libraries(trxinfo PRIVATE trx CLI11::CLI11)
target_compile_features(trxinfo PRIVATE cxx_std_11)
target_link_libraries(trxinfo PRIVATE trx cxxopts::cxxopts)
target_compile_features(trxinfo PRIVATE cxx_std_17)

install(TARGETS trxinfo
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
Expand Down
26 changes: 21 additions & 5 deletions examples/trxinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <string>
#include <vector>

#include <CLI/CLI.hpp>
#include <cxxopts.hpp>

#include "cli_colors.h"

Expand Down Expand Up @@ -210,20 +210,36 @@ struct ReaderPrinter

int main(int argc, char **argv)
{
CLI::App app{"Print information about a TRX file or directory."};
std::string path;
bool show_stats = false;

app.add_option("path", path, "Path to TRX file or directory")->required();
app.add_flag("--stats", show_stats, "Compute Min/Mean/Max streamline lengths");
cxxopts::Options options("trxinfo", "Print information about a TRX file or directory.");
options.add_options()("stats", "Compute Min/Mean/Max streamline lengths",
cxxopts::value<bool>(show_stats)->default_value("false"))(
"path", "Path to TRX file or directory", cxxopts::value<std::string>(path));
options.parse_positional({"path"});

CLI11_PARSE(app, argc, argv);
try
{
auto result = options.parse(argc, argv);
if (!result.count("path"))
{
std::cerr << options.help() << "\n";
return 1;
}
path = result["path"].as<std::string>();
show_stats = result["stats"].as<bool>();

const bool is_dir = trxmmap::is_trx_directory(path);
ReaderPrinter printer{path, is_dir, show_stats};
return trxmmap::with_trx_reader(path, printer);
}
catch (const cxxopts::exceptions::exception &e)
{
std::cerr << "trxinfo: " << e.what() << "\n";
std::cerr << options.help() << "\n";
return 1;
}
catch (const std::exception &e)
{
std::cerr << "trxinfo: " << e.what() << "\n";
Expand Down
96 changes: 0 additions & 96 deletions include/trx/compat.h

This file was deleted.

88 changes: 0 additions & 88 deletions include/trx/dirent.h

This file was deleted.

Loading