代码拉取完成,页面将自动刷新
cmake_minimum_required(VERSION 3.10)
project(VideoPlayer)
add_subdirectory(thirdparty/glfw)
add_subdirectory(thirdparty/glm)
set (CMKAE_CXX_STANDARD 14)
set (CMAKE_BUILD_TYPE Release)
set (CMAKE_INCLUDE_CURRENT_DIR ON)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set (SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/src")
set (INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/src")
set (GLFW_INC "${CMAKE_CURRENT_LIST_DIR}/thirdparty/glfw/include")
set (GLAD_SRC "${CMAKE_CURRENT_LIST_DIR}/thirdparty/glad/src")
set (GLAD_INC "${CMAKE_CURRENT_LIST_DIR}/thirdparty/glad/include")
set (STB_IMAGE_INC "${CMAKE_CURRENT_LIST_DIR}/thirdparty/stb_image")
set (GLM_INC "${CMAKE_CURRENT_LIST_DIR}/thirdparty/glm")
set (IMGUI_SRC "${CMAKE_CURRENT_LIST_DIR}/thirdparty/imgui")
set (FILEDIALOGS_SRC "${CMAKE_CURRENT_LIST_DIR}/thirdparty/tinyfiledialogs")
if (WIN32)
set (FFMPEG_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/thirdparty/FFmpeg/win/include")
set (FFMPEG_LIB_DIR "${CMAKE_SOURCE_DIR}/thirdparty/FFmpeg/win/lib")
elseif (UNIX)
add_subdirectory(${CMAKE_SOURCE_DIR}/thirdparty/FFmpeg/unix)
endif()
set (VLD_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/thirdparty/VLD/include")
set (VLD_LIB_DIR "${CMAKE_SOURCE_DIR}/thirdparty/VLD/lib")
link_directories(
${FFMPEG_LIB_DIR}
${VLD_LIB_DIR}
)
include_directories(
${INCLUDE_DIR}
${INCLUDE_DIR}/Video
${INCLUDE_DIR}/Graphics
${GLFW_INC}
${GLAD_INC}
${STB_IMAGE_INC}
${GLM_INC}
${IMGUI_SRC}
${FFMPEG_INCLUDE_DIR}
${VLD_INCLUDE_DIR}
)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
file(GLOB_RECURSE SRC_FILES
"${SOURCE_DIR}/*.c*"
"${GLAD_SRC}/*c*"
"${IMGUI_SRC}/*.c*"
)
file (GLOB_RECURSE INC_FILES
"${INCLUDE_DIR}/*.h"
"${IMGUI_SRC}/*.h"
"${GLAD_INC}/*h"
)
file (GLOB_RECURSE RES_FILES
"${CMAKE_SOURCE_DIR}/res/shaders/*.shader"
"${CMAKE_SOURCE_DIR}/res/*.rc"
)
if (WIN32)
source_group(TREE ${CMAKE_CURRENT_LIST_DIR} FILES ${SRC_FILES})
source_group(TREE ${CMAKE_CURRENT_LIST_DIR} FILES ${INC_FILES})
source_group(TREE ${CMAKE_CURRENT_LIST_DIR} FILES ${RES_FILES})
elseif (UNIX)
#nothing to do
endif ()
if (WIN32)
list(APPEND EXTRA_LIBS
opengl32 glfw User32 Gdi32 Shell32
)
elseif (UNIX)
list (APPEND EXTRA_LIBS
GL GLU X11 glfw
)
endif ()
add_executable(${PROJECT_NAME} ${SRC_FILES} ${INC_FILES} ${RES_FILES})
# Add the target includes for MY_PROJECT
target_include_directories(${PROJECT_NAME} PRIVATE ${INCLUDE_DIR})
target_include_directories(${PROJECT_NAME} PRIVATE ${SOURCE_DIR})
#===================== LINKING LIBRARIES =======================#
target_link_libraries(${PROJECT_NAME} ${EXTRA_LIBS} swscale avformat avdevice avcodec avutil )
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
if (WIN32)
file (GLOB FFMPEG_COPY_DLL "${CMAKE_SOURCE_DIR}/thirdparty/FFmpeg/win/dll/*")
file(COPY ${FFMPEG_COPY_DLL} DESTINATION ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE})
file(COPY ${CMAKE_SOURCE_DIR}/config/imgui.ini DESTINATION ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE})
file(COPY ${CMAKE_SOURCE_DIR}/res DESTINATION ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE})
elseif (UNIX)
file(COPY ${CMAKE_SOURCE_DIR}/config/imgui.ini DESTINATION ${EXECUTABLE_OUTPUT_PATH})
file(COPY ${CMAKE_SOURCE_DIR}/res DESTINATION ${EXECUTABLE_OUTPUT_PATH})
endif()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。