mirror of
https://github.com/estkme-group/lpac
synced 2024-07-07 09:16:56 +02:00
feat: add CPack support (#39)
* chore: use GNUInstallDirs Signed-off-by: Coelacanthus <CoelacanthusHex@gmail.com> * feat: add CPack support Signed-off-by: Coelacanthus <CoelacanthusHex@gmail.com> * fix: Time.h and time.h conflict * fix: ${DL_LIBRARY} use before init Signed-off-by: Coelacanthus <CoelacanthusHex@gmail.com> --------- Signed-off-by: Coelacanthus <CoelacanthusHex@gmail.com>
This commit is contained in:
parent
086e8fb029
commit
04bd397ea4
25
.github/workflows/build.yaml
vendored
25
.github/workflows/build.yaml
vendored
|
@ -23,35 +23,38 @@ jobs:
|
|||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libpcsclite-dev libcurl4-openssl-dev gcc make cmake gcc-mingw-w64 g++-mingw-w64 unzip
|
||||
sudo apt-get install -y libpcsclite-dev libcurl4-openssl-dev gcc make cmake gcc-mingw-w64 g++-mingw-w64 unzip ninja-build
|
||||
|
||||
- name: Setup toolchain for Windows(Cygwin)
|
||||
if: runner.os == 'Windows'
|
||||
uses: egor-tensin/setup-cygwin@v4
|
||||
with:
|
||||
packages: cmake gcc-g++ make zip wget
|
||||
packages: cmake gcc-g++ make zip wget ninja
|
||||
|
||||
- name: Build for Windows(Cygwin)
|
||||
if: runner.os == 'Windows'
|
||||
run: |
|
||||
mkdir build-cygwin && cd build-cygwin && cmake .. && make
|
||||
wget https://curl.se/windows/dl-8.5.0_3/curl-8.5.0_3-win64-mingw.zip -O curl.zip && unzip curl.zip && mv curl-8.5.0_3-win64-mingw/bin/libcurl-x64.dll output/libcurl.dll
|
||||
cp C:\tools\cygwin\bin\cygwin1.dll output
|
||||
zip -r -j lpac-windows-x86_64-cygwin.zip output/*
|
||||
mkdir build-cygwin && cd build-cygwin && cmake .. -GNinja -DCPACK_GENERATOR=CygwinBinary && ninja package
|
||||
|
||||
- name: Build for Linux
|
||||
if: runner.os == 'Linux'
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir build && cd build && cmake .. && make -j$(nproc)
|
||||
mkdir build && cd build && cmake .. -GNinja && ninja
|
||||
chmod +x output/lpac
|
||||
zip -r -j lpac-linux-x86_64.zip output/*
|
||||
|
||||
- name: Build for Debian
|
||||
if: runner.os == 'Linux'
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir build-deb && cd build-deb && cmake .. -GNinja -DCPACK_GENERATOR=DEB && ninja package
|
||||
|
||||
- name: Build for Windows(MinGW)
|
||||
if: runner.os == 'Linux'
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir build-mingw && cd build-mingw && cmake -DCMAKE_TOOLCHAIN_FILE=./cmake/linux-mingw64.cmake .. && make -j$(nproc)
|
||||
mkdir build-mingw && cd build-mingw && cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=./cmake/linux-mingw64.cmake .. && ninja
|
||||
wget https://curl.se/windows/dl-8.5.0_3/curl-8.5.0_3-win64-mingw.zip -O curl.zip && unzip curl.zip && mv curl-8.5.0_3-win64-mingw/bin/libcurl-x64.dll output/libcurl.dll
|
||||
zip -r -j lpac-windows-x86_64-mingw.zip output/*
|
||||
|
||||
|
@ -69,7 +72,8 @@ jobs:
|
|||
name: artifact-${{ matrix.os }}
|
||||
path: |
|
||||
build-mingw/lpac-windows-x86_64-mingw.zip
|
||||
build-cygwin/lpac-windows-x86_64-cygwin.zip
|
||||
build-cygwin/lpac-*.tar.bz2
|
||||
build-deb/lpac-*.deb
|
||||
build/lpac-linux-x86_64.zip
|
||||
build/lpac-macos-universal.zip
|
||||
|
||||
|
@ -79,6 +83,7 @@ jobs:
|
|||
with:
|
||||
files: |
|
||||
build-mingw/lpac-windows-x86_64-mingw.zip
|
||||
build-cygwin/lpac-windows-x86_64-cygwin.zip
|
||||
build-cygwin/lpac-*.tar.bz2
|
||||
build-deb/lpac-*.deb
|
||||
build/lpac-linux-x86_64.zip
|
||||
build/lpac-macos-universal.zip
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
cmake_minimum_required (VERSION 3.8)
|
||||
project (lpac)
|
||||
project (lpac
|
||||
VERSION 1.0.0
|
||||
HOMEPAGE_URL "https://github.com/estkme-group/lpac"
|
||||
DESCRIPTION "C-based eUICC LPA."
|
||||
LANGUAGES C)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
|
||||
|
@ -11,13 +15,34 @@ if(CYGWIN)
|
|||
add_definitions(-DHAVE_TIMEGM=1)
|
||||
endif()
|
||||
|
||||
add_subdirectory(cjson)
|
||||
add_subdirectory(euicc)
|
||||
add_subdirectory(interface)
|
||||
add_subdirectory(src)
|
||||
if(UNIX)
|
||||
include(GNUInstallDirs)
|
||||
if(NOT CMAKE_INSTALL_RPATH)
|
||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}/lpac")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CPACK_GENERATOR)
|
||||
set(CPACK_PACKAGE_VENDOR "eSTK.me Group")
|
||||
|
||||
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "eSTK.me Group")
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc")
|
||||
set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "libcurl, libpcsclite, pcscd")
|
||||
|
||||
set(CPACK_RPM_PACKAGE_LICENSE "AGPL-3.0-only AND LGPL-2.0-only AND MIT")
|
||||
set(CPACK_RPM_PACKAGE_AUTOREQ "yes")
|
||||
set(CPACK_RPM_PACKAGE_REQUIRES "libcurl, libpcsclite, pcscd")
|
||||
|
||||
include(CPack)
|
||||
endif()
|
||||
|
||||
if(MINGW)
|
||||
add_subdirectory(dlfcn-win32)
|
||||
set(DL_LIBRARY dlfcn-win32)
|
||||
else()
|
||||
set(DL_LIBRARY dl)
|
||||
endif()
|
||||
add_subdirectory(cjson)
|
||||
add_subdirectory(euicc)
|
||||
add_subdirectory(interface)
|
||||
add_subdirectory(src)
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/asn1 LIB_EUICC_ASN1_SRCS)
|
||||
add_library(euiccasn1 STATIC ${LIB_EUICC_ASN1_SRCS})
|
||||
target_compile_definitions(euiccasn1 PRIVATE HAVE_CONFIG_H)
|
||||
target_include_directories(euiccasn1 PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/asn1>
|
||||
target_include_directories(euiccasn1 PRIVATE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
|
||||
|
||||
if(MINGW)
|
||||
|
|
|
@ -2,7 +2,9 @@ add_library(apduinterface_pcsc SHARED pcsc.c)
|
|||
target_link_libraries(apduinterface_pcsc euicc cjson-static)
|
||||
set_target_properties(apduinterface_pcsc PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/output")
|
||||
set_target_properties(apduinterface_pcsc PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/output")
|
||||
install(TARGETS apduinterface_pcsc LIBRARY DESTINATION lib/lpac)
|
||||
if(UNIX)
|
||||
install(TARGETS apduinterface_pcsc LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/lpac")
|
||||
endif()
|
||||
|
||||
if(MINGW OR CYGWIN)
|
||||
target_link_libraries(apduinterface_pcsc winscard)
|
||||
|
@ -17,10 +19,14 @@ add_library(apduinterface_at SHARED at.c)
|
|||
target_link_libraries(apduinterface_at euicc)
|
||||
set_target_properties(apduinterface_at PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/output")
|
||||
set_target_properties(apduinterface_at PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/output")
|
||||
install(TARGETS apduinterface_at LIBRARY DESTINATION lib/lpac)
|
||||
if(UNIX)
|
||||
install(TARGETS apduinterface_at LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/lpac")
|
||||
endif()
|
||||
|
||||
add_library(apduinterface_stdio SHARED stdio.c)
|
||||
target_link_libraries(apduinterface_stdio euicc cjson-static)
|
||||
set_target_properties(apduinterface_stdio PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/output")
|
||||
set_target_properties(apduinterface_stdio PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/output")
|
||||
install(TARGETS apduinterface_stdio LIBRARY DESTINATION lib/lpac)
|
||||
if(UNIX)
|
||||
install(TARGETS apduinterface_stdio LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/lpac")
|
||||
endif()
|
||||
|
|
|
@ -2,11 +2,15 @@ add_library(httpinterface_curl SHARED curl.c)
|
|||
target_link_libraries(httpinterface_curl euicc ${DL_LIBRARY})
|
||||
set_target_properties(httpinterface_curl PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/output")
|
||||
set_target_properties(httpinterface_curl PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/output")
|
||||
install(TARGETS httpinterface_curl LIBRARY DESTINATION lib/lpac)
|
||||
if(UNIX)
|
||||
install(TARGETS httpinterface_curl LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/lpac")
|
||||
endif()
|
||||
|
||||
|
||||
add_library(httpinterface_stdio SHARED stdio.c)
|
||||
target_link_libraries(httpinterface_stdio euicc cjson-static)
|
||||
set_target_properties(httpinterface_stdio PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/output")
|
||||
set_target_properties(httpinterface_stdio PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/output")
|
||||
install(TARGETS httpinterface_stdio LIBRARY DESTINATION lib/lpac)
|
||||
if(UNIX)
|
||||
install(TARGETS httpinterface_stdio LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/lpac")
|
||||
endif()
|
||||
|
|
|
@ -16,3 +16,7 @@ set_target_properties(lpac PROPERTIES
|
|||
)
|
||||
target_link_libraries(lpac euicc ${DL_LIBRARY})
|
||||
target_include_directories(lpac PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
|
||||
|
||||
if(UNIX)
|
||||
install(TARGETS lpac RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
endif()
|
||||
|
|
Loading…
Reference in a new issue