-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
72 lines (63 loc) · 2.52 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
cmake_minimum_required(VERSION 3.21.0)
# Disable in-source builds to prevent source tree corruption.
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "In-source builds are not allowed. You should create a separate directory for build files.")
endif()
project(CoralReefPlayer VERSION 1.2)
set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE STRING "" FORCE)
if(MSVC)
if(NOT CMAKE_VS_PLATFORM_NAME)
set(CMAKE_VS_PLATFORM_NAME x64 CACHE STRING "" FORCE)
endif()
if(NOT ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64"))
message(FATAL_ERROR "${CMAKE_VS_PLATFORM_NAME} arch is not supported!")
endif()
message(STATUS "Architecture: ${CMAKE_VS_PLATFORM_NAME}")
set(LINK_STATIC_MSVC_LIBS OFF CACHE BOOL "")
if(LINK_STATIC_MSVC_LIBS)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
add_compile_options("/utf-8")
else()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_options("-D_DEBUG")
endif()
if(APPLE)
set(MACOSX_BUNDLE OFF CACHE BOOL "" FORCE) # Disable default behavior
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
set(BUILD_MACOS_FRAMEWORK ON CACHE BOOL "Build library as Framework on macOS")
set(BUILD_MACOS_BUNDLE ON CACHE BOOL "Build executable as App Bundle on macOS")
endif()
endif()
endif()
set(CMAKE_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
list(APPEND CMAKE_MODULE_PATH ${CMAKE_MODULE_DIR})
set(THIRD_PARTY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty")
if(WIN32 AND NOT CYGWIN)
set(CMAKE_INSTALL_LIBDIR "CoralReefCam" CACHE PATH "")
set(CMAKE_INSTALL_BINDIR "CoralReefCam" CACHE PATH "")
set(CMAKE_INSTALL_INCLUDEDIR "CoralReefCam" CACHE PATH "")
elseif(APPLE)
if(BUILD_MACOS_FRAMEWORK)
set(CMAKE_INSTALL_LIBDIR "." CACHE PATH "")
endif()
if(BUILD_MACOS_BUNDLE)
set(CMAKE_INSTALL_BINDIR "." CACHE PATH "")
endif()
endif()
include(GNUInstallDirs)
foreach(dir LIB BIN INCLUDE)
message(STATUS "Installing ${dir} components to ${CMAKE_INSTALL_FULL_${dir}DIR}")
endforeach()
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries instead of static")
set(HTTPLIB_INSTALL OFF CACHE BOOL "" FORCE)
add_subdirectory(${THIRD_PARTY_DIR}/live555)
add_subdirectory(${THIRD_PARTY_DIR}/cpp-httplib)
add_subdirectory(${THIRD_PARTY_DIR}/ffmpeg)
add_subdirectory(src)
add_subdirectory(test)
add_subdirectory(binding)
set(BUILD_DEMO ON CACHE BOOL "Build CoralReefCam")
if(BUILD_DEMO)
add_subdirectory(CoralReefCam)
endif()