作者:康 林 kl222@126.com
IOS
Mac os 和 IOS ,本人没有相应设备,请有相应设备的同学自己编译,测试。
本软件如果对你有用,或者你喜欢它,请你捐赠,支持作者。谢谢!
git clone https://github.com/KangLin/RabbitCommon.git
建立并进入build目录
git clone --recursive https://github.com/KangLin/Calendar.git
mkdir build
编译
cd build
qmake ../Calendar.pro RabbitCommon_DIR=
make install
windows 或 linux
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=`pwd`/install \
-DCMAKE_BUILD_TYPE=Release \
-DQt5_DIR=${QT_ROOT}/lib/cmake/Qt5 \
-DRabbitCommon_DIR=
cmake --build . --config Release --target install
编译
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=`pwd`/android-build \
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \
-DANDROID_ABI="armeabi-v7a with NEON" \
-DANDROID_PLATFORM=android-18 \
-DQt6_DIR= \
-DRabbitCommon_DIR=
cmake --build . --config Release
+ 安装 - 安装库和程序
cmake --build . --config Release --target install
编译
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=%cd%\android-build ^
-G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_TOOLCHAIN_FILE=%ANDROID_NDK%/build/cmake/android.toolchain.cmake ^
-DCMAKE_MAKE_PROGRAM=%ANDROID_NDK%/prebuilt/windows-x86_64/bin/make.exe ^
-DANDROID_ABI=arm64-v8a ^
-DANDROID_ARM_NEON=ON ^
-DANDROID_PLATFORM=android-24 ^
-DQt6_DIR= ^
-DRabbitCommon_DIR=
安装
安装库和程序
cmake –build . –config Release –target install
安装 apk 到设备
adb install android-build-debug.apk
linux
sudo apt-get install libssl1.1
库方式: 在项目文件中加入下列语句:
isEmpty(Calendar_DIR): Calendar_DIR=$ENV{Calendar_DIR}
isEmpty(Calendar_DIR){
message("1. Please download Calendar source code from https://github.com/KangLin/Calendar")
message(" ag:")
message(" git clone https://github.com/KangLin/Calendar.git")
message("2. Build the project, get library")
error("2. Then set value Calendar_DIR to library root directory")
}
INCLUDEPATH *= $${Calendar_DIR}/include $${Calendar_DIR}/include/export
LIBS *= -L$${Calendar_DIR}/lib -lLunarCalendar -lCalendar
子模块方式
add_subdirectory(3th_libs/Calendar/Src)
非子模块方式
# Need include ${RabbitCommon_DIR}/cmake/Translations.cmake
if( "${RabbitCommon_DIR}" STREQUAL "" )
set(RabbitCommon_DIR $ENV{RabbitCommon_DIR})
if( "${RabbitCommon_DIR}" STREQUAL "" )
set(RabbitCommon_DIR ${CMAKE_SOURCE_DIR}/../RabbitCommon)
endif()
endif()
if(DEFINED RabbitCommon_DIR AND EXISTS ${RabbitCommon_DIR}/Src)
add_subdirectory(${RabbitCommon_DIR}/Src ${CMAKE_BINARY_DIR}/RabbitCommon)
include(${RabbitCommon_DIR}/cmake/Translations.cmake)
else()
message("1. Please download RabbitCommon source code from https://github.com/KangLin/RabbitCommon")
message(" ag:")
message(" git clone https://github.com/KangLin/RabbitCommon.git")
message("2. Then set cmake value or environment variable RabbitCommon_DIR to download root directory.")
message(" ag:")
message(FATAL_ERROR " cmake -DRabbitCommon_DIR= ")
endif()
set(Calendar_DIR $ENV{Calendar_DIR} CACHE PATH "Set Calendar source code root directory.")
if(EXISTS ${Calendar_DIR}/Src)
add_subdirectory(${Calendar_DIR}/Src ${CMAKE_BINARY_DIR}/Calendar)
else()
message("1. Please download Calendar source code from https://github.com/KangLin/Calendar")
message(" ag:")
message(" git clone https://github.com/KangLin/Calendar.git")
message("2. Then set cmake value or environment variable Calendar_DIR to download root directory.")
message(" ag:")
message(FATAL_ERROR " cmake -DCalendar_DIR= ")
endif()
库方式:
Cmake 参数指定 Calendar_DIR 到库安装目录
FIND_PACKAGE(Calendar)
在 CMakeLists.txt 中增加头文件和库文件
SET(APP_LIBS ${PROJECT_NAME} ${QT_LIBRARIES})
if(Calendar_FOUND)
target_compile_definitions(${PROJECT_NAME}
PRIVATE -DCalendar)
target_include_directories(${PROJECT_NAME}
PRIVATE "${Calendar_INCLUDE_DIRS}/Src"
"${Calendar_INCLUDE_DIRS}/Src/export")
set(APP_LIBS ${APP_LIBS} ${Calendar_LIBRARIES})
endif()
target_link_libraries(${PROJECT_NAME} ${APP_LIBS})
用库中提供的函数
CTasksTools::Instance()->InitResource();
自定义
QString szPre;
#if defined(Q_OS_ANDROID) || _DEBUG
szPre = ":/Translations";
#else
szPre = qApp->applicationDirPath() + QDir::separator() + ".." + QDir::separator() + "translations";
#endif
m_Translator.load(szPre + "/Calendar_" + QLocale::system().name() + ".qm");
qApp->installTranslator(&m_Translator);