From 69d01204e0e1220e196d4a7cb6cfdb41292bc6a9 Mon Sep 17 00:00:00 2001 From: txtsd Date: Tue, 15 Feb 2022 00:42:14 +0530 Subject: [PATCH] Implement PR suggestions --- .github/workflows/build.yml | 2 +- BUILD.md | 8 ++++---- CMakeLists.txt | 8 ++++---- launcher/Application.cpp | 3 +-- packages/nix/polymc/default.nix | 2 +- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e4cc2614..af5a1074 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -126,7 +126,7 @@ jobs: - name: Configure CMake on Linux if: runner.os == 'Linux' run: | - cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DLAUNCHER_PORTABLE=OFF -G Ninja + cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DLauncher_PORTABLE=OFF -G Ninja - name: Build run: | diff --git a/BUILD.md b/BUILD.md index 42aed07a..fa6a8d04 100644 --- a/BUILD.md +++ b/BUILD.md @@ -56,7 +56,7 @@ This is the preferred method for installation, and is suitable for packages. cmake -S . -B build \   -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX="/usr" \ # Use "/usr" when building Linux packages. If building on FreeBSD or not for package, use "/usr/local" - -DLAUNCHER_PORTABLE=OFF + -DLauncher_PORTABLE=OFF cd build make -j$(nproc) install # Optionally specify DESTDIR for packages (i.e. DESTDIR=${pkgdir}) ``` @@ -250,8 +250,8 @@ zlib1.dll 1. If you installed Qt with the web installer, there should be a shortcut called `Qt 5.4 for Desktop (MinGW 4.9 32-bit)` in the Start menu on Windows 7 and 10. Best way to find it is to search for it. Do note you cannot just use cmd.exe, you have to use the shortcut, otherwise the proper MinGW software will not be on the PATH. 2. Once that is open, change into your user directory, and clone PolyMC by doing `git clone --recursive https://github.com/PolyMC/PolyMC.git`, and change directory to the folder you cloned to. 3. Make a build directory, and change directory to the directory and do `cmake -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=C:\Path\that\makes\sense\for\you`. By default, it will install to C:\Program Files (x86), which you might not want, if you want a local installation. If you want to install it to that directory, make sure to run the command window as administrator. -4. If you want PolyMC to store its data in `%APPDATA%`, append `-DLAUNCHER_PORTABLE=OFF` to the previous command. -5. Do `mingw32-make -jX`, where X is the number of cores your CPU has plus one. +4. If you want PolyMC to store its data in `%APPDATA%`, append `-DLauncher_PORTABLE=OFF` to the previous command. +5. Do `mingw32-make -j$(nproc)`, where X is the number of cores your CPU has plus one. 6. Now to wait for it to compile. This could take some time. Hopefully it compiles properly. 7. Run the command `mingw32-make install`, and it should install PolyMC, to whatever the `-DCMAKE_INSTALL_PREFIX` was. 8. In most cases, whenever compiling, the OpenSSL dll's aren't put into the directory to where PolyMC installs, meaning you cannot log in. The best way to fix this is just to do `copy C:\OpenSSL-Win32\*.dll C:\Where\you\installed\PolyMC\to`. This should copy the required OpenSSL dll's to log in. @@ -335,7 +335,7 @@ This is the preferred method for installation, and is suitable for packages. cmake -S . -B build \   -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX="/usr/local" \ # /usr/local is default in OpenBSD and FreeBSD - -DLAUNCHER_PORTABLE=OFF -DCMAKE_PREFIX_PATH=/usr/local/lib/qt5/cmake # use linux layout and point to qt5 libs + -DLauncher_PORTABLE=OFF -DCMAKE_PREFIX_PATH=/usr/local/lib/qt5/cmake # use linux layout and point to qt5 libs cd build make -j$(nproc) install # Optionally specify DESTDIR for packages (i.e. DESTDIR=${pkgdir}) ``` diff --git a/CMakeLists.txt b/CMakeLists.txt index f98b8760..02900f83 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -147,7 +147,7 @@ add_subdirectory(program_info) ####################################### Install layout ####################################### # Install the build results according to platform -set(LAUNCHER_PORTABLE 1 CACHE BOOL "The type of installation (Portable or System)") +set(Launcher_PORTABLE 1 CACHE BOOL "The type of installation (Portable or System)") if(UNIX AND APPLE) @@ -183,13 +183,13 @@ if(UNIX AND APPLE) elseif(UNIX) set(BINARY_DEST_DIR "bin") - if(LAUNCHER_PORTABLE) + if(Launcher_PORTABLE) set(LIBRARY_DEST_DIR "bin") set(BUNDLE_DEST_DIR ".") set(JARS_DEST_DIR "bin/jars") # launcher/Application.cpp will use this value - set(Launcher_APP_BINARY_DEFS "-DLAUNCHER_PORTABLE=1") + set(Launcher_APP_BINARY_DEFS "-DLauncher_PORTABLE=1") # Install basic runner script configure_file(launcher/Launcher.in "${CMAKE_CURRENT_BINARY_DIR}/LauncherScript" @ONLY) @@ -201,7 +201,7 @@ elseif(UNIX) set(LAUNCHER_METAINFO_DEST_DIR "share/metainfo" CACHE STRING "Path to the metainfo directory") set(LAUNCHER_ICON_DEST_DIR "share/icons/hicolor/scalable/apps" CACHE STRING "Path to the scalable icon directory") - set(Launcher_APP_BINARY_DEFS "-DMULTIMC_JARS_LOCATION=${CMAKE_INSTALL_PREFIX}/${JARS_DEST_DIR}" "-DLAUNCHER_PORTABLE=0") + set(Launcher_APP_BINARY_DEFS "-DMULTIMC_JARS_LOCATION=${CMAKE_INSTALL_PREFIX}/${JARS_DEST_DIR}" "-DLauncher_PORTABLE=0") install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${Launcher_Desktop} DESTINATION ${LAUNCHER_DESKTOP_DEST_DIR}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${Launcher_MetaInfo} DESTINATION ${LAUNCHER_METAINFO_DEST_DIR}) diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 16fd612e..fa5d267e 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -294,8 +294,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) } else { - // qDebug() << LAUNCHER_PORTABLE; -#if !LAUNCHER_PORTABLE || defined(Q_OS_MAC) +#if !Launcher_PORTABLE || defined(Q_OS_MAC) QDir foo(FS::PathCombine(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation), "..")); dataPath = foo.absolutePath(); adjustedBy += dataPath; diff --git a/packages/nix/polymc/default.nix b/packages/nix/polymc/default.nix index cc2ed4db..d65f39e1 100644 --- a/packages/nix/polymc/default.nix +++ b/packages/nix/polymc/default.nix @@ -69,7 +69,7 @@ mkDerivation rec { cmakeFlags = [ "-GNinja" - "-DLAUNCHER_PORTABLE=OFF" + "-DLauncher_PORTABLE=OFF" ]; postInstall = ''