fix static library builds and build static and shared in ci
This commit is contained in:
11
appveyor.yml
11
appveyor.yml
@@ -4,13 +4,18 @@ version: 2.4.3.{build}
|
||||
|
||||
image: Visual Studio 2019
|
||||
|
||||
skip_commits:
|
||||
files:
|
||||
- doc/*
|
||||
environment:
|
||||
matrix:
|
||||
- GGPO_SHARED_LIB: on
|
||||
- GGPO_SHARED_LIB: off
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
|
||||
skip_commits:
|
||||
files:
|
||||
- doc/*
|
||||
|
||||
configuration:
|
||||
- Debug
|
||||
- Release
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
@echo off
|
||||
set local
|
||||
|
||||
cmake -G "Visual Studio 16 2019" -A x64 -B build -DBUILD_SHARED_LIBS=off
|
||||
IF "%GGPO_SHARED_LIB%" == "" (
|
||||
echo GGPO_SHARED_LIB not set. Defaulting to off
|
||||
set GGPO_SHARED_LIB=off
|
||||
)
|
||||
|
||||
echo Generating GGPO Visual Studio solution files.
|
||||
echo GGPO_SHARED_LIB=%GGPO_SHARED_LIB%
|
||||
|
||||
cmake -G "Visual Studio 16 2019" -A x64 -B build -DBUILD_SHARED_LIBS=%GGPO_SHARED_LIB%
|
||||
|
||||
echo Finished! Open build/GGPO.sln in Visual Studio to build.
|
||||
|
||||
IF "%1"=="--no-prompt" goto :done
|
||||
:: pause so the user can see the output if they double clicked the configure script
|
||||
pause
|
||||
|
||||
:done
|
||||
:done
|
||||
|
||||
@@ -14,13 +14,12 @@ target_include_directories(GGPO PUBLIC
|
||||
if(WIN32 AND BUILD_SHARED_LIBS)
|
||||
# Link to Multimedia API and Winsocks during a shared build.
|
||||
target_link_libraries(GGPO PUBLIC winmm.lib ws2_32.lib)
|
||||
add_definitions(-DGGPO_SHARED_LIB)
|
||||
add_definitions(-DGGPO_SDK_EXPORT)
|
||||
endif()
|
||||
|
||||
set_target_properties(GGPO PROPERTIES VERSION ${PROJECT_VERSION})
|
||||
|
||||
# Export the SDK.
|
||||
add_definitions(-DGGPO_SDK_EXPORT)
|
||||
|
||||
# Install
|
||||
install(
|
||||
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
|
||||
@@ -4,6 +4,10 @@ add_executable(VectorWar WIN32
|
||||
${GGPO_EXAMPLES_VECTORWAR_SRC}
|
||||
)
|
||||
|
||||
if(WIN32 AND BUILD_SHARED_LIBS)
|
||||
add_definitions(-DGGPO_SHARED_LIB)
|
||||
endif()
|
||||
|
||||
add_common_flags(VectorWar)
|
||||
# Change the character set to unicode.
|
||||
add_definitions(-D_UNICODE -DUNICODE)
|
||||
|
||||
@@ -17,13 +17,17 @@ extern "C" {
|
||||
// On windows, export at build time and import at runtime.
|
||||
// ELF systems don't need an explicit export/import.
|
||||
#ifdef _WIN32
|
||||
# if defined(GGPO_SHARED_LIB)
|
||||
# ifdef GGPO_SDK_EXPORT
|
||||
# define GGPO_EXPORT __declspec(dllexport)
|
||||
# define GGPO_API __declspec(dllexport)
|
||||
# else
|
||||
# define GGPO_API __declspec(dllimport)
|
||||
# endif
|
||||
# else
|
||||
# define GGPO_EXPORT __declspec(dllimport)
|
||||
# define GGPO_API
|
||||
# endif
|
||||
#else
|
||||
# define GGPO_EXPORT
|
||||
# define GGPO_API
|
||||
#endif
|
||||
|
||||
#define GGPO_MAX_PLAYERS 4
|
||||
@@ -315,12 +319,12 @@ typedef struct GGPONetworkStats {
|
||||
*
|
||||
* local_port - The port GGPO should bind to for UDP traffic.
|
||||
*/
|
||||
GGPO_EXPORT GGPOErrorCode __cdecl ggpo_start_session(GGPOSession **session,
|
||||
GGPOSessionCallbacks *cb,
|
||||
const char *game,
|
||||
int num_players,
|
||||
int input_size,
|
||||
int localport);
|
||||
GGPO_API GGPOErrorCode __cdecl ggpo_start_session(GGPOSession **session,
|
||||
GGPOSessionCallbacks *cb,
|
||||
const char *game,
|
||||
int num_players,
|
||||
int input_size,
|
||||
int localport);
|
||||
|
||||
|
||||
/*
|
||||
@@ -334,9 +338,9 @@ GGPO_EXPORT GGPOErrorCode __cdecl ggpo_start_session(GGPOSession **session,
|
||||
* handle - An out parameter to a handle used to identify this player in the future.
|
||||
* (e.g. in the on_event callbacks).
|
||||
*/
|
||||
GGPO_EXPORT GGPOErrorCode __cdecl ggpo_add_player(GGPOSession *session,
|
||||
GGPOPlayer *player,
|
||||
GGPOPlayerHandle *handle);
|
||||
GGPO_API GGPOErrorCode __cdecl ggpo_add_player(GGPOSession *session,
|
||||
GGPOPlayer *player,
|
||||
GGPOPlayerHandle *handle);
|
||||
|
||||
|
||||
/*
|
||||
@@ -363,12 +367,12 @@ GGPO_EXPORT GGPOErrorCode __cdecl ggpo_add_player(GGPOSession *session,
|
||||
* recommended value is 1.
|
||||
*
|
||||
*/
|
||||
GGPO_EXPORT GGPOErrorCode __cdecl ggpo_start_synctest(GGPOSession **session,
|
||||
GGPOSessionCallbacks *cb,
|
||||
char *game,
|
||||
int num_players,
|
||||
int input_size,
|
||||
int frames);
|
||||
GGPO_API GGPOErrorCode __cdecl ggpo_start_synctest(GGPOSession **session,
|
||||
GGPOSessionCallbacks *cb,
|
||||
char *game,
|
||||
int num_players,
|
||||
int input_size,
|
||||
int frames);
|
||||
|
||||
|
||||
/*
|
||||
@@ -395,21 +399,21 @@ GGPO_EXPORT GGPOErrorCode __cdecl ggpo_start_synctest(GGPOSession **session,
|
||||
*
|
||||
* host_port - The port of the session on the host
|
||||
*/
|
||||
GGPO_EXPORT GGPOErrorCode __cdecl ggpo_start_spectating(GGPOSession **session,
|
||||
GGPOSessionCallbacks *cb,
|
||||
const char *game,
|
||||
int num_players,
|
||||
int input_size,
|
||||
int local_port,
|
||||
char *host_ip,
|
||||
int host_port);
|
||||
GGPO_API GGPOErrorCode __cdecl ggpo_start_spectating(GGPOSession **session,
|
||||
GGPOSessionCallbacks *cb,
|
||||
const char *game,
|
||||
int num_players,
|
||||
int input_size,
|
||||
int local_port,
|
||||
char *host_ip,
|
||||
int host_port);
|
||||
|
||||
/*
|
||||
* ggpo_close_session --
|
||||
* Used to close a session. You must call ggpo_close_session to
|
||||
* free the resources allocated in ggpo_start_session.
|
||||
*/
|
||||
GGPO_EXPORT GGPOErrorCode __cdecl ggpo_close_session(GGPOSession *);
|
||||
GGPO_API GGPOErrorCode __cdecl ggpo_close_session(GGPOSession *);
|
||||
|
||||
|
||||
/*
|
||||
@@ -418,9 +422,9 @@ GGPO_EXPORT GGPOErrorCode __cdecl ggpo_close_session(GGPOSession *);
|
||||
* Change the amount of frames ggpo will delay local input. Must be called
|
||||
* before the first call to ggpo_synchronize_input.
|
||||
*/
|
||||
GGPO_EXPORT GGPOErrorCode __cdecl ggpo_set_frame_delay(GGPOSession *,
|
||||
GGPOPlayerHandle player,
|
||||
int frame_delay);
|
||||
GGPO_API GGPOErrorCode __cdecl ggpo_set_frame_delay(GGPOSession *,
|
||||
GGPOPlayerHandle player,
|
||||
int frame_delay);
|
||||
|
||||
/*
|
||||
* ggpo_idle --
|
||||
@@ -431,8 +435,8 @@ GGPO_EXPORT GGPOErrorCode __cdecl ggpo_set_frame_delay(GGPOSession *,
|
||||
* timeout - The amount of time GGPO.net is allowed to spend in this function,
|
||||
* in milliseconds.
|
||||
*/
|
||||
GGPO_EXPORT GGPOErrorCode __cdecl ggpo_idle(GGPOSession *,
|
||||
int timeout);
|
||||
GGPO_API GGPOErrorCode __cdecl ggpo_idle(GGPOSession *,
|
||||
int timeout);
|
||||
|
||||
/*
|
||||
* ggpo_add_local_input --
|
||||
@@ -449,10 +453,10 @@ GGPO_EXPORT GGPOErrorCode __cdecl ggpo_idle(GGPOSession *,
|
||||
* size - The size of the controller inputs. This must be exactly equal to the
|
||||
* size passed into ggpo_start_session.
|
||||
*/
|
||||
GGPO_EXPORT GGPOErrorCode __cdecl ggpo_add_local_input(GGPOSession *,
|
||||
GGPOPlayerHandle player,
|
||||
void *values,
|
||||
int size);
|
||||
GGPO_API GGPOErrorCode __cdecl ggpo_add_local_input(GGPOSession *,
|
||||
GGPOPlayerHandle player,
|
||||
void *values,
|
||||
int size);
|
||||
|
||||
/*
|
||||
* ggpo_synchronize_input --
|
||||
@@ -471,10 +475,10 @@ GGPO_EXPORT GGPOErrorCode __cdecl ggpo_add_local_input(GGPOSession *,
|
||||
* that player will be zeroed and the i-th flag will be set. For example,
|
||||
* if only player 3 has disconnected, disconnect flags will be 8 (i.e. 1 << 3).
|
||||
*/
|
||||
GGPO_EXPORT GGPOErrorCode __cdecl ggpo_synchronize_input(GGPOSession *,
|
||||
void *values,
|
||||
int size,
|
||||
int *disconnect_flags);
|
||||
GGPO_API GGPOErrorCode __cdecl ggpo_synchronize_input(GGPOSession *,
|
||||
void *values,
|
||||
int size,
|
||||
int *disconnect_flags);
|
||||
|
||||
/*
|
||||
* ggpo_disconnect_player --
|
||||
@@ -482,8 +486,8 @@ GGPO_EXPORT GGPOErrorCode __cdecl ggpo_synchronize_input(GGPOSession *,
|
||||
* Disconnects a remote player from a game. Will return GGPO_ERRORCODE_PLAYER_DISCONNECTED
|
||||
* if you try to disconnect a player who has already been disconnected.
|
||||
*/
|
||||
GGPO_EXPORT GGPOErrorCode __cdecl ggpo_disconnect_player(GGPOSession *,
|
||||
GGPOPlayerHandle player);
|
||||
GGPO_API GGPOErrorCode __cdecl ggpo_disconnect_player(GGPOSession *,
|
||||
GGPOPlayerHandle player);
|
||||
|
||||
/*
|
||||
* ggpo_advance_frame --
|
||||
@@ -493,7 +497,7 @@ GGPO_EXPORT GGPOErrorCode __cdecl ggpo_disconnect_player(GGPOSession *,
|
||||
* you advance the gamestate by a frame, even during rollbacks. GGPO.net
|
||||
* may call your save_state callback before this function returns.
|
||||
*/
|
||||
GGPO_EXPORT GGPOErrorCode __cdecl ggpo_advance_frame(GGPOSession *);
|
||||
GGPO_API GGPOErrorCode __cdecl ggpo_advance_frame(GGPOSession *);
|
||||
|
||||
/*
|
||||
* ggpo_get_network_stats --
|
||||
@@ -505,9 +509,9 @@ GGPO_EXPORT GGPOErrorCode __cdecl ggpo_advance_frame(GGPOSession *);
|
||||
*
|
||||
* stats - Out parameter to the network statistics.
|
||||
*/
|
||||
GGPO_EXPORT GGPOErrorCode __cdecl ggpo_get_network_stats(GGPOSession *,
|
||||
GGPOPlayerHandle player,
|
||||
GGPONetworkStats *stats);
|
||||
GGPO_API GGPOErrorCode __cdecl ggpo_get_network_stats(GGPOSession *,
|
||||
GGPOPlayerHandle player,
|
||||
GGPONetworkStats *stats);
|
||||
|
||||
/*
|
||||
* ggpo_set_disconnect_timeout --
|
||||
@@ -521,8 +525,8 @@ GGPO_EXPORT GGPOErrorCode __cdecl ggpo_get_network_stats(GGPOSession *,
|
||||
*
|
||||
* timeout - The time in milliseconds to wait before disconnecting a peer.
|
||||
*/
|
||||
GGPO_EXPORT GGPOErrorCode __cdecl ggpo_set_disconnect_timeout(GGPOSession *,
|
||||
int timeout);
|
||||
GGPO_API GGPOErrorCode __cdecl ggpo_set_disconnect_timeout(GGPOSession *,
|
||||
int timeout);
|
||||
|
||||
/*
|
||||
* ggpo_set_disconnect_notify_start --
|
||||
@@ -533,8 +537,8 @@ GGPO_EXPORT GGPOErrorCode __cdecl ggpo_set_disconnect_timeout(GGPOSession *,
|
||||
* timeout - The amount of time which needs to elapse without receiving a packet
|
||||
* before the GGPO_EVENTCODE_NETWORK_INTERRUPTED event is sent.
|
||||
*/
|
||||
GGPO_EXPORT GGPOErrorCode __cdecl ggpo_set_disconnect_notify_start(GGPOSession *,
|
||||
int timeout);
|
||||
GGPO_API GGPOErrorCode __cdecl ggpo_set_disconnect_notify_start(GGPOSession *,
|
||||
int timeout);
|
||||
|
||||
/*
|
||||
* ggpo_log --
|
||||
@@ -544,17 +548,17 @@ GGPO_EXPORT GGPOErrorCode __cdecl ggpo_set_disconnect_notify_start(GGPOSession *
|
||||
* variable is set to 1. This will change in future versions of the
|
||||
* SDK.
|
||||
*/
|
||||
GGPO_EXPORT void __cdecl ggpo_log(GGPOSession *,
|
||||
const char *fmt, ...);
|
||||
GGPO_API void __cdecl ggpo_log(GGPOSession *,
|
||||
const char *fmt, ...);
|
||||
/*
|
||||
* ggpo_logv --
|
||||
*
|
||||
* A varargs compatible version of ggpo_log. See ggpo_log for
|
||||
* more details.
|
||||
*/
|
||||
GGPO_EXPORT void __cdecl ggpo_logv(GGPOSession *,
|
||||
const char *fmt,
|
||||
va_list args);
|
||||
GGPO_API void __cdecl ggpo_logv(GGPOSession *,
|
||||
const char *fmt,
|
||||
va_list args);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user