From 982495a8ee6932f4a1586faf0c853ebaf951000f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Sun, 6 Jun 2021 13:00:48 +0800 Subject: Add support for Emscripten --- CMakeLists.txt | 27 +++++++++++++-------------- README.md | 46 +++++++++------------------------------------- libicclient | 2 +- 3 files changed, 23 insertions(+), 52 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 123a895..852c035 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,17 +1,19 @@ cmake_minimum_required(VERSION 3.5) - project(qicclient) - set(CMAKE_AUTOMOC ON) - find_package(Qt5Core) -add_library(${PROJECT_NAME} SHARED +set(HDRS + ${PROJECT_NAME}/product.hxx ${PROJECT_NAME}/catalog.hxx ${PROJECT_NAME}/ord.hxx ${PROJECT_NAME}/member.hxx ${PROJECT_NAME}/admin.hxx ${PROJECT_NAME}/client.hxx + ) + +set(SRCS + ${HDRS} catalog.cxx ord.cxx member.cxx @@ -19,20 +21,17 @@ add_library(${PROJECT_NAME} SHARED client.cxx ) +if (EMSCRIPTEN OR IOS) + add_library(${PROJECT_NAME} STATIC ${SRCS}) +else() + add_library(${PROJECT_NAME} SHARED ${SRCS}) +endif() + target_link_libraries(${PROJECT_NAME} Qt5::Core icclient ) target_compile_definitions(${PROJECT_NAME} PRIVATE QICCLIENT) - install(TARGETS ${PROJECT_NAME} DESTINATION lib) -install(FILES - ${PROJECT_NAME}/product.hxx - ${PROJECT_NAME}/catalog.hxx - ${PROJECT_NAME}/ord.hxx - ${PROJECT_NAME}/member.hxx - ${PROJECT_NAME}/admin.hxx - ${PROJECT_NAME}/client.hxx - DESTINATION include/${PROJECT_NAME} - ) +install(FILES ${HDRS} DESTINATION include/${PROJECT_NAME}) diff --git a/README.md b/README.md index 5faddfb..5612bf0 100644 --- a/README.md +++ b/README.md @@ -6,52 +6,24 @@ ```sh $ git clone git://darapsa.org/qicclient.git +$ cd qicclient +$ mkdir build && cd build ``` -## Configuring for various target hosts (with optional debugging) +## Configuring for various target hosts (with optional debugging), compiling, linking, and installing ```sh -$ mkdir build-qicclient-Desktop-Debug -$ cd build-qicclient-Desktop-Debug -$ cmake -DCMAKE_BUILD_TYPE=Debug ../qicclient +$ cmake -DCMAKE_TOOLCHAIN_FILE=/opt/android-sdk-update-manager/ndk/21.3.6528147/build/cmake/android.toolchain.cmake -DCMAKE_FIND_ROOT_PATH=/opt/Qt/5.15.2/android -DANDROID_NATIVE_API_LEVEL=21 -DANDROID_ABI=arm64-v8a -DCMAKE_INSTALL_PREFIX=/opt/Qt/5.15.2/android -DCMAKE_BUILD_TYPE=Debug .. +$ make +$ make install ``` or ```sh -$ mkdir build-qicclient-Android_for_armeabi_v7a_arm64_v8a_x86_x86_64_Clang_Qt_5_15_2_android-Debug -$ cd build-qicclient-Android_for_armeabi_v7a_arm64_v8a_x86_x86_64_Clang_Qt_5_15_2_android-Debug -``` - -and then - -```sh -$ cmake -DCMAKE_TOOLCHAIN_FILE=/opt/android-sdk-update-manager/ndk/21.3.6528147/build/cmake/android.toolchain.cmake -DCMAKE_FIND_ROOT_PATH=/opt/Qt/5.15.2/android -DANDROID_NATIVE_API_LEVEL=21 -DANDROID_ABI=arm64-v8a -DCMAKE_INSTALL_PREFIX=/opt/Qt/5.15.2/android -DCMAKE_BUILD_TYPE=Debug ../qicclient -``` - -or - -```sh -$ cmake -DCMAKE_TOOLCHAIN_FILE=/opt/android-sdk-update-manager/ndk/21.3.6528147/build/cmake/android.toolchain.cmake -DCMAKE_FIND_ROOT_PATH=/opt/Qt/5.15.2/android -DANDROID_NATIVE_API_LEVEL=16 -DANDROID_ABI=armeabi-v7a -DCMAKE_INSTALL_PREFIX=/opt/Qt/5.15.2/android -DCMAKE_BUILD_TYPE=Debug ../qicclient -``` - -or - -```sh -$ cmake -DCMAKE_TOOLCHAIN_FILE=/opt/android-sdk-update-manager/ndk/21.3.6528147/build/cmake/android.toolchain.cmake -DCMAKE_FIND_ROOT_PATH=/opt/Qt/5.15.2/android -DANDROID_NATIVE_API_LEVEL=16 -DANDROID_ABI=x86 -DCMAKE_INSTALL_PREFIX=/opt/Qt/5.15.2/android -DCMAKE_BUILD_TYPE=Debug ../qicclient -``` - -or - -```sh -$ cmake -DCMAKE_TOOLCHAIN_FILE=/opt/android-sdk-update-manager/ndk/21.3.6528147/build/cmake/android.toolchain.cmake -DCMAKE_FIND_ROOT_PATH=/opt/Qt/5.15.2/android -DANDROID_NATIVE_API_LEVEL=21 -DANDROID_ABI=x86_64 -DCMAKE_INSTALL_PREFIX=/opt/Qt/5.15.2/android -DCMAKE_BUILD_TYPE=Debug ../qicclient +$ emcmake cmake -DCMAKE_TOOLCHAIN_FILE=/opt/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DQt5Core_DIR=/opt/Qt/5.15.2/wasm_32/lib/cmake/Qt5Core -DCMAKE_INSTALL_PREFIX=/opt/emsdk/upstream/emscripten/system -DCMAKE_BUILD_TYPE=Debug .. +$ emmake make +$ emmake make install ``` or so on. - -## Compiling, linking, and installing - -```sh -$ make # -jN (with N an integer number of parallel tasks you allow your computer to run for compiling this) -$ sudo make install -``` diff --git a/libicclient b/libicclient index 3d67e18..37b3483 160000 --- a/libicclient +++ b/libicclient @@ -1 +1 @@ -Subproject commit 3d67e186c27b9fe01c0bcd12b055b5bc6aaa0cd1 +Subproject commit 37b3483ea690318b9dfcbc840bfc8dd0d959b642 -- cgit v1.2.3