Add static lib support to cmake
This commit is contained in:
@@ -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)
|
||||||
@@ -31,6 +32,13 @@ include(DoxygenTargets)
|
|||||||
|
|
||||||
add_definitions(-DWIIUSE_COMPILE_LIB)
|
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)
|
||||||
find_package(Bluez REQUIRED)
|
find_package(Bluez REQUIRED)
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ if(MSVC)
|
|||||||
list(APPEND API wiiuse_msvcstdint.h)
|
list(APPEND API wiiuse_msvcstdint.h)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(wiiuse SHARED ${SOURCES} ${API})
|
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})
|
||||||
|
|||||||
Reference in New Issue
Block a user