mirror of
https://github.com/yuzu-emu/discord-rpc.git
synced 2024-11-27 15:14:15 +01:00
Use cmake-standard flag BUILD_SHARED_LIBS
This removes custom `BUILD_DYNAMIC_LIB` option and replaces it with a standard BUILD_SHARED_LIBS: https://cmake.org/cmake/help/v3.7/variable/BUILD_SHARED_LIBS.html Although not mentioned in the documentation there, this flag is implicitly available.
This commit is contained in:
parent
cfd6470946
commit
d121bbe709
@ -42,7 +42,7 @@ Sometimes I use the generated project files. There are a couple of CMake options
|
||||
| flag | default | does |
|
||||
|------|---------|------|
|
||||
| `ENABLE_IO_THREAD` | `ON` | When enabled, we start up a thread to do io processing, if disabled you should call `Discord_UpdateConnection` yourself.
|
||||
| `BUILD_DYNAMIC_LIB` | `OFF` | Build library as a DLL
|
||||
| `BUILD_SHARED_LIBS` | `OFF` | Build library as a DLL
|
||||
|
||||
You can also try the `build.py` script for an easy compile for whatever OS you are on.
|
||||
|
||||
|
6
build.py
6
build.py
@ -73,9 +73,9 @@ def main(clean):
|
||||
generator64 = 'Visual Studio 14 2015 Win64'
|
||||
|
||||
build_lib('win32-static', generator32, {})
|
||||
build_lib('win32-dynamic', generator32, {'BUILD_DYNAMIC_LIB': True})
|
||||
build_lib('win32-dynamic', generator32, {'BUILD_SHARED_LIBS': True})
|
||||
build_lib('win64-static', generator64, {})
|
||||
build_lib('win64-dynamic', generator64, {'BUILD_DYNAMIC_LIB': True})
|
||||
build_lib('win64-dynamic', generator64, {'BUILD_SHARED_LIBS': True})
|
||||
|
||||
# todo: this in some better way
|
||||
src_dll = os.path.join(SCRIPT_PATH, 'builds', 'win64-dynamic', 'src', 'Release', 'discord-rpc.dll')
|
||||
@ -85,7 +85,7 @@ def main(clean):
|
||||
shutil.copy(src_dll, dst_dll)
|
||||
elif sys.platform == 'darwin':
|
||||
build_lib('osx-static', None, {})
|
||||
build_lib('osx-dynamic', None, {'BUILD_DYNAMIC_LIB': True})
|
||||
build_lib('osx-dynamic', None, {'BUILD_SHARED_LIBS': True})
|
||||
|
||||
create_archive()
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
include_directories(${PROJECT_SOURCE_DIR}/include)
|
||||
|
||||
option(ENABLE_IO_THREAD "Start up a separate I/O thread, otherwise I'd need to call an update function" ON)
|
||||
option(BUILD_DYNAMIC_LIB "Build library as a DLL" OFF)
|
||||
|
||||
set(BASE_RPC_SRC
|
||||
${PROJECT_SOURCE_DIR}/include/discord-rpc.h
|
||||
@ -16,19 +15,16 @@ set(BASE_RPC_SRC
|
||||
msg_queue.h
|
||||
)
|
||||
|
||||
if (${BUILD_DYNAMIC_LIB})
|
||||
set(RPC_LIBRARY_TYPE SHARED)
|
||||
if (${BUILD_SHARED_LIBS})
|
||||
if(WIN32)
|
||||
set(BASE_RPC_SRC ${BASE_RPC_SRC} dllmain.cpp)
|
||||
endif(WIN32)
|
||||
else(${BUILD_DYNAMIC_LIB})
|
||||
set(RPC_LIBRARY_TYPE STATIC)
|
||||
endif(${BUILD_DYNAMIC_LIB})
|
||||
endif(${BUILD_SHARED_LIBS})
|
||||
|
||||
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})
|
||||
add_library(discord-rpc ${BASE_RPC_SRC})
|
||||
if (MSVC)
|
||||
target_compile_options(discord-rpc PRIVATE /EHsc
|
||||
/MT
|
||||
@ -60,7 +56,7 @@ if(UNIX)
|
||||
set(BASE_RPC_SRC ${BASE_RPC_SRC} discord_register_linux.cpp)
|
||||
endif(APPLE)
|
||||
|
||||
add_library(discord-rpc ${RPC_LIBRARY_TYPE} ${BASE_RPC_SRC})
|
||||
add_library(discord-rpc ${BASE_RPC_SRC})
|
||||
target_link_libraries(discord-rpc PUBLIC pthread)
|
||||
target_compile_options(discord-rpc PRIVATE
|
||||
-g
|
||||
@ -91,10 +87,10 @@ if (NOT ${ENABLE_IO_THREAD})
|
||||
target_compile_definitions(discord-rpc PUBLIC -DDISCORD_DISABLE_IO_THREAD)
|
||||
endif (NOT ${ENABLE_IO_THREAD})
|
||||
|
||||
if (${BUILD_DYNAMIC_LIB})
|
||||
if (${BUILD_SHARED_LIBS})
|
||||
target_compile_definitions(discord-rpc PUBLIC -DDISCORD_DYNAMIC_LIB)
|
||||
target_compile_definitions(discord-rpc PRIVATE -DDISCORD_BUILDING_SDK)
|
||||
endif(${BUILD_DYNAMIC_LIB})
|
||||
endif(${BUILD_SHARED_LIBS})
|
||||
|
||||
add_dependencies(discord-rpc clangformat)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user