linux下编译dcmtk的Android版本

本文介绍如何在Linux环境下使用NDK及CMake配置工具链来编译DCMTK,包括创建独立工具链、设置环境变量、配置CMake参数等步骤,并解决了几个常见编译问题。

用Windows编译dcmtk太痛苦了http://blog.youkuaiyun.com/newsten/article/details/45820689

干脆在linux下编译。


1.编译环境:

下载linux的NDK解压,再生成standalone toolchain,

<ndkpath>/build/tools/make-standalone-toolchain.sh --platform=android-18 --install-dir=my-android-toolchain-path  --arch=(x86 or arm)


2.设置环境变量:

export ANDROID_NDK=my-android-toolchain-path


3.cmake配置:

cmake  -DCMAKE_TOOLCHAIN_FILE=<dcmtkpath>/CMake/android.toolchain.cmake  -DDCMTK_ANDROID_TOOLCHAIN_VERIFIED=TRUE .


4.修改:

<dcmtkpath>/CMake/dcmtkUseAndroidSDK.cmake的DCMTK_ANDROID_START_EMULATOR和DCMTK_SETUP_ANDROID_EMULATOR函数直接RETURN(),这样就用不着AndroidSDK了。

用普通cmake生成的config\include\dcmtk\config\arith.h替换相同目录下的文件。

ofstd\libsrc\ofstd.cc里面的getlogin_r改成getlogin实现,要不在x86下编不过。


5.make -j8编译,交叉编译完成!!!

QT += quick widgets quickwidgets #charts #virtualkeyboard TEMPLATE = app CONFIG += release CONFIG += qml TARGET = xcamera_gui INCLUDEPATH += . CONFIG += c++11 QMAKE_CXXFLAGS += -std=c++11 # The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings # depend on your compiler). Refer to the documentation for the # deprecated API to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 INCLUDEPATH += Zmq SOURCES += \ Zmq/CR_ReadConfig.cpp \ Zmq/SDKImageProcessing.cpp \ Zmq/ZmqSocket.cpp \ Zmq/fastguidedfilter.cpp \ Zmq/imagesocket.cpp \ appconfig.cpp \ confighandle.cpp \ commonfunction.cpp \ demo.cpp \ imageprovider.cpp \ informationhandle.cpp \ jpegimage.cpp \ jsonconfig.cpp \ main.cpp \ messagehandle.cpp \ patienthandle.cpp \ radimage.cpp \ tracehandle.cpp \ type.cpp RESOURCES += qml.qrc # Additional import path used to resolve QML modules just for Qt Quick Designer # Default rules for deployment. #qnx: target.path = /tmp/$${TARGET}/bin #else: unix:!android: target.path = /opt/$${TARGET}/bin #!isEmpty(target.path): INSTALLS += target HEADERS += \ Zmq/CR_ReadConfig.h \ Zmq/SDKImageProcessing.h \ Zmq/ZmqSocket.h \ Zmq/fastguidedfilter.h \ Zmq/imagesocket.h \ appconfig.h \ confighandle.h \ commonfunction.h \ demo.h \ errorcode.h \ imageprovider.h \ informationhandle.h \ jpegimage.h \ jsonconfig.h \ messagehandle.h \ patienthandle.h \ radimage.h \ tracehandle.h \ type.h INCLUDEPATH += /export/include \ /usr/include/opencv4 \ /export/dcmtk3.6.6/usr/local/include LIBS += -L/export/lib -lzmq \ -L/usr/lib/aarch64-linux-gnu/opencv_4.1.1 -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -lopencv_highgui \ -L/export/dcmtk3.6.6/usr/local/lib -ldcmdata -ldcmimgle -ldcmjpeg -lofstd 参考上述qt的pro文件,将构建器从qmake迁移至cmake,cmake的架构和CMakeLists应该如何实现
07-17
``` QT += widgets charts virtualkeyboard #quickwidgets quick TEMPLATE = app CONFIG += c++11 CONFIG += release CONFIG += qml_release#qml_debug TARGET = careray_XCamera INCLUDEPATH += . # The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings # depend on your compiler). Refer to the documentation for the # deprecated API to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 INCLUDEPATH += Zmq SOURCES += \ Zmq/CommandSocket.cpp \ Zmq/ZmqSocket.cpp \ Zmq/imagesocket.cpp \ appconfig.cpp \ confighandle.cpp \ demo.cpp \ imageprovider.cpp \ informationhandle.cpp \ jpegimage.cpp \ jsonconfig.cpp \ main.cpp \ messagehandle.cpp \ patienthandle.cpp \ radimage.cpp \ tracehandle.cpp \ type.cpp RESOURCES += qml.qrc # Additional import path used to resolve QML modules in Qt Creator's code model # Additional import path used to resolve QML modules just for Qt Quick Designer # Default rules for deployment. #qnx: target.path = /tmp/$${TARGET}/bin #else: unix:!android: target.path = /opt/$${TARGET}/bin #!isEmpty(target.path): INSTALLS += target HEADERS += \ Zmq/CommandSocket.h \ Zmq/ZmqSocket.h \ Zmq/imagesocket.h \ appconfig.h \ confighandle.h \ demo.h \ errorcode.h \ imageprovider.h \ informationhandle.h \ jpegimage.h \ jsonconfig.h \ messagehandle.h \ patienthandle.h \ radimage.h \ tracehandle.h \ type.h INCLUDEPATH += $$PWD/ThirdParty/include/zmq \ $$PWD/ThirdParty/include/dcmtk LIBS += -L$$PWD/ThirdParty/lib/zmq/x64 -llibzmq \ -L$$PWD/ThirdParty/lib/dcmtk \ -lIphlpapi \ -lws2_32 \ -lwsock32 \ -lnetapi32\ -lofstd \ -loflog \ -ldcmdata \ -lzlib_o \ -ldcmimgle \ -ldcmimage \ -lijg8 \ -lijg12 \ -lijg16 \ -ldcmjpeg #LIBS += -llibzmq \ # -ldcmimgle -ldcmimage -ldcmdata -lofstd -ldcmjpeg DEPENDPATH += $$PWD/ThirdParty/lib/zmq/x64 \ $$PWD/ThirdParty/lib/dcmtk```分析这个.pro文件的问题,并输出优化后的结果
03-26
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值