Skip to content

Commit 6856517

Browse files
committed
fix ffmpeg dll deploy to debug and release directory during cmake configure.
1 parent ff59235 commit 6856517

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

CamStudioRecorder/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515

1616
project(CamStudioRecorder)
1717

18+
find_package(ffmpeg)
19+
1820
include(MyBuildinfo)
21+
include(CopyToTargetConfigPath)
1922

2023
generate_build_info_header(
2124
"${CMAKE_SOURCE_DIR}/license.txt"
@@ -211,4 +214,16 @@ install(
211214
"${CMAKE_SOURCE_DIR}/README.md"
212215
DESTINATION
213216
bin
217+
)
218+
219+
copy_to_target_config_path(TARGET CamStudioRecorder
220+
FILES
221+
"${FFMPEG_BIN_DIR}/avcodec-58.dll"
222+
"${FFMPEG_BIN_DIR}/avdevice-58.dll"
223+
"${FFMPEG_BIN_DIR}/avfilter-7.dll"
224+
"${FFMPEG_BIN_DIR}/avformat-58.dll"
225+
"${FFMPEG_BIN_DIR}/avutil-56.dll"
226+
"${FFMPEG_BIN_DIR}/postproc-55.dll"
227+
"${FFMPEG_BIN_DIR}/swresample-3.dll"
228+
"${FFMPEG_BIN_DIR}/swscale-5.dll"
214229
)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright (C) 2018 Steven Hoving
2+
#
3+
# This program is free software: you can redistribute it and/or modify
4+
# it under the terms of the GNU General Public License as published by
5+
# the Free Software Foundation, either version 3 of the License, or
6+
# (at your option) any later version.
7+
#
8+
# This program is distributed in the hope that it will be useful,
9+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
# GNU General Public License for more details.
12+
#
13+
# You should have received a copy of the GNU General Public License
14+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
15+
16+
function(copy_to_target_config_path)
17+
18+
cmake_parse_arguments(
19+
FUNCTION_ARGS
20+
""
21+
"TARGET"
22+
"FILES"
23+
${ARGN}
24+
)
25+
26+
get_target_property(TARGET_RUNTIME_DIRECTORY ${FUNCTION_ARGS_TARGET} RUNTIME_OUTPUT_DIRECTORY)
27+
28+
foreach (CONFIGURATION ${CMAKE_CONFIGURATION_TYPES})
29+
foreach (FILEPATH ${FUNCTION_ARGS_FILES})
30+
get_filename_component(FILENAME ${FILEPATH} NAME)
31+
configure_file("${FILEPATH}" "${TARGET_RUNTIME_DIRECTORY}/${CONFIGURATION}/${FILENAME}" COPYONLY)
32+
endforeach ()
33+
endforeach ()
34+
endfunction()

0 commit comments

Comments
 (0)