Skip to content

Commit 1b8004f

Browse files
committed
Improve vcpkg manifest, use features for build options.
Now pulling in the required vcpkg dependencies only if a certain build feature is requested.
1 parent 1711511 commit 1b8004f

File tree

5 files changed

+78
-18
lines changed

5 files changed

+78
-18
lines changed

CMakeLists.txt

+28-8
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,34 @@ set(CMAKE_CXX_VISIBILITY_PRESET hidden)
1818

1919
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
2020

21+
# General build options
22+
option(ENABLE_SYSTEM_GLM "Enable use of system-install GLM library" OFF)
23+
option(ENABLE_SYSTEM_PROJECTM_EVAL "Enable use of a system-installed/external projectM-eval library" ON)
2124
option(ENABLE_DEBUG_POSTFIX "Add \"d\" (by default) after library names for debug builds." ON)
25+
option(ENABLE_PLAYLIST "Enable building the playlist management library" ON)
26+
option(ENABLE_BOOST_FILESYSTEM "Force the use of boost::filesystem, even if the compiler supports C++17." OFF)
27+
option(ENABLE_SDL_UI "Build the SDL2-based developer test UI. Ignored when building with Emscripten or for Android." OFF)
28+
29+
option(BUILD_TESTING "Build the libprojectM test suite" OFF)
30+
option(BUILD_DOCS "Build documentation" OFF)
31+
32+
# Enable vcpkg manifest features according to the build options set
33+
if(ENABLE_SYSTEM_GLM)
34+
list(APPEND VCPKG_MANIFEST_FEATURES external-glm)
35+
endif()
36+
if(ENABLE_SYSTEM_PROJECTM_EVAL)
37+
list(APPEND VCPKG_MANIFEST_FEATURES external-evallib)
38+
endif()
39+
if(ENABLE_BOOST_FILESYSTEM)
40+
list(APPEND VCPKG_MANIFEST_FEATURES boost-filesystem)
41+
endif()
42+
if(ENABLE_SDL_UI)
43+
list(APPEND VCPKG_MANIFEST_FEATURES gui)
44+
endif()
45+
if(BUILD_TESTING)
46+
list(APPEND VCPKG_MANIFEST_FEATURES test)
47+
endif()
48+
2249
if(ENABLE_DEBUG_POSTFIX)
2350
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Output file debug postfix. Default is \"d\".")
2451
endif()
@@ -65,17 +92,10 @@ else()
6592
set(ENABLE_EMSCRIPTEN OFF CACHE BOOL "Build for web with emscripten. Requires emscripten toolset for building." FORCE)
6693
endif()
6794

68-
# Feature options, including dependencies.
69-
option(BUILD_TESTING "Build the libprojectM test suite" OFF)
95+
# Compiler-/system-dependent options, including dependencies.
7096
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)
71-
option(ENABLE_PLAYLIST "Enable building the playlist management library" ON)
72-
cmake_dependent_option(ENABLE_SDL_UI "Build the SDL2-based developer test UI" OFF "NOT ENABLE_EMSCRIPTEN" OFF)
7397
cmake_dependent_option(ENABLE_GLES "Enable OpenGL ES support" OFF "NOT ENABLE_EMSCRIPTEN AND NOT CMAKE_SYSTEM_NAME STREQUAL Android" ON)
74-
option(ENABLE_BOOST_FILESYSTEM "Force the use of boost::filesystem, even if the compiler supports C++17." OFF)
7598
cmake_dependent_option(ENABLE_INSTALL "Enable installing projectM libraries and headers." OFF "NOT PROJECT_IS_TOP_LEVEL" ON)
76-
option(ENABLE_SYSTEM_GLM "Enable use of system-install GLM library" OFF)
77-
option(ENABLE_SYSTEM_PROJECTM_EVAL "Enable use of a system-installed/external projectM-eval library" ON)
78-
option(BUILD_DOCS "Build documentation" OFF)
7999

80100
# Experimental/unsupported features
81101
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)

src/sdl-test-ui/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
if(NOT ENABLE_SDL_UI)
1+
if(NOT ENABLE_SDL_UI OR ENABLE_EMSCRIPTEN OR CMAKE_SYSTEM_NAME STREQUAL Android)
22
return()
33
endif()
44

vcpkg-configuration.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
2-
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg-configuration.schema.json",
32
"default-registry": {
43
"kind": "git",
5-
"baseline": "815d93b520779e4354bb4b954fc2179b3e520c26",
4+
"baseline": "a0f7f5379aa39d638efb1b89ac88a39c1011e4aa",
65
"repository": "https://github.com/microsoft/vcpkg"
76
}
87
}

vcpkg.json

+47-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,49 @@
11
{
2-
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
2+
"name": "projectm",
3+
"version": "4.1.2",
4+
"description": "projectM is an open-source project that reimplements the esteemed Winamp Milkdrop by Geiss in a more modern, cross-platform reusable library.",
5+
"homepage": "https://github.com/projectM-visualizer/projectm",
6+
"license": "LGPL-2.1-only",
37
"dependencies": [
4-
"glew",
5-
"gtest",
6-
"sdl2"
7-
]
8-
}
8+
{
9+
"name": "glew",
10+
"platform": "windows"
11+
}
12+
],
13+
"default-features": [
14+
"external-glm",
15+
"external-evallib"
16+
],
17+
"features": {
18+
"external-glm": {
19+
"description": "Use external GLM headers instead of the built-in ones",
20+
"dependencies": [
21+
"glm"
22+
]
23+
},
24+
"external-evallib": {
25+
"description": "Use external projectm-eval library instead of the Git submodule",
26+
"dependencies": [
27+
"projectm-eval"
28+
]
29+
},
30+
"gui": {
31+
"description": "Build a simple, SDL2-based development test UI",
32+
"dependencies": [
33+
"sdl2"
34+
]
35+
},
36+
"boost-filesystem": {
37+
"description": "Force using boost::filesystem instead of std::filesystem",
38+
"dependencies": [
39+
"boost-filesystem"
40+
]
41+
},
42+
"test": {
43+
"description": "Build unit tests",
44+
"dependencies": [
45+
"gtest"
46+
]
47+
}
48+
}
49+
}

0 commit comments

Comments
 (0)