Skip to content

Commit

Permalink
Add lilv port (#14080)
Browse files Browse the repository at this point in the history
Co-authored-by: NancyLi1013 <lirui09@beyondsoft.com>
  • Loading branch information
DomClark and NancyLi1013 committed Oct 23, 2020
1 parent 5b93dab commit e6d762b
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 0 deletions.
96 changes: 96 additions & 0 deletions ports/lilv/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
cmake_minimum_required(VERSION 3.17)
project(lilv C)

find_package(lv2 CONFIG REQUIRED)
find_package(serd CONFIG REQUIRED)
find_package(sord CONFIG REQUIRED)
find_package(sratom CONFIG REQUIRED)

add_library(lilv
src/collections.c
src/filesystem.c
src/instance.c
src/lib.c
src/node.c
src/plugin.c
src/pluginclass.c
src/port.c
src/query.c
src/scalepoint.c
src/state.c
src/ui.c
src/util.c
src/world.c
src/zix/tree.c
)

if(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "MinGW")
set(LILV_PATH_SEP [[;]])
set(LILV_DIR_SEP [[\\]])
set(LV2_PATH [[%APPDATA%\\LV2;%COMMONPROGRAMFILES%\\LV2]])
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(LILV_PATH_SEP ":")
set(LILV_DIR_SEP "/")
set(LV2_PATH "~/Library/Audio/Plug-Ins/LV2:~/.lv2:/usr/local/lib/lv2:/usr/lib/lv2:/Library/Audio/Plug-Ins/LV2")
else()
set(LILV_PATH_SEP ":")
set(LILV_DIR_SEP "/")
set(LV2_PATH "~/.lv2:/usr/lib/lv2:/usr/local/lib/lv2")
endif()

file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/lilv_config.h.in" [[
#define LILV_PATH_SEP "@LILV_PATH_SEP@"
#define LILV_DIR_SEP "@LILV_DIR_SEP@"
#define LILV_DEFAULT_LV2_PATH "@LV2_PATH@"
]])
configure_file("${CMAKE_CURRENT_BINARY_DIR}/lilv_config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/lilv_config.h")

target_include_directories(lilv
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/src" "${CMAKE_CURRENT_BINARY_DIR}"
)

target_link_libraries(lilv
PUBLIC lv2::lv2
PRIVATE serd::serd sord::sord sratom::sratom
)

set_target_properties(lilv PROPERTIES
C_STANDARD 99
C_STANDARD_REQUIRED ON
)

target_compile_definitions(lilv PRIVATE LILV_INTERNAL _CRT_SECURE_NO_WARNINGS)

if(BUILD_SHARED_LIBS)
target_compile_definitions(lilv PUBLIC LILV_SHARED)
endif()

install(
TARGETS lilv
EXPORT lilv-targets
INCLUDES DESTINATION include
)

if(NOT DISABLE_INSTALL_HEADERS)
install(DIRECTORY lilv DESTINATION include)
endif()

install(
EXPORT lilv-targets
NAMESPACE lilv::
DESTINATION "${CMAKE_INSTALL_PREFIX}/share/lilv"
)

file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/lilv-config.cmake" [[
include(CMakeFindDependencyMacro)
find_dependency(lv2 CONFIG)
find_dependency(serd CONFIG)
find_dependency(sord CONFIG)
find_dependency(sratom CONFIG)
include("${CMAKE_CURRENT_LIST_DIR}/lilv-targets.cmake")
]])

install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/lilv-config.cmake"
DESTINATION "${CMAKE_INSTALL_PREFIX}/share/lilv"
)
28 changes: 28 additions & 0 deletions ports/lilv/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
vcpkg_fail_port_install(ON_TARGET "UWP")

vcpkg_from_gitlab(
GITLAB_URL https://gitlab.com
OUT_SOURCE_PATH SOURCE_PATH
REPO lv2/lilv
REF v0.24.10
SHA512 be47b72f2671f3bbab219944519b990156547e26aa432c2618273683c86dc23ae3b071d1de586f45dfda3ea8dbbc095429ad318fda60efcf715ae917a7caa34b
HEAD_REF master
)

file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")

vcpkg_configure_cmake(
SOURCE_PATH "${SOURCE_PATH}"
PREFER_NINJA
OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=1
)

vcpkg_install_cmake()

vcpkg_copy_pdbs()
vcpkg_fixup_cmake_targets()
file(
INSTALL "${SOURCE_PATH}/COPYING"
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}"
RENAME copyright
)
14 changes: 14 additions & 0 deletions ports/lilv/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "lilv",
"version-string": "0.24.10",
"description": "Lilv is a C library for simple use of LV2 plugins in applications.",
"homepage": "https://drobilla.net/software/lilv",
"license": "ISC",
"supports": "!uwp",
"dependencies": [
"lv2",
"serd",
"sord",
"sratom"
]
}

0 comments on commit e6d762b

Please sign in to comment.