Fix mingw builds
This commit is contained in:
parent
767b15184f
commit
f22f299330
3 changed files with 16 additions and 8 deletions
|
@ -27,12 +27,12 @@ else(CLANG_FORMAT_CMD)
|
|||
endif(CLANG_FORMAT_CMD)
|
||||
|
||||
# thirdparty stuff
|
||||
execute_process(
|
||||
execute_process(
|
||||
COMMAND mkdir ${CMAKE_SOURCE_DIR}/thirdparty
|
||||
ERROR_QUIET
|
||||
)
|
||||
|
||||
find_file(RAPIDJSONTEST NAMES rapidjson rapidjson-1.1.0 PATHS ${CMAKE_SOURCE_DIR}/thirdparty)
|
||||
find_file(RAPIDJSONTEST NAMES rapidjson rapidjson-1.1.0 PATHS ${CMAKE_SOURCE_DIR}/thirdparty CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
if (NOT RAPIDJSONTEST)
|
||||
message("no rapidjson, download")
|
||||
set(RJ_TAR_FILE ${CMAKE_SOURCE_DIR}/thirdparty/v1.1.0.tar.gz)
|
||||
|
@ -44,11 +44,11 @@ if (NOT RAPIDJSONTEST)
|
|||
file(REMOVE ${RJ_TAR_FILE})
|
||||
endif(NOT RAPIDJSONTEST)
|
||||
|
||||
find_file(RAPIDJSON NAMES rapidjson rapidjson-1.1.0 PATHS ${CMAKE_SOURCE_DIR}/thirdparty)
|
||||
find_file(RAPIDJSON NAMES rapidjson rapidjson-1.1.0 PATHS ${CMAKE_SOURCE_DIR}/thirdparty CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
|
||||
add_library(rapidjson STATIC IMPORTED ${RAPIDJSON})
|
||||
|
||||
# add subdirs
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(examples/send-presence)
|
||||
add_subdirectory(examples/send-presence)
|
||||
|
|
|
@ -29,6 +29,7 @@ if(WIN32)
|
|||
add_definitions(-DDISCORD_WINDOWS)
|
||||
set(BASE_RPC_SRC ${BASE_RPC_SRC} connection_win.cpp discord_register_win.cpp)
|
||||
add_library(discord-rpc ${RPC_LIBRARY_TYPE} ${BASE_RPC_SRC})
|
||||
if (MSVC)
|
||||
target_compile_options(discord-rpc PRIVATE /EHsc
|
||||
/MT
|
||||
/Wall
|
||||
|
@ -44,6 +45,8 @@ if(WIN32)
|
|||
/wd4946 # reinterpret_cast used between related classes
|
||||
/wd5027 # move assignment operator was implicitly defined as deleted
|
||||
)
|
||||
endif(MSVC)
|
||||
target_link_libraries(discord-rpc PRIVATE psapi)
|
||||
endif(WIN32)
|
||||
|
||||
if(UNIX)
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
#ifdef __MINGW32__
|
||||
// 0x0600 == vista
|
||||
#define WINVER 0x0600
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#endif // __MINGW32__
|
||||
|
||||
#include "discord-rpc.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -6,9 +12,8 @@
|
|||
#define NOSERVICE
|
||||
#define NOIME
|
||||
#include <windows.h>
|
||||
#include <Psapi.h>
|
||||
#include <Strsafe.h>
|
||||
#pragma comment(lib, "Psapi.lib")
|
||||
#include <psapi.h>
|
||||
#include <strsafe.h>
|
||||
|
||||
void Discord_RegisterW(const wchar_t* applicationId, const wchar_t* command)
|
||||
{
|
||||
|
@ -24,7 +29,7 @@ void Discord_RegisterW(const wchar_t* applicationId, const wchar_t* command)
|
|||
StringCbPrintfW(openCommand, sizeof(openCommand), L"%s", command);
|
||||
}
|
||||
else {
|
||||
lstrcpyW(openCommand, exeFilePath);
|
||||
StringCbCopyW(openCommand, sizeof(openCommand), exeFilePath);
|
||||
}
|
||||
|
||||
wchar_t protocolName[64];
|
||||
|
|
Loading…
Reference in a new issue