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

Changes to cmake and minor code edits #30

Merged
merged 1 commit into from
Jul 26, 2022
Merged
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
91 changes: 8 additions & 83 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
################################################################################
# set include path for cmake functionality
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})

################################################################################
# minimum cmake version - if your CMake version is less that this, then
# configuration will fail.
cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.13)

################################################################################
# we have vcpkg installed as a submodule, and this will ensure that we install
Expand All @@ -25,18 +21,6 @@ endif(NOT EXISTS ${CMAKE_TOOLCHAIN_FILE})
# several projects, but this is declared as the top level project.
project(qmedia VERSION 0.1 LANGUAGES C CXX)

################################################################################
# If this is a Makefile generator and the build type was not defined, then the
# project should default to a debug build. Also sets the generated
# configurations to match the build type.
if("${CMAKE_GENERATOR}" MATCHES "Makefiles" AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()

if("${CMAKE_GENERATOR}" MATCHES "Makefiles")
set(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE})
endif()

################################################################################
# Options are public build variables that will be surfaced to a CMake GUI if
# you might using one.
Expand All @@ -48,32 +32,21 @@ option(CLANG_TIDY "Perform linting with clang-tidy" OFF)

################################################################################
# dependencies
include(dependencies)
#

# Build PIC dependencies when created extern shared library.
if (BUILD_EXTERN)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif(BUILD_EXTERN)

add_subdirectory(dependencies)

###
### Global Config
###
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
#set(CMAKE_OSX_ARCHITECTURES "arm64")

################################################################################
# update the general compiler configuration
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# clang & gcc
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
add_compile_options(-pedantic -Wextra)
elseif(MSVC)
#add_compile_options(/W4)
endif()

if(CLANG_TIDY)
find_program(CLANG_TIDY_EXE NAMES "clang-tidy")
if(CLANG_TIDY_EXE)
Expand All @@ -83,35 +56,10 @@ if(CLANG_TIDY)
endif()
endif()



################################################################################
# subdirectories - if we want to build tests or anything else, we could add the
# subdirectories here. Generally, the subdirectories on this level would be
# include, contrib, src, and tests.

include_directories( include src/extern )


###
### Dependencies
###

find_package(Picoquic REQUIRED)
message(STATUS "Picoquic/include: ${Picoquic_INCLUDE_DIRS}" )
message(STATUS "Picoquic library: ${Picoquic_LIBRARIES}" )

find_package(PTLS REQUIRED)
message(STATUS "picotls/include: ${PTLS_INCLUDE_DIRS}" )
message(STATUS "picotls libraries: ${PTLS_LIBRARIES}" )

find_package(Quicr REQUIRED)
message(STATUS "quicr/include: ${QUICR_INCLUDE_DIRS}" )
message(STATUS "quicr libraries: ${QUICR_LIBRARIES}" )

include_directories(include lib tests
${QUICR_INCLUDE_DIRS} ${Picoquic_INCLUDE_DIRS} ${PTLS_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR})

set(LIBRARIES media_api gsl sframe)

# samplerate
Expand Down Expand Up @@ -166,34 +114,10 @@ endif()
###
### Library Source
###
add_subdirectory(lib)
#add_subdirectory(lib)

add_subdirectory(src)

###
### Library Config
###

set(LIB_NAME "${PROJECT_NAME}")

file(GLOB_RECURSE LIB_HEADERS CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.hh")
file(GLOB_RECURSE LIB_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc")

add_library(${LIB_NAME} ${LIB_HEADERS} ${LIB_SOURCES})
target_link_directories(${LIB_NAME} PUBLIC ${PROJECT_LIBS_LIBRARY_DIR} ${OpenH264_LIB_DIR})
target_link_libraries(${LIB_NAME} ${LIBRARIES} OpenSSL::Crypto openh264)
target_include_directories(${LIB_NAME}
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
${CMAKE_CURRENT_BINARY_DIR}
${Protobuf_INCLUDE_DIRS}
${OpenH264_INCLUDE_DIR}
$<INSTALL_INTERFACE:include/${PROJECT_NAME}-${PROJECT_VERSION}>
)

target_link_libraries(${LIB_NAME} ${QUICR_LIBRARIES} ${Picoquic_LIBRARIES} ${PTLS_LIBRARIES})


###
### Applications
###
Expand All @@ -203,6 +127,7 @@ add_subdirectory(cmd)
###
### Tests
###
if(BUILD_TESTS)
include(CTest)
if(BUILD_TESTING AND qmedia_BUILD_TESTS)
add_subdirectory(test)
endif(BUILD_TESTS)
endif()
45 changes: 0 additions & 45 deletions cmake/FindPTLS.cmake

This file was deleted.

36 changes: 0 additions & 36 deletions cmake/FindPicoquic.cmake

This file was deleted.

33 changes: 0 additions & 33 deletions cmake/FindQuicr.cmake

This file was deleted.

20 changes: 13 additions & 7 deletions cmd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
add_executable(forty forty-bytes.cc)
target_link_libraries( forty PUBLIC qmedia)

find_package(portaudio QUIET)
if(portaudio_FOUND)
add_executable( sound sound.cc)
target_link_libraries( sound PUBLIC qmedia)
add_executable(sound sound.cc)
target_link_libraries(sound PUBLIC qmedia)

if (WIN32)
target_link_libraries( sound PUBLIC portaudio)
target_link_libraries(sound PUBLIC portaudio)
else(WIN32)
target_link_libraries( sound PUBLIC portaudio_static)
target_link_libraries(sound PUBLIC portaudio_static)
endif(WIN32)
target_compile_options(sound
PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>: -Wpedantic -Wextra -Wall>
$<$<CXX_COMPILER_ID:MSVC>: >)
set_target_properties(sound
PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS OFF)
else(portaudio_FOUND)
message(STATUS "Skipping building sound as missing portaudio")
endif(portaudio_FOUND)
Loading