Skip to content

Commit ab43974

Browse files
authored
Merge pull request #326 from thp/no-static-libraries
Do not build static libraries
2 parents 72f995f + 3047423 commit ab43974

File tree

8 files changed

+35
-59
lines changed

8 files changed

+35
-59
lines changed

bindings/CMakeLists.txt

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@ if(SWIG_FOUND)
2222
unset(CMAKE_SWIG_FLAGS)
2323
include_directories(${PYTHON_INCLUDE_PATH})
2424
swig_add_module(psmove python ${CMAKE_CURRENT_LIST_DIR}/psmove.i)
25-
swig_link_libraries(psmove psmoveapi_static ${PYTHON_LIBRARIES})
25+
swig_link_libraries(psmove psmoveapi ${PYTHON_LIBRARIES})
2626
if (PSMOVE_BUILD_TRACKER)
27-
swig_link_libraries(psmove psmoveapi_tracker_static)
27+
swig_link_libraries(psmove psmoveapi_tracker)
2828
endif()
29-
set_target_properties(_psmove PROPERTIES
30-
COMPILE_FLAGS -DUSING_STATIC_LIBRARY)
3129
set(INFO_BUILD_PYTHON_BINDINGS "Yes")
3230
else()
3331
set(INFO_BUILD_PYTHON_BINDINGS "No (libpython not found)")
@@ -45,12 +43,10 @@ if(SWIG_FOUND)
4543
set(CMAKE_SWIG_FLAGS -package ${PSMOVEAPI_JAVA_PKG})
4644
include_directories(${JNI_INCLUDE_DIRS})
4745
swig_add_module(psmove_java java ${CMAKE_CURRENT_LIST_DIR}/psmove.i)
48-
swig_link_libraries(psmove_java psmoveapi_static ${JNI_LIBRARIES})
46+
swig_link_libraries(psmove_java psmoveapi ${JNI_LIBRARIES})
4947
if (PSMOVE_BUILD_TRACKER)
50-
swig_link_libraries(psmove_java psmoveapi_tracker_static)
48+
swig_link_libraries(psmove_java psmoveapi_tracker)
5149
endif()
52-
set_target_properties(psmove_java PROPERTIES
53-
COMPILE_FLAGS -DUSING_STATIC_LIBRARY)
5450
set(INFO_BUILD_JAVA_BINDINGS "Yes")
5551

