This action will force synchronization from kl222/LunarCalendar, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
Author: KangLin (kl222@126.com)
The lunar calendar written by Qt. It provides:
Mac os and IOS, I don't have the corresponding equipment, please compile and test the students with the corresponding equipment.
Depend
git clone https://github.com/KangLin/RabbitCommon.git
Create and enter the build directory
git clone --recursive https://github.com/KangLin/LunarCalendar.git
cd LunarCalendar
mkdir build
Use cmake
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
windows
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
Android
The host is linux
cd build
# If is Qt6
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 \
-DQT_DIR= \
-DQt6_DIR= \
-DRabbitCommon_DIR=
cmake --build . --target all
# If is Qt5
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 \
-DQT_DIR= \
-DQt5_DIR= \
-DRabbitCommon_DIR=
cmake --build . --config Release --target install
cmake --build . --target APK
The host is windows
cd build
; If is Qt5
cmake .. -G"Unix Makefiles" ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_INSTALL_PREFIX=`pwd`/android-build ^
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake ^
-DCMAKE_MAKE_PROGRAM=${ANDROID_NDK}/prebuilt/windows-x86_64/bin/make.exe ^
-DANDROID_PLATFORM=android-18 ^
-DANDROID_ABI=arm64-v8a ^
-DANDROID_ARM_NEON=ON ^
-DQT_DIR= ^
-DQt5_DIR= ^
-DRabbitCommon_DIR=
cmake --build . --config Release --target install
cmake --build . --target APK
; If is Qt6
cmake .. -G"Unix Makefiles" ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_INSTALL_PREFIX=`pwd`/android-build ^
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake ^
-DCMAKE_MAKE_PROGRAM=${ANDROID_NDK}/prebuilt/windows-x86_64/bin/make.exe ^
-DANDROID_PLATFORM=android-18 ^
-DANDROID_ABI=arm64-v8a ^
-DANDROID_ARM_NEON=ON ^
-DQT_DIR= ^
-DQt6_DIR= ^
-DRabbitCommon_DIR=
cmake --build . --target all
Parameter Description: https://developer.android.google.cn/ndk/guides/cmake
Install apk to devices
adb install android-build-debug.apk
Note
windows If you build app. Qt does not provide openssl dynamic library for copyright reasons, so you must copy the dynamic library of openssl to the installation directory.
linux
sudo apt-get install libssl1.1
|-App application source code
|-Src calendar library source code
|- LunarCalendar.h calendar interface header file
|- Resource
|- database
|- chinese_holidays.sql chinese holidays sql
Direct use the library source code.
Submodule
add submodule:
git submodule add https://github.com/KangLin/LunarCalendar.git 3th_lib/LunarCalendar
git submodule update --init --recursive
Add follow code in CMakeLists.txt
add_subdirectory(3th_lib/LunarCalendar/Src)
No submodule
Download LunarCalendar source code from https://github.com/KangLin/LunarCalendar
git clone --recursive https://github.com/KangLin/LunarCalendar.git
Add follow code in CMakeLists.txt
set(LunarCalendar_DIR $ENV{LunarCalendar_DIR} CACHE PATH "Set LunarCalendar source code root directory.")
if(EXISTS ${LunarCalendar_DIR}/Src)
add_subdirectory(${LunarCalendar_DIR}/Src ${CMAKE_BINARY_DIR}/LunarCalendar)
else()
message("1. Please download LunarCalendar source code from https://github.com/KangLin/LunarCalendar")
message(" ag:")
message(" git clone https://github.com/KangLin/LunarCalendar.git")
message("2. Then set cmake value or environment variable LunarCalendar_DIR to download root directory.")
message(" ag:")
message(FATAL_ERROR " cmake -DLunarCalendar_DIR= ")
endif()
Add libraries and include in CMakeLists.txt
SET(APP_LIBS ${PROJECT_NAME} ${QT_LIBRARIES})
if(TARGET LunarCalendar)
target_compile_definitions(${PROJECT_NAME}
PRIVATE -DLunarCalendar)
target_include_directories(${PROJECT_NAME}
PRIVATE "${LunarCalendar_DIR}/Src"
"${LunarCalendar_DIR}/Src/export")
set(APP_LIBS ${APP_LIBS} LunarCalendar)
endif()
target_link_libraries(${PROJECT_NAME} ${APP_LIBS})
Use in library mode
Cmake parameter LunarCalendar_DIR specifies the installation root directory
find_package(LunarCalendar)
Add libraries and include in CMakeLists.txt
SET(APP_LIBS ${PROJECT_NAME} ${QT_LIBRARIES})
if(LunarCalendar_FOUND)
target_compile_definitions(${PROJECT_NAME}
PRIVATE -DLunarCalendar)
target_include_directories(${PROJECT_NAME}
PRIVATE "${LunarCalendar_INCLUDE_DIRS}/Src"
"${LunarCalendar_INCLUDE_DIRS}/Src/export")
set(APP_LIBS ${APP_LIBS} ${LunarCalendar_LIBRARIES})
endif()
target_link_libraries(${PROJECT_NAME} ${APP_LIBS})
Load translator
Use library function
CLunarCalendar::InitResource();
Customize
QString szPre;
#if defined(Q_OS_ANDROID) || _DEBUG
szPre = ":/Translations";
#else
szPre = qApp->applicationDirPath() + QDir::separator() + ".." + QDir::separator() + "translations";
#endif
m_Translator.load(szPre + "/LunarCalendar_" + QLocale::system().name() + ".qm");
qApp->installTranslator(&m_Translator);
Please follow the license agreement for the third-party libraries below and the license and thank the authors of the third-party libraries.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。