Merge pull request #2577 from tobylane/vcpkgmacos

Add cmake build options and macOS support to vcpkg
This commit is contained in:
Stephen E. Baker
2024-06-22 08:39:51 -04:00
committed by GitHub
4 changed files with 103 additions and 23 deletions

View File

@@ -34,8 +34,14 @@ option(BUILD_TOOLS "Build additional CLI tools (rnc_decode)" OFF)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake)
if(WITH_MOVIES) if(WITH_FREETYPE2)
list(APPEND VCPKG_MANIFEST_FEATURES "movies") 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() endif()
if(BUILD_ANIMVIEW) if(BUILD_ANIMVIEW)
list(APPEND VCPKG_MANIFEST_FEATURES "animview") list(APPEND VCPKG_MANIFEST_FEATURES "animview")
@@ -43,6 +49,9 @@ endif()
if(WITH_UPDATE_CHECK) if(WITH_UPDATE_CHECK)
list(APPEND VCPKG_MANIFEST_FEATURES "updatecheck") list(APPEND VCPKG_MANIFEST_FEATURES "updatecheck")
endif() endif()
if(ENABLE_UNIT_TESTS)
list(APPEND VCPKG_MANIFEST_FEATURES "catch2")
endif()
project(CorsixTH_Top_Level) project(CorsixTH_Top_Level)

View File

@@ -60,6 +60,30 @@
"VCPKG_TARGET_TRIPLET": "x86-windows", "VCPKG_TARGET_TRIPLET": "x86-windows",
"ENABLE_UNIT_TESTS": "ON" "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": [ "buildPresets": [
@@ -77,6 +101,16 @@
"name": "win-x86-rel", "name": "win-x86-rel",
"configurePreset": "win-x86-rel", "configurePreset": "win-x86-rel",
"configuration": "RelWithDebInfo" "configuration": "RelWithDebInfo"
},
{
"name": "macos-arm64-rel",
"configurePreset": "macos-arm64-rel",
"configuration": "RelWithDebInfo"
},
{
"name": "macos-x64-rel",
"configurePreset": "macos-x64-rel",
"configuration": "RelWithDebInfo"
} }
], ],
"testPresets": [ "testPresets": [
@@ -106,6 +140,24 @@
"outputOnFailure": true "outputOnFailure": true
}, },
"configuration": "RelWithDebInfo" "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"
} }
] ]
} }

View File

@@ -186,7 +186,7 @@ if(CORSIX_TH_USE_FFMPEG)
if(APPLE) if(APPLE)
target_link_libraries(CorsixTH PRIVATE libz.dylib) target_link_libraries(CorsixTH PRIVATE libz.dylib)
# These LDFLAGS are necessary for static ffmpeg, harmless for dynamic ffmpeg # 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() endif()
message(" FFmpeg found") message(" FFmpeg found")
else() else()

View File

@@ -1,34 +1,41 @@
{ {
"dependencies": [ "dependencies": [
"freetype",
{ {
"name": "lua", "name": "lua",
"features": [ "features": [
"tools" "tools"
] ]
}, },
"luafilesystem",
"lpeg",
"sdl2", "sdl2",
{ "luafilesystem",
"name": "fluidsynth", "lpeg"
"features": [
"sndfile"
]
},
{
"name": "sdl2-mixer",
"features": [
"libmodplug",
"fluidsynth",
"libflac",
"mpg123",
"opusfile"
]
},
"catch2"
], ],
"features": { "features": {
"audio": {
"description": "In game audio support",
"dependencies": [
{
"name": "fluidsynth",
"platform": "!osx",
"features": [
"sndfile"
]
},
{
"name": "sdl2-mixer",
"features": [
"libmodplug",
{
"name": "fluidsynth",
"platform": "!osx"
},
"libflac",
"mpg123",
"opusfile"
]
}
]
},
"animview": { "animview": {
"description": "Support building AnimView", "description": "Support building AnimView",
"dependencies": [ "dependencies": [
@@ -61,6 +68,18 @@
] ]
} }
] ]
},
"freetype": {
"description": "In game freetype font support",
"dependencies": [
"freetype"
]
},
"catch2": {
"description": "Support Catch2 tests",
"dependencies": [
"catch2"
]
} }
}, },
"overrides": [ "overrides": [