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

Add CMake compatibility for MinGW #1

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
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
128 changes: 128 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
cmake_minimum_required(VERSION 3.15)
project(video-encode VERSION 1.0)

option(BUILD_SHARED_LIBS "Build using shared libraries" ON)

# video-encode
set(LIB_SOURCES
src/venc.c
)

add_library(${PROJECT_NAME} SHARED ${LIB_SOURCES})

set_target_properties(${PROJECT_NAME} PROPERTIES
POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS}
)


target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

target_compile_definitions(${PROJECT_NAME} PRIVATE "VENC_API_EXPORTS")
target_compile_options(${PROJECT_NAME} PRIVATE "-fvisibility=hidden")
target_compile_options(${PROJECT_NAME} PRIVATE "-std=gnu99")

target_link_libraries(${PROJECT_NAME}

PRIVATE
futils
pomp
ulog
video-defs
h264
h265
media-buffers
media-buffers-memory
media-buffers-memory-generic
video-defs
video-metadata
video-streaming
video-encode-core
transport-packet
)

# video-encode-core
set(LIB_SOURCES
core/src/venc_core.c
core/src/venc_h264.c
core/src/venc_h265.c
)
add_library(${PROJECT_NAME}-core SHARED ${LIB_SOURCES})
target_include_directories(${PROJECT_NAME}-core PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/core/include>
$<INSTALL_INTERFACE:include>
)

set_target_properties(${PROJECT_NAME}-core PROPERTIES
POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS}
)

target_include_directories(video-encode-core PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/core/include>
$<INSTALL_INTERFACE:include>
)

target_compile_definitions(${PROJECT_NAME}-core PRIVATE "VENC_API_EXPORTS")
target_compile_options(${PROJECT_NAME}-core PRIVATE "-fvisibility=hidden")
target_compile_options(${PROJECT_NAME}-core PRIVATE "-std=gnu99")

if(WIN32)
target_link_libraries(${PROJECT_NAME}-core
# PUBLIC

PRIVATE
ws2_32
futils
pomp
ulog
h264
h265
media-buffers
media-buffers-memory
media-buffers-memory-generic
video-defs
video-metadata
video-streaming
transport-packet

)
else()

target_link_libraries(${PROJECT_NAME}-core
# PUBLIC

PRIVATE
futils
pomp
ulog
h264
h265
media-buffers
media-buffers-memory
media-buffers-memory-generic
video-defs
video-metadata
video-streaming
transport-packet

)
endif()


install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}-targets
PUBLIC_HEADER DESTINATION include
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)

install(TARGETS ${PROJECT_NAME}-core
EXPORT ${PROJECT_NAME}-core-targets
PUBLIC_HEADER DESTINATION include
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)