Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake Support #10

Merged
merged 8 commits into from Oct 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
46 changes: 33 additions & 13 deletions .gitignore
@@ -1,15 +1,35 @@
# ignore visual studio directies and local files
# Ignore visual studio directies and local files
.vscode
ksmit799 marked this conversation as resolved.
Show resolved Hide resolved
build/VS2019/x64/**
build/VS2019/.vs/**
build/VS2019/Release/**
build/VS2019/Debug/**
build/VS2019/GGPO/Release/**
build/VS2019/GGPO/Debug/**
build/VS2019/GGPO/x64/**
build/VS2019/GGPO/GGPO.vcxproj.user
build/VS2019/Vectorwar/Release/**
build/VS2019/Vectorwar/Debug/**
build/VS2019/Vectorwar/x64/**
build/VS2019/VectorWar/VectorWar.vcxproj.user

# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app
68 changes: 68 additions & 0 deletions CMakeLists.txt
@@ -0,0 +1,68 @@
cmake_minimum_required(VERSION 3.2)

# TODO: SDK Versioning.
project(ggpo VERSION 1.0.0)

# What do we want to build?
option(BUILD_GGPO "Enable the build of the GGPO SDK" ON)
option(BUILD_VECTORWAR "Enable the build of the Vector War example app" ON)
option(BUILD_SHARED_LIBS "Enable the build of shared libraries (.dll/.so) instead of static ones (.lib/.a)" ON)

set(GGPO_SDK
src/include/ggponet.h
src/lib/ggpo/main.cpp
src/lib/ggpo/bitvector.h
src/lib/ggpo/bitvector.cpp
src/lib/ggpo/game_input.h
src/lib/ggpo/game_input.cpp
src/lib/ggpo/input_queue.h
src/lib/ggpo/input_queue.cpp
src/lib/ggpo/log.h
src/lib/ggpo/log.cpp
src/lib/ggpo/poll.h
src/lib/ggpo/poll.cpp
src/lib/ggpo/ring_buffer.h
src/lib/ggpo/static_buffer.h
src/lib/ggpo/sync.h
src/lib/ggpo/sync.cpp
src/lib/ggpo/timesync.h
src/lib/ggpo/timesync.cpp
src/lib/ggpo/types.h
src/lib/ggpo/zconf.h
src/lib/ggpo/zlib.h
src/lib/ggpo/backends/backend.h
src/lib/ggpo/backends/p2p.h
src/lib/ggpo/backends/p2p.cpp
src/lib/ggpo/backends/spectator.h
src/lib/ggpo/backends/spectator.cpp
src/lib/ggpo/backends/synctest.h
src/lib/ggpo/backends/synctest.cpp
src/lib/ggpo/network/udp.h
src/lib/ggpo/network/udp.cpp
src/lib/ggpo/network/udp_msg.h
src/lib/ggpo/network/udp_proto.h
src/lib/ggpo/network/udp_proto.cpp
)

if(BUILD_GGPO)
add_library(ggpo ${GGPO_SDK})

target_include_directories(ggpo PUBLIC src/include)
target_include_directories(ggpo PUBLIC src/lib/ggpo)

if(WIN32 AND BUILD_SHARED_LIBS)
# Link to Multimedia API and Winsocks during a static build.
target_link_libraries(ggpo LINK_PUBLIC winmm.lib ws2_32.lib)
endif()

set_target_properties(ggpo PROPERTIES VERSION ${PROJECT_VERSION})
endif()

if(BUILD_VECTORWAR)
# Vector War is windows only.
if(WIN32)
add_subdirectory(src/apps/vectorwar)
else()
message(WARNING "The Vector War app only supports windows, skipping...")
endif()
endif()
11 changes: 10 additions & 1 deletion README.md
Expand Up @@ -5,7 +5,16 @@ Traditional techniques account for network transmission time by adding delay to

For more information about the history of GGPO, check out http://ggpo.net/

This repository contains the code, documentation, and sample application for the Windows version of the SDK (requires Visual Studio 2019).
This repository contains the code, documentation, and sample applications for the SDK.

## Building
Building GGPO is currently only available on Windows, however efforts are being made to port it to other platforms. To get started, clone the repository using either git or svn:
```git clone https://github.com/pond3r/ggpo.git```
**OR**
```svn checkout https://github.com/pond3r/ggpo```

### Windows
On windows, it's recommended to use Visual Studio 2019 and cmake-gui (which can be downloaded [here](https://cmake.org/download/)). Once everything has been setup, open cmake-gui and select the root of the repository under ```Where is the source code:``` followed by the build folder under ```Where to build the binaries:```. Next, hit ```Configure``` and change any options that appear in the main window before hitting ```Generate``` which will generate the VS2019 solution. Once the solution has been generated, hit ```Open Project``` and build with the appropriate settings (Debug/Release). The built binaries can then be found where they were configured to be built.

## Licensing
GGPO is available under The MIT License. This means GGPO is free for commercial and non-commercial use. Attribution is not required, but appreciated.
3 changes: 3 additions & 0 deletions build/.gitignore
@@ -0,0 +1,3 @@
# Track the build directory but not its contents.
*
!.gitignore
44 changes: 0 additions & 44 deletions build/VS2019/GGPO.sln

This file was deleted.

179 changes: 0 additions & 179 deletions build/VS2019/GGPO/GGPO.vcxproj

This file was deleted.