[fltk] Force static library due to global variables. Fix CMake Targets. (#12273)

* [fltk] Force static library due to global variables. Fix CMake Targets.

* [fltk] Add include directory to exported targets

* [fltk] Update ports/fltk/CONTROL

Co-authored-by: nicole mazzuca <mazzucan@outlook.com>

* Update ports/fltk/portfile.cmake

Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
Co-authored-by: Phoebe <20694052+PhoebeHui@users.noreply.github.com>
This commit is contained in:
ras0219 2020-07-30 22:41:46 -07:00 committed by GitHub
parent 32b7ad04ea
commit 7938ab75c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 48 additions and 41 deletions

View File

@ -1,5 +1,6 @@
Source: fltk
Version: 1.3.5-2
Version: 1.3.5
Port-Version: 3
Homepage: https://www.fltk.org/
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.
Build-Depends: zlib, libpng, libjpeg-turbo

View File

@ -0,0 +1,13 @@
diff --git a/CMake/setup.cmake b/CMake/setup.cmake
index 4d960a5..194887d 100644
--- a/CMake/setup.cmake
+++ b/CMake/setup.cmake
@@ -88,6 +88,8 @@ else()
set(FLTK_CONFIG_PATH ${FLTK_DATADIR}/fltk)
endif(WIN32 AND NOT CYGWIN)
+set(FLTK_CONFIG_PATH share/fltk)
+
include(TestBigEndian)
TEST_BIG_ENDIAN(WORDS_BIGENDIAN)

13
ports/fltk/include.patch Normal file
View File

@ -0,0 +1,13 @@
diff --git a/CMake/macros.cmake b/CMake/macros.cmake
index ca03371..bde2c7e 100644
--- a/CMake/macros.cmake
+++ b/CMake/macros.cmake
@@ -36,6 +36,8 @@ macro(FL_ADD_LIBRARY LIBNAME LIBTYPE LIBFILES)
add_library(${LIBRARY_NAME} ${LIBTYPE} ${LIBFILES})
+ target_include_directories(${LIBRARY_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
+
set_target_properties(${LIBRARY_NAME}
PROPERTIES
OUTPUT_NAME ${LIBRARY_NAME}

View File

@ -4,20 +4,19 @@ vcpkg_download_distfile(ARCHIVE
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}
PATCHES
findlibsfix.patch
add-link-libraries.patch
config-path.patch
include.patch
)
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
set(BUILD_SHARED ON)
else()
set(BUILD_SHARED OFF)
endif()
if (VCPKG_TARGET_ARCHITECTURE MATCHES "arm" OR VCPKG_TARGET_ARCHITECTURE MATCHES "arm64")
set(OPTION_USE_GL "-DOPTION_USE_GL=OFF")
else()
@ -34,55 +33,36 @@ vcpkg_configure_cmake(
-DOPTION_USE_SYSTEM_ZLIB=ON
-DOPTION_USE_SYSTEM_LIBPNG=ON
-DOPTION_USE_SYSTEM_LIBJPEG=ON
-DOPTION_BUILD_SHARED_LIBS=${BUILD_SHARED}
-DOPTION_BUILD_SHARED_LIBS=OFF
-DFLTK_CONFIG_PATH=share/fltk
${OPTION_USE_GL}
)
vcpkg_install_cmake()
if (VCPKG_TARGET_IS_LINUX)
vcpkg_fixup_cmake_targets(CONFIG_PATH share/${PORT} TARGET_PATH share/${PORT})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/fluid DESTINATION ${CURRENT_PACKAGES_DIR}/tools/fltk)
file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/fluid)
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/fluid)
elseif (VCPKG_TARGET_IS_OSX)
file(COPY ${CURRENT_PACKAGES_DIR}/bin/fluid.app DESTINATION ${CURRENT_PACKAGES_DIR}/tools/fltk)
file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/fluid.app)
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/fluid.app)
else()
vcpkg_fixup_cmake_targets(CONFIG_PATH CMake)
file(COPY ${CURRENT_PACKAGES_DIR}/bin/fluid.exe DESTINATION ${CURRENT_PACKAGES_DIR}/tools/fltk)
file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/fluid.exe)
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/fluid.exe)
vcpkg_fixup_cmake_targets(CONFIG_PATH share/fltk)
if(VCPKG_TARGET_IS_OSX)
vcpkg_copy_tools(TOOL_NAMES fluid.app fltk-config AUTO_CLEAN)
elseif(VCPKG_TARGET_IS_WINDOWS)
file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/fltk-config ${CURRENT_PACKAGES_DIR}/debug/bin/fltk-config)
vcpkg_copy_tools(TOOL_NAMES fluid AUTO_CLEAN)
else()
vcpkg_copy_tools(TOOL_NAMES fluid fltk-config AUTO_CLEAN)
endif()
file(REMOVE_RECURSE
${CURRENT_PACKAGES_DIR}/debug/include
${CURRENT_PACKAGES_DIR}/debug/share
)
file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/fltk-config)
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/fltk-config)
vcpkg_copy_pdbs()
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/fltk)
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE
${CURRENT_PACKAGES_DIR}/debug/bin
${CURRENT_PACKAGES_DIR}/bin
)
else()
file(GLOB SHARED_LIBS "${CURRENT_PACKAGES_DIR}/lib/*_SHARED.lib" "${CURRENT_PACKAGES_DIR}/debug/lib/*_SHAREDd.lib")
file(GLOB STATIC_LIBS "${CURRENT_PACKAGES_DIR}/lib/*.lib" "${CURRENT_PACKAGES_DIR}/debug/lib/*.lib")
list(FILTER STATIC_LIBS EXCLUDE REGEX "_SHAREDd?\\.lib\$")
file(REMOVE ${STATIC_LIBS})
foreach(SHARED_LIB ${SHARED_LIBS})
string(REGEX REPLACE "_SHARED(d?)\\.lib\$" "\\1.lib" NEWNAME ${SHARED_LIB})
file(RENAME ${SHARED_LIB} ${NEWNAME})
endforeach()
endif()
file(REMOVE_RECURSE
${CURRENT_PACKAGES_DIR}/debug/include
${CURRENT_PACKAGES_DIR}/debug/share
)
foreach(FILE Fl_Export.H fl_utf8.h)
file(READ ${CURRENT_PACKAGES_DIR}/include/FL/${FILE} FLTK_HEADER)