This extends and refactors the original CMake script to make it nicer. The structure of it is loosely based on that used in bs::framework project. - Separate the Main SDK build definitions to its own CMakeLists.txt. Source file lists for each project were also moved to file CMakeSources.cmake, cataloged based on a folder they're in and the filter definitions for VS were added. - During build the executable/library artifacts are now stored in <BUILD_DIR>/<BIN_OR_LIB>/<ARCHITECTURE>/<BUILD_TYPE>. The scripts were modified to reflect that change. - Added most of the build flags from the original VS project with some new one. - Added some properties to explicitly configure the build environment. - Add ability to install the libraries for distribution. - Other small renaming, cleanups and things that I've forgotten.
36 lines
1.1 KiB
CMake
36 lines
1.1 KiB
CMake
cmake_minimum_required(VERSION 3.2)
|
|
|
|
# TODO: SDK Versioning.
|
|
project(GGPO VERSION 1.0.0)
|
|
|
|
# Remove RelWithDebInfo and MinSizeRelease build types to match the original Visual Studio Project.
|
|
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
|
|
|
|
include(src/cmake/properties.cmake)
|
|
include(src/cmake/helper_methods.cmake)
|
|
|
|
if(WIN32)
|
|
## Prevent the CMake trying to install GGPO in Program Files on Windows
|
|
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
|
set (CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/installed" CACHE PATH "Default install path" FORCE)
|
|
endif()
|
|
endif()
|
|
|
|
# What do we want to build?
|
|
option(GGPO_BUILD_SDK "Enable the build of the GGPO SDK" ON)
|
|
option(GGPO_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)
|
|
|
|
if(GGPO_BUILD_SDK)
|
|
add_subdirectory(src)
|
|
endif()
|
|
|
|
if(GGPO_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()
|