Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: add basic support #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 38 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: make
run: make
run: |
mkdir build
cd build
cmake ../src
cmake --build .
- name: download testfile
run: ./hlsdl -b -o test.ts "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8"
run: build/hlsdl -b -o test.ts "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8"
- name: verify testfile
run: echo "6bf11a9a4be02443d4790e43e6569a614128bad453c5cb327ec74031f6ea6382 test.ts" | shasum -a256 -c

Expand All @@ -27,8 +31,38 @@ jobs:
- name: install libcurl libcrypto
run: sudo apt -y install libcurl4-openssl-dev libssl-dev
- name: make
run: make
run: |
mkdir build
cd build
cmake ../src
cmake --build .
- name: download testfile
run: ./hlsdl -b -o test.ts "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8"
run: build/hlsdl -b -o test.ts "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8"
- name: verify testfile
run: echo "6bf11a9a4be02443d4790e43e6569a614128bad453c5cb327ec74031f6ea6382 test.ts" | shasum -a256 -c


build-windows:

runs-on: windows-latest
defaults:
run:
shell: msys2 {0}

steps:
- uses: actions/checkout@v1
with:
submodules: recursive
- uses: eine/setup-msys2@v1
with:
install: mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-openssl mingw-w64-x86_64-curl
- name: build
run: |
mkdir build
cd build
cmake -G "MSYS Makefiles" ../src
cmake --build .
- name: download testfile
run: build/hlsdl -b -o test.ts "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8"
- name: verify testfile
run: echo "6bf11a9a4be02443d4790e43e6569a614128bad453c5cb327ec74031f6ea6382 test.ts" | shasum -a256 -c
25 changes: 25 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 3.5)

project(hlsdl VERSION 0.27 LANGUAGES C)

if (APPLE AND NOT IOS)
if (NOT OPENSSL_ROOT_DIR)
EXECUTE_PROCESS(COMMAND brew --prefix openssl
OUTPUT_VARIABLE OPENSSL_ROOT_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
endif()

find_package(OpenSSL REQUIRED)
find_package(CURL REQUIRED)
find_package(Threads REQUIRED)

add_executable(hlsdl main.c aes_openssl.c curl.c hls.c misc.c msg.c mpegts.c)

target_include_directories(hlsdl PRIVATE ${OPENSSL_INCLUDE_DIR} ${CURL_INCLUDE_DIRS})

if (WIN32)
target_sources(hlsdl PRIVATE "../msvc/win/memmem.c")
endif()

target_link_libraries(hlsdl PRIVATE OpenSSL::Crypto CURL::libcurl Threads::Threads)