-
Notifications
You must be signed in to change notification settings - Fork 311
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
[SofaFramework] Isolate OpenGL code into a single module (Sofa.GL) #1649
Merged
Merged
Changes from 36 commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
fee8613
new module, move files, setup cmake
fredroy a673df6
make the module compile
fredroy cc3a770
make SofaFramework compiling
fredroy 0b115cb
split Transformation (w/ and wo ogl)
fredroy 4307293
move DrawToolGL in gl, move DrawTool in helper, make sofacore indepen…
fredroy 42ddfd7
add compat mechanism
fredroy be3d0c0
move Trackball to helper::visual (as it has no opengl code), and add …
fredroy 13cb482
Make SofaOpenGLVisual (and others) compiling
fredroy a0e971c
Make SofaGuiQt (and others) compiling
fredroy 8816356
add Sofa.GL test
fredroy 4211608
clean compat
fredroy 898f896
add Color compat
fredroy 3f2d4c7
Add Sofa.GL dep to SofaEulerianFluid
fredroy a736ae9
add last compat header (seems unused, but in case of)
fredroy 92eea3a
change ref to InvertibleFVM
fredroy 7b5ab1f
Fix cmake config with no opengl and win include dir
fredroy 299c6cd
Make Sofa.GL a real package (i.e able to do find_package() and stuff)
fredroy 79bbc9b
use only drawtool for Visual3DText, remove gl dependency
fredroy a3cfce7
remove macro SOFA_NO_OPENGL and use Sofa.GL package mechanism
fredroy 32924bd
add Sofa.GL dependency to OpenCL
fredroy 4d8d518
remove SOFA_NO_OPENGL use in Sofa codebase (i.e no in the plugins)
fredroy b1a71a8
Change message to ref the PR number for more info
fredroy 43a0a91
Add dep to sofa.gl for OptiTrackNatNet
fredroy e91ed50
IDE: add Sofa.GL in the SofaFramework folder
fredroy eb08a81
replace _API keyword (with SOFA_GL_API)
fredroy b034046
Revert "Merge remote-tracking branch 'origin/fix_cmake_win_noopengl_p…
fredroy 40292b7
[CImgPlugin] CLEAN dependencies in CMakeLists
guparan 154acf8
[CImgPlugin] FIX Zlib dependency
guparan fa9b9e3
[CImgPlugin] CLEAN link to release deps only
guparan b108dc0
Fix image with GL
fredroy f45b973
Merge branch 'master' into isolate_gl
fredroy e70358d
Merge branch 'master' into isolate_gl
fredroy 66aba35
fix merge...
fredroy 5ce7bd7
Merge branch 'master' into isolate_gl
fredroy 4d25774
Update CMakeLists.txt
fredroy 1daa165
Update VisualParams.h
fredroy 6ec30ba
Merge branch 'master' into isolate_gl
fredroy 2f931bd
Merge branch 'master' into isolate_gl
fredroy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
cmake_minimum_required(VERSION 3.12) | ||
project(Sofa.GL LANGUAGES CXX) | ||
|
||
set(SOFAGLSRC_ROOT "src/sofa/gl") | ||
|
||
sofa_find_package(OpenGL REQUIRED BOTH_SCOPES) | ||
sofa_find_package(GLEW BOTH_SCOPES) | ||
|
||
set(HEADER_FILES | ||
${SOFAGLSRC_ROOT}/config.h.in | ||
${SOFAGLSRC_ROOT}/initSofa.GL.h | ||
${SOFAGLSRC_ROOT}/gl.h | ||
${SOFAGLSRC_ROOT}/glu.h | ||
${SOFAGLSRC_ROOT}/Capture.h | ||
${SOFAGLSRC_ROOT}/Color.h | ||
${SOFAGLSRC_ROOT}/RAII.h | ||
${SOFAGLSRC_ROOT}/template.h | ||
${SOFAGLSRC_ROOT}/Axis.h | ||
${SOFAGLSRC_ROOT}/BasicShapes.h | ||
${SOFAGLSRC_ROOT}/BasicShapesGL.h | ||
${SOFAGLSRC_ROOT}/BasicShapesGL.inl | ||
${SOFAGLSRC_ROOT}/Cylinder.h | ||
${SOFAGLSRC_ROOT}/Texture.h | ||
${SOFAGLSRC_ROOT}/VideoRecorderFFMPEG.h | ||
${SOFAGLSRC_ROOT}/glText.h | ||
${SOFAGLSRC_ROOT}/glText.inl | ||
${SOFAGLSRC_ROOT}/TransformationGL.h | ||
${SOFAGLSRC_ROOT}/DrawToolGL.h | ||
) | ||
|
||
set(SOURCE_FILES | ||
${SOFAGLSRC_ROOT}/initSofa.GL.cpp | ||
${SOFAGLSRC_ROOT}/Axis.cpp | ||
${SOFAGLSRC_ROOT}/BasicShapesGL.cpp | ||
${SOFAGLSRC_ROOT}/Cylinder.cpp | ||
${SOFAGLSRC_ROOT}/glText.cpp | ||
${SOFAGLSRC_ROOT}/Capture.cpp | ||
${SOFAGLSRC_ROOT}/Texture.cpp | ||
${SOFAGLSRC_ROOT}/VideoRecorderFFMPEG.cpp | ||
${SOFAGLSRC_ROOT}/Color.cpp | ||
${SOFAGLSRC_ROOT}/gl.cpp | ||
${SOFAGLSRC_ROOT}/TransformationGL.cpp | ||
${SOFAGLSRC_ROOT}/DrawToolGL.cpp | ||
) | ||
|
||
if(GLEW_FOUND) | ||
list(APPEND HEADER_FILES | ||
${SOFAGLSRC_ROOT}/FrameBufferObject.h | ||
${SOFAGLSRC_ROOT}/GLSLShader.h | ||
) | ||
list(APPEND SOURCE_FILES | ||
${SOFAGLSRC_ROOT}/FrameBufferObject.cpp | ||
${SOFAGLSRC_ROOT}/GLSLShader.cpp | ||
) | ||
list(APPEND SHADER_FILES | ||
${SOFAGLSRC_ROOT}/shaders/generateSphere.cppglsl | ||
) | ||
endif() | ||
|
||
add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES}) | ||
target_link_libraries(${PROJECT_NAME} PUBLIC SofaHelper SofaDefaultType) | ||
|
||
target_compile_definitions(${PROJECT_NAME} PRIVATE SOFA_BUILD_SOFA_GL) # To remove once sofa_add_targets_to_package remove the dot in the generated definition | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @guparan just not to be forgotten for the update of |
||
|
||
if(TARGET OpenGL::GL AND TARGET OpenGL::GLU) # Imported targets defined since CMake 3.8 | ||
target_link_libraries(${PROJECT_NAME} PUBLIC OpenGL::GL OpenGL::GLU) | ||
else() | ||
target_link_libraries(${PROJECT_NAME} PUBLIC ${OPENGL_LIBRARIES}) | ||
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC ${OPENGL_INCLUDE_DIR}) | ||
endif() | ||
if(CMAKE_SYSTEM_NAME STREQUAL Linux AND SOFA_BUILD_RELEASE_PACKAGE AND OPENGL_GLU_FOUND) | ||
# Add GLU to Linux binaries | ||
sofa_install_libraries(PATHS ${OPENGL_glu_LIBRARY}) | ||
endif() | ||
|
||
if(GLEW_FOUND) | ||
target_link_libraries(${PROJECT_NAME} PUBLIC GLEW::GLEW) | ||
if (SOFA_BUILD_RELEASE_PACKAGE OR CMAKE_SYSTEM_NAME STREQUAL Windows) | ||
sofa_install_libraries(TARGETS GLEW::GLEW) | ||
endif() | ||
else() | ||
message("OpenGL advanced functions (e.g shaders, FBO) are disabled.") | ||
endif() | ||
|
||
# own include dir, the macro does not handle "independent" package for SofaFramework-style include | ||
# i.e NOT the name of package first (sofa/gl is wanted, instead of Sofa.GL/) | ||
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include/${PROJECT_NAME}/${PROJECT_NAME}>") | ||
|
||
sofa_create_package_with_targets( | ||
PACKAGE_NAME ${PROJECT_NAME} | ||
PACKAGE_VERSION ${Sofa_VERSION} | ||
TARGETS ${PROJECT_NAME} AUTO_SET_TARGET_PROPERTIES | ||
INCLUDE_SOURCE_DIR "src" | ||
INCLUDE_INSTALL_DIR "${PROJECT_NAME}" | ||
RELOCATABLE "SofaFramework" | ||
) | ||
|
||
set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER SofaFramework) | ||
|
||
# Tests | ||
# If SOFA_BUILD_TESTS exists and is OFF, then these tests will be auto-disabled | ||
cmake_dependent_option(SOFAGL_BUILD_TESTS "Compile the automatic tests" ON "SOFA_BUILD_TESTS OR NOT DEFINED SOFA_BUILD_TESTS" OFF) | ||
if(SOFAGL_BUILD_TESTS) | ||
enable_testing() | ||
add_subdirectory(${PROJECT_NAME}_test) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Sofa.GL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# CMake package configuration file for the @PROJECT_NAME@ module | ||
|
||
@PACKAGE_GUARD@ | ||
@PACKAGE_INIT@ | ||
|
||
set(SOFA.GL_HAVE_GLEW @SOFA.GL_HAVE_GLEW@) | ||
|
||
find_package(SofaFramework QUIET REQUIRED) # SofaHelper SofaDefaulttype | ||
find_package(OpenGL QUIET REQUIRED) | ||
|
||
if(SOFA.GL_HAVE_GLEW) | ||
find_package(GLEW QUIET REQUIRED) | ||
endif() | ||
|
||
if(NOT TARGET @PROJECT_NAME@) | ||
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") | ||
endif() | ||
|
||
check_required_components(@PROJECT_NAME@) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
cmake_minimum_required(VERSION 3.12) | ||
|
||
project(Sofa.GL_test) | ||
|
||
set(SOURCE_FILES | ||
src/GLSLShader_test.cpp | ||
) | ||
|
||
add_executable(${PROJECT_NAME} ${SOURCE_FILES}) | ||
target_link_libraries(${PROJECT_NAME} SofaGTestMain Sofa.GL) | ||
|
||
add_test(NAME Sofa.GL_test COMMAND Sofa.GL_test) |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we define versions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Package version follows Sofa's version; you can see that this is set in the macro with
(... PACKAGE_VERSION ${Sofa_VERSION}... )