aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/libui
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/libui')
-rw-r--r--vcpkg/ports/libui/001-fix-cmake.patch46
-rw-r--r--vcpkg/ports/libui/002-fix-macosx-build.patch19
-rw-r--r--vcpkg/ports/libui/003-fix-system-link.patch17
-rw-r--r--vcpkg/ports/libui/portfile.cmake29
-rw-r--r--vcpkg/ports/libui/vcpkg.json23
5 files changed, 134 insertions, 0 deletions
diff --git a/vcpkg/ports/libui/001-fix-cmake.patch b/vcpkg/ports/libui/001-fix-cmake.patch
new file mode 100644
index 0000000..3d20658
--- /dev/null
+++ b/vcpkg/ports/libui/001-fix-cmake.patch
@@ -0,0 +1,46 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index c7193fbb..50c997f8 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -152,8 +152,7 @@ add_subdirectory("common")
+ add_subdirectory("${_OSNAME}")
+ add_library(libui ${_LIBUI_SOURCES})
+ target_include_directories(libui
+- PUBLIC .
+- PRIVATE ${_LIBUI_INCLUEDIRS})
++ PUBLIC $<INSTALL_INTERFACE:include>)
+ target_compile_definitions(libui
+ PRIVATE ${_LIBUI_DEFS})
+ # cmake produces this for us by default but only for shared libraries
+@@ -229,10 +228,30 @@ macro(_add_exec _name)
+ # TODOfor some reason these don't propagate
+ if(NOT WIN32)
+ target_include_directories(${_name}
+- PUBLIC .)
++ PUBLIC $<INSTALL_INTERFACE:include>)
+ target_compile_options(${_name}
+ PUBLIC ${_COMMON_CFLAGS})
+ endif()
+ endmacro()
+ add_subdirectory("test")
+ add_subdirectory("examples")
++
++if(BUILD_SHARED_LIBS)
++ install(TARGETS ${PROJECT_NAME}
++ EXPORT ${PROJECT_NAME}-config
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
++else()
++ install(TARGETS ${PROJECT_NAME}
++ EXPORT ${PROJECT_NAME}-config
++ DESTINATION ${CMAKE_INSTALL_LIBDIR})
++endif()
++
++install(EXPORT ${PROJECT_NAME}-config
++ FILE unofficial-${PROJECT_NAME}-config.cmake
++ NAMESPACE unofficial::libui::
++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
++)
++
++install(FILES ui.h DESTINATION include)
diff --git a/vcpkg/ports/libui/002-fix-macosx-build.patch b/vcpkg/ports/libui/002-fix-macosx-build.patch
new file mode 100644
index 0000000..a5b91c7
--- /dev/null
+++ b/vcpkg/ports/libui/002-fix-macosx-build.patch
@@ -0,0 +1,19 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 50c997f..a23b84d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -16,7 +16,13 @@ cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
+ # TODO figure out what other variables must be set with CACHE
+ # TODO figure out if FORCE is needed here
+ # TODO figure out whether STRING "" is best or if something else is better; also what FORCE does because I forget and later I say it's needed
+-set(CMAKE_OSX_DEPLOYMENT_TARGET "10.8" CACHE STRING "" FORCE)
++
++# VCPKG PATCH NOTE: Fix build on MacOS
++# Due to a bug in CMake (https://gitlab.kitware.com/cmake/cmake/issues/18396) we change CMAKE_OSX_DEPLOYMENT_TARGET to "10.9".
++# See the discussion here:
++# * https://github.com/andlabs/libui/issues/422
++# * https://github.com/andlabs/libui/issues/457
++set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "" FORCE)
+
+ # we want to disable incremental linking
+ # see also:
diff --git a/vcpkg/ports/libui/003-fix-system-link.patch b/vcpkg/ports/libui/003-fix-system-link.patch
new file mode 100644
index 0000000..42dd23c
--- /dev/null
+++ b/vcpkg/ports/libui/003-fix-system-link.patch
@@ -0,0 +1,17 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a23b84d..9892dfc 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -172,6 +172,12 @@ if(BUILD_SHARED_LIBS)
+ target_link_libraries(libui
+ PRIVATE ${_LIBUI_LIBS})
+ endif()
++
++if (APPLE)
++ find_library(Foundation Foundation)
++ find_library(AppKit AppKit)
++ target_link_libraries(libui PUBLIC $<$<PLATFORM_ID:Darwin>:${Foundation};${AppKit}>)
++endif()
+ # TODO INTERFACE libs don't inherit to grandhcildren?
+ # on Windows the linker for static libraries is different; don't give it the flags
+ if(BUILD_SHARED_LIBS)
diff --git a/vcpkg/ports/libui/portfile.cmake b/vcpkg/ports/libui/portfile.cmake
new file mode 100644
index 0000000..56eea00
--- /dev/null
+++ b/vcpkg/ports/libui/portfile.cmake
@@ -0,0 +1,29 @@
+if(VCPKG_TARGET_IS_MINGW)
+ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+endif()
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO andlabs/libui
+ REF 7138276ccfbde94873cb6e2db65642adcbd2ee19
+ SHA512 3a9fb27d0c376479f58ba2fc5be3579efa5f462776a7e725313b92413ce78f3ca60897e63b580c419eeaee2cd2101de2be1ee5af80a547ef433c6284a3053d45
+ HEAD_REF master
+ PATCHES
+ "001-fix-cmake.patch"
+ "002-fix-macosx-build.patch"
+ "003-fix-system-link.patch"
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+)
+
+vcpkg_cmake_install()
+
+vcpkg_copy_pdbs()
+
+vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/libui PACKAGE_NAME unofficial-libui)
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
diff --git a/vcpkg/ports/libui/vcpkg.json b/vcpkg/ports/libui/vcpkg.json
new file mode 100644
index 0000000..4014078
--- /dev/null
+++ b/vcpkg/ports/libui/vcpkg.json
@@ -0,0 +1,23 @@
+{
+ "name": "libui",
+ "version-date": "2018-11-03",
+ "port-version": 3,
+ "description": "Simple and portable (but not inflexible) native GUI library in C.",
+ "homepage": "https://github.com/andlabs/libui",
+ "license": "MIT",
+ "supports": "!android & !emscripten & !ios & !uwp",
+ "dependencies": [
+ {
+ "name": "gtk3",
+ "platform": "!windows & !osx"
+ },
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ]
+}