mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-27 22:51:37 +08:00
[fltk] Control dependencies (#28297)
* [fltk] Revise dependency control * Default-enable opengl * Update versions * License and copyright stuff * Minor changes * Fix script and tool installation * Update versions * Remove icns from bin * Avoid absolute path for Cocoa framework * Overwrite versions * Fontconfig not needed for osx
This commit is contained in:
parent
cafd2852e5
commit
0219697aee
101
ports/fltk/dependencies.patch
Normal file
101
ports/fltk/dependencies.patch
Normal file
@ -0,0 +1,101 @@
|
||||
diff --git a/CMake/options.cmake b/CMake/options.cmake
|
||||
index ddd650f..69bcc2e 100644
|
||||
--- a/CMake/options.cmake
|
||||
+++ b/CMake/options.cmake
|
||||
@@ -63,7 +63,7 @@ endif (APPLE)
|
||||
# find X11 libraries and headers
|
||||
set (PATH_TO_XLIBS)
|
||||
if ((NOT APPLE OR OPTION_APPLE_X11) AND NOT WIN32)
|
||||
- include (FindX11)
|
||||
+ find_package(X11)
|
||||
if (X11_FOUND)
|
||||
set (USE_X11 1)
|
||||
list (APPEND FLTK_LDLIBS -lX11)
|
||||
@@ -214,7 +214,7 @@ if (OPTION_USE_GL)
|
||||
unset(HAVE_GL_GLU_H CACHE)
|
||||
find_file (HAVE_GL_GLU_H GL/glu.h PATHS ${X11_INCLUDE_DIR})
|
||||
else()
|
||||
- include (FindOpenGL)
|
||||
+ find_package(OpenGL REQUIRED)
|
||||
if (APPLE)
|
||||
set (HAVE_GL_GLU_H ${HAVE_OPENGL_GLU_H})
|
||||
endif (APPLE)
|
||||
@@ -285,7 +285,7 @@ set (FLTK_PTHREADS_FOUND FALSE)
|
||||
|
||||
if (OPTION_USE_THREADS)
|
||||
|
||||
- include (FindThreads)
|
||||
+ find_package(Threads REQUIRED)
|
||||
|
||||
if (CMAKE_HAVE_THREADS_LIBRARY)
|
||||
add_definitions ("-D_THREAD_SAFE -D_REENTRANT")
|
||||
@@ -330,7 +330,8 @@ unset (debug_threads)
|
||||
option (OPTION_USE_SYSTEM_ZLIB "use system zlib" ON)
|
||||
|
||||
if (OPTION_USE_SYSTEM_ZLIB)
|
||||
- include (FindZLIB)
|
||||
+ find_package(ZLIB REQUIRED)
|
||||
+ set(LIB_zlib "${ZLIB_LIBRARIES}" CACHE INTERNAL "")
|
||||
endif (OPTION_USE_SYSTEM_ZLIB)
|
||||
|
||||
if (ZLIB_FOUND)
|
||||
@@ -359,7 +360,8 @@ else ()
|
||||
endif (APPLE)
|
||||
|
||||
if (OPTION_USE_SYSTEM_LIBJPEG)
|
||||
- include (FindJPEG)
|
||||
+ find_package(JPEG REQUIRED)
|
||||
+ set(LIB_jpeg "${JPEG_LIBRARIES}" CACHE INTERNAL "")
|
||||
endif (OPTION_USE_SYSTEM_LIBJPEG)
|
||||
|
||||
if (JPEG_FOUND)
|
||||
@@ -387,7 +389,9 @@ else ()
|
||||
endif (APPLE)
|
||||
|
||||
if (OPTION_USE_SYSTEM_LIBPNG)
|
||||
- include (FindPNG)
|
||||
+ find_package(PNG REQUIRED)
|
||||
+ set(HAVE_PNG_H "${PNG_FOUND}")
|
||||
+ set(LIB_png "${PNG_LIBRARIES}" CACHE INTERNAL "")
|
||||
endif (OPTION_USE_SYSTEM_LIBPNG)
|
||||
|
||||
if (PNG_FOUND)
|
||||
diff --git a/CMake/resources.cmake b/CMake/resources.cmake
|
||||
index 57173f2..734a528 100644
|
||||
--- a/CMake/resources.cmake
|
||||
+++ b/CMake/resources.cmake
|
||||
@@ -39,7 +39,7 @@ endmacro (fl_find_header)
|
||||
# Include FindPkgConfig for later use of pkg-config
|
||||
#######################################################################
|
||||
|
||||
-include (FindPkgConfig)
|
||||
+find_package(PkgConfig)
|
||||
|
||||
# fl_debug_var (PKG_CONFIG_FOUND)
|
||||
# fl_debug_var (PKG_CONFIG_EXECUTABLE)
|
||||
@@ -151,8 +151,7 @@ mark_as_advanced (HAVE_X11_XREGION_H)
|
||||
|
||||
# where to find freetype headers
|
||||
|
||||
-find_path (FREETYPE_PATH freetype.h PATH_SUFFIXES freetype2)
|
||||
-find_path (FREETYPE_PATH freetype/freetype.h PATH_SUFFIXES freetype2)
|
||||
+set(FREETYPE_PATH "" CACHE INTERNAL "Obsolete")
|
||||
|
||||
if (FREETYPE_PATH)
|
||||
include_directories (${FREETYPE_PATH})
|
||||
@@ -162,11 +161,12 @@ mark_as_advanced (FREETYPE_PATH)
|
||||
|
||||
#######################################################################
|
||||
# libraries
|
||||
-find_library (LIB_dl dl)
|
||||
+set(LIB_dl "${CMAKE_DL_LIBS}" CACHE STRING "")
|
||||
if ((NOT APPLE) OR OPTION_APPLE_X11)
|
||||
- find_library (LIB_fontconfig fontconfig)
|
||||
+ find_package(Fontconfig REQUIRED)
|
||||
+ set(LIB_fontconfig "${Fontconfig_LIBRARIES}" CACHE INTERNAL "")
|
||||
endif ((NOT APPLE) OR OPTION_APPLE_X11)
|
||||
-find_library (LIB_freetype freetype)
|
||||
+set(LIB_freetype "" CACHE INTERNAL "Obsolete")
|
||||
find_library (LIB_GL GL)
|
||||
find_library (LIB_MesaGL MesaGL)
|
||||
find_library (LIB_GLEW GLEW)
|
@ -1,47 +0,0 @@
|
||||
diff --git a/CMake/resources.cmake b/CMake/resources.cmake
|
||||
index 57173f2..149aa62 100644
|
||||
--- a/CMake/resources.cmake
|
||||
+++ b/CMake/resources.cmake
|
||||
@@ -52,10 +52,8 @@ include (FindPkgConfig)
|
||||
fl_find_header (HAVE_ALSA_ASOUNDLIB_H alsa/asoundlib.h)
|
||||
fl_find_header (HAVE_DLFCN_H dlfcn.h)
|
||||
fl_find_header (HAVE_GL_GLU_H GL/glu.h)
|
||||
-fl_find_header (HAVE_LIBPNG_PNG_H libpng/png.h)
|
||||
fl_find_header (HAVE_LOCALE_H locale.h)
|
||||
fl_find_header (HAVE_OPENGL_GLU_H OpenGL/glu.h)
|
||||
-fl_find_header (HAVE_PNG_H png.h)
|
||||
fl_find_header (HAVE_STDIO_H stdio.h)
|
||||
fl_find_header (HAVE_STRINGS_H strings.h)
|
||||
fl_find_header (HAVE_SYS_SELECT_H sys/select.h)
|
||||
@@ -64,6 +62,17 @@ fl_find_header (HAVE_SYS_STDTYPES_H sys/stdtypes.h)
|
||||
fl_find_header (HAVE_X11_XREGION_H "X11/Xlib.h;X11/Xregion.h")
|
||||
fl_find_header (HAVE_XDBE_H "X11/Xlib.h;X11/extensions/Xdbe.h")
|
||||
|
||||
+find_package(PNG REQUIRED)
|
||||
+if(PNG_FOUND)
|
||||
+ set(LIB_png ${PNG_LIBRARIES})
|
||||
+ set(HAVE_PNG_H ${PNG_FOUND})
|
||||
+
|
||||
+endif()
|
||||
+find_package(ZLIB REQUIRED)
|
||||
+if(ZLIB_FOUND)
|
||||
+ set(LIB_zlib ${ZLIB_LIBRARIES})
|
||||
+endif()
|
||||
+
|
||||
if (WIN32 AND NOT CYGWIN)
|
||||
# we don't use pthreads on Windows (except for Cygwin, see options.cmake)
|
||||
set (HAVE_PTHREAD_H 0)
|
||||
@@ -171,12 +180,10 @@ find_library (LIB_GL GL)
|
||||
find_library (LIB_MesaGL MesaGL)
|
||||
find_library (LIB_GLEW GLEW)
|
||||
find_library (LIB_jpeg jpeg)
|
||||
-find_library (LIB_png png)
|
||||
-find_library (LIB_zlib z)
|
||||
|
||||
mark_as_advanced (LIB_dl LIB_fontconfig LIB_freetype)
|
||||
mark_as_advanced (LIB_GL LIB_MesaGL LIB_GLEW)
|
||||
-mark_as_advanced (LIB_jpeg LIB_png LIB_zlib)
|
||||
+mark_as_advanced (LIB_jpeg)
|
||||
|
||||
#######################################################################
|
||||
# functions
|
@ -7,17 +7,22 @@ vcpkg_from_github(
|
||||
REF release-1.3.8
|
||||
SHA512 197848d3b80a65cca936daf4f0b74609f0fe8332a4cd11af53385fb2aa45ad698b1e239a48732b118cd3cb189bc531711b72fb2eeeb85be887dc6c5a558fa4b3
|
||||
PATCHES
|
||||
findlibsfix.patch
|
||||
dependencies.patch
|
||||
config-path.patch
|
||||
include.patch
|
||||
fix-system-link.patch
|
||||
)
|
||||
file(REMOVE_RECURSE
|
||||
"${SOURCE_PATH}/jpeg"
|
||||
"${SOURCE_PATH}/png"
|
||||
"${SOURCE_PATH}/zlib"
|
||||
)
|
||||
|
||||
if (VCPKG_TARGET_ARCHITECTURE MATCHES "arm" OR VCPKG_TARGET_ARCHITECTURE MATCHES "arm64")
|
||||
set(OPTION_USE_GL "-DOPTION_USE_GL=OFF")
|
||||
else()
|
||||
set(OPTION_USE_GL "-DOPTION_USE_GL=ON")
|
||||
endif()
|
||||
vcpkg_check_features(
|
||||
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
FEATURES
|
||||
opengl OPTION_USE_GL
|
||||
)
|
||||
|
||||
set(fluid_path_param "")
|
||||
if(VCPKG_CROSSCOMPILING)
|
||||
@ -27,16 +32,19 @@ endif()
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS
|
||||
${FEATURE_OPTIONS}
|
||||
-DFLTK_BUILD_TEST=OFF
|
||||
-DOPTION_LARGE_FILE=ON
|
||||
-DOPTION_USE_THREADS=ON
|
||||
-DHAVE_ALSA_ASOUNDLIB_H=OFF # tests only
|
||||
-DOPTION_USE_SYSTEM_ZLIB=ON
|
||||
-DOPTION_USE_SYSTEM_LIBPNG=ON
|
||||
-DOPTION_USE_SYSTEM_LIBJPEG=ON
|
||||
-DOPTION_BUILD_SHARED_LIBS=OFF
|
||||
-DFLTK_CONFIG_PATH=share/fltk
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=1
|
||||
"-DCocoa:STRING=-framework Cocoa" # avoid absolute path
|
||||
${fluid_path_param}
|
||||
${OPTION_USE_GL}
|
||||
MAYBE_UNUSED_VARIABLES
|
||||
Cocoa
|
||||
)
|
||||
|
||||
vcpkg_cmake_install()
|
||||
@ -45,24 +53,22 @@ vcpkg_cmake_config_fixup()
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
# don't install fluid
|
||||
if(VCPKG_CROSSCOMPILING)
|
||||
if(NOT VCPKG_TARGET_IS_WINDOWS)
|
||||
vcpkg_copy_tools(TOOL_NAMES fltk-config AUTO_CLEAN)
|
||||
if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/fltk-config")
|
||||
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
|
||||
file(RENAME "${CURRENT_PACKAGES_DIR}/bin/fltk-config" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/fltk-config")
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/fltk-config" "${CURRENT_PACKAGES_DIR}" "`dirname $0`/../..")
|
||||
if(NOT VCPKG_BUILD_TYPE)
|
||||
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug")
|
||||
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/bin/fltk-config" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/fltk-config")
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/fltk-config" "${CURRENT_PACKAGES_DIR}" "`dirname $0`/../../..")
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/fltk-config" "{prefix}/include" "{prefix}/../include")
|
||||
endif()
|
||||
elseif(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()
|
||||
if(EXISTS "${CURRENT_PACKAGES_DIR}/tools/fltk/fltk-config")
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/fltk/fltk-config" "${CURRENT_PACKAGES_DIR}" "`dirname $0`/../..")
|
||||
endif()
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/fluid${VCPKG_TARGET_EXECUTABLE_SUFFIX}" OR
|
||||
EXISTS "${CURRENT_PACKAGES_DIR}/bin/fluid${VCPKG_TARGET_BUNDLE_SUFFIX}")
|
||||
file(REMOVE "${CURRENT_PACKAGES_DIR}/bin/fluid.icns" "${CURRENT_PACKAGES_DIR}/debug/bin/fluid.icns")
|
||||
vcpkg_copy_tools(TOOL_NAMES fluid AUTO_CLEAN)
|
||||
elseif(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
||||
file(REMOVE_RECURSE
|
||||
"${CURRENT_PACKAGES_DIR}/debug/bin"
|
||||
"${CURRENT_PACKAGES_DIR}/bin"
|
||||
@ -73,8 +79,8 @@ file(REMOVE_RECURSE
|
||||
"${CURRENT_PACKAGES_DIR}/debug/share"
|
||||
)
|
||||
|
||||
foreach(FILE Fl_Export.H fl_utf8.h)
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
foreach(FILE IN ITEMS Fl_Export.H fl_utf8.h)
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/FL/${FILE}" "defined(FL_DLL)" "0")
|
||||
else()
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/FL/${FILE}" "defined(FL_DLL)" "1")
|
||||
@ -83,4 +89,18 @@ endforeach()
|
||||
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/fltk/UseFLTK.cmake" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel;${SOURCE_PATH}" [[${CMAKE_CURRENT_LIST_DIR}/../../include]])
|
||||
|
||||
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|
||||
set(copyright_files "${SOURCE_PATH}/COPYING")
|
||||
if("opengl" IN_LIST FEATURES)
|
||||
file(READ "${SOURCE_PATH}/src/freeglut_geometry.cxx" freeglut_copyright)
|
||||
string(REGEX MATCH " [*] Copyright.*" freeglut_copyright "${freeglut_copyright}" )
|
||||
string(REGEX REPLACE "[*]/.*" "" freeglut_copyright "${freeglut_copyright}")
|
||||
file(WRITE "${CURRENT_BUILDTREES_DIR}/Freeglut code copyright" "${freeglut_copyright}")
|
||||
list(APPEND copyright_files "${CURRENT_BUILDTREES_DIR}/Freeglut code copyright")
|
||||
|
||||
file(READ "${SOURCE_PATH}/src/freeglut_teapot.cxx" teapot_copyright)
|
||||
string(REGEX MATCH " [*][^*]*Silicon Graphics, Inc.*" teapot_copyright "${teapot_copyright}")
|
||||
string(REGEX REPLACE "[*]/.*" "" teapot_copyright "${teapot_copyright}")
|
||||
file(WRITE "${CURRENT_BUILDTREES_DIR}/Original teapot code copyright" "${teapot_copyright}")
|
||||
list(APPEND copyright_files "${CURRENT_BUILDTREES_DIR}/Original teapot code copyright")
|
||||
endif()
|
||||
vcpkg_install_copyright(FILE_LIST ${copyright_files})
|
||||
|
@ -1,15 +1,24 @@
|
||||
{
|
||||
"name": "fltk",
|
||||
"version": "1.3.8",
|
||||
"port-version": 2,
|
||||
"port-version": 3,
|
||||
"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/",
|
||||
"license": null,
|
||||
"supports": "!uwp",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "fltk",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "fontconfig",
|
||||
"platform": "!osx"
|
||||
},
|
||||
{
|
||||
"name": "freetype",
|
||||
"default-features": false
|
||||
},
|
||||
"libjpeg-turbo",
|
||||
"libpng",
|
||||
{
|
||||
@ -21,5 +30,16 @@
|
||||
"host": true
|
||||
},
|
||||
"zlib"
|
||||
]
|
||||
],
|
||||
"default-features": [
|
||||
"opengl"
|
||||
],
|
||||
"features": {
|
||||
"opengl": {
|
||||
"description": "OpenGL support",
|
||||
"dependencies": [
|
||||
"opengl"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2370,7 +2370,7 @@
|
||||
},
|
||||
"fltk": {
|
||||
"baseline": "1.3.8",
|
||||
"port-version": 2
|
||||
"port-version": 3
|
||||
},
|
||||
"fluidlite": {
|
||||
"baseline": "2020-08-27",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "f9c84b6995e5d327678ce90845e994854555e849",
|
||||
"version": "1.3.8",
|
||||
"port-version": 3
|
||||
},
|
||||
{
|
||||
"git-tree": "67f9090df208862fcd949bfae2214dd5fb0a3157",
|
||||
"version": "1.3.8",
|
||||
|
Loading…
Reference in New Issue
Block a user