[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
This commit is contained in:
Tri Tran 2019-03-08 19:51:27 -06:00 committed by Victor Romero
parent e16cf98a5b
commit 9b4bf67701
2 changed files with 42 additions and 10 deletions

View File

@ -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

View File

@ -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")