diff --git a/CMakeLists.txt b/CMakeLists.txt index aab1b06..204dc3a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ add_definitions(-DJUCE_USE_MP3AUDIOFORMAT -DJUCE_PLUGINHOST_VST3 -DJUCE_PLUGINHO if(MSVC) add_definitions(-DJUCE_PLUGINHOST_VST -DJUCE_ASIO) -endif(MSVC) +endif() file(GLOB EIM_SRC_FILES "src/*.cpp" "src/*.h") @@ -26,7 +26,9 @@ juce_add_console_app(${PROJECT_NAME} ) set_target_properties(${PROJECT_NAME} PROPERTIES JUCE_TARGET_KIND_STRING "App") _juce_configure_bundle(${PROJECT_NAME} ${PROJECT_NAME}) -_juce_configure_app_bundle(${PROJECT_NAME} ${PROJECT_NAME}) +if(NOT MSVC) + _juce_configure_app_bundle(${PROJECT_NAME} ${PROJECT_NAME}) +endif() target_sources(${PROJECT_NAME} PRIVATE ${EIM_SRC_FILES}) target_compile_definitions(${PROJECT_NAME} PRIVATE JUCE_WEB_BROWSER=0 JUCE_USE_CURL=0) @@ -62,7 +64,7 @@ if(MSVC) string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHa") set_property(TARGET ${PROJECT_NAME} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") -endif(MSVC) +endif() target_compile_definitions(${PROJECT_NAME} PRIVATE diff --git a/src/Main.cpp b/src/Main.cpp index 6569ea3..da5a497 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -65,7 +65,7 @@ int main(int argc, char* argv[]) { juce::JUCEApplicationBase::main(argc, (const char**)argv); } else if (args->containsOption("-O|--output")) { #ifdef JUCE_WINDOWS - CoInitialize(nullptr); + juce::ignoreUnused(CoInitialize(nullptr)); #endif juce::initialiseJuce_GUI(); diff --git a/src/utils.h b/src/utils.h index 0f2d13e..de4af23 100644 --- a/src/utils.h +++ b/src/utils.h @@ -1,7 +1,7 @@ #ifndef EIM_UTILS_H #define EIM_UTILS_H -#ifdef _WIN32 +#ifdef JUCE_WINDOWS #include #endif @@ -20,8 +20,8 @@ namespace eim { output_stream() { setvbuf(oldStdout, nullptr, _IOFBF, 4096); juce::ignoreUnused(freopen(nullptr, "wb", oldStdout)); -#ifdef _WIN32 - _setmode(_fileno(oldStdout), _O_BINARY); +#ifdef JUCE_WINDOWS + juce::ignoreUnused(_setmode(_fileno(oldStdout), _O_BINARY)); #endif } @@ -84,7 +84,11 @@ namespace eim { static void preventStdout() { juce::ignoreUnused(freopen("/dev/null", "w", stdout)); } private: +#ifdef JUCE_WINDOWS + FILE* oldStdout = _fdopen(_dup(1), "wb"); +#else FILE *oldStdout = fdopen(dup(1), "wb"); +#endif }; class input_stream { @@ -92,8 +96,8 @@ namespace eim { input_stream() { setvbuf(stdin, nullptr, _IOFBF, 4096); juce::ignoreUnused(freopen(nullptr, "rb", stdin)); -#ifdef _WIN32 - _setmode(_fileno(stdin), _O_BINARY); +#ifdef JUCE_WINDOWS + juce::ignoreUnused(_setmode(_fileno(stdin), _O_BINARY)); #endif }