Improve vcpkg manifest, use features for build options.

Now pulling in the required vcpkg dependencies only if a certain build feature is requested.
This commit is contained in:
Kai Blaschke 2024-08-07 18:02:09 +02:00
parent 1711511f36
commit 1b8004f714
No known key found for this signature in database
GPG Key ID: B014B6811527389F
5 changed files with 78 additions and 18 deletions

View File

@ -18,7 +18,34 @@ set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# General build options
option(ENABLE_SYSTEM_GLM "Enable use of system-install GLM library" OFF)
option(ENABLE_SYSTEM_PROJECTM_EVAL "Enable use of a system-installed/external projectM-eval library" ON)
option(ENABLE_DEBUG_POSTFIX "Add \"d\" (by default) after library names for debug builds." ON)
option(ENABLE_PLAYLIST "Enable building the playlist management library" ON)
option(ENABLE_BOOST_FILESYSTEM "Force the use of boost::filesystem, even if the compiler supports C++17." OFF)
option(ENABLE_SDL_UI "Build the SDL2-based developer test UI. Ignored when building with Emscripten or for Android." OFF)
option(BUILD_TESTING "Build the libprojectM test suite" OFF)
option(BUILD_DOCS "Build documentation" OFF)
# Enable vcpkg manifest features according to the build options set
if(ENABLE_SYSTEM_GLM)
list(APPEND VCPKG_MANIFEST_FEATURES external-glm)
endif()
if(ENABLE_SYSTEM_PROJECTM_EVAL)
list(APPEND VCPKG_MANIFEST_FEATURES external-evallib)
endif()
if(ENABLE_BOOST_FILESYSTEM)
list(APPEND VCPKG_MANIFEST_FEATURES boost-filesystem)
endif()
if(ENABLE_SDL_UI)
list(APPEND VCPKG_MANIFEST_FEATURES gui)
endif()
if(BUILD_TESTING)
list(APPEND VCPKG_MANIFEST_FEATURES test)
endif()
if(ENABLE_DEBUG_POSTFIX)
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Output file debug postfix. Default is \"d\".")
endif()
@ -65,17 +92,10 @@ else()
set(ENABLE_EMSCRIPTEN OFF CACHE BOOL "Build for web with emscripten. Requires emscripten toolset for building." FORCE)
endif()
# Feature options, including dependencies.
option(BUILD_TESTING "Build the libprojectM test suite" OFF)
# Compiler-/system-dependent options, including dependencies.
cmake_dependent_option(BUILD_SHARED_LIBS "Build and install libprojectM as a shared libraries. If OFF, builds as static libraries." ON "NOT ENABLE_EMSCRIPTEN" OFF)
option(ENABLE_PLAYLIST "Enable building the playlist management library" ON)
cmake_dependent_option(ENABLE_SDL_UI "Build the SDL2-based developer test UI" OFF "NOT ENABLE_EMSCRIPTEN" OFF)
cmake_dependent_option(ENABLE_GLES "Enable OpenGL ES support" OFF "NOT ENABLE_EMSCRIPTEN AND NOT CMAKE_SYSTEM_NAME STREQUAL Android" ON)
option(ENABLE_BOOST_FILESYSTEM "Force the use of boost::filesystem, even if the compiler supports C++17." OFF)
cmake_dependent_option(ENABLE_INSTALL "Enable installing projectM libraries and headers." OFF "NOT PROJECT_IS_TOP_LEVEL" ON)
option(ENABLE_SYSTEM_GLM "Enable use of system-install GLM library" OFF)
option(ENABLE_SYSTEM_PROJECTM_EVAL "Enable use of a system-installed/external projectM-eval library" ON)
option(BUILD_DOCS "Build documentation" OFF)
# Experimental/unsupported features
option(ENABLE_CXX_INTERFACE "Enable exporting C++ symbols for ProjectM and PCM classes, not only the C API. Warning: This is not very portable." OFF)

View File

@ -1,4 +1,4 @@
if(NOT ENABLE_SDL_UI)
if(NOT ENABLE_SDL_UI OR ENABLE_EMSCRIPTEN OR CMAKE_SYSTEM_NAME STREQUAL Android)
return()
endif()

View File

@ -1,8 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg-configuration.schema.json",
"default-registry": {
"kind": "git",
"baseline": "815d93b520779e4354bb4b954fc2179b3e520c26",
"baseline": "a0f7f5379aa39d638efb1b89ac88a39c1011e4aa",
"repository": "https://github.com/microsoft/vcpkg"
}
}

View File

@ -1,8 +1,49 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"name": "projectm",
"version": "4.1.2",
"description": "projectM is an open-source project that reimplements the esteemed Winamp Milkdrop by Geiss in a more modern, cross-platform reusable library.",
"homepage": "https://github.com/projectM-visualizer/projectm",
"license": "LGPL-2.1-only",
"dependencies": [
"glew",
"gtest",
"sdl2"
]
}
{
"name": "glew",
"platform": "windows"
}
],
"default-features": [
"external-glm",
"external-evallib"
],
"features": {
"external-glm": {
"description": "Use external GLM headers instead of the built-in ones",
"dependencies": [
"glm"
]
},
"external-evallib": {
"description": "Use external projectm-eval library instead of the Git submodule",
"dependencies": [
"projectm-eval"
]
},
"gui": {
"description": "Build a simple, SDL2-based development test UI",
"dependencies": [
"sdl2"
]
},
"boost-filesystem": {
"description": "Force using boost::filesystem instead of std::filesystem",
"dependencies": [
"boost-filesystem"
]
},
"test": {
"description": "Build unit tests",
"dependencies": [
"gtest"
]
}
}
}

@ -1 +1 @@
Subproject commit 7cefc94eb2583c5106e022850cfba70d76391015
Subproject commit ee180a2473c12856fd25dc754bafdab7e843cc7a