Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build issues #10938

Merged
merged 2 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 28 additions & 10 deletions ApplicationExeCode/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,11 @@ else()
set(OPENVDS_LIB_NAMES
libopenvds.so
libopenvds.so.3
libopenvds.so.3.2.3
libopenvds-968eeb36.so.3.2.3
libopenvds.so.3.2.7
libopenvds-e1541338.so.3.2.7
libsegyutils.so
libsegyutils.so.3
libsegyutils.so.3.2.3
libsegyutils.so.3.2.7
)
foreach(OPENVDS_LIB_NAME ${OPENVDS_LIB_NAMES})
list(APPEND RI_FILENAMES
Expand All @@ -380,15 +380,33 @@ else()
endforeach(OPENVDS_LIB_NAME)
endif(MSVC)

# Copy dependencies to make it possible to run ResInsight from the build folder
foreach(FILE_TO_COPY ${RI_FILENAMES})
add_custom_command(
TARGET ResInsight
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FILE_TO_COPY}
$<TARGET_FILE_DIR:ResInsight>
# create an empty library target that will be used to copy files to the build
# folder
add_library(ResInsightDummyTarget EXCLUDE_FROM_ALL empty.cpp)
set_property(TARGET ResInsightDummyTarget PROPERTY FOLDER "FileCopyTargets")

# create a custom target that copies the files to the build folder
foreach(riFileName ${RI_FILENAMES})
list(
APPEND
copyCommands
COMMAND
${CMAKE_COMMAND}
-E
copy_if_different
${riFileName}
$<TARGET_FILE_DIR:ResInsightDummyTarget>
)
endforeach()
add_custom_target(
PreBuildFileCopy
COMMENT "PreBuildFileCopy step: copy runtime files into build folder"
${copyCommands}
)
set_property(TARGET PreBuildFileCopy PROPERTY FOLDER "FileCopyTargets")

# Make ResInsight depend on the prebuild target.
add_dependencies(ResInsight PreBuildFileCopy)

# Generate Python code in a target that is part of ALL_BUILD and depends on
# ResInsight
Expand Down
10 changes: 10 additions & 0 deletions ApplicationExeCode/empty.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//
// This empty file is used by ResInsightDummyTarget
//
// Creating a dummy target with an empty file is used to have a different target than ResInsight.
// This target is used to find the full path to the build folder.
//
// $<TARGET_FILE_DIR:ResInsightDummyTarget>
//
// If we use the ResInsight target ($<TARGET_FILE_DIR:ResInsight>), we get a circular dependency.
//
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,12 @@ endif()
if(MSVC)
FetchContent_Declare(
openvds
URL https://bluware.jfrog.io/artifactory/Releases-OpenVDSPlus/3.2/openvds+-3.2.3-win.zip
URL https://bluware.jfrog.io/artifactory/Releases-OpenVDSPlus/3.2/openvds+-3.2.7-win.zip
)
else()
FetchContent_Declare(
openvds
URL https://bluware.jfrog.io/artifactory/Releases-OpenVDSPlus/3.2/openvds+-3.2.3-manylinux_2014.tar.gz
URL https://bluware.jfrog.io/artifactory/Releases-OpenVDSPlus/3.2/openvds+-3.2.7-manylinux_2014.tar.gz
)
endif()

Expand Down Expand Up @@ -885,11 +885,11 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(OPENVDS_SHARED_LIB_FILES
${RESINSIGHT_OPENVDS_API_DIR}/lib64/libopenvds.so
${RESINSIGHT_OPENVDS_API_DIR}/lib64/libopenvds.so.3
${RESINSIGHT_OPENVDS_API_DIR}/lib64/libopenvds.so.3.2.3
${RESINSIGHT_OPENVDS_API_DIR}/lib64/libopenvds-968eeb36.so.3.2.3
${RESINSIGHT_OPENVDS_API_DIR}/lib64/libopenvds.so.3.2.7
${RESINSIGHT_OPENVDS_API_DIR}/lib64/libopenvds-e1541338.so.3.2.7
${RESINSIGHT_OPENVDS_API_DIR}/lib64/libsegyutils.so
${RESINSIGHT_OPENVDS_API_DIR}/lib64/libsegyutils.so.3
${RESINSIGHT_OPENVDS_API_DIR}/lib64/libsegyutils.so.3.2.3
${RESINSIGHT_OPENVDS_API_DIR}/lib64/libsegyutils.so.3.2.7
)
install(FILES ${OPENVDS_SHARED_LIB_FILES}
DESTINATION ${RESINSIGHT_INSTALL_FOLDER}
Expand Down