Skip to content

Commit

Permalink
separate sql dir and android script
Browse files Browse the repository at this point in the history
  • Loading branch information
hypengw committed Oct 19, 2024
1 parent 4d3df73 commit 95c8901
Show file tree
Hide file tree
Showing 14 changed files with 140 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,5 @@ CMakeLists.txt.*
compile_commands.json
/.qmllint.ini
/.vscode
/CMakeUserPresets.json
/CMakeUserPresets.json
/env.sh
19 changes: 19 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": 3,
"configurePresets": [
{
"name": "android",
"binaryDir": "build/android-release",
"cacheVariables": {
"CMAKE_INSTALL_PREFIX": "build/android-release/install",
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_GENERATOR": "Ninja",
"ANDROID_SDK_ROOT": "$env{SDK_ROOT}",
"ANDROID_NDK_ROOT": "$env{NDK_ROOT}",
"QCM_MODEL_GENERATOR": "${sourceDir}/build/Release/generator/model/qcm_model_generator",
"QT_ANDROID_SIGN_APK": "ON"
},
"toolchainFile": "build/android-release/generators/conan_toolchain.cmake"
}
]
}
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Qcm
Material3 cloud music player.
Currently linux only.

Music Service:
- Jellyfin(wip)
Expand Down
8 changes: 4 additions & 4 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,26 @@ set(SOURCES
include/Qcm/image_provider.h
include/Qcm/playlist.h
include/Qcm/qr_image.h
include/Qcm/cache_sql.h
include/Qcm/lyric.h
include/Qcm/clipboard.h
include/Qcm/player.h
include/Qcm/qml_util.h
include/Qcm/storage_info.h
include/Qcm/collection_sql.h
include/Qcm/sql/cache_sql.h
include/Qcm/sql/collection_sql.h
src/action.cpp
src/app.cpp
src/image_provider.cpp
src/playlist.cpp
src/qr_image.cpp
src/cache_sql.cpp
src/lyric.cpp
src/clipboard.cpp
src/player.cpp
src/fake_moc.cpp
src/qml_util.cpp
src/storage_info.cpp
src/collection_sql.cpp)
src/sql/cache_sql.cpp
src/sql/collection_sql.cpp)

