discord-rpc/src/CMakeLists.txt

64 lines
1.7 KiB
Text
Raw Normal View History

include_directories(${PROJECT_SOURCE_DIR}/include)
2017-07-01 00:18:54 +01:00
2017-07-25 21:40:30 +01: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 23:58:39 +01:00
option(BUILD_DYNAMIC_LIB "Build library as a DLL" OFF)
2017-07-25 21:40:30 +01:00
if (NOT ${ENABLE_IO_THREAD})
2017-07-25 21:40:30 +01:00
add_definitions(-DDISCORD_DISABLE_IO_THREAD)
endif (NOT ${ENABLE_IO_THREAD})
set(BASE_RPC_SRC
${PROJECT_SOURCE_DIR}/include/discord-rpc.h
discord-rpc.cpp
discord-register.cpp
rpc_connection.h
rpc_connection.cpp
serialization.h
serialization.cpp
connection.h
backoff.h
)
2017-07-25 21:40:30 +01:00
if (${BUILD_DYNAMIC_LIB})
set(RPC_LIBRARY_TYPE SHARED)
set(BASE_RPC_SRC ${BASE_RPC_SRC} dllmain.cpp)
else(${BUILD_DYNAMIC_LIB})
2017-07-31 23:58:39 +01:00
set(RPC_LIBRARY_TYPE STATIC)
endif(${BUILD_DYNAMIC_LIB})
2017-07-01 00:18:54 +01:00
if(WIN32)
2017-07-31 23:58:39 +01:00
add_library(discord-rpc ${RPC_LIBRARY_TYPE} ${BASE_RPC_SRC} connection_win.cpp)
2017-07-27 21:52:37 +01:00
target_compile_options(discord-rpc PRIVATE /W4)
2017-07-01 00:18:54 +01:00
endif(WIN32)
2017-07-13 16:32:08 +01:00
2017-07-13 18:08:14 +01:00
if(UNIX)
2017-07-31 23:58:39 +01:00
add_library(discord-rpc ${RPC_LIBRARY_TYPE} ${BASE_RPC_SRC} connection_unix.cpp)
2017-07-27 23:09:05 +01:00
target_link_libraries(discord-rpc PUBLIC pthread)
target_compile_options(discord-rpc PRIVATE -g -Wall)
2017-07-13 18:08:14 +01:00
endif(UNIX)
2017-07-17 17:28:54 +01:00
2017-07-18 22:29:54 +01:00
target_include_directories(discord-rpc PRIVATE ${RAPIDJSON}/include)
if (${BUILD_DYNAMIC_LIB})
2017-07-31 23:58:39 +01:00
target_compile_definitions(discord-rpc PUBLIC -DDISCORD_DYNAMIC_LIB)
target_compile_definitions(discord-rpc PRIVATE -DDISCORD_BUILDING_SDK)
endif(${BUILD_DYNAMIC_LIB})
2017-07-31 23:58:39 +01:00
add_dependencies(discord-rpc clangformat)
2017-07-26 00:00:12 +01:00
# install
install(
TARGETS discord-rpc
EXPORT "discord-rpc"
LIBRARY DESTINATION "lib"
ARCHIVE DESTINATION "lib"
INCLUDES DESTINATION "include"
)
install(
FILES
"../include/discord-rpc.h"
DESTINATION "include"
)