From 2911c3584cb203453197d9bc8c445ba9948090f2 Mon Sep 17 00:00:00 2001 From: Toby Lane Date: Sun, 28 Apr 2024 15:38:55 +0100 Subject: [PATCH 1/2] Add cmake build options to vcpkg --- CMakeLists.txt | 13 ++++++++++-- vcpkg.json | 55 ++++++++++++++++++++++++++++++++------------------ 2 files changed, 46 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bddbed61..decdd165 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,8 +34,14 @@ option(BUILD_TOOLS "Build additional CLI tools (rnc_decode)" OFF) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake) -if(WITH_MOVIES) - list(APPEND VCPKG_MANIFEST_FEATURES "movies") +if(WITH_FREETYPE2) + list(APPEND VCPKG_MANIFEST_FEATURES "freetype") +endif() +if(WITH_AUDIO) + list(APPEND VCPKG_MANIFEST_FEATURES "audio") + if(WITH_MOVIES) + list(APPEND VCPKG_MANIFEST_FEATURES "movies") + endif() endif() if(BUILD_ANIMVIEW) list(APPEND VCPKG_MANIFEST_FEATURES "animview") @@ -43,6 +49,9 @@ endif() if(WITH_UPDATE_CHECK) list(APPEND VCPKG_MANIFEST_FEATURES "updatecheck") endif() +if(ENABLE_UNIT_TESTS) + list(APPEND VCPKG_MANIFEST_FEATURES "catch2") +endif() project(CorsixTH_Top_Level) diff --git a/vcpkg.json b/vcpkg.json index 08eab65c..6ec8c576 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,34 +1,37 @@ { "dependencies": [ - "freetype", { "name": "lua", "features": [ "tools" ] }, - "luafilesystem", - "lpeg", "sdl2", - { - "name": "fluidsynth", - "features": [ - "sndfile" - ] - }, - { - "name": "sdl2-mixer", - "features": [ - "libmodplug", - "fluidsynth", - "libflac", - "mpg123", - "opusfile" - ] - }, - "catch2" + "luafilesystem", + "lpeg" ], "features": { + "audio": { + "description": "In game audio support", + "dependencies": [ + { + "name": "fluidsynth", + "features": [ + "sndfile" + ] + }, + { + "name": "sdl2-mixer", + "features": [ + "libmodplug", + "fluidsynth", + "libflac", + "mpg123", + "opusfile" + ] + } + ] + }, "animview": { "description": "Support building AnimView", "dependencies": [ @@ -61,6 +64,18 @@ ] } ] + }, + "freetype": { + "description": "In game freetype font support", + "dependencies": [ + "freetype" + ] + }, + "catch2": { + "description": "Support Catch2 tests", + "dependencies": [ + "catch2" + ] } }, "overrides": [ From 857c6f8746054fd8c938824ce833a44ad37e9948 Mon Sep 17 00:00:00 2001 From: Toby Lane Date: Sun, 28 Apr 2024 15:40:54 +0100 Subject: [PATCH 2/2] Add macos to vcpkg presets --- CMakePresets.json | 52 +++++++++++++++++++++++++++++++++++++++++ CorsixTH/CMakeLists.txt | 2 +- vcpkg.json | 6 ++++- 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 411608b7..e109a959 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -60,6 +60,30 @@ "VCPKG_TARGET_TRIPLET": "x86-windows", "ENABLE_UNIT_TESTS": "ON" } + }, + { + "name": "macos-arm64-rel", + "binaryDir": "${sourceDir}/build/macos-arm64-rel", + "generator": "Unix Makefiles", + "cacheVariables": { + "VCPKG_TARGET_TRIPLET": "arm64-osx-release", + "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "CMAKE_C_COMPILER": "clang", + "CMAKE_CXX_COMPILER": "clang++", + "CMAKE_MAKE_PROGRAM": "/usr/bin/make" + } + }, + { + "name": "macos-x64-rel", + "binaryDir": "${sourceDir}/build/macos-arm64-rel", + "generator": "Unix Makefiles", + "cacheVariables": { + "VCPKG_TARGET_TRIPLET": "x64-osx-release", + "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "CMAKE_C_COMPILER": "clang", + "CMAKE_CXX_COMPILER": "clang++", + "CMAKE_MAKE_PROGRAM": "/usr/bin/make" + } } ], "buildPresets": [ @@ -77,6 +101,16 @@ "name": "win-x86-rel", "configurePreset": "win-x86-rel", "configuration": "RelWithDebInfo" + }, + { + "name": "macos-arm64-rel", + "configurePreset": "macos-arm64-rel", + "configuration": "RelWithDebInfo" + }, + { + "name": "macos-x64-rel", + "configurePreset": "macos-x64-rel", + "configuration": "RelWithDebInfo" } ], "testPresets": [ @@ -106,6 +140,24 @@ "outputOnFailure": true }, "configuration": "RelWithDebInfo" + }, + { + "name": "macos-arm64-rel", + "configurePreset": "macos-arm64-rel", + "output": { + "verbosity": "extra", + "outputOnFailure": true + }, + "configuration": "RelWithDebInfo" + }, + { + "name": "macos-x64-rel", + "configurePreset": "macos-x64-rel", + "output": { + "verbosity": "extra", + "outputOnFailure": true + }, + "configuration": "RelWithDebInfo" } ] } diff --git a/CorsixTH/CMakeLists.txt b/CorsixTH/CMakeLists.txt index d0b099f6..e7cccf5a 100644 --- a/CorsixTH/CMakeLists.txt +++ b/CorsixTH/CMakeLists.txt @@ -186,7 +186,7 @@ if(CORSIX_TH_USE_FFMPEG) if(APPLE) target_link_libraries(CorsixTH PRIVATE libz.dylib) # These LDFLAGS are necessary for static ffmpeg, harmless for dynamic ffmpeg - set(CMAKE_EXE_LINKER_FLAGS "-liconv -framework CoreVideo") + set(CMAKE_EXE_LINKER_FLAGS "-liconv -framework CoreMedia -framework CoreVideo -framework VideoToolbox") endif() message(" FFmpeg found") else() diff --git a/vcpkg.json b/vcpkg.json index 6ec8c576..8a0041ba 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -16,6 +16,7 @@ "dependencies": [ { "name": "fluidsynth", + "platform": "!osx", "features": [ "sndfile" ] @@ -24,7 +25,10 @@ "name": "sdl2-mixer", "features": [ "libmodplug", - "fluidsynth", + { + "name": "fluidsynth", + "platform": "!osx" + }, "libflac", "mpg123", "opusfile"