mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-15 19:22:25 +08:00
Windows building
This commit is contained in:
parent
a02410c282
commit
c4f90a50c7
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -31,4 +31,10 @@ Qt/
|
|||
QtGraphicalEffects/
|
||||
QtQuick/
|
||||
QtQuick.2/
|
||||
Qt5Compat/
|
||||
QtQml/
|
||||
sqldrivers/
|
||||
styles/
|
||||
tls/
|
||||
translations/
|
||||
*.dll
|
||||
|
|
|
@ -13,10 +13,11 @@ FreeKill采用最新的Qt进行构建,因此需要先安装Qt6的开发环境
|
|||
Qt安装的流程不赘述。为了编译FreeKill,至少需要安装以下的组件:
|
||||
- Qt 6: MinGW 11.2.0 64-bit (不支持MSVC)
|
||||
- Qt 6: Qt5 Compat
|
||||
- Qt 6: Shader Tools (为了使用GraphicalEffects)
|
||||
- Qt 6: Multimedia
|
||||
- QtCreator(这个是安装器强制要你安装的)
|
||||
- CMake、Ninja
|
||||
- OpenSSL 1.1.1j Source
|
||||
- OpenSSL 1.1.1
|
||||
|
||||
接下来根据平台的不同,步骤也稍有区别。
|
||||
|
||||
|
@ -24,13 +25,15 @@ ___
|
|||
|
||||
## Windows
|
||||
|
||||
从网络上下载swig、flex、bison。swig在其官网可以下载,flex和bison可在[github](https://github.com/lexxmark/winflexbison/releases/)下载。
|
||||
从网络上下载swig、flex、bison。swig在其官网可以下载,flex和bison可在[github](https://github.com/lexxmark/winflexbison/releases/)或者SourceForge下载。
|
||||
|
||||
全都下载完成之后,将含有swig.exe、win_flex.exe、win_bison.exe的文件夹全部都设置到Path环境变量里面去。
|
||||
|
||||
之后,把<Qt_root>/Tools/OpenSSL/src/include/openssl这个文件夹复制到<Qt_root>/6.3.2/mingw_64/include。
|
||||
接下来使用QtCreator打开项目,然后尝试编译。
|
||||
|
||||
接下来万事俱备,使用QtCreator打开项目,然后编译吧。
|
||||
这时遇到cmake报错:OpenSSL:Crypto not found. 这是因为我们还没有告诉编译器OpenSSL的位置,点左侧“项目”,查看构建选项,在CMake的Initial Configuration中,点击添加按钮,新增String型环境变量OPENSSL_ROOT_DIR,将其值设为跟Qt一同安装的OpenSSL的位置(如C:/Qt/Tools/OpenSSL/Win_x64)。然后点下方的Re-configure with Initial Parameters,这样就能正常编译了。
|
||||
|
||||
运行的话,在Qt Creator的项目选项->运行中,先将工作目录改为项目所在的目录(git仓库的目录)。然后先将编译好了的FreeKill.exe放到项目目录中,在目录下打开CMD,执行windeployqt FreeKill.exe。调整目录下的dll文件直到能运行起来为止,之后就可以在Qt Creator中正常运行和调试了。
|
||||
|
||||
___
|
||||
|
||||
|
@ -47,7 +50,7 @@ $ sudo apt install liblua5.4-dev libsqlite3-dev libssl-dev swig flex bison
|
|||
Arch Linux:
|
||||
|
||||
```sh
|
||||
$ sudo pacman -Sy lua sqlite swig openssl swig flex bison
|
||||
$ sudo pacman -Sy lua sqlite swig openssl flex bison
|
||||
```
|
||||
|
||||
然后使用配置好的QtCreator环境即可编译。
|
||||
|
|
|
@ -31,7 +31,7 @@ set(freekill_HEADERS
|
|||
if (WIN32)
|
||||
set(LUA_LIB ${PROJECT_SOURCE_DIR}/lib/win/lua54.dll)
|
||||
set(SQLITE3_LIB ${PROJECT_SOURCE_DIR}/lib/win/sqlite3.dll)
|
||||
set(CRYPTO_LIB ${PROJECT_SOURCE_DIR}/lib/win/libcrypto_1_1.dll)
|
||||
set(CRYPTO_LIB OpenSSL::Crypto)
|
||||
elseif (ANDROID)
|
||||
set(LUA_LIB ${PROJECT_SOURCE_DIR}/lib/android/liblua54.so)
|
||||
set(SQLITE3_LIB ${PROJECT_SOURCE_DIR}/lib/android/libsqlite3.so)
|
||||
|
|
138
src/applink.c
Executable file
138
src/applink.c
Executable file
|
@ -0,0 +1,138 @@
|
|||
/*
|
||||
* Copyright 2004-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#define APPLINK_STDIN 1
|
||||
#define APPLINK_STDOUT 2
|
||||
#define APPLINK_STDERR 3
|
||||
#define APPLINK_FPRINTF 4
|
||||
#define APPLINK_FGETS 5
|
||||
#define APPLINK_FREAD 6
|
||||
#define APPLINK_FWRITE 7
|
||||
#define APPLINK_FSETMOD 8
|
||||
#define APPLINK_FEOF 9
|
||||
#define APPLINK_FCLOSE 10 /* should not be used */
|
||||
|
||||
#define APPLINK_FOPEN 11 /* solely for completeness */
|
||||
#define APPLINK_FSEEK 12
|
||||
#define APPLINK_FTELL 13
|
||||
#define APPLINK_FFLUSH 14
|
||||
#define APPLINK_FERROR 15
|
||||
#define APPLINK_CLEARERR 16
|
||||
#define APPLINK_FILENO 17 /* to be used with below */
|
||||
|
||||
#define APPLINK_OPEN 18 /* formally can't be used, as flags can vary */
|
||||
#define APPLINK_READ 19
|
||||
#define APPLINK_WRITE 20
|
||||
#define APPLINK_LSEEK 21
|
||||
#define APPLINK_CLOSE 22
|
||||
#define APPLINK_MAX 22 /* always same as last macro */
|
||||
|
||||
#ifndef APPMACROS_ONLY
|
||||
# include <stdio.h>
|
||||
# include <io.h>
|
||||
# include <fcntl.h>
|
||||
|
||||
static void *app_stdin(void)
|
||||
{
|
||||
return stdin;
|
||||
}
|
||||
|
||||
static void *app_stdout(void)
|
||||
{
|
||||
return stdout;
|
||||
}
|
||||
|
||||
static void *app_stderr(void)
|
||||
{
|
||||
return stderr;
|
||||
}
|
||||
|
||||
static int app_feof(FILE *fp)
|
||||
{
|
||||
return feof(fp);
|
||||
}
|
||||
|
||||
static int app_ferror(FILE *fp)
|
||||
{
|
||||
return ferror(fp);
|
||||
}
|
||||
|
||||
static void app_clearerr(FILE *fp)
|
||||
{
|
||||
clearerr(fp);
|
||||
}
|
||||
|
||||
static int app_fileno(FILE *fp)
|
||||
{
|
||||
return _fileno(fp);
|
||||
}
|
||||
|
||||
static int app_fsetmod(FILE *fp, char mod)
|
||||
{
|
||||
return _setmode(_fileno(fp), mod == 'b' ? _O_BINARY : _O_TEXT);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
__declspec(dllexport)
|
||||
void **
|
||||
# if defined(__BORLANDC__)
|
||||
/*
|
||||
* __stdcall appears to be the only way to get the name
|
||||
* decoration right with Borland C. Otherwise it works
|
||||
* purely incidentally, as we pass no parameters.
|
||||
*/
|
||||
__stdcall
|
||||
# else
|
||||
__cdecl
|
||||
# endif
|
||||
OPENSSL_Applink(void)
|
||||
{
|
||||
static int once = 1;
|
||||
static void *OPENSSL_ApplinkTable[APPLINK_MAX + 1] =
|
||||
{ (void *)APPLINK_MAX };
|
||||
|
||||
if (once) {
|
||||
OPENSSL_ApplinkTable[APPLINK_STDIN] = (void *)app_stdin;
|
||||
OPENSSL_ApplinkTable[APPLINK_STDOUT] = (void *)app_stdout;
|
||||
OPENSSL_ApplinkTable[APPLINK_STDERR] = (void *)app_stderr;
|
||||
OPENSSL_ApplinkTable[APPLINK_FPRINTF] = (void *)fprintf;
|
||||
OPENSSL_ApplinkTable[APPLINK_FGETS] = (void *)fgets;
|
||||
OPENSSL_ApplinkTable[APPLINK_FREAD] = (void *)fread;
|
||||
OPENSSL_ApplinkTable[APPLINK_FWRITE] = (void *)fwrite;
|
||||
OPENSSL_ApplinkTable[APPLINK_FSETMOD] = (void *)app_fsetmod;
|
||||
OPENSSL_ApplinkTable[APPLINK_FEOF] = (void *)app_feof;
|
||||
OPENSSL_ApplinkTable[APPLINK_FCLOSE] = (void *)fclose;
|
||||
|
||||
OPENSSL_ApplinkTable[APPLINK_FOPEN] = (void *)fopen;
|
||||
OPENSSL_ApplinkTable[APPLINK_FSEEK] = (void *)fseek;
|
||||
OPENSSL_ApplinkTable[APPLINK_FTELL] = (void *)ftell;
|
||||
OPENSSL_ApplinkTable[APPLINK_FFLUSH] = (void *)fflush;
|
||||
OPENSSL_ApplinkTable[APPLINK_FERROR] = (void *)app_ferror;
|
||||
OPENSSL_ApplinkTable[APPLINK_CLEARERR] = (void *)app_clearerr;
|
||||
OPENSSL_ApplinkTable[APPLINK_FILENO] = (void *)app_fileno;
|
||||
|
||||
OPENSSL_ApplinkTable[APPLINK_OPEN] = (void *)_open;
|
||||
OPENSSL_ApplinkTable[APPLINK_READ] = (void *)_read;
|
||||
OPENSSL_ApplinkTable[APPLINK_WRITE] = (void *)_write;
|
||||
OPENSSL_ApplinkTable[APPLINK_LSEEK] = (void *)_lseek;
|
||||
OPENSSL_ApplinkTable[APPLINK_CLOSE] = (void *)_close;
|
||||
|
||||
once = 0;
|
||||
}
|
||||
|
||||
return OPENSSL_ApplinkTable;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -5,6 +5,10 @@
|
|||
#include "shell.h"
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN32)
|
||||
#include "applink.c"
|
||||
#endif
|
||||
|
||||
#include <QSplashScreen>
|
||||
#include <QScreen>
|
||||
|
||||
|
|
|
@ -15,9 +15,6 @@ typedef int LuaFunction;
|
|||
#include "lua.hpp"
|
||||
#include "sqlite3.h"
|
||||
|
||||
// Note: headers of openssl is too big, so they are not provided in git repo
|
||||
// Please install openssl's src via Qt Installer, then copy headers
|
||||
// (<Qt_root>/Tools/OpenSSL/src/include/openssl) to <Qt6_dir>/mingw_64/include
|
||||
#include <openssl/rsa.h>
|
||||
#include <openssl/pem.h>
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user