From 1e85c72ce9f04e56046c2282d344eac3bd81cac1 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Tue, 25 Jan 2011 07:16:39 -0600 Subject: [PATCH 1/4] Merge static library support from paulburton --- src/wiiuse.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/wiiuse.h b/src/wiiuse.h index d820d3e..d092b44 100644 --- a/src/wiiuse.h +++ b/src/wiiuse.h @@ -727,8 +727,13 @@ typedef enum wiiuse_loglevel { *****************************************/ #ifdef WIIUSE_WIN32 - #define WIIUSE_EXPORT_DECL __declspec(dllexport) - #define WIIUSE_IMPORT_DECL __declspec(dllimport) + #ifdef WIIUSE_STATIC + #define WIIUSE_EXPORT_DECL + #define WIIUSE_IMPORT_DECL + #else + #define WIIUSE_EXPORT_DECL __declspec(dllexport) + #define WIIUSE_IMPORT_DECL __declspec(dllimport) + #endif #else #define WIIUSE_EXPORT_DECL #define WIIUSE_IMPORT_DECL From 3788697c5e41b1da0fd5b585651c1bfce52b7f32 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Fri, 9 Sep 2011 09:42:35 -0500 Subject: [PATCH 2/4] Add static lib support to cmake --- CMakeLists.txt | 8 ++++++++ src/CMakeLists.txt | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 982e261..f3fa48c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,7 @@ message(STATUS "Configuring WiiUse version ${CPACK_PACKAGE_VERSION}") option(BUILD_EXAMPLE "Should we build the example app?" YES) option(BUILD_EXAMPLE_SDL "Should we build the SDL-based example app?" YES) +option(BUILD_WIIUSE_SHARED_LIB "Should we build as a shared library (dll/so)?" YES) option(INSTALL_EXAMPLES "Should we install the example apps?" YES) option(CPACK_MONOLITHIC_INSTALL "Only produce a single component installer, rather than multi-component." NO) @@ -31,6 +32,13 @@ include(DoxygenTargets) add_definitions(-DWIIUSE_COMPILE_LIB) +if(BUILD_WIIUSE_SHARED_LIB) + set(WIIUSE_LIB_TYPE SHARED) +else() + set(WIIUSE_LIB_TYPE STATIC) + add_definitions(-DWIIUSE_STATIC) +endif() + if(NOT WIN32 AND NOT APPLE) set(LINUX YES) find_package(Bluez REQUIRED) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 07bcde4..690c869 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -34,7 +34,7 @@ if(MSVC) list(APPEND API wiiuse_msvcstdint.h) endif() -add_library(wiiuse SHARED ${SOURCES} ${API}) +add_library(wiiuse ${WIIUSE_LIB_TYPE} ${SOURCES} ${API}) if(WIN32) target_link_libraries(wiiuse ws2_32 setupapi ${WINHID_LIBRARIES}) From ddeed643dbe2e390221f42a10249b9cfd4af6056 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Fri, 9 Sep 2011 09:43:46 -0500 Subject: [PATCH 3/4] move "BUILDING" definition into the library's subdir --- CMakeLists.txt | 2 -- src/CMakeLists.txt | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f3fa48c..545d199 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,8 +30,6 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") include(UseBackportedModules) include(DoxygenTargets) -add_definitions(-DWIIUSE_COMPILE_LIB) - if(BUILD_WIIUSE_SHARED_LIB) set(WIIUSE_LIB_TYPE SHARED) else() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 690c869..b4572b7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -34,6 +34,8 @@ if(MSVC) list(APPEND API wiiuse_msvcstdint.h) endif() +add_definitions(-DWIIUSE_COMPILE_LIB) + add_library(wiiuse ${WIIUSE_LIB_TYPE} ${SOURCES} ${API}) if(WIN32) From 976315e5cf171106f4711913ffe886d525306b83 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Fri, 9 Sep 2011 09:45:41 -0500 Subject: [PATCH 4/4] add to changelog. --- CHANGELOG.mkd | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.mkd b/CHANGELOG.mkd index becbdc1..c132f52 100644 --- a/CHANGELOG.mkd +++ b/CHANGELOG.mkd @@ -19,6 +19,11 @@ Added: by and included with RPythonic http://code.google.com/p/rpythonic/ Thanks to hartsantler for this feature. +- Ability to build as a static library - must define WIIUSE_STATIC in + client app as well as choosing the appropriate option when building + WiiUse. The default is still a shared library (dll/so). Merged from + paulburton and added to build system. + Fixed: - Properly disable rumbling when told to. Thanks to Jeff Baker from