2022-11-12 09:32:25 +08:00
if ( NOT X_VCPKG_FORCE_VCPKG_X_LIBRARIES AND NOT VCPKG_TARGET_IS_WINDOWS )
message ( STATUS "Utils and libraries provided by '${PORT}' should be provided by your system! Install the required packages or force vcpkg libraries by setting X_VCPKG_FORCE_VCPKG_X_LIBRARIES in your triplet!" )
set ( VCPKG_POLICY_EMPTY_PACKAGE enabled )
else ( )
if ( VCPKG_TARGET_IS_WINDOWS )
vcpkg_check_linkage ( ONLY_STATIC_LIBRARY )
# Downstream uses &widgetClassRec in a const context which doesn't work
# if this is a dynamic library since the memory adress is only known at runtime
endif ( )
if ( VCPKG_CROSSCOMPILING )
set ( PATCHES cc_for_build.patch )
endif ( )
vcpkg_from_gitlab (
G I T L A B _ U R L h t t p s : / / g i t l a b . f r e e d e s k t o p . o r g / x o r g
O U T _ S O U R C E _ P A T H S O U R C E _ P A T H
R E P O l i b / l i b x t
2024-03-26 06:31:47 +08:00
R E F " l i b X t - $ { V E R S I O N } "
S H A 5 1 2 7 c b 2 2 b e 9 7 0 6 b d 7 d 0 8 9 e 8 4 c 0 9 a 9 9 5 9 7 f 7 3 0 c a 8 5 8 a 9 f 8 1 3 4 d 2 7 4 1 9 1 6 b 2 8 c d 4 7 8 6 e 2 3 6 b e a a d 5 6 8 c 8 b 7 a b 8 c d c f d e a 1 c 4 9 1 4 0 c e f a c 5 2 8 2 4 4 b a b 8 c 9 4 d 4 8 d c 4 7 2 9 2 6 7 e 8
2022-11-12 09:32:25 +08:00
H E A D _ R E F m a s t e r
2023-08-15 04:58:43 +08:00
P A T C H E S
w i n d o w s _ b u i l d . p a t c h
g l o b a l s . p a t c h
g e t c w d . p a t c h
a d d - m i s s i n g - p r o c e s s - h . p a t c h
$ { P A T C H E S }
2022-11-12 09:32:25 +08:00
)
set ( ENV{ACLOCAL} "aclocal -I \" ${ CURRENT_INSTALLED_DIR } /share/xorg/aclocal/\ "" )
string ( APPEND VCPKG_C_FLAGS " -DXT_BUILD" )
string ( APPEND VCPKG_CXX_FLAGS " -DXT_BUILD" )
if ( VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic" AND VCPKG_TARGET_IS_WINDOWS )
string ( APPEND VCPKG_C_FLAGS " -DXT_DLL_EXPORTS" )
string ( APPEND VCPKG_CXX_FLAGS " -DXT_DLL_EXPORTS" )
endif ( )
if ( VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW )
z_vcpkg_get_cmake_vars ( cmake_vars_file )
include ( "${cmake_vars_file}" )
if ( VCPKG_DETECTED_CMAKE_C_COMPILER_ID STREQUAL "MSVC" )
vcpkg_find_acquire_program ( CLANG )
cmake_path ( GET CLANG PARENT_PATH CLANG_PARENT_PATH )
set ( CLANG_CL "${CLANG_PARENT_PATH}/clang-cl.exe" )
file ( READ "${cmake_vars_file}" contents )
string ( APPEND contents "\nset(VCPKG_DETECTED_CMAKE_C_COMPILER \" ${ CLANG_CL } \")")
string ( APPEND contents "\nset(VCPKG_DETECTED_CMAKE_CXX_COMPILER \" ${ CLANG_CL } \")")
if ( VCPKG_TARGET_ARCHITECTURE STREQUAL x86 )
string ( APPEND contents "\nstring(APPEND VCPKG_DETECTED_CMAKE_C_FLAGS_DEBUG \" -m32\ ")" )
string ( APPEND contents "\nstring(APPEND VCPKG_DETECTED_CMAKE_C_FLAGS_RELEASE \" -m32\ ")" )
elseif ( VCPKG_TARGET_ARCHITECTURE STREQUAL arm64 )
string ( APPEND contents "\nstring(PREPEND VCPKG_DETECTED_CMAKE_C_FLAGS_DEBUG \" --target=arm64-pc-win32 \")")
string ( APPEND contents "\nstring(PREPEND VCPKG_DETECTED_CMAKE_C_FLAGS_RELEASE \" --target=arm64-pc-win32 \")")
endif ( )
file ( WRITE "${cmake_vars_file}" "${contents}" )
endif ( )
set ( cmake_vars_file "${cmake_vars_file}" CACHE INTERNAL "" ) # Don't run z_vcpkg_get_cmake_vars twice
set ( OPTIONS --disable-selective-werror )
endif ( )
vcpkg_configure_make (
S O U R C E _ P A T H " $ { S O U R C E _ P A T H } "
A U T O C O N F I G
O P T I O N S
- - w i t h - x f i l e - s e a r c h - p a t h = X 1 1
- - w i t h - a p p d e f a u l t d i r = s h a r e / X 1 1 / a p p - d e f a u l t s
- - e n a b l e - m a l l o c 0 r e t u r n s n u l l = y e s
x o r g _ c v _ m a l l o c 0 _ r e t u r n s _ n u l l = y e s
$ { O P T I O N S }
)
if ( VCPKG_CROSSCOMPILING )
file ( INSTALL "${CURRENT_HOST_INSTALLED_DIR}/tools/${PORT}/makestrs${VCPKG_HOST_EXECUTABLE_SUFFIX}" DESTINATION "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/util/" )
if ( NOT VCPKG_BUILD_TYPE )
file ( INSTALL "${CURRENT_HOST_INSTALLED_DIR}/tools/${PORT}/makestrs${VCPKG_HOST_EXECUTABLE_SUFFIX}" DESTINATION "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/util/" )
endif ( )
endif ( )
vcpkg_install_make ( )
vcpkg_fixup_pkgconfig ( )
if ( VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic" AND VCPKG_TARGET_IS_WINDOWS )
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/include/X11/StringDefs.h" "defined(XT_DLL_EXPORTS)" "1" )
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/include/X11/Shell.h" "defined(XT_DLL_EXPORTS)" "1" )
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/include/X11/Intrinsic.h" "defined(XT_DLL_EXPORTS)" "1" )
# XTSTRINGDEFINES is required since the "strings" are often used in a const context which doesn't work if they are adresses of a global array in another dll
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/include/X11/StringDefs.h" "#define _XtStringDefs_h_" "#define _XtStringDefs_h_\n#define XTSTRINGDEFINES" )
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/include/X11/Shell.h" "#define _XtShell_h" "#define _XtShell_h\n#define XTSTRINGDEFINES" )
endif ( )
if ( VCPKG_TARGET_IS_WINDOWS )
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/xt.pc" " -lXt" " -lXt -lws2_32" )
if ( NOT VCPKG_BUILD_TYPE )
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/xt.pc" " -lXt" " -lXt -lws2_32" )
endif ( )
endif ( )
file ( REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" )
file ( REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share" )
if ( NOT VCPKG_CROSSCOMPILING )
file ( INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/util/makestrs${VCPKG_TARGET_EXECUTABLE_SUFFIX}"
D E S T I N A T I O N " $ { C U R R E N T _ P A C K A G E S _ D I R } / t o o l s / $ { P O R T } " )
endif ( )
# Handle copyright
file ( INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright )
endif ( )