Skip to content

Commit

Permalink
Merge pull request #326 from thp/no-static-libraries
Browse files Browse the repository at this point in the history
Do not build static libraries
  • Loading branch information
thp authored Sep 13, 2017
2 parents 72f995f + 3047423 commit ab43974
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 59 deletions.
18 changes: 6 additions & 12 deletions bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ if(SWIG_FOUND)
unset(CMAKE_SWIG_FLAGS)
include_directories(${PYTHON_INCLUDE_PATH})
swig_add_module(psmove python ${CMAKE_CURRENT_LIST_DIR}/psmove.i)
swig_link_libraries(psmove psmoveapi_static ${PYTHON_LIBRARIES})
swig_link_libraries(psmove psmoveapi ${PYTHON_LIBRARIES})
if (PSMOVE_BUILD_TRACKER)
swig_link_libraries(psmove psmoveapi_tracker_static)
swig_link_libraries(psmove psmoveapi_tracker)
endif()
set_target_properties(_psmove PROPERTIES
COMPILE_FLAGS -DUSING_STATIC_LIBRARY)
set(INFO_BUILD_PYTHON_BINDINGS "Yes")
else()
set(INFO_BUILD_PYTHON_BINDINGS "No (libpython not found)")
Expand All @@ -45,12 +43,10 @@ if(SWIG_FOUND)
set(CMAKE_SWIG_FLAGS -package ${PSMOVEAPI_JAVA_PKG})
include_directories(${JNI_INCLUDE_DIRS})
swig_add_module(psmove_java java ${CMAKE_CURRENT_LIST_DIR}/psmove.i)
swig_link_libraries(psmove_java psmoveapi_static ${JNI_LIBRARIES})
swig_link_libraries(psmove_java psmoveapi ${JNI_LIBRARIES})
if (PSMOVE_BUILD_TRACKER)
swig_link_libraries(psmove_java psmoveapi_tracker_static)
swig_link_libraries(psmove_java psmoveapi_tracker)
endif()
set_target_properties(psmove_java PROPERTIES
COMPILE_FLAGS -DUSING_STATIC_LIBRARY)
set(INFO_BUILD_JAVA_BINDINGS "Yes")