5652
add_custom_target(psmoveapi.jar ALL
@@ -128,12 +124,10 @@ if(SWIG_FOUND)
128124

129125
set(CMAKE_SWIG_FLAGS -namespace ${PSMOVEAPI_CSHARP_NS})
130126
swig_add_module(psmoveapi_csharp csharp ${CMAKE_CURRENT_LIST_DIR}/psmove.i)
131-
swig_link_libraries(psmoveapi_csharp psmoveapi_static)
127+
swig_link_libraries(psmoveapi_csharp psmoveapi)
132128
if (PSMOVE_BUILD_TRACKER)
133-
swig_link_libraries(psmoveapi_csharp psmoveapi_tracker_static)
129+
swig_link_libraries(psmoveapi_csharp psmoveapi_tracker)
134130
endif()
135-
set_target_properties(psmoveapi_csharp PROPERTIES
136-
COMPILE_FLAGS -DUSING_STATIC_LIBRARY)
137131
set(INFO_BUILD_CSHARP_BINDINGS "Yes")
138132
else()
139133
set(INFO_BUILD_CSHARP_BINDINGS "No (disabled)")

include/psmove.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,7 @@ extern "C" {
3939

4040
#ifdef _WIN32
4141
# define ADDCALL __cdecl
42-
# if defined(BUILDING_STATIC_LIBRARY)
43-
# define ADDAPI
44-
# elif defined(USING_STATIC_LIBRARY)
45-
# define ADDAPI
46-
# elif defined(BUILDING_SHARED_LIBRARY)
42+
# if defined(BUILDING_SHARED_LIBRARY)
4743
# define ADDAPI __declspec(dllexport)
4844
# else /* using shared library */
4945
# define ADDAPI __declspec(dllimport)

src/CMakeLists.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,6 @@ set_target_properties(psmoveapi PROPERTIES
166166
COMPILE_FLAGS -DBUILDING_SHARED_LIBRARY)
167167
list(APPEND PSMOVEAPI_INSTALL_TARGETS psmoveapi)
168168

169-
# Static library
170-
171-
add_library(psmoveapi_static STATIC ${PSMOVEAPI_LIBRARY_SRC})
172-
target_link_libraries(psmoveapi_static ${PSMOVEAPI_REQUIRED_LIBS})
173-
set_target_properties(psmoveapi_static PROPERTIES
174-
COMPILE_FLAGS -DBUILDING_STATIC_LIBRARY)
175-
176169
# For system-wide installation
177170

178171
if(NOT PSMOVEAPI_LIB_DEST)

src/daemon/moved_client.h

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232

3333

34+
#include "psmove.h"
35+
3436
#include "../psmove_sockets.h"
3537

3638
#include <stdio.h>
@@ -61,21 +63,21 @@ typedef struct _moved_client_list {
6163
struct _moved_client_list *next;
6264
} moved_client_list;
6365

64-
moved_client_list *
65-
moved_client_list_open();
66+
ADDAPI moved_client_list *
67+
ADDCALL moved_client_list_open();
6668

67-
void
68-
moved_client_list_destroy(moved_client_list *client_list);
69+
ADDAPI void
70+
ADDCALL moved_client_list_destroy(moved_client_list *client_list);
6971

70-
moved_client *
71-
moved_client_create(const char *hostname);
72+
ADDAPI moved_client *
73+
ADDCALL moved_client_create(const char *hostname);
7274

73-
int
74-
moved_client_send(moved_client *client, enum PSMoveMovedCmd cmd, int controller_id,
75+
ADDAPI int
76+
ADDCALL moved_client_send(moved_client *client, enum PSMoveMovedCmd cmd, int controller_id,
7577
const uint8_t *data, size_t len);
7678

77-
void
78-
moved_client_destroy(moved_client *client);
79+
ADDAPI void
80+
ADDCALL moved_client_destroy(moved_client *client);
7981

8082
#ifdef __cplusplus
8183
}

src/psmove_port.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ extern "C" {
6868
#endif
6969

7070
/* Initialize sockets API (if required) -- call before using sockets */
71-
void
72-
psmove_port_initialize_sockets();
71+
ADDAPI void
72+
ADDCALL psmove_port_initialize_sockets();
7373

7474
/**
7575
* Check if necessary permissions are available for pairing controllers
7676
* Returns non-zero if permissions are available, zero if not
7777
**/
78-
int
79-
psmove_port_check_pairing_permissions();
78+
ADDAPI int
79+
ADDCALL psmove_port_check_pairing_permissions();
8080

8181
/**
8282
* Get the current time in milliseconds since the first call
@@ -93,26 +93,26 @@ ADDCALL psmove_port_sleep_ms(uint32_t duration_ms);
9393
/**
9494
* Set the timeout to the specified time in milliseconds for a given socket
9595
**/
96-
void
97-
psmove_port_set_socket_timeout_ms(int socket, uint32_t timeout_ms);
96+
ADDAPI void
97+
ADDCALL psmove_port_set_socket_timeout_ms(int socket, uint32_t timeout_ms);
9898

9999
/**
100100
* Close a socket
101101
**/
102-
void
103-
psmove_port_close_socket(int socket);
102+
ADDAPI void
103+
ADDCALL psmove_port_close_socket(int socket);
104104

105105
/**
106106
* Get the default Bluetooth host controller address (result must be freed)
107107
**/
108-
char *
109-
psmove_port_get_host_bluetooth_address();
108+
ADDAPI char *
109+
ADDCALL psmove_port_get_host_bluetooth_address();
110110

111111
/**
112112
* Add the PS Move Bluetooth controller address to the system database
113113
**/
114-
void
115-
psmove_port_register_psmove(const char *addr, const char *host);
114+
ADDAPI void
115+
ADDCALL psmove_port_register_psmove(const char *addr, const char *host);
116116

117117
#ifdef __cplusplus
118118
}

src/psmove_sockets.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
**/
3030

3131

32+
#include "psmove.h"
3233

3334
#ifdef _WIN32
3435
# include <winsock2.h>
@@ -41,7 +42,8 @@
4142
#ifdef __cplusplus
4243
extern "C" {
4344
#endif
44-
const char *inet_ntop(int af, const void *src, char *dst, int cnt);
45+
ADDAPI const char *
46+
ADDCALL inet_ntop(int af, const void *src, char *dst, int cnt);
4547
#ifdef __cplusplus
4648
}
4749
#endif

src/tracker/CMakeLists.txt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -153,16 +153,6 @@ if(PSMOVE_BUILD_TRACKER)
153153
set_target_properties(psmoveapi_tracker PROPERTIES
154154
COMPILE_FLAGS -DBUILDING_SHARED_LIBRARY)
155155
list(APPEND PSMOVEAPI_INSTALL_TARGETS psmoveapi_tracker)
156-
157-
add_library(psmoveapi_tracker_static STATIC
158-
${PSMOVEAPI_TRACKER_SRC}
159-
${PSMOVEAPI_TRACKER_PLATFORM_SRC})
160-
target_link_libraries(psmoveapi_tracker_static
161-
psmoveapi_static
162-
${PSMOVEAPI_REQUIRED_LIBS}
163-
${PSMOVEAPI_TRACKER_REQUIRED_LIBS})
164-
set_target_properties(psmoveapi_tracker_static PROPERTIES
165-
COMPILE_FLAGS -DBUILDING_STATIC_LIBRARY)
166156
endif()
167157

168158
message("")

src/utils/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ include_directories(${ROOT_DIR}/src)
66

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

0 commit comments

Comments
 (0)