diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ea20b2dc4..34d830f8a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -159,6 +159,12 @@ add_executable(aseprite WIN32 target_link_libraries(aseprite app-lib ${PLATFORM_LIBS}) add_dependencies(aseprite copy_data) +if(MSVC AND USE_SKIA_BACKEND) + # Add support to expand filename wildcards in argc/argv + set_target_properties(aseprite + PROPERTIES LINK_FLAGS "-LINK wsetargv.obj -ENTRY:\"wWinMainCRTStartup\"") +endif() + install(TARGETS aseprite RUNTIME DESTINATION bin) diff --git a/src/she/skia/she.cpp b/src/she/skia/she.cpp index 833a0dab2..a6be689cb 100644 --- a/src/she/skia/she.cpp +++ b/src/she/skia/she.cpp @@ -51,20 +51,22 @@ void clear_keyboard_buffer() extern int app_main(int argc, char* argv[]); #if _WIN32 -int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, - LPSTR lpCmdLine, int nCmdShow) { - int argc = 0; - LPWSTR* argvW = CommandLineToArgvW(GetCommandLineW(), &argc); +extern int __argc; +extern wchar_t** __wargv; + +int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + PWSTR lpCmdLine, int nCmdShow) { + int argc = __argc; char** argv; - if (argvW && argc > 0) { + if (__wargv && argc > 0) { argv = new char*[argc]; for (int i=0; i