vcpkg/ports/mygui/portfile.cmake
Frank 9419283e45
[mygui] Fix LNK2005 duplicate function definition (#38386)
Fix
https://github.com/microsoft/vcpkg/issues/34416#issuecomment-2068572360
Error:
```
LINK Pass 1: command "C:\PROGRA~1\MICROS~3\2022\COMMUN~1\VC\Tools\MSVC\1439~1.335\bin\Hostx64\x64\link.exe Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\cmake_pch.cxx.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\__\__\Common\Precompiled.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\Application.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\ApplicationState.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\AreaSelectorControl.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\BackgroundControl.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\BackwardCompatibilityManager.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\CodeGenerator.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\EditorState.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\EditorToolTip.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\EditorWidgets.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\GroupMessage.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\LayoutEditor.rc.res Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\MainMenuControl.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\MainPaneControl.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\MainWorkspaceControl.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\MyGUI_RTTLayer.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\PanelControllers.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\PanelExtensionProperties.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\PanelItems.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\PanelMainProperties.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\PanelProperties.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\PanelTemplateProperties.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\PanelUserData.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\Parse.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\PositionSelectorControl.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\ProjectControl.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\PropertiesPanelView.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\PropertyFieldAlpha.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\PropertyFieldColour.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\PropertyFieldComboBox.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\PropertyFieldEditBox.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\PropertyFieldFileName.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\PropertyFieldFont.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\PropertyFieldManager.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\PropertyFieldNumeric.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\PropertyFieldPosition.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\PropertyFieldSkin.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\PropertyFieldType.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\RecentFilesManager.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\SelectorControl.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\SeparatorPartControl.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\SettingsGeneralControl.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\SettingsResourcePathsControl.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\SettingsResourcesControl.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\SettingsUpdateResourcesControl.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\SettingsWidgetsControl.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\StatisticInfoControl.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\TestState.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\TextureControl.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\TextureToolControl.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\ToolsControl.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\UndoManager.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\WidgetContainer.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\WidgetCreatorManager.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\WidgetSelectorManager.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\WidgetTypes.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\WidgetsWindow.cpp.obj Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir\WorkspaceControl.cpp.obj /out:bin\LayoutEditor.exe /implib:lib\LayoutEditor.lib /pdb:bin\LayoutEditor.pdb /version:0.0 /machine:x64 /nologo /debug /INCREMENTAL /subsystem:windows lib\MyGUICommon_d.lib F:\1\vcpkg\installed\x64-windows\lib\SDL2.lib winmm.lib imm32.lib version.lib setupapi.lib lib\MyGUI.DummyPlatform_d.lib lib\MyGUIEngineStatic_d.lib lib\EditorFrameworkStatic_d.lib lib\MyGUICommon_d.lib F:\1\vcpkg\installed\x64-windows\lib\SDL2.lib winmm.lib imm32.lib version.lib setupapi.lib lib\MyGUI.DummyPlatform_d.lib lib\MyGUIEngineStatic_d.lib F:\1\vcpkg\installed\x64-windows\debug\lib\freetyped.lib F:\1\vcpkg\installed\x64-windows\debug\lib\zlibd.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir/intermediate.manifest Tools\LayoutEditor\CMakeFiles\LayoutEditor.dir/manifest.res" failed (exit code 1169) with the following output:
EditorFrameworkStatic_d.lib(ComponentFactory.cpp.obj) : error LNK2005: "public: __cdecl tools::BackgroundControl::BackgroundControl(void)" (??0BackgroundControl@tools@@QEAA@XZ) already defined in BackgroundControl.cpp.obj
EditorFrameworkStatic_d.lib(BackgroundControl.cpp.obj) : error LNK2005: "public: virtual __cdecl tools::BackgroundControl::~BackgroundControl(void)" (??1BackgroundControl@tools@@UEAA@XZ) already defined in BackgroundControl.cpp.obj

bin\LayoutEditor.exe : fatal error LNK1169: one or more multiply defined symbols found
```

Since the complete declaration of class `BackgroundControl` has been
included in the header file, `BackgroundControl` is removed from
`FACTORY_ITEM ` to avoid repeated function definitions.

- [x] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- [ ] ~~SHA512s are updated for each updated download.~~
- [x] The "supports" clause reflects platforms that may be fixed by this
new version.
- [ ] ~~Any fixed [CI
baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt)
entries are removed from that file.~~
- [ ] ~~Any patches that are no longer applied are deleted from the
port's directory.~~
- [x] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [x] Only one version is added to each modified port's versions file.
2024-04-25 09:20:33 -04:00

62 lines
1.7 KiB
CMake

# MyGUI supports compiling itself as a DLL,
# but it seems platform-related stuff doesn't support dynamic linkage
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO MyGUI/mygui
REF MyGUI${VERSION}
SHA512 88c69ca2e706af364b72d425f95013eb285501881d8094f8d67e31a54c45ca11b0eb5b62c382af0d4c43f69aa8197648259ac306b72efa7ef3e25eecb9b039cb
HEAD_REF master
PATCHES
fix-generation.patch
Install-tools.patch
opengl.patch
sdl2-static.patch
fix-tools-lnk2005.patch
)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "wasm32")
message(STATUS "Setting MYGUI_RENDERSYSTEM to 8 (GLES) - officially supported MyGUI render system for wasm32")
set(MYGUI_RENDERSYSTEM 8)
elseif("opengl" IN_LIST FEATURES)
set(MYGUI_RENDERSYSTEM 4)
else()
set(MYGUI_RENDERSYSTEM 1)
endif()
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
tools MYGUI_BUILD_TOOLS
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DMYGUI_STATIC=TRUE
-DMYGUI_BUILD_DEMOS=FALSE
-DMYGUI_BUILD_PLUGINS=TRUE
-DMYGUI_BUILD_UNITTESTS=FALSE
-DMYGUI_BUILD_TEST_APP=FALSE
-DMYGUI_BUILD_WRAPPER=FALSE
-DMYGUI_BUILD_DOCS=FALSE
-DMYGUI_RENDERSYSTEM=${MYGUI_RENDERSYSTEM}
${FEATURE_OPTIONS}
)
vcpkg_cmake_install()
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
)
vcpkg_fixup_pkgconfig()
if("tools" IN_LIST FEATURES)
vcpkg_copy_tools(TOOL_NAMES FontEditor ImageEditor LayoutEditor SkinEditor AUTO_CLEAN)
endif()
# Handle copyright
file(INSTALL "${SOURCE_PATH}/COPYING.MIT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)