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
R E F e d d 7 0 b d f b b d 1 6 2 4 7 e 3 d 9 5 6 4 c a 5 1 d 8 6 4 f 8 2 6 2 6 e b 7 # 1.2.1
S H A 5 1 2 c 4 9 8 7 6 2 5 3 d f d 1 8 7 e 7 d 5 6 a 0 9 8 d 3 d 9 9 2 1 5 7 d a e f a 2 c 2 5 e e 7 3 2 e a a e 5 8 1 8 e e 0 4 5 1 3 b e d d 8 0 7 d 2 f 2 6 5 0 8 5 d b 2 e 8 2 c 0 b 1 8 2 1 e 1 5 2 a 8 8 f b 4 9 9 8 c 0 0 0 2 f 6 a c 5 7 2 0 4 5 4 3 f e 1 8 5 6 6
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 ( )