Skip to content

Commit

Permalink
Updated cmake for windows wip
Browse files Browse the repository at this point in the history
  • Loading branch information
suhrm committed Nov 24, 2023
1 parent 4756d79 commit 25bb6d4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
35 changes: 23 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,28 @@ find_package(Python COMPONENTS Interpreter)

# Use waf to resolve dependencies
if(NOT DEFINED STEINWURF_RESOLVE)
message(STATUS "Resolving dependencies...")
execute_process(
message(STATUS "Resolving dependencies...")
execute_process(
COMMAND ${Python_EXECUTABLE} waf resolve ${STEINWURF_RESOLVE_OPTIONS}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE STATUS)

if(STATUS AND NOT STATUS EQUAL 0)
message(FATAL_ERROR "Failed: ${STATUS}")
endif()
if(STATUS AND NOT STATUS EQUAL 0)
message(FATAL_ERROR "Failed: ${STATUS}")
endif()

set(STEINWURF_RESOLVE "${CMAKE_CURRENT_SOURCE_DIR}/resolve_symlinks")
set(STEINWURF_TOP_NAME ${PROJECT_NAME})
set(STEINWURF_RESOLVE "${CMAKE_CURRENT_SOURCE_DIR}/resolve_symlinks")
set(STEINWURF_TOP_NAME ${PROJECT_NAME})
endif()





if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set (BUILD_TYPE "Debug")
else()
set (BUILD_TYPE "Release")
endif()

if (UNIX AND NOT APPLE)
Expand All @@ -28,7 +38,7 @@ elseif (APPLE)
set(LIB_NAME "libsrt.a")
elseif (WIN32)
# Windows-specific code
set(LIB_NAME "srt_static.lib")
set(LIB_NAME "srt.lib")
endif ()


Expand All @@ -37,17 +47,18 @@ ExternalProject_add(project_srt
SOURCE_DIR ${STEINWURF_RESOLVE}/srt-source
BINARY_DIR ${STEINWURF_RESOLVE}/srt-source/cmake_build
INSTALL_DIR ${STEINWURF_RESOLVE}/srt-source/install
CONFIGURE_COMMAND ${CMAKE_COMMAND} ${STEINWURF_RESOLVE}/srt-source/ -DENABLE_BONDING=ON -DENABLE_APPS=OFF -DENABLE_ENCRYPTION=OFF
BUILD_COMMAND ${CMAKE_COMMAND} --build ${STEINWURF_RESOLVE}/srt-source/cmake_build --config ${CMAKE_BUILD_TYPE}
CONFIGURE_COMMAND ${CMAKE_COMMAND} ${STEINWURF_RESOLVE}/srt-source/ -DENABLE_BONDING=ON -DENABLE_APPS=OFF -DENABLE_ENCRYPTION=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DENABLE_SHARED=ON -DENABLE_STATIC=ON
BUILD_COMMAND ${CMAKE_COMMAND} --build ${STEINWURF_RESOLVE}/srt-source/cmake_build --config ${BUILD_TYPE}
EXCLUDE_FROM_ALL TRUE
STEP_TARGETS build
INSTALL_COMMAND ${CMAKE_COMMAND} --install ${STEINWURF_RESOLVE}/srt-source/cmake_build --prefix ${STEINWURF_RESOLVE}/srt-source/install --config --config ${CMAKE_BUILD_TYPE}
# INSTALL_COMMAND ${CMAKE_COMMAND} --install ${STEINWURF_RESOLVE}/srt-source/cmake_build --prefix ${STEINWURF_RESOLVE}/srt-source/install --config ${BUILD_TYPE}
BUILD_BYPRODUCTS ${STEINWURF_RESOLVE}/srt-source/install/lib/${LIB_NAME}
CMAKE_ARGS -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)
add_library(srt STATIC IMPORTED GLOBAL)
set_target_properties(srt PROPERTIES
IMPORTED_LOCATION ${STEINWURF_RESOLVE}/srt-source/install/lib/${LIB_NAME}

)


Expand Down
8 changes: 6 additions & 2 deletions test/src/test_srt.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@

#include <cassert>
#include <gtest/gtest.h>
#include <iostream>
#include <srt/srt.h>
#include <srt/udt.h>
#include <srt/version.h>

TEST(test_srt, lib) {
srt_startup();
srt_cleanup();
int ret = srt_startup();
assert(ret == SRT_SUCCESS);
ret = srt_cleanup();
assert(ret == SRT_SUCCESS);
}

0 comments on commit 25bb6d4

Please sign in to comment.