From d9d79e63a5c54f6026d3fcc13bc2eda7b0513092 Mon Sep 17 00:00:00 2001 From: Claudio Bantaloukas Date: Tue, 2 Nov 2021 18:06:49 +0000 Subject: [PATCH 1/9] Create MSI installer DASH-313 --- CMakeLists.txt | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index be03de6f..4638dfb0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,13 +16,18 @@ include(GNUInstallDirs) # Set up variables that will be replaced in source files set(DASH_VERSION ${CMAKE_PROJECT_VERSION}) set(DASH_COPYRIGHT_YEAR "2021") +set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) # Configure CPack based package generation -set(CPACK_PACKAGE_NAME "dash") +set(CPACK_PACKAGE_NAME "DASH") set(CPACK_PACKAGE_VENDOR "The Cambridge Crystallographic Data Centre") set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/description.txt") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A versatile and interactive package for solving crystal structures from powder diffraction data") set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.org/ccdc-opensource/dash") +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt") +set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md") if($ENV{BUILD_NUMBER}) set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${DASH_VERSION}-$ENV{BUILD_NUMBER}-win32) set(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${DASH_VERSION}-$ENV{BUILD_NUMBER}) @@ -31,15 +36,15 @@ else() set(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${DASH_VERSION}-developer-build) endif() # set(CPACK_PACKAGE_INSTALL_DIRECTORY "") -set(CPACK_PACKAGE_ICON icons/dash_128x128.png) +set(CPACK_PACKAGE_ICON ${CMAKE_CURRENT_SOURCE_DIR}/distribution/share/icons/dash/dash.ico) +set(CPACK_WIX_PRODUCT_ICON ${CMAKE_CURRENT_SOURCE_DIR}/distribution/share/icons/dash/dash.ico) +set(CPACK_WIX_PROGRAM_MENU_FOLDER .) set(CPACK_PACKAGE_CHECKSUM SHA256) -# set(CPACK_RESOURCE_FILE_LICENSE LICENSE) -# set(CPACK_RESOURCE_FILE_README ) -# set(CPACK_RESOURCE_FILE_WELCOME) set(CPACK_MONOLITHIC_INSTALL TRUE) set(CPACK_PACKAGE_EXECUTABLES dash;DASH) set(CPACK_VERBATIM_VARIABLES TRUE) -set(CPACK_GENERATOR "7Z") +set(CPACK_WIX_UPGRADE_GUID "f45138d2-73a1-4f1b-9099-85ecadd4f86e") +set(CPACK_GENERATOR "7Z;WIX") include(CPack) From 10709db56169a4433dfb46e38c81f7ebcf83e18a Mon Sep 17 00:00:00 2001 From: Claudio Bantaloukas Date: Wed, 3 Nov 2021 11:00:16 +0000 Subject: [PATCH 2/9] Fix SpaceGroupSymbols not found NO_JIRA --- src/Align.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Align.f90 b/src/Align.f90 index c4817f7e..1541bfda 100644 --- a/src/Align.f90 +++ b/src/Align.f90 @@ -155,7 +155,7 @@ SUBROUTINE ALIGN() ENDDO !--------- End of Checks ---------- - OPEN(220,FILE=ShareDashDirectory(1:LEN_TRIM(ShareDashDirectory))//'SpaceGroupSymbols.dat',STATUS='OLD', ERR = 10) + OPEN(220,FILE=ShareDashDirectory(1:LEN_TRIM(ShareDashDirectory))//DIRSPACER//'SpaceGroupSymbols.dat',STATUS='OLD', ERR = 10) DO j = 1,(NumberSGTable-1) READ (220, 50) line nlin = LEN_TRIM(line) From ebd78dbcda730f55821adccf660a75d40dae3945 Mon Sep 17 00:00:00 2001 From: Claudio Bantaloukas Date: Fri, 12 Nov 2021 13:31:05 +0000 Subject: [PATCH 3/9] Use user copy of winteracter DASH-296 --- CMakeLists.txt | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4638dfb0..b59dfc48 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,9 +43,12 @@ set(CPACK_PACKAGE_CHECKSUM SHA256) set(CPACK_MONOLITHIC_INSTALL TRUE) set(CPACK_PACKAGE_EXECUTABLES dash;DASH) set(CPACK_VERBATIM_VARIABLES TRUE) +if(WIN32) set(CPACK_WIX_UPGRADE_GUID "f45138d2-73a1-4f1b-9099-85ecadd4f86e") set(CPACK_GENERATOR "7Z;WIX") - +else() + set(CPACK_GENERATOR "7Z") +endif() include(CPack) @@ -53,14 +56,13 @@ include(CPack) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/PCDash_Main.f90.in" "${CMAKE_CURRENT_BINARY_DIR}/src/PCDash_Main.f90" @ONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/variables.f90.in" "${CMAKE_CURRENT_BINARY_DIR}/src/variables.f90" @ONLY) -# A temporary path for winteracter 9.2 -FetchContent_Declare( - winteracter - URL "https://artifactory.ccdc.cam.ac.uk/artifactory/ccdc-legacy-windows-distributions/winteracter-9.2.7z" - URL_HASH "SHA256=6c13d4e9b343e258630d879ff91f2d2d463ebe87d53d4224516e087197c2bf04" - HTTP_HEADER "X-JFrog-Art-Api:$ENV{ARTIFACTORY_API_KEY}" -) -FetchContent_MakeAvailable(winteracter) +# Select the right library directory based on the compiler +if(WIN32) + set(WINTERACTER_ROOT "c:/wint" CACHE STRING "Location where winteracter is installed") + if(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel") + set(winteracter_LIBRARY_PATH ${WINTERACTER_ROOT}/lib.if8) + endif() +endif() # Create the DASH executable target add_executable(DASH WIN32) @@ -68,15 +70,19 @@ add_executable(DASH WIN32) target_include_directories( DASH PRIVATE - ${winteracter_SOURCE_DIR}/include - ${winteracter_SOURCE_DIR}/lib.if8 + ${WINTERACTER_ROOT}/include + ${winteracter_LIBRARY_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR} ) -target_link_directories(DASH PRIVATE ${winteracter_SOURCE_DIR}/lib.if8) +target_link_directories(DASH PRIVATE ${winteracter_LIBRARY_PATH}) +if(WIN32) + if(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel") # DASH was built with /QxW, which has been superseded by /arch switches target_compile_options(DASH PRIVATE "/arch:SSE2") + endif() +endif() target_link_libraries( DASH PRIVATE From b2d87da80c865c04808281a62718e8c8cc903f37 Mon Sep 17 00:00:00 2001 From: Claudio Bantaloukas Date: Mon, 15 Nov 2021 09:18:47 +0000 Subject: [PATCH 4/9] Use IOsOpenDocument NO_JIRA --- CMakeLists.txt | 1 - src/PCDash_Main.f90.in | 2 +- src/Tutorials.f90 | 26 +++++++++----------------- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b59dfc48..004b87a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,7 +87,6 @@ endif() target_link_libraries( DASH PRIVATE winter.lib # Winteracter main library - htmlhelp.lib # Used by some parts of Winteracter ) target_sources( diff --git a/src/PCDash_Main.f90.in b/src/PCDash_Main.f90.in index 98455f8c..19178a31 100644 --- a/src/PCDash_Main.f90.in +++ b/src/PCDash_Main.f90.in @@ -453,7 +453,7 @@ USE WINTERACTER IMPLICIT NONE - CALL WHelpFile('https://github.com/ccdc-opensource/dash/wiki') + CALL IOsOpenDocument('https://github.com/ccdc-opensource/dash/wiki') END SUBROUTINE LaunchHelp ! diff --git a/src/Tutorials.f90 b/src/Tutorials.f90 index 662dbb64..623d7430 100644 --- a/src/Tutorials.f90 +++ b/src/Tutorials.f90 @@ -29,19 +29,13 @@ SUBROUTINE LaunchTutorial(Tutorial_ID) USE WINTERACTER USE DRUID_HEADER USE VARIABLES -#ifdef _WIN32 - USE KERNEL32 - USE dfwinty -#endif - + IMPLICIT NONE INTEGER, INTENT (IN ) :: Tutorial_ID - CHARACTER(MaxPathLength) ManualPath, DocumentationPath, FileDir + CHARACTER(MaxPathLength) DocumentationPath CHARACTER(MaxPathLength) DestineDir - - CHARACTER(MaxPathLength) TutorialWikiPage CHARACTER(2) NumberStr INTEGER d @@ -66,18 +60,16 @@ SUBROUTINE LaunchTutorial(Tutorial_ID) NumberStr = '06' END SELECT + CALL IOsDirChange(TRIM(DocumentationRoot)//DIRSPACER//"tutorials"//DIRSPACER//"tutorial-"//NumberStr//DIRSPACER//"data") + CALL IOsCopyFile('*.xye',TRIM(DestineDir)//DIRSPACER) + CALL IOsCopyFile('*.raw',TRIM(DestineDir)//DIRSPACER) + CALL IOsCopyFile('*.mol2',TRIM(DestineDir)//DIRSPACER) + CALL IOsCopyFile('*.zmatrix',TRIM(DestineDir)//DIRSPACER) - FileDir = TRIM(TRIM(DocumentationRoot)//DIRSPACER//"tutorials"//DIRSPACER//"tutorial-"//NumberStr//DIRSPACER//"data") - CALL IOsDirChange(FileDir) - CALL IOsCopyFile('Tutorial_'//NumberStr//'.xye',TRIM(DestineDir)//DIRSPACER) - CALL IOsCopyFile('Tutorial_'//NumberStr//'.raw',TRIM(DestineDir)//DIRSPACER) - CALL IOsCopyFile('Tutorial_'//NumberStr//'*.mol2',TRIM(DestineDir)//DIRSPACER) - CALL IOsCopyFile('Tutorial_'//NumberStr//'*.zmatrix',TRIM(DestineDir)//DIRSPACER) - - TutorialWikiPage = TRIM("https://github.com/ccdc-opensource/dash/wiki/Tutorial"//TRIM(NumberStr)) - CALL WHelpFile(TutorialWikiPage) + CALL IOsOpenDocument("https://github.com/ccdc-opensource/dash/wiki/Tutorial"//TRIM(NumberStr)) CALL IOsDirChange(TRIM(DestineDir)) + CALL IOsOpenDocument(TRIM(DestineDir)) END SUBROUTINE LaunchTutorial From a6775226a2445e78b4c43ca7abdcb6dca3df7220 Mon Sep 17 00:00:00 2001 From: Claudio Bantaloukas Date: Mon, 15 Nov 2021 12:25:41 +0000 Subject: [PATCH 5/9] remove old installer NO_JIRA --- installer/Licence.txt | 29 ----- installer/dash.xml | 266 ------------------------------------------ installer/dash_en.lng | 2 - 3 files changed, 297 deletions(-) delete mode 100755 installer/Licence.txt delete mode 100644 installer/dash.xml delete mode 100644 installer/dash_en.lng diff --git a/installer/Licence.txt b/installer/Licence.txt deleted file mode 100755 index a44ef71a..00000000 --- a/installer/Licence.txt +++ /dev/null @@ -1,29 +0,0 @@ -In order to run this version of DASH, you must first read and agree to the terms of the following Software Licence Agreement (Evaluation). - -DASH, excluding the component program Mercury DASH which is a copyright work of the Cambridge Crystallographic Data Centre, and its associate documentation and software have been jointly developed by and are copyright works of CCDC Software Ltd (CCDC) and the Council for the Central Laboratory of the Research Councils (CCLRC) and all rights are protected. - -In consideration of the access to DASH the "Program" (including any or all components) granted you, you agree to run and use the Program solely in accordance with the following terms - -You are permitted to run and to use the Program and the documentation until key expiry date for the purpose of evaluating whether or not the Program meets your requirements. Within 14 days of this date you agree to delete all copies of the Program from your computers and storage systems. - -You may not supply, assign, transfer or sublicense (in whole or part) the Program to any third party as part of a commercial transaction or for any consideration, in money, money's worth or otherwise, or free of charge. The Program shall only be accessible to your employees. - -You may not bundle this Program together with any other software product or products without the prior written consent of CCDC Software Limited. - -You may copy the Program only to the extent strictly necessary for evaluation and back-up purposes. Subject thereto or as otherwise expressly permitted by applicable law, you may not copy, reproduce, translate, adapt, decompile, modify, reverse engineer or disassemble the Program. You shall ensure at all times that all copies of the Programs made by you contain the copyright notice issued by CCDC and contained in the Program. You shall not amend or obscure this notice or any logos or trademarks of CCDC contained in the Program. - -THE PROGRAM IS SUPPLIED TO YOU WITHOUT CHARGE, AND ACCORDINGLY YOU AGREE THAT THE PROGRAM IS PROVIDED ON AN *AS IS* BASIS, AND NO REPRESENTATION IS MADE OR WARRANTY GIVEN, WHETHER WITH REGARD TO THE FUNCTIONALITY OR FITNESS FOR PURPOSE OF THE PROGRAM OR OTHERWISE, AND ALL SUCH REPRESENTATIONS AND WARRANTIES, WHETHER EXPRESSED OR IMPLIED (BY LAW OR OTHERWISE) ARE HEREBY EXCLUDED TO THE FULLEST EXTENT PERMITTED BY LAW. WITHOUT PREJUDICE TO THE FOREGOING IN NO EVENT SHALL CCDC SOFTWARE LIMITED BE LIABLE TO YOU, IN CONTRACT, IN TORT OR OTHERWISE, FOR ANY INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL LOSS OR DAMAGE, INCLUDING, WITHOUT LIMITATION, ADMINISTRATION COSTS, LOSS OF BUSINESS AND GOODWILL, LOSS UNDER CURRENT AND FUTURE CONTRACTS, LOSS OF PROFIT OR OPPORTUNITY OR FINANCIAL LOSS OF ANY KIND ARISING IN ANY WAY OUT OF OR IN CONNECTION WITH YOUR USE OF THE PROGRAM. - -You agree to minimise any adverse effect of downloading, installing and using the Program, including by keeping back-up data and implementing adequate disaster recovery procedures. Accordingly, CCDC Software Limited shall be in no manner liable for any effect which the Program may have on your data, software, hardware or other systems or products. - -No amendment, variation or discharge of these terms and conditions is valid unless accepted in writing by both parties. - -The failure of either party to exercise or enforce any rights under these terms and conditions shall not amount to a waiver of those rights. - -The illegality or invalidity of any part of these terms and conditions shall not affect the legality or validity of the remainder of them. - -These terms and conditions are not intended to confer rights on any third party, whether pursuant to the Contracts (Rights of Third Parties) Act 1999 or otherwise, and no third party shall have any right to enforce any provision of these terms and conditions. - -The foregoing terms and conditions and any dispute in connection with them shall be governed by and construed in accordance with English law and shall be subject to the exclusive jurisdiction of the English courts. - -If you agree to the foregoing terms and conditions then please select the "I have read the full text above and I AGREE" option below. If you do not agree to the foregoing terms and conditions you should select the "I DO NOT AGREE" option below. After making your selection, please click OK to proceed. diff --git a/installer/dash.xml b/installer/dash.xml deleted file mode 100644 index acfbb35c..00000000 --- a/installer/dash.xml +++ /dev/null @@ -1,266 +0,0 @@ - - DASH - DASH - ${DASH_version} - ${project.shortName}-${platform_name}-installer.${platform_exec_suffix} - Licence.txt - ../../cppbuilds_shared/installer/images/EFEMUX01_163x314.png - ../../cppbuilds_shared/installer/images/ccdc_logo_48x48.png - ../../cppbuilds_shared/installer/images/ccdc_logo_350x82.png - - - ../../cppbuilds_shared/installer/components/vcredist.xml - - - default - Default Component - 1 - 1 - 1 - - - Launch ${product_fullname} ${product_version} - - - ${product_fullname} ${product_version} - - all - 0 - 0 - ${installdir}/dash.exe - - ${installdir}/icons/dash.ico - ${installdir} - - - - - Program Files - ${installdir} - programfiles - all - - - Uninstall - ${installdir}/${uninstallerName} - - Uninstall ${product_fullname} - ${installdir} - all - 0 - 0 - ${installdir}/${uninstallerName}.exe - - - ${installdir} - - - - - Program Files - ${installdir} - programfileslinux - linux - - - Program Files - ${installdir} - programfileswindows - windows - - - ${env(DISTRIBUTION_DIRECTORY)}/dash/* - - - - - Program Files - ${installdir} - programfilesosx - osx - - - - - Uninstall ${product_fullname} - Uninstall ${product_fullname} - 0 - 0 - ${installdir}/${uninstallerName}.exe - - - ${installdir}/ - - - ${product_fullname} ${product_version} - ${product_fullname} ${product_version} - 0 - 0 - ${installdir}/dash.exe - - ${installdir}/icons/dash.ico - ${installdir}/ - - - Documentation - windows - - - View the DASH documentation - ${installdir}\Documentation\dash\dash.html - DASH Documentation - 0 - 0 - - - - - - - - - - ${build_project_directory}/installer_generated.lng - ${build_project_directory}/../../cppbuilds_shared/installer/general_en.lng - - - custom_messages - ${build_project_directory}/${product_shortname}_en.lng - - - ${build_project_directory}/installer_generated.lng - ${custom_messages} - - - - - ${build_project_directory}/installer_generated.lng - - - - - 0 - HKEY_LOCAL_MACHINE\SOFTWARE\ccdc - DASHLatestVersion - 0 - 0 - dash_latest - - - - - 0 - HKEY_LOCAL_MACHINE\SOFTWARE\ccdc - DASHLatestVersion - 0 - 0 - REG_SZ - ${product_version} - - - 0 - HKEY_LOCAL_MACHINE\SOFTWARE\ccdc\DASH\${product_version} - InstallDir - 0 - 0 - REG_SZ - ${installdir} - - - 0 - HKEY_CURRENT_USER\Software\CCDC - DASHLatestVersion - 0 - 0 - REG_SZ - ${product_version} - - - 0 - HKEY_CURRENT_USER\SOFTWARE\ccdc\DASH\${product_version} - InstallDir - 0 - 0 - REG_SZ - ${installdir} - - - 1 - 1 - ${env(INSTALLER_DIRECTORY)}/dash - 1 - CCDC/${product_fullname} ${product_version} - CCDC - - - en - installer_generated.lng - - - - - Launch DASH - - - ${installdir}/DASH.exe - - Launch DASH - ${installdir} - - - windows - - - - - - - View instructions on how to use more recent DICVOL versions with DASH - 0 - DASH is supplied with DICVOL91 for powder diffraction indexing, but newer versions of this -software are available (such as DICVOL06). We are not, however, able to integrate these into -DASH, but they can be configured to be used by DASH by the end user. In order to so, -please follow these instructions: - -1) Locate the latest copy of DICVOL from the CPP14 website - see - -http://www.ccp14.ac.uk/solution/indexing/index.html - -2) Download and install the DICVOL program to a location of your choice on your computer. -DICVOL is usually supplied as a .zip file, you will need to unpack the contents of these files to -a folder on your computer. - -3) Run DASH and select the Options -> Configuration option from the pull down menu. - -4) Click the "Browse" button next to the DICVOL line and navigate to the DICVOL executable you -saved earlier. Click close to save this setting. - -5) DICVOL should now be configured for use with DASH. When indexing a powder pattern, -select the "External DICVOL" option to use the version of DICVOL you have installed. - - How to use more recent DICVOL programs with DASH - - - - - installdir - Installer.Parameter.installdir.description - Installer.Parameter.installdir.explanation - - ${platform_install_prefix}/${product_shortname}-${product_version} - 0 - yes - prefix - yes - 0 - 40 - - - installdir - ${platform_install_prefix}/CCDC/DASH ${DASH_version} - - - - - - diff --git a/installer/dash_en.lng b/installer/dash_en.lng deleted file mode 100644 index 937429ec..00000000 --- a/installer/dash_en.lng +++ /dev/null @@ -1,2 +0,0 @@ -Installer.Welcome.Title=Setup - %1$s ${product_version} -Installer.Welcome.Text=Welcome to the %1$s ${product_version} Setup Wizard\n\n From 3d6686451eb3afc16bf134d8afcf5aa680bccde3 Mon Sep 17 00:00:00 2001 From: Claudio Bantaloukas Date: Mon, 15 Nov 2021 16:33:53 +0000 Subject: [PATCH 6/9] Use winteracter method to find mercury NO_JIRA --- src/Initialisation.f90 | 2 +- src/MONKEY1.F90 | 171 ++++++++--------------------------------- 2 files changed, 31 insertions(+), 142 deletions(-) diff --git a/src/Initialisation.f90 b/src/Initialisation.f90 index 630faec8..9f52e4f8 100644 --- a/src/Initialisation.f90 +++ b/src/Initialisation.f90 @@ -545,7 +545,7 @@ SUBROUTINE InitialiseVariables(batch_setting) Rietan_FP = .FALSE. IF ( .NOT. in_batch ) then - CALL GetPathToMercuryFromRegistry + CALL GetPathToMercury CALL GetPathToMogulFromRegistry CALL GetPathToTopasFromRegistry CALL GetPathToExpguiFromRegistry diff --git a/src/MONKEY1.F90 b/src/MONKEY1.F90 index 176eb177..9f825b48 100644 --- a/src/MONKEY1.F90 +++ b/src/MONKEY1.F90 @@ -25,152 +25,41 @@ ! !***************************************************************************** ! - SUBROUTINE GetPathToMercuryFromRegistry + SUBROUTINE GetPathToMercury - USE DFWIN + USE WINTERACTER USE VARIABLES IMPLICIT NONE - - INTEGER*4, PARAMETER :: MAX_VALUE_NAME = 128 - INTEGER*4, PARAMETER :: MAX_DATA_LEN = 1024 - - INTEGER*4 hKeyRoot - CHARACTER*(512) RegPath - INTEGER*4 hKey - INTEGER*4 retCode - CHARACTER*(MAX_PATH) ClassName - INTEGER*4 dwcClassLen - INTEGER*4 dwcSubKeys - INTEGER*4 dwcMaxSubKey - INTEGER*4 dwcMaxClass - INTEGER*4 dwcValues - INTEGER*4 dwcMaxValueName - INTEGER*4 dwcMaxValueData - INTEGER*4 dwcSecDesc - TYPE (T_FILETIME) ftLastWriteTime - CHARACTER*(MAX_VALUE_NAME) ValueName - INTEGER*4 cbValueName - INTEGER*4 cbData - INTEGER*4 dwLBIndex - INTEGER*4 dwType - CHARACTER*MAX_DATA_LEN bData - INTEGER i, j - -! First attempt: HKEY_CLASSES_ROOT\mercuryFile\shell\open\command - cbValueName = MAX_VALUE_NAME - dwcClassLen = MAX_PATH - hKeyRoot = HKEY_CLASSES_ROOT - RegPath = 'mercuryFile\shell\open\command'//CHAR(0) -! Use RegOpenKeyEx() with the new Registry path to get an open handle -! to the child key you want to enumerate. - retCode = RegOpenKeyEx(hKeyRoot, & - RegPath, & - 0, & - KEY_EXECUTE, & - LOC(hKey)) - IF (retCode .NE. ERROR_SUCCESS) GOTO 20 -! ADD A QUERY AND ALLOCATE A BUFFER FOR BDATA. - retCode = RegQueryInfoKey(hKey, & ! Key handle returned from RegOpenKeyEx. - ClassName, & ! Buffer for class name. - LOC(dwcClassLen), & ! Length of class string. - NULL, & ! Reserved. - LOC(dwcSubKeys), & ! Number of sub keys. - LOC(dwcMaxSubKey), & ! Longest sub key size. - LOC(dwcMaxClass), & ! Longest class string. - LOC(dwcValues), & ! Number of values for this key. - LOC(dwcMaxValueName), & ! Longest Value name. - LOC(dwcMaxValueData), & ! Longest Value data. - LOC(dwcSecDesc), & ! Security descriptor. - ftLastWriteTime) ! Last write time. - IF (retCode .NE. ERROR_SUCCESS) GOTO 20 - cbData = dwcMaxValueData -! ENUMERATE THE KEY. - dwLBIndex = 0 ! I'm guessing here - retCode = RegEnumValue (hKey, & ! Key handle returned from RegOpenKeyEx. - dwLBIndex, & ! Value index, taken from listbox. - ValueName, & ! Name of value. - LOC(cbValueName), & ! Size of value name. - NULL, & ! Reserved, dword = NULL. - LOC(dwType), & ! Type of data. - LOC(bData), & ! Data buffer. - LOC(cbData)) ! Size of data buffer. - IF (retCode .NE. ERROR_SUCCESS) GOTO 20 - IF (dwType .NE. REG_SZ) GOTO 20 - i = RegCloseKey(hKey) ! Close the key handle. -! Remove first double quote - VIEWEXE(1:cbData-1) = bData(2:cbData) -! Find second - i = 1 - DO WHILE ((VIEWEXE(i:i) .NE. '"') .AND. (i .LT. cbData)) - i = i + 1 - ENDDO - IF (VIEWEXE(i:i) .EQ. '"') THEN - DO j = i, MaxPathLength - VIEWEXE(j:j) = ' ' - ENDDO + CHARACTER*(MaxPathLength) tLatestVersion, tInstallDirectory + INTEGER tRetCode + + CALL IOsRegistryGet(KEYNAME='HKEY_CURRENT_USER\Software\CCDC', VALUE=tLatestVersion, VALNAME='MercuryLatestVersion', TYPE=tRetCode) + ! 1 is code for string, errors are returned as -1 + IF (tRetCode .NE. 1) THEN + CALL IOsRegistryGet(KEYNAME='HKEY_LOCAL_MACHINE\Software\CCDC', VALUE=tLatestVersion, VALNAME='MercuryLatestVersion', TYPE=tRetCode) + IF (tRetCode .NE. 1) THEN + MercuryExecutable = '' + RETURN + ENDIF ENDIF + CALL IOsRegistryGet(KEYNAME='HKEY_CURRENT_USER\Software\CCDC\Mercury\'//tLatestVersion, VALUE=tInstallDirectory, VALNAME='InstallDir', TYPE=tRetCode) + ! 1 is code for string, errors are returned as -1 + IF (tRetCode .NE. 1) THEN + CALL IOsRegistryGet(KEYNAME='HKEY_LOCAL_MACHINE\Software\CCDC\Mercury\'//tLatestVersion, VALUE=tInstallDirectory, VALNAME='InstallDir', TYPE=tRetCode) + IF (tRetCode .NE. 1) THEN + MercuryExecutable = '' RETURN - 20 CONTINUE - i = RegCloseKey(hKey) ! Close the key handle. -! Second attempt: HKCR\Applications\mercury.exe\shell\open\command - cbValueName = MAX_VALUE_NAME - dwcClassLen = MAX_PATH - hKeyRoot = HKEY_CLASSES_ROOT - RegPath = 'Applications\mercury.exe\shell\open\command'//CHAR(0) -! Use RegOpenKeyEx() with the new Registry path to get an open handle -! to the child key you want to enumerate. - retCode = RegOpenKeyEx(hKeyRoot, & - RegPath, & - 0, & - KEY_EXECUTE, & - LOC(hKey)) - IF (retCode .NE. ERROR_SUCCESS) GOTO 30 -! ADD A QUERY AND ALLOCATE A BUFFER FOR BDATA. - retCode = RegQueryInfoKey(hKey, & ! Key handle returned from RegOpenKeyEx. - ClassName, & ! Buffer for class name. - LOC(dwcClassLen), & ! Length of class string. - NULL, & ! Reserved. - LOC(dwcSubKeys), & ! Number of sub keys. - LOC(dwcMaxSubKey), & ! Longest sub key size. - LOC(dwcMaxClass), & ! Longest class string. - LOC(dwcValues), & ! Number of values for this key. - LOC(dwcMaxValueName), & ! Longest Value name. - LOC(dwcMaxValueData), & ! Longest Value data. - LOC(dwcSecDesc), & ! Security descriptor. - ftLastWriteTime) ! Last write time. - IF (retCode .NE. ERROR_SUCCESS) GOTO 30 - cbData = dwcMaxValueData -! ENUMERATE THE KEY. - dwLBIndex = 0 ! I'm guessing here - retCode = RegEnumValue (hKey, & ! Key handle returned from RegOpenKeyEx. - dwLBIndex, & ! Value index, taken from listbox. - ValueName, & ! Name of value. - LOC(cbValueName), & ! Size of value name. - NULL, & ! Reserved, dword = NULL. - LOC(dwType), & ! Type of data. - LOC(bData), & ! Data buffer. - LOC(cbData)) ! Size of data buffer. - IF (retCode .NE. ERROR_SUCCESS) GOTO 30 - IF (dwType .NE. REG_SZ) GOTO 30 - i = RegCloseKey(hKey) ! Close the key handle. -! Remove first double quote - VIEWEXE(1:cbData-1) = bData(2:cbData) -! Find second - i = 1 - DO WHILE ((VIEWEXE(i:i) .NE. '"') .AND. (i .LT. cbData)) - i = i + 1 - ENDDO - IF (VIEWEXE(i:i) .EQ. '"') THEN - DO j = i, MaxPathLength - VIEWEXE(j:j) = ' ' - ENDDO + ENDIF ENDIF - RETURN - 30 CONTINUE -! Failure... - - END SUBROUTINE GetPathToMercuryFromRegistry + MercuryExecutable = TRIM(tInstallDirectory)//DIRSPACER//'bin'//DIRSPACER//'Mercury.exe' + IF (.NOT. IOsFileExists(MercuryExecutable)) THEN + MercuryExecutable = TRIM(tInstallDirectory)//DIRSPACER//'Mercury.exe' + ENDIF + IF (.NOT. IOsFileExists(MercuryExecutable)) THEN + MercuryExecutable = '' + ENDIF + END SUBROUTINE GetPathToMercury ! !***************************************************************************** @@ -760,9 +649,9 @@ END SUBROUTINE CopyFirstString ! #else - SUBROUTINE GetPathToMercuryFromRegistry() + SUBROUTINE GetPathToMercury() IMPLICIT NONE - END SUBROUTINE GetPathToMercuryFromRegistry + END SUBROUTINE GetPathToMercury SUBROUTINE GetPathToMogulFromRegistry() IMPLICIT NONE From f5812c6d4d8cd2c9861757b60e1d096081275630 Mon Sep 17 00:00:00 2001 From: Claudio Bantaloukas Date: Mon, 15 Nov 2021 16:34:28 +0000 Subject: [PATCH 7/9] Remove need for dash_csd_connector exe NO_JIRA --- src/Initialisation.f90 | 24 ++++++++++++++++-------- src/MONKEY1.F90 | 2 +- src/Main_Field_Changed_Routines.f90 | 6 +++--- src/SA_refresh.f90 | 22 ++++++++++++---------- src/variables.f90.in | 3 ++- 5 files changed, 34 insertions(+), 23 deletions(-) diff --git a/src/Initialisation.f90 b/src/Initialisation.f90 index 9f52e4f8..79d0814f 100644 --- a/src/Initialisation.f90 +++ b/src/Initialisation.f90 @@ -534,7 +534,7 @@ SUBROUTINE InitialiseVariables(batch_setting) ! Initialise path to viewer and argument for viewer. These will be overwritten if ! the configuration file is found and used. VIEWARG = '' - VIEWEXE = '' + ViewerExecutable = '' MOGULEXE = ' ' DICVOLEXE = '' McMailleEXE = '' @@ -594,7 +594,7 @@ SUBROUTINE InitialiseVariables(batch_setting) CALL SelectDASHDialog(IDD_Index_Preparation) CALL WDialogPutReal(IDF_eps, 0.03, '(F5.3)') CALL SelectDASHDialog(IDD_Configuration) - CALL WDialogPutString(IDF_ViewExe, ViewExe) + CALL WDialogPutString(IDF_ViewExe, ViewerExecutable) CALL WDialogPutString(IDF_ViewArg, ViewArg) CALL WDialogPutString(IDF_MogulExe, MogulExe) CALL WDialogPutString(IDF_TopasExe, TopasExe) @@ -953,8 +953,13 @@ SUBROUTINE WriteConfigurationFile CALL FileWriteReal(hFile, RecNr, DASHDefaultMaxResolution) ! Save the viewer CALL SelectDASHDialog(IDD_Configuration) - CALL DASHWDialogGetString(IDF_ViewExe, ViewExe) - CALL FileWriteString(hFile, RecNr, ViewExe) + + CALL DASHWDialogGetString(IDF_ViewExe, ViewerExecutable) + IF (ViewerExecutable .EQ. MercuryExecutable) THEN + CALL FileWriteString(hFile, RecNr, '') + ELSE + CALL FileWriteString(hFile, RecNr, ViewerExecutable) + ENDIF ! and the viewer arguments CALL DASHWDialogGetString(IDF_ViewArg, ViewArg) CALL FileWriteString(hFile, RecNr, ViewArg) @@ -1233,10 +1238,13 @@ SUBROUTINE ReadConfigurationFile ! Read the viewer IF ( .NOT. IN_BATCH ) & CALL SelectDASHDialog(IDD_Configuration) - CALL FileReadString(hFile, RecNr, ViewExe) - - IF ( .NOT. IN_BATCH ) & - CALL WDialogPutString(IDF_ViewExe, ViewExe) + + CALL FileReadString(hFile, RecNr, ViewerExecutable) + IF (( .NOT. IN_BATCH ) .AND. (LEN_TRIM(ViewerExecutable) .GT. 0)) THEN + CALL WDialogPutString(IDF_ViewExe, ViewerExecutable) + ELSE + CALL WDialogPutString(IDF_ViewExe, MercuryExecutable) + ENDIF ! and the viewer arguments CALL FileReadString(hFile, RecNr, ViewArg) diff --git a/src/MONKEY1.F90 b/src/MONKEY1.F90 index 9f825b48..fda9ea85 100644 --- a/src/MONKEY1.F90 +++ b/src/MONKEY1.F90 @@ -49,7 +49,7 @@ SUBROUTINE GetPathToMercury CALL IOsRegistryGet(KEYNAME='HKEY_LOCAL_MACHINE\Software\CCDC\Mercury\'//tLatestVersion, VALUE=tInstallDirectory, VALNAME='InstallDir', TYPE=tRetCode) IF (tRetCode .NE. 1) THEN MercuryExecutable = '' - RETURN + RETURN ENDIF ENDIF MercuryExecutable = TRIM(tInstallDirectory)//DIRSPACER//'bin'//DIRSPACER//'Mercury.exe' diff --git a/src/Main_Field_Changed_Routines.f90 b/src/Main_Field_Changed_Routines.f90 index 773a5078..52f4ba8c 100644 --- a/src/Main_Field_Changed_Routines.f90 +++ b/src/Main_Field_Changed_Routines.f90 @@ -178,10 +178,10 @@ SUBROUTINE DealWithConfiguration CALL WDialogFieldState(IDF_ColourBySolution, Enabled) ENDIF CASE (IDBBROWSE) - tFileName = ViewExe + tFileName = ViewerExecutable IF ( SelectOneFile(tFileName, 'Select Viewer') ) THEN - VIEWEXE = tFileName - CALL WDialogPutString(IDF_ViewExe, VIEWEXE) + ViewerExecutable = tFileName + CALL WDialogPutString(IDF_ViewExe, ViewerExecutable) ENDIF CASE (IDBBROWSE2) tFileName = MOGULEXE diff --git a/src/SA_refresh.f90 b/src/SA_refresh.f90 index b521fa9f..fa594008 100644 --- a/src/SA_refresh.f90 +++ b/src/SA_refresh.f90 @@ -112,8 +112,6 @@ SUBROUTINE ViewStructure(TheFileName, BuiltInOnly) CHARACTER(MaxPathLength+40) tArgStr, tExeStr CHARACTER(1024) FullFileName - - CHARACTER(1) cUseClient INTEGER, DIMENSION(2) :: ID @@ -126,21 +124,25 @@ SUBROUTINE ViewStructure(TheFileName, BuiltInOnly) CALL SelectDASHDialog(IDD_Configuration) tBuiltInMercury = DASHWDialogGetCheckBoxLogical(IDF_BuiltIn_Mercury) tUseClient = DASHWDialogGetCheckBoxLogical(IDF_Use_Client) - CALL DASHWDialogGetString(IDF_ViewExe,ViewExe) - CALL DASHWDialogGetString(IDF_ViewArg,ViewArg) + CALL DASHWDialogGetString(IDF_ViewExe, ViewerExecutable) + CALL DASHWDialogGetString(IDF_ViewArg, ViewArg) CALL PopActiveWindowID ENDIF IF (tBuiltInMercury) THEN + if (LEN_TRIM(MercuryExecutable) .EQ. 0) THEN + CALL ErrorMessage("Could not find default mercury location.") + RETURN + ENDIF - - cUseClient = '0' - IF (tUseClient) cUseClient = '1' - CALL IOsFullPathname(TheFileName,FullFileName) M = WInfoError(3) ! Clear errors - CALL IOSCommand( TRIM(BinDirectory)//DIRSPACER//'zmconv'//DIRSPACER//'dash_csd_connector'//CCDC_EXE_EXT//' --launch-mercury "'//TRIM(FullFileName)//'" '//cUseClient , ProcSilent, IDPROC=ID) + IF (tUseClient) THEN + CALL IOSCommand( TRIM(MercuryExecutable)//' -load-all-files -client "'//TRIM(FullFileName)//'"', ProcSilent, IDPROC=ID) + ELSE + CALL IOSCommand( TRIM(MercuryExecutable)//' -load-all-files "'//TRIM(FullFileName)//'"', ProcSilent, IDPROC=ID) + ENDIF DO CALL IOsCommandCheck(ID, ISTATUS, IEXCOD) IF (ISTATUS==0) EXIT @@ -156,7 +158,7 @@ SUBROUTINE ViewStructure(TheFileName, BuiltInOnly) RETURN ENDIF ELSE - tExeStr = ViewExe + tExeStr = ViewerExecutable tArgStr = ViewArg I = LEN_TRIM(tExeStr) diff --git a/src/variables.f90.in b/src/variables.f90.in index 7f88d51c..7a35d6d9 100644 --- a/src/variables.f90.in +++ b/src/variables.f90.in @@ -76,7 +76,8 @@ INTEGER, PARAMETER :: cRECLMult = 1 #endif - CHARACTER(MaxPathLength) :: VIEWEXE + CHARACTER(MaxPathLength) :: MercuryExecutable + CHARACTER(MaxPathLength) :: ViewerExecutable CHARACTER(20) :: VIEWARG CHARACTER(MaxPathLength) :: MOGULEXE CHARACTER(MaxPathLength) :: DICVOLEXE From 56db673e1ac731899d71d938ff341a42a66fb9e2 Mon Sep 17 00:00:00 2001 From: Claudio Bantaloukas Date: Mon, 15 Nov 2021 23:55:02 +0000 Subject: [PATCH 8/9] Support Intel OneAPI NO_JIRA --- CMakeLists.txt | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 004b87a4..9b0f8348 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,7 +60,11 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/variables.f90.in" "${CMAKE_CURRE if(WIN32) set(WINTERACTER_ROOT "c:/wint" CACHE STRING "Location where winteracter is installed") if(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel") - set(winteracter_LIBRARY_PATH ${WINTERACTER_ROOT}/lib.if8) + if (${CMAKE_Fortran_COMPILER_ARCHITECTURE_ID} STREQUAL "x64") + set(winteracter_LIBRARY_PATH ${WINTERACTER_ROOT}/lib.i64) + else() + set(winteracter_LIBRARY_PATH ${WINTERACTER_ROOT}/lib.if8) + endif() endif() endif() @@ -289,12 +293,21 @@ install( # Install required intel fortran DLLs. # InstallRequiredSystemLibraries currently has difficulties with our legacy fortran compiler -set(INTEL_FORTRAN_COMMON_FILES "C:/Program Files (x86)/Common Files/Intel/Shared Libraries/redist/ia32_win/compiler") -install( - FILES - "${INTEL_FORTRAN_COMMON_FILES}/libifcoremd.dll" - "${INTEL_FORTRAN_COMMON_FILES}/libmmd.dll" - "${INTEL_FORTRAN_COMMON_FILES}/svml_dispmd.dll" - DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT -) +if(WIN32) + if(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel") + if (${CMAKE_Fortran_COMPILER_ARCHITECTURE_ID} STREQUAL "x64") + set(INTEL_FORTRAN_COMMON_FILES "C:/Program Files (x86)/Intel/oneAPI/compiler/2021.4.0/windows/redist/intel64_win/compiler") + else() + set(INTEL_FORTRAN_COMMON_FILES "C:/Program Files (x86)/Intel/oneAPI/compiler/2021.4.0/windows/redist/ia32_win/compiler") + endif() + install( + FILES + "${INTEL_FORTRAN_COMMON_FILES}/libifcoremd.dll" + "${INTEL_FORTRAN_COMMON_FILES}/libmmd.dll" + "${INTEL_FORTRAN_COMMON_FILES}/svml_dispmd.dll" + DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT + ) + endif() +endif() + From 6c89035d339af05887914230566b7c43c3e37422 Mon Sep 17 00:00:00 2001 From: Claudio Bantaloukas Date: Mon, 15 Nov 2021 23:55:32 +0000 Subject: [PATCH 9/9] Add missing pathseps NO_JIRA --- src/GSAS.f90 | 2 +- src/RIETAN.f90 | 2 +- src/SpaceGroupDetermination.f90 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GSAS.f90 b/src/GSAS.f90 index c902623b..0f6c8813 100644 --- a/src/GSAS.f90 +++ b/src/GSAS.f90 @@ -157,7 +157,7 @@ INTEGER FUNCTION CheckEXPGUIExe (ExpguiExe, ScriptName, fg_EXPGUI) ScriptName = TRIM(tDirName)//ctScriptDir//DIRSPACER//ctScriptFile INQUIRE(FILE=ScriptName, EXIST=exists) IF ( exists ) GOTO 10 - ScriptName = TRIM(BinDirectory)//ctScriptDir//DIRSPACER//ctScriptFile + ScriptName = TRIM(BinDirectory)//DIRSPACER//ctScriptDir//DIRSPACER//ctScriptFile INQUIRE(FILE=ScriptName, EXIST=exists) IF ( .NOT. exists ) GOTO 999 10 CheckEXPGUIExe = 0 diff --git a/src/RIETAN.f90 b/src/RIETAN.f90 index 10b15dd9..8ef8b010 100644 --- a/src/RIETAN.f90 +++ b/src/RIETAN.f90 @@ -124,7 +124,7 @@ INTEGER FUNCTION CheckRIETANExe (ExeName, ScriptName) CALL StrUpperCase(tExtension) IF ( tExtension .NE. 'EXE' ) goto 998 #endif - ScriptName = TRIM(BinDirectory)//ctScriptFile + ScriptName = TRIM(BinDirectory)//DIRSPACER//ctScriptFile INQUIRE(FILE=ScriptName, EXIST=exists) IF ( .NOT. exists ) GOTO 999 10 CheckRIETANExe = 0 diff --git a/src/SpaceGroupDetermination.f90 b/src/SpaceGroupDetermination.f90 index 654fb59b..959dbd65 100644 --- a/src/SpaceGroupDetermination.f90 +++ b/src/SpaceGroupDetermination.f90 @@ -129,7 +129,7 @@ SUBROUTINE SpaceGroupDeterminationCode(LatBrav, PawleyChiSqd) ! Before calling the executable in the DASH installation directory. CALL IosDeleteFile(TRIM(CurrentDirectory)//DIRSPACER//'table.asc') errcode = InfoError(1) - CALL IOsCommand(TRIM(BinDirectory)//ExtSymEXE,2) + CALL IOsCommand(TRIM(BinDirectory)//DIRSPACER//ExtSymEXE,2) errcode = InfoError(1) #ifdef _WIN32 IF (errcode .EQ. ErrOsCommand) GOTO 888 ! error ocurred