set(QCM_INTERFACE_HEADER
include/qcm_interface/enum.h include/qcm_interface/global.h
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions app/src/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
#include "Qcm/qr_image.h"
#include "Qcm/image_provider.h"
#include "Qcm/qml_util.h"
#include "Qcm/collection_sql.h"
#include "Qcm/cache_sql.h"
#include "Qcm/sql/collection_sql.h"
#include "Qcm/sql/cache_sql.h"
#include "Qcm/info.h"

using namespace qcm;
Expand Down
2 changes: 1 addition & 1 deletion app/src/qml_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "qcm_interface/path.h"
#include "crypto/crypto.h"
#include "asio_helper/basic.h"
#include "Qcm/cache_sql.h"
#include "Qcm/sql/cache_sql.h"

namespace qcm::qml
{
Expand Down
2 changes: 1 addition & 1 deletion app/src/cache_sql.cpp → app/src/sql/cache_sql.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "Qcm/cache_sql.h"
#include "Qcm/sql/cache_sql.h"

#include <asio/use_awaitable.hpp>
#include <asio/bind_executor.hpp>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "Qcm/collection_sql.h"
#include "Qcm/sql/collection_sql.h"

#include <QSqlError>
#include <QSqlQuery>
Expand Down
2 changes: 1 addition & 1 deletion app/src/storage_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "qcm_interface/async.inl"
#include "qcm_interface/global.h"
#include "Qcm/app.h"
#include "Qcm/cache_sql.h"
#include "Qcm/sql/cache_sql.h"

#include "asio_helper/basic.h"

Expand Down
10 changes: 10 additions & 0 deletions generator/model/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
cmake_minimum_required(VERSION 3.14)

project(
QcmModelGenerator
LANGUAGES CXX
)
find_package(
Qt6 REQUIRED
COMPONENTS Core)

if(0)
find_package(FLEX REQUIRED)
flex_target(CppScanner cpp_scanner/lexer.l ${CMAKE_CURRENT_BINARY_DIR}/lexer.cpp)
Expand Down
98 changes: 98 additions & 0 deletions make_android.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#!/bin/bash

set -ex

# QT_ROOT
# SDK_ROOT
# NDK_ROOT
# QT_ANDROID_KEYSTORE_PATH
# QT_ANDROID_KEYSTORE_ALIAS
# QT_ANDROID_KEYSTORE_STORE_PASS
# LLVM_STRIP

export QT_HOST_PATH=$QT_ROOT/gcc_64
build_dir=build/android-release

if [ ! -e $build_dir/openssl ];then
mkdir -p $build_dir/openssl
pushd $build_dir/openssl

OPENSSL_VERSION=3.3.2
OPENSSL_SHA=2e8a40b01979afe8be0bbfb3de5dc1c6709fedb46d6c89c10da114ab5fc3d281

wget -Oconanfile.py https://github.com/conan-io/conan-center-index/raw/refs/heads/master/recipes/openssl/3.x.x/conanfile.py
replaced=" replace_in_file(self, os.path.join(self.source_folder, 'crypto/x509/by_dir.c'), 'X509_NAME_hash_ex(name, libctx, propq, \\&i);\\\\n if (i == 0)', 'X509_NAME_hash_old(name);if(0)')"
sed -ie "s|strip_root=True)|strip_root=True)\n$replaced\n|" conanfile.py
sed -ie "s|shared_extension = \"\"|shared_extension = r'shared_extension => \".so\",'|" conanfile.py
cat <<EOF > conandata.yml
sources:
${OPENSSL_VERSION}:
url: "https://github.com/openssl/openssl/releases/download/openssl-${OPENSSL_VERSION}/openssl-${OPENSSL_VERSION}.tar.gz"
sha256: ${OPENSSL_SHA}
patches:
${OPENSSL_VERSION}:
- patch_file: "x509-md5-names.patch"
patch_description: "Android ships MD5 hash named certificates which OpenSSL no longer supports by default."
patch_type: portability
patch_source: https://github.com/openssl/openssl/issues/13565
EOF

cat <<EOF > x509-md5-names.patch
diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c
index 1d401d0420..49a32d694f 100644
--- a/crypto/x509/by_dir.c
+++ b/crypto/x509/by_dir.c
@@ -257,9 +257,13 @@ static int get_cert_by_subject_ex(X509_LOOKUP *xl, X509_LOOKUP_TYPE type,
}
ctx = (BY_DIR *)xl->method_data;
+#ifdef FORCE_MD5_X509_NAME_HASHES
+ h = X509_NAME_hash_old(name);
+#else
h = X509_NAME_hash_ex(name, libctx, propq, &i);
if (i == 0)
goto finish;
+#endif
for (i = 0; i < sk_BY_DIR_ENTRY_num(ctx->dirs); i++) {
BY_DIR_ENTRY *ent;
int idx;
EOF

conan export . --version $OPENSSL_VERSION
popd
fi

cat <<EOF > ~/.conan2/profiles/android
{% set ndk = os.getenv('NDK_ROOT') %}
{% set ndk_bin = ndk + "/toolchains/llvm/prebuilt/linux-x86_64/bin" %}
{% set api = 29 %}
[settings]
os=Android
os.api_level={{api}}
build_type=Release
arch=armv8
compiler=clang
compiler.version=18
compiler.libcxx=c++_shared
compiler.cppstd=23
[conf]
tools.android:ndk_path={{ndk}}
tools.cmake.cmaketoolchain:generator=Ninja
tools.cmake.cmake_layout:build_folder_vars=['settings.os','settings.build_type']
[buildenv]
CC={{ndk_bin}}/aarch64-linux-android{{api}}-clang
CXX={{ndk_bin}}/aarch64-linux-android{{api}}-clang++
STRIP=${LLVM_STRIP}
EOF

conan install . --profile=android --build=missing -s build_type=Release \
-d runtime_deploy \
--deployer-folder $build_dir/deps \
-c "tools.cmake.cmaketoolchain:user_toolchain=[\"$QT_ROOT/android_arm64_v8a/lib/cmake/Qt6/qt.toolchain.cmake\"]" \
-o 'libcurl*:with_ca_path=/system/etc/security/cacerts'

cmake --preset android
cmake --build $build_dir -j
2 changes: 1 addition & 1 deletion qml_material
Submodule qml_material updated 1 files
+5 −7 qml/AppBar.qml

0 comments on commit 95c8901

Please sign in to comment.