Skip to content

Commit

Permalink
[fltk] Fix link to system libs (#17094)
Browse files Browse the repository at this point in the history
* [fltk] Fix link to system libs

* update version record
  • Loading branch information
JackBoosY authored Apr 9, 2021
1 parent 06fd7cc commit 59b938e
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 13 deletions.
6 changes: 0 additions & 6 deletions ports/fltk/CONTROL

This file was deleted.

18 changes: 18 additions & 0 deletions ports/fltk/fix-system-link.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --git a/CMake/macros.cmake b/CMake/macros.cmake
index 0c2586f..eb77510 100644
--- a/CMake/macros.cmake
+++ b/CMake/macros.cmake
@@ -37,6 +37,13 @@ macro(FL_ADD_LIBRARY LIBNAME LIBTYPE LIBFILES)
add_library(${LIBRARY_NAME} ${LIBTYPE} ${LIBFILES})

target_include_directories(${LIBRARY_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
+
+ if (APPLE)
+ find_library(Cocoa Cocoa)
+ target_link_libraries(${LIBRARY_NAME} PUBLIC $<$<PLATFORM_ID:Darwin>:${Cocoa}>)
+ elseif (WIN32)
+ target_link_libraries(${LIBRARY_NAME} PUBLIC gdi32 gdiplus user32 advapi32 ole32 shell32 comdlg32)
+ endif()

set_target_properties(${LIBRARY_NAME}
PROPERTIES
13 changes: 7 additions & 6 deletions ports/fltk/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# FLTK has many improperly shared global variables that get duplicated into every DLL
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

vcpkg_download_distfile(ARCHIVE
URLS "https://fltk.org/pub/fltk/1.3.5/fltk-1.3.5-source.tar.gz"
FILENAME "fltk-1.3.5.tar.gz"
SHA512 db7ea7c5f3489195a48216037b9371a50f1119ae7692d66f71b6711e5ccf78814670581bae015e408dee15c4bba921728309372c1cffc90113cdc092e8540821
)

# FLTK has many improperly shared global variables that get duplicated into every DLL
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
Expand All @@ -15,6 +15,7 @@ vcpkg_extract_source_archive_ex(
add-link-libraries.patch
config-path.patch
include.patch
fix-system-link.patch
)

if (VCPKG_TARGET_ARCHITECTURE MATCHES "arm" OR VCPKG_TARGET_ARCHITECTURE MATCHES "arm64")
Expand Down Expand Up @@ -42,6 +43,8 @@ vcpkg_install_cmake()

vcpkg_fixup_cmake_targets(CONFIG_PATH share/fltk)

vcpkg_copy_pdbs()

if(VCPKG_TARGET_IS_OSX)
vcpkg_copy_tools(TOOL_NAMES fluid.app fltk-config AUTO_CLEAN)
elseif(VCPKG_TARGET_IS_WINDOWS)
Expand All @@ -51,8 +54,6 @@ else()
vcpkg_copy_tools(TOOL_NAMES fluid fltk-config AUTO_CLEAN)
endif()

vcpkg_copy_pdbs()

if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE
${CURRENT_PACKAGES_DIR}/debug/bin
Expand All @@ -74,4 +75,4 @@ foreach(FILE Fl_Export.H fl_utf8.h)
file(WRITE ${CURRENT_PACKAGES_DIR}/include/FL/${FILE} "${FLTK_HEADER}")
endforeach()

file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
12 changes: 12 additions & 0 deletions ports/fltk/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "fltk",
"version": "1.3.5",
"port-version": 4,
"description": "FLTK (pronounced fulltick) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X. FLTK provides modern GUI functionality without the bloat and supports 3D graphics via OpenGL and its built-in GLUT emulation.",
"homepage": "https://www.fltk.org/",
"dependencies": [
"libjpeg-turbo",
"libpng",
"zlib"
]
}
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -1990,7 +1990,7 @@
},
"fltk": {
"baseline": "1.3.5",
"port-version": 3
"port-version": 4
},
"fluidlite": {
"baseline": "2020-08-27",
Expand Down
5 changes: 5 additions & 0 deletions versions/f-/fltk.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "09b2ceac638353fa15310751f007a9e868087460",
"version": "1.3.5",
"port-version": 4
},
{
"git-tree": "4f56d4551d634591725cc016e804323a7a793faa",
"version-string": "1.3.5",
Expand Down

0 comments on commit 59b938e

Please sign in to comment.