1 | |
2 | // |
3 | // This source file is part of appleseed. |
4 | // Visit http://appleseedhq.net/ for additional information and resources. |
5 | // |
6 | // This software is released under the MIT license. |
7 | // |
8 | // Copyright (c) 2010-2013 Francois Beaune, Jupiter Jazz Limited |
9 | // Copyright (c) 2014-2017 Francois Beaune, The appleseedhq Organization |
10 | // |
11 | // Permission is hereby granted, free of charge, to any person obtaining a copy |
12 | // of this software and associated documentation files (the "Software"), to deal |
13 | // in the Software without restriction, including without limitation the rights |
14 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
15 | // copies of the Software, and to permit persons to whom the Software is |
16 | // furnished to do so, subject to the following conditions: |
17 | // |
18 | // The above copyright notice and this permission notice shall be included in |
19 | // all copies or substantial portions of the Software. |
20 | // |
21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
22 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
23 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
24 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
25 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
26 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
27 | // THE SOFTWARE. |
28 | // |
29 | |
30 | #ifndef APPLESEED_CLI_COMMANDLINEHANDLER_H |
31 | #define APPLESEED_CLI_COMMANDLINEHANDLER_H |
32 | |
33 | // appleseed.foundation headers. |
34 | #include "foundation/utility/commandlineparser.h" |
35 | |
36 | // appleseed.shared headers. |
37 | #include "application/commandlinehandlerbase.h" |
38 | |
39 | // Standard headers. |
40 | #include <string> |
41 | |
42 | // Forward declarations. |
43 | namespace appleseed { namespace shared { class SuperLogger; } } |
44 | |
45 | namespace appleseed { |
46 | namespace cli { |
47 | |
48 | // |
49 | // Command line handler. |
50 | // |
51 | |
52 | class CommandLineHandler |
53 | : public shared::CommandLineHandlerBase |
54 | { |
55 | public: |
56 | // Input file. |
57 | foundation::ValueOptionHandler<std::string> m_filename; |
58 | |
59 | // General options. |
60 | foundation::ValueOptionHandler<std::string> m_configuration; |
61 | foundation::ValueOptionHandler<std::string> m_params; |
62 | #if defined __APPLE__ || defined _WIN32 |
63 | foundation::FlagOptionHandler m_display_output; |
64 | #endif |
65 | foundation::FlagOptionHandler m_disable_autosave; |
66 | |
67 | // Aliases for rendering options. |
68 | foundation::ValueOptionHandler<std::string> m_threads; // std::string because we need to handle 'auto' |
69 | foundation::ValueOptionHandler<std::string> m_output; |
70 | foundation::FlagOptionHandler m_continuous_saving; |
71 | foundation::ValueOptionHandler<int> m_resolution; |
72 | foundation::ValueOptionHandler<int> m_window; |
73 | foundation::ValueOptionHandler<int> m_samples; |
74 | foundation::ValueOptionHandler<int> m_passes; |
75 | foundation::ValueOptionHandler<std::string> m_override_shading; |
76 | foundation::ValueOptionHandler<std::string> m_select_object_instances; |
77 | |
78 | // Houdini-related options. |
79 | foundation::FlagOptionHandler m_mplay_display; |
80 | foundation::ValueOptionHandler<int> m_hrmanpipe_display; |
81 | |
82 | // Developer-oriented options. |
83 | foundation::ValueOptionHandler<std::string> m_run_unit_tests; |
84 | foundation::ValueOptionHandler<std::string> m_run_unit_benchmarks; |
85 | foundation::FlagOptionHandler m_verbose_unit_tests; |
86 | foundation::FlagOptionHandler m_benchmark_mode; |
87 | |
88 | // Constructor. |
89 | CommandLineHandler(); |
90 | |
91 | private: |
92 | // Emit usage instructions to the logger. |
93 | virtual void print_program_usage( |
94 | const char* executable_name, |
95 | shared::SuperLogger& logger) const; |
96 | }; |
97 | |
98 | } // namespace cli |
99 | } // namespace appleseed |
100 | |
101 | #endif // !APPLESEED_CLI_COMMANDLINEHANDLER_H |
102 | |