Skip to content

Commit

Permalink
use cxxopts via vcpkg, adopt to new version of cxxopts
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisHal committed Jan 29, 2024
1 parent b044d37 commit 4018d55
Showing 11 changed files with 41 additions and 2,165 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -31,6 +31,8 @@ bld/
[Oo]bj/
[Ll]og/

out/

# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
17 changes: 3 additions & 14 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}_build\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": ""
},
{
"name": "x64-Release",
"generator": "Ninja",
"configurationType": "Release",
"buildRoot": "${projectDir}_build\\out\\build\\${name}",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ]
"ctestCommandArgs": ""
}
]
}
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Christian R. Halaszovich
Copyright (c) 2021 - 2024 Christian R. Halaszovich

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
11 changes: 9 additions & 2 deletions PTU2BIN/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -2,11 +2,18 @@ cmake_minimum_required(VERSION 3.10)

# set the project name
project(PTU2BIN)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)

find_package(cxxopts CONFIG REQUIRED)

if(DOPERFORMANCEANALYSIS)
add_compile_definitions(DOPERFORMANCEANALYSIS)
endif()
# add the executable
add_executable(PTU2BIN PTU2BIN.cpp export_igor_ibw.cpp export_igor_ibw.h PTUFileHeader.cpp PTUFileHeader.h RecordBuffer.h TTTRRecordProcessor.cpp TTTRRecordProcessor.h external/cxxopts.hpp)
add_executable(PTU2BIN PTU2BIN.cpp export_igor_ibw.cpp export_igor_ibw.h
PTUFileHeader.cpp PTUFileHeader.h RecordBuffer.h TTTRRecordProcessor.cpp TTTRRecordProcessor.h)

target_link_libraries(PTU2BIN PRIVATE cxxopts::cxxopts)

install(TARGETS PTU2BIN DESTINATION bin)
15 changes: 5 additions & 10 deletions PTU2BIN/PTU2BIN.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Tool to convert 3T PTU file from PicoQuant SymphoTime
// to PicoQuant BIN format (= pre-histogrammed data)
//
// (c) 2021 Christian R. Halaszovich
// (c) 2021 - 2024 Christian R. Halaszovich
// (See LICENSE.txt for licensing information.)
//
// Some parts are based on demo code from PicoQuant
@@ -28,7 +28,7 @@
#define __STDC_WANT_LIB_EXT1__
#endif
#include <ctime>
#include "external/cxxopts.hpp"
#include "cxxopts.hpp"
#include "PTUFileHeader.h"
#include "TTTRRecordProcessor.h"
#include "RecordBuffer.h"
@@ -172,7 +172,7 @@ void AnalyzeTriggers(RecordBuffer& buffer, const TTTRRecordProcessor& processor,
buffer.rewind();
}

cxxopts::ParseResult parse(int argc, char** argv, std::string& infile, std::string& outfile, int& channelofinterest,
void parse(int argc, char** argv, std::string& infile, std::string& outfile, int& channelofinterest,
int64_t& first_frame, int64_t& last_frame, bool& ignore_frame_trigger, int64_t& lines_to_skip)
{
try {
@@ -228,13 +228,8 @@ cxxopts::ParseResult parse(int argc, char** argv, std::string& infile, std::stri
<< std::endl;
}
}

if (argc > 1) {
std::cerr << "Warning: more arguments given than expected. " << std::endl;
}
return result;
}
catch (const cxxopts::OptionException & e) {
catch (const cxxopts::exceptions::exception& e) {
std::cout << "error parsing options: " << e.what() << std::endl;
exit(-1);
}
@@ -246,7 +241,7 @@ int main(int argc, char** argv)
int channelofinterest = 1;
int64_t first_frame = 0, last_frame = std::numeric_limits<int64_t>::max(), lines_to_skip = 0;
bool ignore_frame_trigger{ false };
auto parsedargs = parse(argc, argv, infilename, outfilename, channelofinterest, first_frame, last_frame,
parse(argc, argv, infilename, outfilename, channelofinterest, first_frame, last_frame,
ignore_frame_trigger, lines_to_skip);
// check if we are running from a terminal
#ifdef DOPERFORMANCEANALYSIS
1 change: 0 additions & 1 deletion PTU2BIN/external/00README.txt

This file was deleted.

19 changes: 0 additions & 19 deletions PTU2BIN/external/LICENSE_cxxopts.txt

This file was deleted.

Loading

0 comments on commit 4018d55

Please sign in to comment.