Skip to content

Commit

Permalink
Merge pull request #41 from openmopac/fix-installer
Browse files Browse the repository at this point in the history
Add system path feature to Qt installer
  • Loading branch information
godotalgorithm authored May 17, 2022
2 parents f35ce9f + 388d0dc commit 687b80a
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 117 deletions.
3 changes: 0 additions & 3 deletions .github/INSTALL.txt

This file was deleted.

10 changes: 0 additions & 10 deletions .github/add-to-path.bat

This file was deleted.

16 changes: 0 additions & 16 deletions .github/add-to-path.sh

This file was deleted.

64 changes: 28 additions & 36 deletions .github/qtifw_component.qs
Original file line number Diff line number Diff line change
@@ -1,74 +1,66 @@
function Component()
{
installer.installationFinished.connect(this, Component.prototype.installationFinishedPageIsShown);
component.loaded.connect(this, addCheckBoxes);
}

Component.prototype.installationFinishedPageIsShown = function()
addCheckBoxes = function()
{
/*
if(installer.isInstaller() && (installer.status == QInstaller.Success)) {
if(installer.isInstaller()) {
installer.addWizardPageItem(component, "PathCheckBoxForm", QInstaller.TargetDirectory, 1);
if(systemInfo.kernelType === "winnt") {
installer.addWizardPageItem(component, "FileCheckBoxForm", QInstaller.InstallationFinished, 2);
installer.addWizardPageItem(component, "IconCheckBoxForm", QInstaller.InstallationFinished, 3);
}
else {
installer.addWizardPageItem(component, "PathCheckBoxForm", QInstaller.InstallationFinished, 1);
installer.addWizardPageItem(component, "FileCheckBoxForm", QInstaller.TargetDirectory, 2);
installer.addWizardPageItem(component, "IconCheckBoxForm", QInstaller.TargetDirectory, 3);
}
}
*/
}

Component.prototype.createOperations = function()
{
component.createOperations();
/*

var checkboxForm = component.userInterface("PathCheckBoxForm");
if(checkboxForm && checkboxForm.pathCheckBox.checked) {
if(systemInfo.kernelType === "winnt") {
let target_dir = installer.value("TargetDir").replace(/\//g,"\\");
let add_path = "$LiteralPath = '" + target_dir + "\\bin'; $regPath = 'registry::HKEY_CURRENT_USER\\Environment'; $currDirs = (Get-Item -LiteralPath $regPath).GetValue('Path', '', 'DoNotExpandEnvironmentNames') -split ';' -ne ''; $newValue = ($currDirs + $LiteralPath) -join ';'; Set-ItemProperty -Type ExpandString -LiteralPath $regPath Path $newValue; $dummyName = [guid]::NewGuid().ToString(); [Environment]::SetEnvironmentVariable($dummyName, 'foo', 'User'); [Environment]::SetEnvironmentVariable($dummyName, [NullString]::value, 'User');";
let remove_path = "$LiteralPath = '" + target_dir + "\\bin'; $regPath = 'registry::HKEY_CURRENT_USER\\Environment'; $currDirs = (Get-Item -LiteralPath $regPath).GetValue('Path', '', 'DoNotExpandEnvironmentNames') -split ';' -ne ''; $newValue = ($currDirs.Split(';') | Where-Object { $_ -ne $LiteralPath }) -join ';'; Set-ItemProperty -Type ExpandString -LiteralPath $regPath Path $newValue; $dummyName = [guid]::NewGuid().ToString(); [Environment]::SetEnvironmentVariable($dummyName, 'foo', 'User'); [Environment]::SetEnvironmentVariable($dummyName, [NullString]::value, 'User');";
component.addOperation("Execute",
"@TargetDir@/add-to-path.bat",
"@TargetDir@\bin",
"powershell.exe",
"-Command",
add_path,
"UNDOEXECUTE",
"@TargetDir@/remove-from-path.bat",
"@TargetDir@\bin");
"powershell.exe",
"-Command",
remove_path);
}
else {
component.addOperation("Execute",
"bash",
"@TargetDir@/add-to-path.sh",
"@TargetDir@/bin",
"UNDOEXECUTE",
"bash",
"@TargetDir@/remove-from-path.sh",
"@TargetDir@/bin");
component.addOperation("Execute",
"bash",
"@TargetDir@/add-to-path.sh",
"@TargetDir@/lib",
"UNDOEXECUTE",
"bash",
"@TargetDir@/remove-from-path.sh",
"@TargetDir@/lib");
let path_append = ' PATH="$PATH:@TargetDir@/bin"\n';
if(systemInfo.kernelType == "darwin") { component.addOperation("AppendFile", "@HomeDir@/.bash_profile", "export" + path_append); }
else { component.addOperation("AppendFile", "@HomeDir@/.bashrc", "export" + path_append); }
component.addOperation("AppendFile", "@HomeDir@/.cshrc", "setenv" + path_append);
component.addOperation("AppendFile", "@HomeDir@/.zshrc", "export" + path_append);
component.addOperation("AppendFile", "@HomeDir@/.profile", "export" + path_append);
}
}

if(systemInfo.kernelType === "winnt") {
let target_dir = installer.value("TargetDir").replace(/\//g,"\\");
checkboxForm = component.userInterface("IconCheckBoxForm");
if(checkboxForm && checkboxForm.iconCheckBox.checked) {
component.addOperation("CreateShortcut",
"@TargetDir@/bin/mopac-win.exe",
"@TargetDir@/bin/mopac.exe",
"@DesktopDir@/MOPAC.lnk",
"iconPath=@TargetDir@/mopac.ico");
}
checkboxForm = component.userInterface("FileCheckBoxForm");
if(checkboxForm && checkboxForm.fileCheckBox.checked) {
component.addOperation("RegisterFileType",
".mop",
"@TargetDir@/bin/mopac-win.exe '%1'",
"mop",
target_dir + "\\bin\\mopac.exe \"%1\"",
"MOPAC input file extension",
"text/plain",
"@TargetDir@/mopac.ico");
target_dir + "\\mopac.ico",
"ProgId=mopac.mop");
}
}
*/
}
10 changes: 0 additions & 10 deletions .github/remove-from-path.bat

