From 9b4bf67701fed2bebd8d3a7ca383943c0557d46e Mon Sep 17 00:00:00 2001 From: Tri Tran Date: Fri, 8 Mar 2019 19:51:27 -0600 Subject: [PATCH] [tgui] Add gui-builder in tool feature (#5603) * [tgui] Add gui-builder in tool feature * [tgui] Fix path issue on MacOS * [tgui] Fix extension for Windows and not-Windows --- ports/tgui/CONTROL | 7 ++++-- ports/tgui/portfile.cmake | 45 ++++++++++++++++++++++++++++++++------- 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/ports/tgui/CONTROL b/ports/tgui/CONTROL index 521a36c484..b69819c8d0 100644 --- a/ports/tgui/CONTROL +++ b/ports/tgui/CONTROL @@ -1,4 +1,7 @@ Source: tgui -Version: 0.8.4-1 -Description: TGUI is an easy to use, cross-platform, c++ GUI for SFML. +Version: 0.8.4-2 +Description: TGUI is an easy to use, cross-platform, C++ GUI for SFML. Build-Depends: sfml + +Feature: tool +Description: Build GUI builder diff --git a/ports/tgui/portfile.cmake b/ports/tgui/portfile.cmake index 9350e84808..d0f400eca1 100644 --- a/ports/tgui/portfile.cmake +++ b/ports/tgui/portfile.cmake @@ -11,16 +11,25 @@ vcpkg_extract_source_archive_ex( ARCHIVE ${ARCHIVE} ) +set(TGUI_SHARE_PATH ${CURRENT_PACKAGES_DIR}/share/tgui) +set(TGUI_TOOLS_PATH ${CURRENT_PACKAGES_DIR}/tools/tgui) + # Enable static build -file(REMOVE ${SOURCE_PATH}/cmake/Modules/FindSFML.cmake) -string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" TGUI_SHARED_LIBS) +file(REMOVE "${SOURCE_PATH}/cmake/Modules/FindSFML.cmake") +string(COMPARE EQUAL ${VCPKG_LIBRARY_LINKAGE} "dynamic" TGUI_SHARED_LIBS) + +# gui-builder +set(BUILD_GUI_BUILDER OFF) +if("tool" IN_LIST FEATURES) + set(BUILD_GUI_BUILDER ON) +endif() vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA # Disable this option if project cannot be built with Ninja + SOURCE_PATH "${SOURCE_PATH}" + PREFER_NINJA OPTIONS - -DTGUI_BUILD_GUI_BUILDER=OFF - -DTGUI_MISC_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR}/share/tgui + -DTGUI_BUILD_GUI_BUILDER=${BUILD_GUI_BUILDER} + -DTGUI_MISC_INSTALL_PREFIX=${TGUI_SHARE_PATH} -DTGUI_SHARED_LIBS=${TGUI_SHARED_LIBS} ) @@ -28,7 +37,27 @@ vcpkg_install_cmake() vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/TGUI) vcpkg_copy_pdbs() -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +if(BUILD_GUI_BUILDER) + set(EXECUTABLE_SUFFIX "") + if (WIN32) + set(EXECUTABLE_SUFFIX ".exe") + endif() + + message(STATUS "Check for: ${TGUI_SHARE_PATH}/gui-builder/gui-builder${EXECUTABLE_SUFFIX}") + if(EXISTS "${TGUI_SHARE_PATH}/gui-builder/gui-builder${EXECUTABLE_SUFFIX}") + file(MAKE_DIRECTORY "${TGUI_TOOLS_PATH}") + file(RENAME + "${TGUI_SHARE_PATH}/gui-builder/gui-builder${EXECUTABLE_SUFFIX}" + "${TGUI_TOOLS_PATH}/gui-builder${EXECUTABLE_SUFFIX}") + # Need to copy `resources` and `themes` directories + file(COPY "${TGUI_SHARE_PATH}/gui-builder/resources" DESTINATION "${TGUI_TOOLS_PATH}") + file(COPY "${TGUI_SHARE_PATH}/gui-builder/themes" DESTINATION "${TGUI_TOOLS_PATH}") + file(REMOVE_RECURSE "${TGUI_SHARE_PATH}/gui-builder") + vcpkg_copy_tool_dependencies("${TGUI_TOOLS_PATH}") + endif() +endif() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") # Handle copyright -file(RENAME ${CURRENT_PACKAGES_DIR}/share/tgui/license.txt ${CURRENT_PACKAGES_DIR}/share/tgui/copyright) +file(RENAME "${CURRENT_PACKAGES_DIR}/share/tgui/license.txt" "${CURRENT_PACKAGES_DIR}/share/tgui/copyright")