From 1a75fc6b19c34ee5834440573df8a5844bb2cf12 Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 26 May 2023 00:39:29 +0200 Subject: [PATCH] Fix cmake defaults, msvc log thread Signed-off-by: falkTX --- cmake/CMakeLists.txt | 4 ++-- source/utils/CarlaLogThread.hpp | 14 +++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 7c7d1fd61..273ad4af1 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -37,8 +37,8 @@ else() set(CARLA_USE_OSC_DEFAULT TRUE) endif() -set(CARLA_USE_JACK TRUE CACHE ${CARLA_USE_JACK_DEFAULT} "Enable JACK") -set(CARLA_USE_OSC TRUE CACHE ${CARLA_USE_OSC_DEFAULT} "Enable OSC") +set(CARLA_USE_JACK ${CARLA_USE_JACK_DEFAULT} CACHE BOOL "Enable JACK") +set(CARLA_USE_OSC ${CARLA_USE_OSC_DEFAULT} CACHE BOOL "Enable OSC") ####################################################################################################################### # required dependencies diff --git a/source/utils/CarlaLogThread.hpp b/source/utils/CarlaLogThread.hpp index beb3ae0c8..9e01908d1 100644 --- a/source/utils/CarlaLogThread.hpp +++ b/source/utils/CarlaLogThread.hpp @@ -24,6 +24,13 @@ #include +#ifdef CARLA_OS_WIN +# include +# define close _close +# define dup _dup +# define dup2 _dup2 +#endif + using CARLA_BACKEND_NAMESPACE::EngineCallbackFunc; // ----------------------------------------------------------------------- @@ -82,7 +89,7 @@ public: #endif fStdOut = dup(stdout_fileno); - fStdErr = dup(STDERR_FILENO); + fStdErr = dup(stderr_fileno); dup2(pipe1, stdout_fileno); dup2(pipe1, stderr_fileno); @@ -114,8 +121,8 @@ public: const int stderr_fileno = STDERR_FILENO; #endif - dup2(fStdOut, STDOUT_FILENO); - dup2(fStdErr, STDERR_FILENO); + dup2(fStdOut, stdout_fileno); + dup2(fStdErr, stderr_fileno); close(fStdOut); close(fStdErr); fStdOut = -1; @@ -224,6 +231,7 @@ private: #ifdef CARLA_OS_WIN # undef close +# undef dup # undef dup2 #endif