This file was deleted.

16 changes: 0 additions & 16 deletions .github/remove-from-path.sh

This file was deleted.

28 changes: 22 additions & 6 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
- name: Test MOPAC with CTest
run: |
cd build
ctest -j$NUM_CORES
ctest -j $NUM_CORES
- name: Save test results as an artifact (on failure)
if: ${{ failure() }}
Expand Down Expand Up @@ -138,7 +138,7 @@ jobs:
run: |
source /opt/intel/oneapi/setvars.sh
cd build
ctest -j$NUM_CORES
ctest -j $NUM_CORES
- name: Save test results as an artifact (on failure)
if: ${{ failure() }}
Expand All @@ -147,7 +147,12 @@ jobs:
name: linux-test-output
path: build/tests

- name: Package MOPAC with CPack (in development)
- name: Local installation test
run: |
cd build
sudo make install
- name: Package MOPAC with CPack
run: |
source /opt/intel/oneapi/setvars.sh
cd build
Expand Down Expand Up @@ -235,7 +240,7 @@ jobs:
run: |
source /opt/intel/oneapi/setvars.sh
cd build
ctest -j$NUM_CORES
ctest -j $NUM_CORES
- name: Save test results as an artifact (on failure)
if: ${{ failure() }}
Expand All @@ -244,7 +249,12 @@ jobs:
name: mac-test-output
path: build/tests

- name: Package MOPAC with CPack (in development)
- name: Local installation test
run: |
cd build
make install
- name: Package MOPAC with CPack
run: |
source /opt/intel/oneapi/setvars.sh
cd build
Expand Down Expand Up @@ -329,7 +339,7 @@ jobs:
call "C:\Program Files (x86)\Intel\oneAPI\compiler\${{ env.IFORT_WINDOWS_VERSION }}\env\vars.bat"
call "C:\Program Files (x86)\Intel\oneAPI\mkl\${{ env.MKL_WINDOWS_VERSION }}\env\vars.bat"
cd build
ctest -j%NUM_CORES%
ctest -j %NUM_CORES%
- name: Save test results as an artifact (on failure)
if: ${{ failure() }}
Expand All @@ -338,6 +348,12 @@ jobs:
name: windows-test-output
path: build/tests

- name: Local installation test
shell: cmd
run: |
cd build
cmake --install .
- name: Package MOPAC with CPack (in development)
shell: cmd
run: |
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ cff-version: 1.2.0
message: "If you use this software for a scientific publication, please cite it as below."
title: MOPAC
type: software
version: 22.0.0
version: 22.0.1
doi: 10.5281/zenodo.6511959
date-released: 2022-05-02
date-released: 2022-05-17
authors:
- family-names: Stewart
given-names: "James J. P."
Expand Down
36 changes: 21 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)

# Specify project name & programming languages
project(openmopac VERSION 22.0.0 LANGUAGES Fortran)
project(openmopac VERSION 22.0.1 LANGUAGES Fortran)

# Enable C language support for MKL? (C is only needed for auto-detection of MKL by find_package)
option(ENABLE_MKL "Turn on C language support for MKL" ON)
Expand All @@ -29,6 +29,14 @@ endif()
# Follow GNU conventions for installing directories (languages need to be enabled at this stage)
include(GNUInstallDirs)

# Failsafe definition of install directories (not guaranteed behavior in some older CMake versions)
if(NOT DEFINED CMAKE_INSTALL_BINDIR)
set(CMAKE_INSTALL_BINDIR "bin")
endif()
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR "lib")
endif()