add_custom_target(psmoveapi.jar ALL
Expand Down Expand Up @@ -128,12 +124,10 @@ if(SWIG_FOUND)

set(CMAKE_SWIG_FLAGS -namespace ${PSMOVEAPI_CSHARP_NS})
swig_add_module(psmoveapi_csharp csharp ${CMAKE_CURRENT_LIST_DIR}/psmove.i)
swig_link_libraries(psmoveapi_csharp psmoveapi_static)
swig_link_libraries(psmoveapi_csharp psmoveapi)
if (PSMOVE_BUILD_TRACKER)
swig_link_libraries(psmoveapi_csharp psmoveapi_tracker_static)
swig_link_libraries(psmoveapi_csharp psmoveapi_tracker)
endif()
set_target_properties(psmoveapi_csharp PROPERTIES
COMPILE_FLAGS -DUSING_STATIC_LIBRARY)
set(INFO_BUILD_CSHARP_BINDINGS "Yes")
else()
set(INFO_BUILD_CSHARP_BINDINGS "No (disabled)")
Expand Down
6 changes: 1 addition & 5 deletions include/psmove.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ extern "C" {

#ifdef _WIN32
# define ADDCALL __cdecl
# if defined(BUILDING_STATIC_LIBRARY)
# define ADDAPI
# elif defined(USING_STATIC_LIBRARY)
# define ADDAPI
# elif defined(BUILDING_SHARED_LIBRARY)
# if defined(BUILDING_SHARED_LIBRARY)
# define ADDAPI __declspec(dllexport)
# else /* using shared library */
# define ADDAPI __declspec(dllimport)
Expand Down
7 changes: 0 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,6 @@ set_target_properties(psmoveapi PROPERTIES
COMPILE_FLAGS -DBUILDING_SHARED_LIBRARY)
list(APPEND PSMOVEAPI_INSTALL_TARGETS psmoveapi)

# Static library

add_library(psmoveapi_static STATIC ${PSMOVEAPI_LIBRARY_SRC})
target_link_libraries(psmoveapi_static ${PSMOVEAPI_REQUIRED_LIBS})
set_target_properties(psmoveapi_static PROPERTIES
COMPILE_FLAGS -DBUILDING_STATIC_LIBRARY)

# For system-wide installation

if(NOT PSMOVEAPI_LIB_DEST)
Expand Down
22 changes: 12 additions & 10 deletions src/daemon/moved_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@



#include "psmove.h"

#include "../psmove_sockets.h"

#include <stdio.h>
Expand Down Expand Up @@ -61,21 +63,21 @@ typedef struct _moved_client_list {
struct _moved_client_list *next;
} moved_client_list;

moved_client_list *
moved_client_list_open();
ADDAPI moved_client_list *
ADDCALL moved_client_list_open();

void
moved_client_list_destroy(moved_client_list *client_list);
ADDAPI void
ADDCALL moved_client_list_destroy(moved_client_list *client_list);

moved_client *
moved_client_create(const char *hostname);
ADDAPI moved_client *
ADDCALL moved_client_create(const char *hostname);

int
moved_client_send(moved_client *client, enum PSMoveMovedCmd cmd, int controller_id,
ADDAPI int
ADDCALL moved_client_send(moved_client *client, enum PSMoveMovedCmd cmd, int controller_id,
const uint8_t *data, size_t len);

void
moved_client_destroy(moved_client *client);
ADDAPI void
ADDCALL moved_client_destroy(moved_client *client);

#ifdef __cplusplus
}
Expand Down
24 changes: 12 additions & 12 deletions src/psmove_port.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ extern "C" {
#endif

/* Initialize sockets API (if required) -- call before using sockets */
void
psmove_port_initialize_sockets();
ADDAPI void
ADDCALL psmove_port_initialize_sockets();

/**
* Check if necessary permissions are available for pairing controllers
* Returns non-zero if permissions are available, zero if not
**/
int
psmove_port_check_pairing_permissions();
ADDAPI int
ADDCALL psmove_port_check_pairing_permissions();

/**
* Get the current time in milliseconds since the first call
Expand All @@ -93,26 +93,26 @@ ADDCALL psmove_port_sleep_ms(uint32_t duration_ms);
/**
* Set the timeout to the specified time in milliseconds for a given socket
**/
void
psmove_port_set_socket_timeout_ms(int socket, uint32_t timeout_ms);
ADDAPI void
ADDCALL psmove_port_set_socket_timeout_ms(int socket, uint32_t timeout_ms);

/**
* Close a socket
**/
void
psmove_port_close_socket(int socket);
ADDAPI void
ADDCALL psmove_port_close_socket(int socket);

/**
* Get the default Bluetooth host controller address (result must be freed)
**/
char *
psmove_port_get_host_bluetooth_address();
ADDAPI char *
ADDCALL psmove_port_get_host_bluetooth_address();

/**
* Add the PS Move Bluetooth controller address to the system database
**/
void
psmove_port_register_psmove(const char *addr, const char *host);
ADDAPI void
ADDCALL psmove_port_register_psmove(const char *addr, const char *host);

#ifdef __cplusplus
}
Expand Down
4 changes: 3 additions & 1 deletion src/psmove_sockets.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
**/


#include "psmove.h"

#ifdef _WIN32
# include <winsock2.h>
Expand All @@ -41,7 +42,8 @@
#ifdef __cplusplus
extern "C" {
#endif
const char *inet_ntop(int af, const void *src, char *dst, int cnt);
ADDAPI const char *
ADDCALL inet_ntop(int af, const void *src, char *dst, int cnt);
#ifdef __cplusplus
}
#endif
Expand Down
10 changes: 0 additions & 10 deletions src/tracker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,6 @@ if(PSMOVE_BUILD_TRACKER)
set_target_properties(psmoveapi_tracker PROPERTIES
COMPILE_FLAGS -DBUILDING_SHARED_LIBRARY)
list(APPEND PSMOVEAPI_INSTALL_TARGETS psmoveapi_tracker)

add_library(psmoveapi_tracker_static STATIC
${PSMOVEAPI_TRACKER_SRC}
${PSMOVEAPI_TRACKER_PLATFORM_SRC})
target_link_libraries(psmoveapi_tracker_static
psmoveapi_static
${PSMOVEAPI_REQUIRED_LIBS}
${PSMOVEAPI_TRACKER_REQUIRED_LIBS})
set_target_properties(psmoveapi_tracker_static PROPERTIES
COMPILE_FLAGS -DBUILDING_STATIC_LIBRARY)
endif()

message("")
Expand Down
3 changes: 1 addition & 2 deletions src/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ include_directories(${ROOT_DIR}/src)

# New command line interface
add_executable(psmove ${CMAKE_CURRENT_LIST_DIR}/psmovecli.cpp)
target_link_libraries(psmove psmoveapi_static)
set_target_properties(psmove PROPERTIES COMPILE_FLAGS -DUSING_STATIC_LIBRARY)
target_link_libraries(psmove psmoveapi)
set_property(TARGET psmove PROPERTY FOLDER "Utilities")
list(APPEND PSMOVEAPI_INSTALL_TARGETS psmove)

0 comments on commit ab43974

Please sign in to comment.