Skip to content

Commit d39de39

Browse files
committed
Patch install path for ini (#263)
* Patch install path for ini and provide a valid path even when ffmpeg is not shipped * Small fix for debug display
1 parent 942b5cd commit d39de39

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

SofaGLFW/CMakeLists.txt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,19 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/etc/${PROJECT_NAME}.ini.in "${CMAKE_B
104104

105105
#### For install tree
106106
get_filename_component(FFMPEG_EXEC_FILENAME "${FFMPEG_EXEC_FILE}" NAME)
107-
set(FFMPEG_EXEC_PATH "../bin/${FFMPEG_EXEC_FILENAME}") # relative path for install dir, see .ini file
107+
if(FFMPEG_EXEC_FILENAME)
108+
set(FFMPEG_EXEC_PATH "../bin/${FFMPEG_EXEC_FILENAME}")
109+
else()
110+
#If ffmpeg hasn't been found, it'll not be shipped but we still want to offer the possibility for the user to use it
111+
#easily by putting the executable alongside runSofa
112+
set(FFMPEG_EXEC_PATH "../bin/ffmpeg")
113+
if(WIN32)
114+
set(FFMPEG_EXEC_PATH "${FFMPEG_EXEC_PATH}.exe")
115+
endif()
116+
endif()
108117
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/etc/${PROJECT_NAME}.ini.in "${CMAKE_BINARY_DIR}/etc/installed${PROJECT_NAME}.ini")
109-
install(FILES "${CMAKE_BINARY_DIR}/etc/installed${PROJECT_NAME}.ini" DESTINATION ${CMAKE_INSTALL_PREFIX}/etc RENAME ${PROJECT_NAME}.ini COMPONENT applications)
118+
#Hack relative tree to ../../etc because of Windows:NSIS that doesn't allow absolute install path.
119+
install(FILES "${CMAKE_BINARY_DIR}/etc/installed${PROJECT_NAME}.ini" DESTINATION ../../etc RENAME ${PROJECT_NAME}.ini COMPONENT applications)
110120

111121

112122

SofaGLFW/src/SofaGLFW/SofaGLFWBaseGUI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1228,8 +1228,8 @@ bool SofaGLFWBaseGUI::initRecorder(int width, int height, unsigned int framerate
12281228
if (iniFileValues.find("FFMPEG_EXEC_PATH") != iniFileValues.end())
12291229
{
12301230
// get absolute path of FFMPEG executable
1231-
msg_info("SofaGLFWBaseGUI") << " The file " << ffmpegIniFilePath << " points to " << ffmpeg_exec_path << " for the ffmpeg executable.";
12321231
ffmpeg_exec_path = sofa::helper::system::SetDirectory::GetRelativeFromProcess(iniFileValues["FFMPEG_EXEC_PATH"].c_str());
1232+
msg_info("SofaGLFWBaseGUI") << " The file " << ffmpegIniFilePath << " points to " << ffmpeg_exec_path << " for the ffmpeg executable.";
12331233
}
12341234
else
12351235
{

0 commit comments

Comments
 (0)