mirror of
https://github.com/UltraCoderRU/libwebrtc.git
synced 2026-01-28 11:15:13 +00:00
Set the project's version and targets inside the main CMakeLists.txt file
This commit is contained in:
parent
0607a2bd6f
commit
704267abcb
3 changed files with 67 additions and 81 deletions
|
|
@ -17,6 +17,19 @@ else (WIN32)
|
||||||
endif (WIN32)
|
endif (WIN32)
|
||||||
find_package(DepotTools REQUIRED)
|
find_package(DepotTools REQUIRED)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Set the project's version
|
||||||
|
set(LIBWEBRTC_MAJOR_VERSION 0)
|
||||||
|
set(LIBWEBRTC_MINOR_VERSION 0)
|
||||||
|
set(LIBWEBRTC_PATCH_VERSION 1)
|
||||||
|
set(LIBWEBRTC_BUILD_VERSION -rc.4)
|
||||||
|
set(LIBWEBRTC_WEBRTC_REVISION ae2551232b5249e38298a50f2d9a64d3c862db00)
|
||||||
|
|
||||||
|
set(LIBWEBRTC_API_VERSION
|
||||||
|
"${LIBWEBRTC_MAJOR_VERSION}.${LIBWEBRTC_MINOR_VERSION}.${LIBWEBRTC_PATCH_VERSION}")
|
||||||
|
set(LIBWEBRTC_VERSION
|
||||||
|
${LIBWEBRTC_API_VERSION}${LIBWEBRTC_BUILD_VERSION})
|
||||||
|
|
||||||
#
|
#
|
||||||
# Options
|
# Options
|
||||||
#
|
#
|
||||||
|
|
@ -25,9 +38,6 @@ option(BUILD_TESTS "Build test binaries" OFF)
|
||||||
option(BUILD_SAMPLES "Build samples binaries" OFF)
|
option(BUILD_SAMPLES "Build samples binaries" OFF)
|
||||||
set(NINJA_ARGS "" CACHE STRING "Ninja arguments to pass before compiling WebRTC")
|
set(NINJA_ARGS "" CACHE STRING "Ninja arguments to pass before compiling WebRTC")
|
||||||
|
|
||||||
include(LibWebRTCSubsystem)
|
|
||||||
include(LibWebRTCVersion)
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Directories
|
# Directories
|
||||||
#
|
#
|
||||||
|
|
@ -45,6 +55,60 @@ if (NOT LIBWEBRTC_INSTALL_INCLUDE_DIR)
|
||||||
set(LIBWEBRTC_INSTALL_INCLUDE_DIR "include")
|
set(LIBWEBRTC_INSTALL_INCLUDE_DIR "include")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
#
|
||||||
|
# Target OS
|
||||||
|
set(TARGET_OS "" CACHE STRING "Target OS, used as --target_os argument")
|
||||||
|
set(TARGET_OS_LIST android chromeos ios linux nacl mac win)
|
||||||
|
|
||||||
|
if (TARGET_OS STREQUAL "")
|
||||||
|
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||||
|
set(TARGET_OS "linux")
|
||||||
|
elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||||
|
set(TARGET_OS "mac")
|
||||||
|
elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||||
|
set(TARGET_OS "win")
|
||||||
|
endif ()
|
||||||
|
endif (TARGET_OS STREQUAL "")
|
||||||
|
|
||||||
|
if (NOT ${TARGET_OS} IN_LIST TARGET_OS_LIST)
|
||||||
|
message(FATAL_ERROR "Unknown value '${TARGET_OS}' for variable TARGET_OS, options are: ${TARGET_OS_LIST}")
|
||||||
|
endif (NOT ${TARGET_OS} IN_LIST TARGET_OS_LIST)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Target CPU
|
||||||
|
set(TARGET_CPU "" CACHE STRING "Target CPU, used as --target_cpu argument")
|
||||||
|
set(TARGET_CPU_LIST x86 x64 arm arm64 mipsel)
|
||||||
|
|
||||||
|
if (TARGET_CPU STREQUAL "")
|
||||||
|
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
|
||||||
|
set(TARGET_CPU "x86")
|
||||||
|
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^x86.64$")
|
||||||
|
set(TARGET_CPU "x64")
|
||||||
|
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64")
|
||||||
|
set(TARGET_CPU "x64")
|
||||||
|
else ()
|
||||||
|
set(TARGET_CPU ${CMAKE_SYSTEM_PROCESSOR})
|
||||||
|
endif (CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
|
||||||
|
endif (TARGET_CPU STREQUAL "")
|
||||||
|
|
||||||
|
if (NOT ${TARGET_CPU} IN_LIST TARGET_CPU_LIST)
|
||||||
|
message(FATAL_ERROR "Unknown value '${TARGET_CPU}' for variable TARGET_CPU, options are: ${TARGET_CPU_LIST}")
|
||||||
|
endif (NOT ${TARGET_CPU} IN_LIST TARGET_CPU_LIST)
|
||||||
|
|
||||||
|
if (UNIX)
|
||||||
|
if (TARGET_CPU STREQUAL "x86")
|
||||||
|
set(LIBWEBRTC_REQUIRED_CXX_FLAGS "-m32")
|
||||||
|
endif (TARGET_CPU STREQUAL "x86")
|
||||||
|
set(LIBWEBRTC_REQUIRED_CXX_FLAGS "${LIBWEBRTC_REQUIRED_CXX_FLAGS} -std=gnu++0x")
|
||||||
|
list(APPEND LIBWEBRTC_DEFINITIONS WEBRTC_POSIX _GLIBCXX_USE_CXX11_ABI=0)
|
||||||
|
elseif (WIN32)
|
||||||
|
set(LIBWEBRTC_REQUIRED_C_FLAGS_DEBUG "/MTd")
|
||||||
|
set(LIBWEBRTC_REQUIRED_C_FLAGS_RELEASE "/MT")
|
||||||
|
set(LIBWEBRTC_REQUIRED_CXX_FLAGS_DEBUG "/MTd")
|
||||||
|
set(LIBWEBRTC_REQUIRED_CXX_FLAGS_RELEASE "/MT")
|
||||||
|
list(APPEND LIBWEBRTC_DEFINITIONS WEBRTC_WIN NOMINMAX _CRT_SECURE_NO_WARNINGS)
|
||||||
|
endif(UNIX)
|
||||||
|
|
||||||
set(LIBWEBRTC_LIBRARY_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}webrtc${CMAKE_STATIC_LIBRARY_SUFFIX})
|
set(LIBWEBRTC_LIBRARY_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}webrtc${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||||
set(LIBWEBRTC_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${LIBWEBRTC_INSTALL_LIB_DIR}/${LIBWEBRTC_LIBRARY_NAME})
|
set(LIBWEBRTC_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${LIBWEBRTC_INSTALL_LIB_DIR}/${LIBWEBRTC_LIBRARY_NAME})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
#
|
|
||||||
# Subsystem
|
|
||||||
#
|
|
||||||
|
|
||||||
set(TARGET_OS "" CACHE STRING "Target OS, used as --target_os argument")
|
|
||||||
set(TARGET_OS_LIST android chromeos ios linux nacl mac win)
|
|
||||||
|
|
||||||
if (TARGET_OS STREQUAL "")
|
|
||||||
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|
||||||
set(TARGET_OS "linux")
|
|
||||||
elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
|
||||||
set(TARGET_OS "mac")
|
|
||||||
elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
|
|
||||||
set(TARGET_OS "win")
|
|
||||||
endif ()
|
|
||||||
endif (TARGET_OS STREQUAL "")
|
|
||||||
|
|
||||||
if (NOT ${TARGET_OS} IN_LIST TARGET_OS_LIST)
|
|
||||||
message(FATAL_ERROR "Unknown value '${TARGET_OS}' for variable TARGET_OS, the following values are supported: ${TARGET_OS_LIST}")
|
|
||||||
endif (NOT ${TARGET_OS} IN_LIST TARGET_OS_LIST)
|
|
||||||
|
|
||||||
set(TARGET_CPU "" CACHE STRING "Target CPU, used as --target_cpu argument")
|
|
||||||
set(TARGET_CPU_LIST x86 x64 arm arm64 mipsel)
|
|
||||||
|
|
||||||
if (TARGET_CPU STREQUAL "")
|
|
||||||
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
|
|
||||||
set(TARGET_CPU "x86")
|
|
||||||
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^x86.64$")
|
|
||||||
set(TARGET_CPU "x64")
|
|
||||||
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64")
|
|
||||||
set(TARGET_CPU "x64")
|
|
||||||
else ()
|
|
||||||
set(TARGET_CPU ${CMAKE_SYSTEM_PROCESSOR})
|
|
||||||
endif (CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
|
|
||||||
endif (TARGET_CPU STREQUAL "")
|
|
||||||
|
|
||||||
if (NOT ${TARGET_CPU} IN_LIST TARGET_CPU_LIST)
|
|
||||||
message(FATAL_ERROR "Unknown value '${TARGET_CPU}' for variable TARGET_CPU, the following values are supported: ${TARGET_CPU_LIST}")
|
|
||||||
endif (NOT ${TARGET_CPU} IN_LIST TARGET_CPU_LIST)
|
|
||||||
|
|
||||||
if (UNIX)
|
|
||||||
if (TARGET_CPU STREQUAL "x86")
|
|
||||||
set(CMAKE_C_FLAGS -m32)
|
|
||||||
set(CMAKE_CXX_FLAGS -m32)
|
|
||||||
endif (TARGET_CPU STREQUAL "x86")
|
|
||||||
endif(UNIX)
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
#
|
|
||||||
# Versioning
|
|
||||||
#
|
|
||||||
|
|
||||||
set(LIBWEBRTC_MAJOR_VERSION 0)
|
|
||||||
set(LIBWEBRTC_MINOR_VERSION 0)
|
|
||||||
set(LIBWEBRTC_PATCH_VERSION 1)
|
|
||||||
set(LIBWEBRTC_BUILD_VERSION rc.4)
|
|
||||||
|
|
||||||
set(LIBWEBRTC_API_VERSION
|
|
||||||
"${LIBWEBRTC_MAJOR_VERSION}.${LIBWEBRTC_MINOR_VERSION}.${LIBWEBRTC_PATCH_VERSION}")
|
|
||||||
set(LIBWEBRTC_VERSION
|
|
||||||
${LIBWEBRTC_API_VERSION}-${LIBWEBRTC_BUILD_VERSION})
|
|
||||||
|
|
||||||
set(LIBWEBRTC_LIBRARY_PROPERTIES ${LIBWEBRTC_LIBRARY_PROPERTIES}
|
|
||||||
VERSION "${LIBWEBRTC_VERSION}"
|
|
||||||
SOVERSION "${LIBWEBRTC_API_VERSION}")
|
|
||||||
|
|
||||||
set(LIBWEBRTC_WEBRTC_REVISION ae2551232b5249e38298a50f2d9a64d3c862db00)
|
|
||||||
|
|
||||||
file(WRITE ${CMAKE_BINARY_DIR}/libwebrtc.h "#ifndef LIBWEBRTC_H_
|
|
||||||
#define LIBWEBRTC_H_
|
|
||||||
|
|
||||||
#define LIBWEBRTC_MAJOR_VERSION \"${LIBWEBRTC_MAJOR_VERSION}\"
|
|
||||||
#define LIBWEBRTC_MINOR_VERSION \"${LIBWEBRTC_MINOR_VERSION}\"
|
|
||||||
#define LIBWEBRTC_PATCH_VERSION \"${LIBWEBRTC_PATCH_VERSION}\"
|
|
||||||
#define LIBWEBRTC_BUILD_VERSION \"${LIBWEBRTC_BUILD_VERSION}\"
|
|
||||||
#define LIBWEBRTC_WEBRTC_REVISION \"${LIBWEBRTC_WEBRTC_REVISION}\"
|
|
||||||
|
|
||||||
#endif /* LIBWEBRTC_H_ */
|
|
||||||
")
|
|
||||||
|
|
||||||
Loading…
Add table
Reference in a new issue