Hi.
I want to use rawtherapee-cli.exe for processing photo from my Windows console.
The problem is when I call rawtherapee.cli.exe it creates another process that does the processing.
How can I find this process, wait for completion and get result?
How can I call rawtherapee-cli.exe like any usual console program, read it’s output and exit code?
it will execute all processings sequentially. It is normal behavior.
But if I execute these lines in command prompt one after another, 3 instances of rawtherapee-cli.exe will be executed in parallel. Command prompt doesn’t wait for process exit.
diff --git a/win.cmake b/win.cmake
index 0a32ac95..3b330ebe 100644
--- a/win.cmake
+++ b/win.cmake
@@ -30,8 +30,8 @@ set(PROC_TARGET_NUMBER 0 CACHE STRING "Target Processor")
# CMAKE_C_FLAGS and CMAKE_EXE_LINKER_FLAGS to select between 32/64bit build
set(CMAKE_CXX_FLAGS "-mwin32 -m64 -mthreads -msse2" CACHE STRING "Compiler options for C++ source files")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g2" CACHE STRING "Compiler options for C++ source files and Debug target")
-set(CMAKE_CXX_FLAGS_RELEASE "-mwindows -Wno-aggressive-loop-optimizations -DNDEBUG -O3" CACHE STRING "Compiler options for C++ source files and Release target")
-set(CMAKE_CXX_FLAGS_MINSIZEREL "-mwindows -DNDEBUG -Os" CACHE STRING "Compiler options for C++ source files and MinSizeRel target")
+set(CMAKE_CXX_FLAGS_RELEASE "-Wno-aggressive-loop-optimizations -DNDEBUG -O3" CACHE STRING "Compiler options for C++ source files and Release target")
+set(CMAKE_CXX_FLAGS_MINSIZEREL "-DNDEBUG -Os" CACHE STRING "Compiler options for C++ source files and MinSizeRel target")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Compiler options for C++ source files and RelWithDebInfo target")
# Uncomment the next line and set the right value to override the default value (special compiling flags for RTEngine)
@@ -39,12 +39,12 @@ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Compiler options for C
set(CMAKE_C_FLAGS "-mwin32 -m64 -mthreads -msse2" CACHE STRING "Compiler options for C source files")
set(CMAKE_C_FLAGS_DEBUG "-O0 -g2" CACHE STRING "Compiler options for C source files and Debug target")
-set(CMAKE_C_FLAGS_RELEASE "-mwindows -DNDEBUG -O2" CACHE STRING "Compiler options for C source files and Release target")
-set(CMAKE_C_FLAGS_MINSIZEREL "-mwindows -DNDEBUG -Os" CACHE STRING "Compiler options for C source files and MinSizeRel target")
+set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O2" CACHE STRING "Compiler options for C source files and Release target")
+set(CMAKE_C_FLAGS_MINSIZEREL "-DNDEBUG -Os" CACHE STRING "Compiler options for C source files and MinSizeRel target")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Compiler options for C source files and RelWithDebInfo target")
set(CMAKE_EXE_LINKER_FLAGS "-m64 -mthreads -static-libgcc" CACHE STRING "Linker options")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-O0" CACHE STRING "Linkage options for the Debug target")
-set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-mwindows -s -O3" CACHE STRING "Linkage options for the Release target")
-set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "-mwindows -s -Os" CACHE STRING "Linkage options for the MinSizeRel target")
+set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s -O3" CACHE STRING "Linkage options for the Release target")
+set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "-s -Os" CACHE STRING "Linkage options for the MinSizeRel target")
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "-s -O2" CACHE STRING "Linkage options for the RelWithDebInfo target")
For rawtherapee.exe (non cli) the -mwindows flag is already set here
@heckflosse Yes seems ok like that for rawtherapee_cli.exe
But a command windows opens when running rawtherapee.exe
It will become tricky to build a correct installation if we need also to generate the cli version without -mwindows and the gui version with -mwindows.
Unfortunately, for %f in (*.cr2) do ("c:\Program Files\RawTherapee\5.1\rawtherapee-cli.exe" -w -o %~nf.jpg -c %f)
runs all instances of rawtherapee-cli.exe in parallel.
Sorry for the late reply, the notification email landed in the ‘spam’ directory…
I probably missed that point and forgot to remove temporary modifications before committing. The line pointed out by @heckflosse ( here ) have to be commented out, and the "-mwindows’ switch removed from your build options file, as done in @heckflosse’s patch. That way the cli version won’t run in its own process but the gui version will.
Btw, if you intend to run RT-cli by specifying one file at once only (you can use wildcards if you want), then you can reduce the start time by using the ‘-q’ switch. In this case, some dependencies like color profile or HaldCLUT profiles will only be listed/loaded if used.
@Hombre Could you bring me some clarification
1- It seems to me that the line 182 of rtgui/CMakeLists.txt is already commented out in the dev branch. So no need for a modification.
2- If I remove the -mwindows switch, cli version works as expected by @Gnitry, but the gui version opens an additional console windows, that is not the expected behaviour.
So I think the goal is to build at the same time a cli and gui version that have each the expected behaviour. Is it possible?
Yes, it works fine.
I found that in this version additional console doesn’t appear even if I don’t use “-w” parameter.
But, as for me, I don’t need this additional window
That’s correct behaviour now. The -w parameter suppresses the additional console window.
But as we now have the rawtherapee-cli.exe we don’t need this parameter anymore.
There are two cases where the console window should open and where it makes no sense to suppress it:
when you start rt in verbose mode
when you pass a parameter (e.g. -h) to the rawtherapee.exe