# Static or dynamic build
option(STATIC_BUILD "Build a static executable" OFF)
if (STATIC_BUILD)
Expand Down Expand Up @@ -218,13 +226,13 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
if(INTEL_OMP_DLL STREQUAL "INTEL_OMP_DLL-NOTFOUND")
message("WARNING: Cannot locate Intel's OpenMP dll for packaging")
endif()
install(PROGRAMS ${INTEL_OMP_DLL} TYPE BIN COMPONENT main)
install(PROGRAMS ${INTEL_OMP_DLL} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT qtifw EXCLUDE_FROM_ALL)
else()
find_library(INTEL_OMP_LIB iomp5 HINT CMAKE_Fortran_COMPILER PATH_SUFFIXES ../../compiler/lib)
if(INTEL_OMP_LIB STREQUAL "INTEL_OMP_LIB-NOTFOUND")
message("WARNING: Cannot locate Intel's OpenMP dll for packaging")
message("WARNING: Cannot locate Intel's OpenMP shared library for packaging")
endif()
install(FILES ${INTEL_OMP_LIB} TYPE LIB COMPONENT main)
install(FILES ${INTEL_OMP_LIB} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT qtifw EXCLUDE_FROM_ALL)
endif()
endif()

Expand All @@ -235,24 +243,22 @@ set(CPACK_IFW_PACKAGE_CONTROL_SCRIPT "${CMAKE_SOURCE_DIR}/.github/qtifw_controll
set(CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME "uninstall-mopac")
set(CPACK_IFW_VERBOSE ON)
if(WIN32)
set(CPACK_IFW_TARGET_DIRECTORY "C:/Program Files/mopac")
# install(PROGRAMS "${CMAKE_SOURCE_DIR}/.github/add-to-path.bat" "${CMAKE_SOURCE_DIR}/.github/remove-from-path.bat" DESTINATION "." COMPONENT qtifw EXCLUDE_FROM_ALL)
set(CPACK_IFW_TARGET_DIRECTORY "C:/Program Files/MOPAC")
else()
set(CPACK_IFW_TARGET_DIRECTORY "/opt/mopac")
install(PROGRAMS "${CMAKE_SOURCE_DIR}/.github/add-to-path.sh" "${CMAKE_SOURCE_DIR}/.github/remove-from-path.sh" DESTINATION "." COMPONENT qtifw EXCLUDE_FROM_ALL)
endif()
install(FILES "${CMAKE_SOURCE_DIR}/.github/mopac.ico" "${CMAKE_SOURCE_DIR}/.github/INSTALL.txt" DESTINATION "." COMPONENT qtifw EXCLUDE_FROM_ALL)
install(FILES "${CMAKE_SOURCE_DIR}/.github/mopac.ico" DESTINATION "." COMPONENT qtifw EXCLUDE_FROM_ALL)

# Install the executables and library
install(TARGETS mopac RUNTIME COMPONENT main)
install(TARGETS mopac-param RUNTIME COMPONENT extra)
install(TARGETS mopac-makpol RUNTIME COMPONENT extra)
install(TARGETS mopac RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT main)
install(TARGETS mopac-param RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT extra)
install(TARGETS mopac-makpol RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT extra)
if(WIN32)
install(TARGETS mopac-core RUNTIME COMPONENT main)
# install(TARGETS mopac-win RUNTIME COMPONENT extra)
install(TARGETS mopac-bz RUNTIME COMPONENT extra)
install(TARGETS mopac-core RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT main)
# install(TARGETS mopac-win RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT extra)
install(TARGETS mopac-bz RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT extra)
else()
install(TARGETS mopac-core LIBRARY COMPONENT main)
install(TARGETS mopac-core LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT main)
endif()

# Add packaging
Expand Down
4 changes: 2 additions & 2 deletions src/output/pdbout.F90
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ subroutine pdbout (mode1)
end if
line(81:) = " "
write (iprt, "(A)") trim(line)
line = "REMARK MOPAC 2016, Version: "//verson//" Date: "//idate(5:11)//idate(21:)//idate(11:16)
line = "REMARK MOPAC, Version: "//verson//" Date: "//idate(5:11)//idate(21:)//idate(11:16)
write (iprt, "(A)") trim(line)
end if
do i = 1, ncomments
Expand All @@ -119,7 +119,7 @@ subroutine pdbout (mode1)
line(81:) = " "
write (iprt, "(A)") trim(line)
if (ncomments == 0) then
line = "REMARK MOPAC 2016, Version: "//verson
line = "REMARK MOPAC, Version: "//verson
write (iprt, "(A)") trim(line)
line = "REMARK Date: "//idate(5:11)//idate(21:)//idate(11:16)
write (iprt, "(A)") trim(line)
Expand Down
2 changes: 1 addition & 1 deletion src/run_mopac.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ subroutine special
j = index(refkey(i)," ")
refkey(i)(j:) = " PM6"
end do
write(iprt,"(a)")" MOPAC2016"
write(iprt,"(a)")" MOPAC"
write(iprt,"(a)")" FINAL GEOMETRY OBTAINED"
call geout (iprt)
end subroutine special

0 comments on commit 687b80a

Please sign in to comment.