Apply cmake-format and clang-format
This commit is contained in:
parent
0341316b4b
commit
a19ee41a39
|
@ -101,11 +101,8 @@ if (MINGW)
|
||||||
list(APPEND SCRIPT_FILES scripts/wine.sh)
|
list(APPEND SCRIPT_FILES scripts/wine.sh)
|
||||||
endif ()
|
endif ()
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
list(APPEND CMAKE_TEMPLATE_FILES
|
list(APPEND CMAKE_TEMPLATE_FILES cmake/templates/windows.rc.in cmake/templates/windows-cli-wrapper.rc.in
|
||||||
cmake/templates/windows.rc.in
|
cmake/templates/cli-wrapper.cpp)
|
||||||
cmake/templates/windows-cli-wrapper.rc.in
|
|
||||||
cmake/templates/cli-wrapper.cpp
|
|
||||||
)
|
|
||||||
endif ()
|
endif ()
|
||||||
set(EXCLUDED_FILES cmake/templates/cli-wrapper.cpp)
|
set(EXCLUDED_FILES cmake/templates/cli-wrapper.cpp)
|
||||||
|
|
||||||
|
|
|
@ -198,7 +198,7 @@ void startConsole()
|
||||||
|
|
||||||
// attach to the parent process' console or allocate a new console if that's not possible
|
// attach to the parent process' console or allocate a new console if that's not possible
|
||||||
if (!skip && (AttachConsole(ATTACH_PARENT_PROCESS) || AllocConsole())) {
|
if (!skip && (AttachConsole(ATTACH_PARENT_PROCESS) || AllocConsole())) {
|
||||||
FILE* fp;
|
FILE *fp;
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
// take care of normal streams
|
// take care of normal streams
|
||||||
if (!skipstdout) {
|
if (!skipstdout) {
|
||||||
|
@ -215,8 +215,10 @@ void startConsole()
|
||||||
std::cin.clear();
|
std::cin.clear();
|
||||||
}
|
}
|
||||||
// take care of wide streams
|
// take care of wide streams
|
||||||
auto hConOut = CreateFile(_T("CONOUT$"), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
auto hConOut = CreateFile(
|
||||||
auto hConIn = CreateFile(_T("CONIN$"), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
_T("CONOUT$"), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
|
auto hConIn = CreateFile(
|
||||||
|
_T("CONIN$"), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
if (!skipstdout) {
|
if (!skipstdout) {
|
||||||
SetStdHandle(STD_OUTPUT_HANDLE, hConOut);
|
SetStdHandle(STD_OUTPUT_HANDLE, hConOut);
|
||||||
std::wcout.clear();
|
std::wcout.clear();
|
||||||
|
|
|
@ -8,7 +8,9 @@ set(TEMPLATE_FINDER_LOADED YES)
|
||||||
|
|
||||||
function (find_template_file FILE_NAME_WITHOUT_EXTENSION PROJECT_VAR_NAME OUTPUT_VAR)
|
function (find_template_file FILE_NAME_WITHOUT_EXTENSION PROJECT_VAR_NAME OUTPUT_VAR)
|
||||||
find_template_file_full_name("${FILE_NAME_WITHOUT_EXTENSION}.in" "${PROJECT_VAR_NAME}" "${OUTPUT_VAR}")
|
find_template_file_full_name("${FILE_NAME_WITHOUT_EXTENSION}.in" "${PROJECT_VAR_NAME}" "${OUTPUT_VAR}")
|
||||||
set(${OUTPUT_VAR} "${${OUTPUT_VAR}}" PARENT_SCOPE)
|
set(${OUTPUT_VAR}
|
||||||
|
"${${OUTPUT_VAR}}"
|
||||||
|
PARENT_SCOPE)
|
||||||
endfunction ()
|
endfunction ()
|
||||||
|
|
||||||
function (find_template_file_full_name FILE_NAME PROJECT_VAR_NAME OUTPUT_VAR)
|
function (find_template_file_full_name FILE_NAME PROJECT_VAR_NAME OUTPUT_VAR)
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cwchar>
|
#include <cwchar>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <system_error>
|
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
#include <system_error>
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Returns \a replacement if \a value matches \a key; otherwise returns \a value.
|
* \brief Returns \a replacement if \a value matches \a key; otherwise returns \a value.
|
||||||
|
@ -58,17 +58,16 @@ int main()
|
||||||
startupInfo.dwFlags |= STARTF_USESTDHANDLES;
|
startupInfo.dwFlags |= STARTF_USESTDHANDLES;
|
||||||
|
|
||||||
// start main executable in new group and print debug information if that's not possible
|
// start main executable in new group and print debug information if that's not possible
|
||||||
auto res = CreateProcessW(
|
auto res = CreateProcessW(pathBuffer, // path of main executable
|
||||||
pathBuffer, // path of main executable
|
commadLine, // command line arguments
|
||||||
commadLine, // command line arguments
|
nullptr, // process handle not inheritable
|
||||||
nullptr, // process handle not inheritable
|
nullptr, // thread handle not inheritable
|
||||||
nullptr, // thread handle not inheritable
|
true, // set handle inheritance to true
|
||||||
true, // set handle inheritance to true
|
CREATE_NEW_PROCESS_GROUP, // creation flags
|
||||||
CREATE_NEW_PROCESS_GROUP, // creation flags
|
nullptr, // use parent's environment block
|
||||||
nullptr, // use parent's environment block
|
nullptr, // use parent's starting directory
|
||||||
nullptr, // use parent's starting directory
|
&startupInfo, // pointer to STARTUPINFO structure
|
||||||
&startupInfo, // pointer to STARTUPINFO structure
|
&processInformation); // pointer to PROCESS_INFORMATION structure
|
||||||
&processInformation); // pointer to PROCESS_INFORMATION structure
|
|
||||||
if (!res) {
|
if (!res) {
|
||||||
std::cerr << "Unable to launch main executable: " << std::error_code(GetLastError(), std::system_category()) << '\n';
|
std::cerr << "Unable to launch main executable: " << std::error_code(GetLastError(), std::system_category()) << '\n';
|
||||||
std::wcerr << L" - assumed path: " << pathBuffer << L'\n';
|
std::wcerr << L" - assumed path: " << pathBuffer << L'\n';
|
||||||
|
|
Loading…
Reference in New Issue