diff --git a/README.md b/README.md index 9c5d9bd..73e28aa 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/build.py b/build.py index 6d984a9..cbc7396 100755 --- a/build.py +++ b/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() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fa516d5..3b96961 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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)