2017-06-30 19:00:45 +00:00
|
|
|
include_directories(${PROJECT_SOURCE_DIR}/include)
|
2017-06-30 23:18:54 +00:00
|
|
|
|
2017-07-25 20:40:30 +00:00
|
|
|
option(ENABLE_IO_THREAD "Start up a separate I/O thread, otherwise I'd need to call an update function" ON)
|
2017-07-31 22:58:39 +00:00
|
|
|
option(BUILD_DYNAMIC_LIB "Build library as a DLL" OFF)
|
2017-07-25 20:40:30 +00:00
|
|
|
|
2017-08-01 20:32:56 +00:00
|
|
|
set(BASE_RPC_SRC
|
|
|
|
${PROJECT_SOURCE_DIR}/include/discord-rpc.h
|
|
|
|
discord-rpc.cpp
|
2017-09-14 15:59:32 +00:00
|
|
|
discord_register.h
|
2017-08-01 20:32:56 +00:00
|
|
|
rpc_connection.h
|
|
|
|
rpc_connection.cpp
|
|
|
|
serialization.h
|
|
|
|
serialization.cpp
|
|
|
|
connection.h
|
|
|
|
backoff.h
|
2017-10-12 20:06:55 +00:00
|
|
|
msg_queue.h
|
2017-08-01 20:32:56 +00:00
|
|
|
)
|
2017-07-25 20:40:30 +00:00
|
|
|
|
2017-08-01 20:32:56 +00:00
|
|
|
if (${BUILD_DYNAMIC_LIB})
|
|
|
|
set(RPC_LIBRARY_TYPE SHARED)
|
2017-09-14 15:59:32 +00:00
|
|
|
if(WIN32)
|
|
|
|
set(BASE_RPC_SRC ${BASE_RPC_SRC} dllmain.cpp)
|
|
|
|
endif(WIN32)
|
2017-08-01 20:32:56 +00:00
|
|
|
else(${BUILD_DYNAMIC_LIB})
|
2017-07-31 22:58:39 +00:00
|
|
|
set(RPC_LIBRARY_TYPE STATIC)
|
2017-08-01 20:32:56 +00:00
|
|
|
endif(${BUILD_DYNAMIC_LIB})
|
2017-06-30 23:18:54 +00:00
|
|
|
|
|
|
|
if(WIN32)
|
2017-09-14 15:59:32 +00:00
|
|
|
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})
|
2017-07-27 20:52:37 +00:00
|
|
|
target_compile_options(discord-rpc PRIVATE /W4)
|
2017-06-30 23:18:54 +00:00
|
|
|
endif(WIN32)
|
2017-07-13 15:32:08 +00:00
|
|
|
|
2017-07-13 17:08:14 +00:00
|
|
|
if(UNIX)
|
2017-09-14 15:59:32 +00:00
|
|
|
set(BASE_RPC_SRC ${BASE_RPC_SRC} connection_unix.cpp)
|
|
|
|
|
|
|
|
if (APPLE)
|
|
|
|
add_definitions(-DDISCORD_OSX)
|
|
|
|
set(BASE_RPC_SRC ${BASE_RPC_SRC} discord_register_osx.m)
|
|
|
|
else (APPLE)
|
|
|
|
add_definitions(-DDISCORD_LINUX)
|
|
|
|
set(BASE_RPC_SRC ${BASE_RPC_SRC} discord_register_linux.cpp)
|
|
|
|
endif(APPLE)
|
|
|
|
|
|
|
|
add_library(discord-rpc ${RPC_LIBRARY_TYPE} ${BASE_RPC_SRC})
|
2017-07-27 22:09:05 +00:00
|
|
|
target_link_libraries(discord-rpc PUBLIC pthread)
|
2017-09-14 15:59:32 +00:00
|
|
|
target_compile_options(discord-rpc PRIVATE -g -Wall)
|
|
|
|
target_compile_options(discord-rpc PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-std=c++14>)
|
|
|
|
|
|
|
|
if (APPLE)
|
|
|
|
target_link_libraries(discord-rpc PRIVATE "-framework AppKit")
|
|
|
|
endif (APPLE)
|
2017-07-13 17:08:14 +00:00
|
|
|
endif(UNIX)
|
2017-07-17 16:28:54 +00:00
|
|
|
|
2017-07-18 21:29:54 +00:00
|
|
|
target_include_directories(discord-rpc PRIVATE ${RAPIDJSON}/include)
|
2017-07-25 17:15:42 +00:00
|
|
|
|
2017-09-07 16:05:41 +00:00
|
|
|
if (NOT ${ENABLE_IO_THREAD})
|
|
|
|
add_definitions(discord-rpc PUBLIC -DDISCORD_DISABLE_IO_THREAD)
|
|
|
|
endif (NOT ${ENABLE_IO_THREAD})
|
|
|
|
|
2017-08-01 20:32:56 +00:00
|
|
|
if (${BUILD_DYNAMIC_LIB})
|
2017-07-31 22:58:39 +00:00
|
|
|
target_compile_definitions(discord-rpc PUBLIC -DDISCORD_DYNAMIC_LIB)
|
|
|
|
target_compile_definitions(discord-rpc PRIVATE -DDISCORD_BUILDING_SDK)
|
2017-08-01 20:32:56 +00:00
|
|
|
endif(${BUILD_DYNAMIC_LIB})
|
2017-07-31 22:58:39 +00:00
|
|
|
|
2017-07-25 17:15:42 +00:00
|
|
|
add_dependencies(discord-rpc clangformat)
|
2017-07-25 23:00:12 +00:00
|
|
|
|
|
|
|
# install
|
|
|
|
|
|
|
|
install(
|
|
|
|
TARGETS discord-rpc
|
|
|
|
EXPORT "discord-rpc"
|
2017-09-07 16:05:41 +00:00
|
|
|
RUNTIME
|
|
|
|
DESTINATION "bin"
|
|
|
|
CONFIGURATIONS Release
|
|
|
|
LIBRARY
|
|
|
|
DESTINATION "lib"
|
|
|
|
CONFIGURATIONS Release
|
|
|
|
ARCHIVE
|
|
|
|
DESTINATION "lib"
|
|
|
|
CONFIGURATIONS Release
|
|
|
|
INCLUDES
|
|
|
|
DESTINATION "include"
|
2017-07-25 23:00:12 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
install(
|
|
|
|
FILES
|
|
|
|
"../include/discord-rpc.h"
|
|
|
|
DESTINATION "include"
|
2017-09-07 16:05:41 +00:00
|
|
|
)
|