From a8a2b44b0fe52df0dbef027c3ac2b8eba38e01fa Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 23 Nov 2014 00:51:57 +0100 Subject: [PATCH] Don't require libunshield on windows --- CMakeLists.txt | 5 ---- apps/wizard/CMakeLists.txt | 42 ++++++++++++++++++++--------- apps/wizard/mainwizard.cpp | 2 ++ apps/wizard/methodselectionpage.cpp | 5 ++++ 4 files changed, 37 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 208bddf33..5a923c631 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -600,11 +600,6 @@ if (BUILD_OPENCS) endif() if (BUILD_WIZARD) - find_package(LIBUNSHIELD REQUIRED) - if(NOT LIBUNSHIELD_FOUND) - message(FATAL_ERROR "Failed to find Unshield library") - endif(NOT LIBUNSHIELD_FOUND) - add_subdirectory(apps/wizard) endif() diff --git a/apps/wizard/CMakeLists.txt b/apps/wizard/CMakeLists.txt index f2defd031..76ca648db 100644 --- a/apps/wizard/CMakeLists.txt +++ b/apps/wizard/CMakeLists.txt @@ -1,10 +1,20 @@ +if (WIN32) # windows users can just run the morrowind installer + set(OPENMW_USE_UNSHIELD FALSE) +else() + set(OPENMW_USE_UNSHIELD TRUE) + + find_package(LIBUNSHIELD REQUIRED) + if(NOT LIBUNSHIELD_FOUND) + message(FATAL_ERROR "Failed to find Unshield library") + endif(NOT LIBUNSHIELD_FOUND) +endif() + set(WIZARD componentselectionpage.cpp conclusionpage.cpp existinginstallationpage.cpp importpage.cpp inisettings.cpp - installationpage.cpp installationtargetpage.cpp intropage.cpp languageselectionpage.cpp @@ -12,8 +22,6 @@ set(WIZARD mainwizard.cpp methodselectionpage.cpp - unshield/unshieldworker.cpp - utils/componentlistwidget.cpp ) @@ -23,15 +31,12 @@ set(WIZARD_HEADER existinginstallationpage.hpp importpage.hpp inisettings.hpp - installationpage.hpp installationtargetpage.hpp intropage.hpp languageselectionpage.hpp mainwizard.hpp methodselectionpage.hpp - unshield/unshieldworker.hpp - utils/componentlistwidget.hpp ) @@ -41,15 +46,12 @@ set(WIZARD_HEADER_MOC conclusionpage.hpp existinginstallationpage.hpp importpage.hpp - installationpage.hpp installationtargetpage.hpp intropage.hpp languageselectionpage.hpp mainwizard.hpp methodselectionpage.hpp - unshield/unshieldworker.hpp - utils/componentlistwidget.hpp ) @@ -58,13 +60,21 @@ set(WIZARD_UI ${CMAKE_SOURCE_DIR}/files/ui/wizard/conclusionpage.ui ${CMAKE_SOURCE_DIR}/files/ui/wizard/existinginstallationpage.ui ${CMAKE_SOURCE_DIR}/files/ui/wizard/importpage.ui - ${CMAKE_SOURCE_DIR}/files/ui/wizard/installationpage.ui ${CMAKE_SOURCE_DIR}/files/ui/wizard/installationtargetpage.ui ${CMAKE_SOURCE_DIR}/files/ui/wizard/intropage.ui ${CMAKE_SOURCE_DIR}/files/ui/wizard/languageselectionpage.ui ${CMAKE_SOURCE_DIR}/files/ui/wizard/methodselectionpage.ui ) +if (OPENMW_USE_UNSHIELD) + set (WIZARD ${WIZARD} installationpage.cpp unshield/unshieldworker.cpp) + set (WIZARD_HEADER ${WIZARD_HEADER} installationpage.hpp unshield/unshieldworker.hpp) + set (WIZARD_HEADER_MOC ${WIZARD_HEADER_MOC} installationpage.hpp unshield/unshieldworker.hpp) + set (WIZARD_UI ${WIZARD_UI} ${CMAKE_SOURCE_DIR}/files/ui/wizard/installationpage.ui) + add_definitions(-DOPENMW_USE_UNSHIELD) +endif (OPENMW_USE_UNSHIELD) + + source_group(wizard FILES ${WIZARD} ${WIZARD_HEADER}) find_package(Qt4 REQUIRED) @@ -82,7 +92,11 @@ QT4_WRAP_UI(UI_HDRS ${WIZARD_UI}) include(${QT_USE_FILE}) -include_directories(${CMAKE_CURRENT_BINARY_DIR} ${LIBUNSHIELD_INCLUDE}) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +if (OPENMW_USE_UNSHIELD) + include_directories(${LIBUNSHIELD_INCLUDE}) +endif() add_executable(openmw-wizard ${GUI_TYPE} @@ -96,10 +110,14 @@ add_executable(openmw-wizard target_link_libraries(openmw-wizard ${Boost_LIBRARIES} ${QT_LIBRARIES} - ${LIBUNSHIELD_LIBRARY} components ) +if (OPENMW_USE_UNSHIELD) + target_link_libraries(openmw-wizard ${LIBUNSHIELD_LIBRARY}) +endif() + + if(DPKG_PROGRAM) INSTALL(TARGETS openmw-wizard RUNTIME DESTINATION games COMPONENT openmw-wizard) endif() diff --git a/apps/wizard/mainwizard.cpp b/apps/wizard/mainwizard.cpp index d539793ec..f98aae315 100644 --- a/apps/wizard/mainwizard.cpp +++ b/apps/wizard/mainwizard.cpp @@ -322,7 +322,9 @@ void Wizard::MainWizard::setupPages() setPage(Page_ExistingInstallation, new ExistingInstallationPage(this)); setPage(Page_InstallationTarget, new InstallationTargetPage(this, mCfgMgr)); setPage(Page_ComponentSelection, new ComponentSelectionPage(this)); +#ifdef OPENMW_USE_UNSHIELD setPage(Page_Installation, new InstallationPage(this)); +#endif setPage(Page_Import, new ImportPage(this)); setPage(Page_Conclusion, new ConclusionPage(this)); setStartId(Page_Intro); diff --git a/apps/wizard/methodselectionpage.cpp b/apps/wizard/methodselectionpage.cpp index d7c64f3b0..5f3917bd5 100644 --- a/apps/wizard/methodselectionpage.cpp +++ b/apps/wizard/methodselectionpage.cpp @@ -9,6 +9,11 @@ Wizard::MethodSelectionPage::MethodSelectionPage(QWidget *parent) : setupUi(this); +#ifndef OPENMW_USE_UNSHIELD + newLocationRadioButton->setEnabled(false); + existingLocationRadioButton->setChecked(true); +#endif + registerField(QLatin1String("installation.new"), newLocationRadioButton); }