1 /*
2     This file is part of darktable,
3     Copyright (C) 2011-2020 darktable developers.
4 
5     darktable is free software: you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation, either version 3 of the License, or
8     (at your option) any later version.
9 
10     darktable is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14 
15     You should have received a copy of the GNU General Public License
16     along with darktable.  If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #include "common/darktable.h"
20 #include "common/opencl.h"
21 
22 #ifdef __APPLE__
23 #include "osx/osx.h"
24 #endif
25 
26 #ifdef _WIN32
27 #include <conio.h>
28 #include "win/main_wrapper.h"
29 #endif
30 
main(int argc,char * arg[])31 int main(int argc, char *arg[])
32 {
33 #ifdef __APPLE__
34   dt_osx_prepare_environment();
35 #endif
36   int result = 1;
37   // only used to force-init opencl, so we want these options:
38   char *m_arg[] = { "-d", "opencl", "--library", ":memory:"};
39   const int m_argc = sizeof(m_arg) / sizeof(m_arg[0]);
40   char **argv = malloc(sizeof(arg[0]) * argc + sizeof(m_arg));
41   if(!argv) goto end;
42   for(int i = 0; i < argc; i++)
43     argv[i] = arg[i];
44   for(int i = 0; i < m_argc; i++)
45     argv[argc + i] = m_arg[i];
46   argc += m_argc;
47   if(dt_init(argc, argv, FALSE, FALSE, NULL)) goto end;
48   dt_cleanup();
49   free(argv);
50 
51   result = 0;
52 end:
53 
54 #ifdef _WIN32
55   printf("\npress any key to exit\n");
56   FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE));
57   getch();
58 #endif
59 
60   exit(result);
61 }
62 
63 // modelines: These editor modelines have been set for all relevant files by tools/update_modelines.sh
64 // vim: shiftwidth=2 expandtab tabstop=2 cindent
65 // kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
66