Merge branch 'static-library-support'

This commit is contained in:
Ryan Pavlik
2011-09-09 09:45:51 -05:00
4 changed files with 22 additions and 4 deletions

View File

@@ -19,6 +19,11 @@ Added:
by and included with RPythonic http://code.google.com/p/rpythonic/ by and included with RPythonic http://code.google.com/p/rpythonic/
Thanks to hartsantler for this feature. 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: Fixed:
- Properly disable rumbling when told to. Thanks to Jeff Baker from - Properly disable rumbling when told to. Thanks to Jeff Baker from

View File

@@ -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 "Should we build the example app?" YES)
option(BUILD_EXAMPLE_SDL "Should we build the SDL-based 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(INSTALL_EXAMPLES "Should we install the example apps?" YES)
option(CPACK_MONOLITHIC_INSTALL "Only produce a single component installer, rather than multi-component." NO) option(CPACK_MONOLITHIC_INSTALL "Only produce a single component installer, rather than multi-component." NO)
@@ -29,7 +30,12 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
include(UseBackportedModules) include(UseBackportedModules)
include(DoxygenTargets) 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) if(NOT WIN32 AND NOT APPLE)
set(LINUX YES) set(LINUX YES)

View File

@@ -34,7 +34,9 @@ if(MSVC)
list(APPEND API wiiuse_msvcstdint.h) list(APPEND API wiiuse_msvcstdint.h)
endif() endif()
add_library(wiiuse SHARED ${SOURCES} ${API}) add_definitions(-DWIIUSE_COMPILE_LIB)
add_library(wiiuse ${WIIUSE_LIB_TYPE} ${SOURCES} ${API})
if(WIN32) if(WIN32)
target_link_libraries(wiiuse ws2_32 setupapi ${WINHID_LIBRARIES}) target_link_libraries(wiiuse ws2_32 setupapi ${WINHID_LIBRARIES})

View File

@@ -727,8 +727,13 @@ typedef enum wiiuse_loglevel {
*****************************************/ *****************************************/
#ifdef WIIUSE_WIN32 #ifdef WIIUSE_WIN32
#ifdef WIIUSE_STATIC
#define WIIUSE_EXPORT_DECL
#define WIIUSE_IMPORT_DECL
#else
#define WIIUSE_EXPORT_DECL __declspec(dllexport) #define WIIUSE_EXPORT_DECL __declspec(dllexport)
#define WIIUSE_IMPORT_DECL __declspec(dllimport) #define WIIUSE_IMPORT_DECL __declspec(dllimport)
#endif
#else #else
#define WIIUSE_EXPORT_DECL #define WIIUSE_EXPORT_DECL
#define WIIUSE_IMPORT_DECL #define WIIUSE_IMPORT_DECL