Files
salmanoff/main.cpp
T
hayodea bffa2b837c Opts: Make singleton; senseApi: check senseApiLibPath, get senseApiDescFn pointer.
* OptionsParser now has a singleton.
* We now use the cmdline opt -p <senseApiLibPath>, and search for
  the specified library in:
  * senseApiLibPath, then CWD, then the place where our executable
    is running from, and then finally we let the hosting OS do
    its own search.
* We now call dlsym() on dlopen()'d libs to to get the senseApiDescFn
  pointer.
2025-01-08 13:43:44 -04:00

46 lines
1.0 KiB
C++

#include <iostream>
#include <exception>
#include <opts.h>
#include <mind.h>
#include <deviceManager/deviceManager.h>
int main(int argc, char **argv)
{
try {
OptionParser &options = OptionParser::getOptions();
hk::Mind mind;
std::cout << PACKAGE_NAME << " " << PACKAGE_VERSION << std::endl;
try {
options.parseArguments(argc, argv);
}
catch (const std::invalid_argument& e) {
std::cerr << e.what() << '\n' << options.getUsage() << '\n';
return EXIT_FAILURE;
}
if (options.printUsage) {
std::cout << options.getUsage() << std::endl;
return EXIT_SUCCESS;
}
options.dumpOptions();
DeviceManager::getInstance().collateAllDeviceSpecs(options);
DeviceManager::getInstance().parseAllDeviceSpecs();
std::cout << DeviceManager::printDeviceSpecs() << std::endl;
}
catch (const std::exception& e) {
std::cerr << "Exception occurred: " << e.what() << std::endl;
return EXIT_FAILURE;
}
catch (...) {
std::cerr << "Unknown exception occurred" << std::endl;
return EXIT_FAILURE;
}
std::cout << "Exiting normally" << std::endl;
return 0;
}