Makefile文件编写

1、qt 工程pro文件配置

QT -= gui

TEMPLATE = lib

CONFIG += 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). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# 设置宏定义
DEFINES += CURL_STATICLIB
#DEFINES += OS_ANDROID

# 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

# 设置编译生成的临时文件输出路径
MOC_DIR = $$PWD/temp/moc
RCC_DIR = $$PWD/temp/rcc
UI_DIR = $$PWD/temp/ui
OBJECTS_DIR = $$PWD/temp/obj

# 设置头文件路径
INCLUDEPATH += ../public

# 条件编译
if(contains(DEFINES,OS_ANDROID)){
   
   

LIBS_PATH = ../public/arm-ca53-linux/lib

INCLUDEPATH += ../public/arm-ca53-linux/include

}else{
   
    # 必须在同一行

LIBS_PATH = ../public/x86-64-linux/lib
INCLUDEPATH += ../public/x86-64-linux/include
DEPENDPATH += ../public/x86-64-linux/lib

}

# 打印
message($$LIBS_PATH)


SOURCES += \
    ../public/Base64.cpp \
    EhcHandler.cpp \
    ErrorDefine.cpp \
    VirtualCardChk.cpp \
    ../public/SM3.cpp \
    ../public/StringUtil.cpp \
    ../public/database.cpp \
    ../public/httpsclient.cpp \
    ../public/json/json_reader.cpp \
    ../public/json/json_value.cpp \
    ../public/json/json_writer.cpp \
    ../public/LogUtil.cpp \
    ../public/JsonUtil.cpp \
    ../public/sm4.cpp \
    ../public/md5.cpp

HEADERS += \
    Base64.h \
    EhcHandler.h \
    ErrorDefine.h \
    VirtualCardChk.h \
    SharedMutex.h \
    Singleton.h \
    StringUtil.h \
    ThreadLockCs.h \
    Util.h \
    database.h \
    httpsclient.h \
    json_batchallocator.h \
    json_internalarray.inl \
    json_internalmap.inl \
    json_valueiterator.inl \
    sm3.h \
    sm4.h \
    stdafx.h

# Default rules for deployment.
unix {
   
   
    target.path = /usr/lib
}
!isEmpty(target.path): INSTALLS += target

# 链接静态库
LIBS += $$LIBS_PATH/libcurl.a
LIBS += $$LIBS_PATH/libssl.a
LIBS += $$LIBS_PATH/libcrypto.a


message($$LIBS)

2、基于qmake生成Makefile文件修改

#############################################################################
# Makefile for building: libVirtualCardChk.so.1.0.0
# Generated by qmake (3.1) (Qt 5.12.9)
# Project:  ../VirtualCardChk/VirtualCardChk.pro
# Template: lib
# Command: /opt/Qt5.12.9/5.12.9/gcc_64/bin/qmake -o Makefile ../VirtualCardChk/VirtualCardChk.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug
#############################################################################

MAKEFILE      = Makefile

EQ            = =

# 设置交叉编译工具路径
CROSS_COMPILE_PATH = /opt/arm/arm-ca53-linux-gnueabihf-6.4/arm-ca53-linux-gnueabihf

# 设置curl和openssl路径
CURL_INCLUDE_PATH = ../public/arm-ca53-linux/include
CURL_LIB_PATH = ../public/arm-ca53-linux/lib
OPENSSL_INCLUDE_PATH = ../public/arm-ca53-linux/include
OPENSSL_LIB_PATH = ../public/arm-ca53-linux/lib

####### Compiler, tools and options
# 设置编译工具名称
CC            = arm-ca53-linux-gnueabihf-gcc
CXX           = arm-ca53-linux-gnueabihf-g++
DEFINES       = -DCURL_STATICLIB
CFLAGS        = -pipe -g -Wall -W -D_REENTRANT -fPIC $(DEFINES)
CXXFLAGS      = -pipe -g -Wall -std=c++11 -
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值