mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-21 21:55:38 +00:00
(Windows) Made es-pdf-convert build with MinGW
This commit is contained in:
parent
f9780e58d8
commit
07f98f1737
|
@ -9,9 +9,14 @@
|
|||
project(es-pdf-convert)
|
||||
|
||||
if(WIN32)
|
||||
set(POPPLER_CPP_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../external/poppler-23.05.0/Library/include/poppler/cpp)
|
||||
set(POPPLER_CPP_LIBRARY ${CMAKE_CURRENT_SOURCE_DIR}/poppler-cpp.lib)
|
||||
else()
|
||||
set(POPPLER_CPP_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../external/poppler/Library/include/poppler/cpp)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
set(POPPLER_CPP_LIBRARY ${CMAKE_CURRENT_SOURCE_DIR}/poppler-cpp.lib)
|
||||
else()
|
||||
set(POPPLER_CPP_LIBRARY ${CMAKE_CURRENT_SOURCE_DIR}/libpoppler-cpp-0.dll)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -municode")
|
||||
endif()
|
||||
else()
|
||||
find_package(Poppler REQUIRED COMPONENTS cpp)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -25,8 +25,15 @@
|
|||
#include <io.h>
|
||||
#include <windows.h>
|
||||
|
||||
#if defined(_MSC_VER) // MSVC compiler.
|
||||
int wmain(int argc, wchar_t* argv[])
|
||||
{
|
||||
#else
|
||||
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
|
||||
{
|
||||
wchar_t** argv {__wargv};
|
||||
int argc = __argc;
|
||||
#endif
|
||||
HANDLE stdoutHandle {GetStdHandle(STD_OUTPUT_HANDLE)};
|
||||
|
||||
if (stdoutHandle == INVALID_HANDLE_VALUE) {
|
||||
|
@ -111,7 +118,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
std::ifstream file;
|
||||
|
||||
file.open(path, std::ifstream::binary);
|
||||
file.open(path.c_str(), std::ifstream::binary);
|
||||
if (file.fail()) {
|
||||
std::cerr << "Error: Couldn't open PDF file, permission problems?" << std::endl;
|
||||
exit(-1);
|
||||
|
|
Loading…
Reference in a new issue