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

[All] Improve extlibs integration #1137

Merged
merged 99 commits into from
Sep 26, 2019
Merged
Show file tree
Hide file tree
Changes from 83 commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
70c9067
[CMake] CLEAN Sofa*Targets.cmake inclusions and SofaComponent* packages
guparan Jul 23, 2019
d0ab5f6
[All] CLEAN Boost::program_options usage
guparan Jul 23, 2019
4ae2521
[SofaTest_test] Disable project
guparan Jul 30, 2019
c9f5e03
[gtest] CLEAN include directories
guparan Jul 30, 2019
4717ed0
[MiniFlowVR] CLEAN include directories
guparan Jul 30, 2019
bc5f2d2
[Newmat] CLEAN Config.cmake
guparan Jul 30, 2019
6fb9260
[TinyXML] CLEAN Config.cmake
guparan Jul 30, 2019
80ac32e
[SofaGTestMain] CLEAN CMakeLists.txt
guparan Jul 30, 2019
a7cae05
[All] Remove useless code
guparan Aug 23, 2019
7e71af8
[CMake] FIX SceneCreator and SofaTest build dirs
guparan Aug 29, 2019
45cb6c8
[SofaMacros] ADD sofa_set_int and sofa_extlib_find_package
guparan Aug 29, 2019
6a57316
[SofaAdvanced] Remove MiniFlowVR (not used)
guparan Aug 29, 2019
5876fad
[SofaMacros] ADD BOTH_SCOPES option to sofa_set_int and sofa_extlib_f…
guparan Aug 29, 2019
917a521
[SofaMacros] FIX add_subdirectory in sofa_add_generic
guparan Aug 30, 2019
75aa01a
[SofaMacros] Rename sofa_extlib_find_package to sofa_find_package
guparan Aug 30, 2019
29b79e2
[SofaMacros] ADD debug_print_target_properties
guparan Aug 30, 2019
6da48e7
[plugins] Handle SofaHighOrder first
guparan Sep 2, 2019
89401fd
[libQGLViewer] CLEAN CMake OpenGL link
guparan Sep 2, 2019
f9ebec8
[CMake] MOVE configure_file to the end in package CMakeLists
guparan Sep 2, 2019
7f0c399
[SofaSimulationGraph] MOVE test inclusion to modules/tests
guparan Sep 2, 2019
41b1af7
[SofaSimulationGraph] FIX missing config.h
guparan Sep 2, 2019
e80cb57
[SofaSimulationGraph_test] CLEAN CMakeLists.txt
guparan Sep 2, 2019
7976a9f
[SofaSimulationCommon] CLEAN TinyXML dependency
guparan Sep 2, 2019
0f4e61d
[SofaMacros] Change sofa_set_int to sofa_set_bool
guparan Sep 2, 2019
2fdfb7d
[SofaHaptics] Remove unneeded SOFA_HAVE_SOFAHAPTICS
guparan Sep 2, 2019
08c5815
[SofaComponentMisc] CLEAN CMakeLists.txt
guparan Sep 2, 2019
d5f5289
[All] CLEAN usage of SOFA_DETECTIONOUTPUT_FREEMOTION
guparan Sep 2, 2019
2ab529a
[SofaHelper] Remove unneeded SOFA_HAVE_BOOST
guparan Sep 2, 2019
20fcfbf
[LeapMotion] Remove unneeded boost include
guparan Sep 2, 2019
e331195
[SofaOpenglVisual] FIX Config.cmake.in
guparan Sep 2, 2019
8201181
[SofaSphFluid] FIX deprecated ExtVec3Types intanciation
guparan Sep 3, 2019
5d7d084
[SofaSphFluid] Remove unneeded SOFA_HAVE_SOFASPHFLUID from Config.cma…
guparan Sep 3, 2019
f51ea00
[SofaVolumetricData] Remove unneeded MiniFlowVR link
guparan Sep 3, 2019
a9ee186
[projects] Remove unneeded SOFA_HAVE_QT_LIBRARIES
guparan Sep 3, 2019
78db11f
[SofaOpenglVisual] Remove unneeded SOFA_HAVE_SOFAOPENGLVISUAL
guparan Sep 3, 2019
59385df
[SofaFramework_test] Privately link GTest
guparan Sep 3, 2019
9689e4a
[SofaCore] Remove duplicated addition of AspectPool
guparan Sep 3, 2019
ae00817
[SofaExplicitOdeSolver] Remove unneeded include
guparan Sep 3, 2019
7afb729
[SofaMacros] FIX sofa_copy_libraries when called out of SOFA
guparan Sep 3, 2019
758eb6b
[Flexible] Remove outdated SOFA_LINK_CLASS blocks
guparan Sep 3, 2019
5ae8256
[SofaMacros] ADD auto configure of "*.h.in" in sofa_install_targets
guparan Sep 3, 2019
8ca77f3
[QGLViewer] FIX out-of-SOFA use
guparan Sep 3, 2019
4b4a004
[SofaExporter_test] CLEAN CMakeLists.txt
guparan Sep 4, 2019
c2a2d04
[SofaKernel] ADD TinyXML links where it is used
guparan Sep 4, 2019
8bbf839
[SofaSimulationCommon] Support only TinyXML parser (no more libXML)
guparan Sep 4, 2019
f6645ca
[SofaKernel] CLEAN CMake and SOFA_HAVE_* vars
guparan Sep 4, 2019
ec04dd8
[SofaMisc] CLEAN CMake and SOFA_HAVE_* vars
guparan Sep 4, 2019
92a2d48
[SofaGeneral] CLEAN CMake and SOFA_HAVE_* vars
guparan Sep 4, 2019
0d4dc7e
[SofaSparseSolver] CLEAN CMake and SOFA_HAVE_* vars
guparan Sep 4, 2019
b51db8f
[SofaPreconditioner] CLEAN CMake and SOFA_HAVE_* vars
guparan Sep 4, 2019
87be1a8
[SofaOpenglVisual] Complete pluginization + better tests inclusion
guparan Sep 4, 2019
215e455
[SofaHaptics] Complete pluginization
guparan Sep 4, 2019
2808670
[SofaExporter] CLEAN CMake and SOFA_HAVE_* vars + Complete pluginizat…
guparan Sep 4, 2019
b65a346
[tests] Pluginized modules add their own tests
guparan Sep 4, 2019
b1929e4
[SofaBoundaryCondition_test] CLEAN SofaSparseSolver dependency
guparan Sep 4, 2019
f223a32
[SofaGui] CLEAN CMake and SOFA_HAVE_* vars
guparan Sep 4, 2019
bc4416f
[meshconv] Remove unneeded SOFA_HAVE_MINIFLOWVR
guparan Sep 4, 2019
2d86414
[projects] FIX projects using old SOFA_HAVE_BOOST
guparan Sep 4, 2019
2b604b4
[SofaPython] Remove unneeded SOFA_HAVE_PYTHON
guparan Sep 4, 2019
9ac67b6
[SofaMiscCollision] CLEAN dependency management
guparan Sep 4, 2019
6ec175e
[SofaImplicitField] CLEAN dependency management
guparan Sep 4, 2019
0f9d151
[SofaDistanceGrid] CLEAN dependency management
guparan Sep 4, 2019
6ffc360
[SofaCUDA] CLEAN MiniFlowVR dep management
guparan Sep 4, 2019
7c603fd
[SceneCreator] CLEAN dependency management
guparan Sep 4, 2019
d4fe4d0
[Registration] CLEAN dependency management
guparan Sep 4, 2019
e2fb359
[image] CLEAN dependency management
guparan Sep 4, 2019
f0d8fb5
[Flexible] CLEAN dependency management
guparan Sep 4, 2019
716b2c3
[Compliant] CLEAN dependency management
guparan Sep 4, 2019
73c1906
[ColladaSceneLoader] CLEAN dependency management
guparan Sep 4, 2019
8de11d5
[CImgPlugin] CLEAN dependency management
guparan Sep 4, 2019
e343155
[PluginExample] CLEAN dependency management
guparan Sep 4, 2019
5168529
[All] Install ZLIB only on Windows
guparan Sep 4, 2019
ff5ecad
Merge remote-tracking branch 'sofa-framework/master' into improve_ext…
guparan Sep 4, 2019
ecbf9d9
[SofaGui] Use SOFA_NO_OPENGL to build an OpenGL-free version of SofaG…
guparan Sep 5, 2019
7602c56
[SofaGuiMain] CLEAN CMakeLists.txt
guparan Sep 5, 2019
abd793d
[SofaGuiQt] CLEAN CMakeLists.txt
guparan Sep 5, 2019
3500411
[SofaGuiQt] CLEAN CMake Qt integration
guparan Sep 5, 2019
4644b34
[QGLViewer] CLEAN CMake Qt integration
guparan Sep 5, 2019
917ebe7
[SofaGui] FIX SOFA_HAVE_FFMPEG_EXEC renamed
guparan Sep 5, 2019
0cb4ccf
[image] FIX typo in Config.cmake.in
guparan Sep 5, 2019
a9a8a99
[CMake] FIX sofa_set_bool when used with undefined value
guparan Sep 5, 2019
f21eb4b
[SofaCUDA] Revert to plain signature for target_link_libraries
guparan Sep 5, 2019
73f1730
[SofaGuiQt] FIX file not found in GUI.ui
guparan Sep 5, 2019
19a8efd
[SofaMacros] Propagate sofa_set_bool fix to sofa_find_package
guparan Sep 5, 2019
8e6f9fb
[SofaGui] FIX typo in Qwt finding + improve
guparan Sep 5, 2019
c6da587
[SofaCUDA] FIX missing config.h
guparan Sep 6, 2019
5a3a807
[CGALPlugin] FIX missing config.h
guparan Sep 6, 2019
b1a034f
[SofaCUDA] FIX includes order
guparan Sep 6, 2019
fad8f73
[SofaGui] FIX #ifdef to #if for SOFAHELPER_HAVE_FFMPEG_EXEC
guparan Sep 6, 2019
8c59d5b
[Modeler] FIX TinyXML dependency
guparan Sep 6, 2019
13b0a1d
[SofaMiscFem_test] FIX missing test
guparan Sep 6, 2019
36593c5
[SofaSimulationGraph_test] FIX missing test
guparan Sep 6, 2019
a0f79b1
[CMake] Change order to have SofaSparseSolver when building tests
guparan Sep 6, 2019
b75790b
Merge remote-tracking branch 'sofa-framework/master' into improve_ext…
guparan Sep 10, 2019
0dda89a
[All] Use cmakedefine01 to ensure correct value
guparan Sep 17, 2019
8f3ef32
[CMake] RENAME sofa_set_bool to sofa_set_01
guparan Sep 17, 2019
fbd9356
[cmake] FIX cmake configuration when SOFA_TEST is disabled
epernod Sep 24, 2019
eca0439
[SofaExporter] FIX compilation when sofa_python is not activated.
epernod Sep 24, 2019
d2cd22f
[cmake] update condition to activate specific package test. Use find_…
epernod Sep 24, 2019
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
19 changes: 8 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,7 @@ add_subdirectory(SofaMisc)
add_subdirectory(SofaGui)

# SofaTest, modules depend on SofaPython, so we add SofaPython before.
sofa_add_plugin( applications/plugins/SofaPython SofaPython )

## Modules
## in the consortium convention a module is a similar to a plugin the difference is that
## a module is hosted and managed by the consortium while plugins are hosted and managed by third parties.
add_subdirectory(modules)
sofa_add_plugin(applications/plugins/SofaPython SofaPython)

## Scene creator option
option(SOFA_BUILD_SCENECREATOR "Compile the C++ API located in applications/plugins/SceneCreator" OFF)
Expand All @@ -253,25 +248,27 @@ endif()

# Library used by SOFA_BUILD_TESTS and SOFA_BUILD_TUTORIALS
if(SOFA_BUILD_SCENECREATOR)
add_subdirectory(applications/plugins/SceneCreator SceneCreator)
add_subdirectory(applications/plugins/SceneCreator)
endif()

# Tests : define subdirectories
if(SOFA_BUILD_TESTS)
# Library used to write high level tests involving many components.
add_subdirectory(applications/plugins/SofaTest SofaTest)
add_subdirectory(applications/plugins/SofaTest)
# Tests for all the modules, written using SofaTest.
add_subdirectory(modules/tests)
# SofaPython_test is a special case, because it depends on
# SofaTest, which depends on SofaPython...
if(PLUGIN_SOFAPYTHON)
add_subdirectory(applications/plugins/SofaPython/SofaPython_test)
endif()

# Not sure what is it
add_subdirectory(applications/plugins/SofaTest/SofaTest_test)
endif()

## Modules
## in the consortium convention a module is a similar to a plugin the difference is that
## a module is hosted and managed by the consortium while plugins are hosted and managed by third parties.
add_subdirectory(modules)

## Plugins
add_subdirectory(applications/plugins)

Expand Down
17 changes: 5 additions & 12 deletions SofaAdvanced/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,16 @@ project(SofaAdvanced)

## Dependencies
find_package(SofaGeneral REQUIRED)
find_package(MiniFlowVR QUIET)
set(SOFA_HAVE_MINIFLOWVR ${MiniFlowVR_FOUND})
set(SOFA_HAVE_FLOWVR ${MiniFlowVR_FOUND}) # cmakedefine

## Version
set(SOFAADVANCED_VERSION ${SofaFramework_VERSION})

## SofaAdvanced/config.h
configure_file(config.h.in "${CMAKE_BINARY_DIR}/include/${PROJECT_NAME}/config.h")
install(FILES "${CMAKE_BINARY_DIR}/include/${PROJECT_NAME}/config.h" DESTINATION "include/${PROJECT_NAME}/${PROJECT_NAME}" COMPONENT headers)


### Subdirectories

## Subdirectories
set(SOFAADVANCED_TARGETS
SofaComponentAdvanced
SofaNonUniformFem
)

foreach(TARGET ${SOFAADVANCED_TARGETS})
foreach(TARGET ${SOFAADVANCED_TARGETS} SofaComponentAdvanced)
add_subdirectory(../modules/${TARGET} ${CMAKE_CURRENT_BINARY_DIR}/${TARGET})
target_include_directories(${TARGET} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../modules>")
target_include_directories(${TARGET} PUBLIC "$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>")
Expand All @@ -32,6 +22,9 @@ foreach(TARGET ${SOFAADVANCED_TARGETS})
set_target_properties(${TARGET} PROPERTIES VERSION ${SOFAADVANCED_VERSION})
endforeach()

## SofaAdvanced/config.h
configure_file(config.h.in "${CMAKE_BINARY_DIR}/include/${PROJECT_NAME}/config.h")
install(FILES "${CMAKE_BINARY_DIR}/include/${PROJECT_NAME}/config.h" DESTINATION "include/${PROJECT_NAME}/${PROJECT_NAME}" COMPONENT headers)

## CMake package configurations files
sofa_write_package_config_files(SofaAdvanced ${SOFAADVANCED_VERSION})
19 changes: 8 additions & 11 deletions SofaAdvanced/SofaAdvancedConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@

find_package(SofaGeneral REQUIRED)

set(SOFA_HAVE_MINIFLOWVR @SOFA_HAVE_MINIFLOWVR@)

if(SOFA_HAVE_MINIFLOWVR)
find_package(MiniFlowVR REQUIRED)
endif()

if(NOT TARGET SofaComponentAdvanced)
include("${CMAKE_CURRENT_LIST_DIR}/SofaAdvancedTargets.cmake")
endif()

check_required_components(@SOFAADVANCED_TARGETS@)
foreach(target @SOFAADVANCED_TARGETS@ SofaComponentAdvanced)
if(NOT TARGET ${target})
include("${CMAKE_CURRENT_LIST_DIR}/SofaAdvancedTargets.cmake")
break()
endif()
endforeach()

check_required_components(@SOFAADVANCED_TARGETS@ SofaComponentAdvanced)
2 changes: 0 additions & 2 deletions SofaAdvanced/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@

#include <SofaCommon/config.h>

#cmakedefine SOFA_HAVE_FLOWVR

#ifdef SOFA_BUILD_NON_UNIFORM_FEM
# define SOFA_TARGET SofaNonUniformFem
# define SOFA_NON_UNIFORM_FEM_API SOFA_EXPORT_DYNAMIC_LIBRARY
Expand Down
25 changes: 11 additions & 14 deletions SofaGeneral/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,13 @@ project(SofaGeneral)
# Send warnings when deprecated CMake project is activated
option(CMAKE_WARN_DEPRECATED "Send warning when deprecated projects are found" ON)

## Dependencies
# Dependencies
find_package(SofaCommon REQUIRED)
find_package(Newmat)
set(SOFA_HAVE_NEWMAT ${Newmat_FOUND})

## Version
# Version
set(SOFAGENERAL_VERSION ${SofaFramework_VERSION})

## SofaGeneral/config.h
configure_file(config.h.in "${CMAKE_BINARY_DIR}/include/${PROJECT_NAME}/config.h")
install(FILES "${CMAKE_BINARY_DIR}/include/${PROJECT_NAME}/config.h" DESTINATION "include/${PROJECT_NAME}/${PROJECT_NAME}" COMPONENT headers)

### Subdirectories

# Subdirectories
set(SOFAGENERAL_TARGETS
SofaGeneralAnimationLoop
SofaGeneralDeformable
Expand All @@ -32,7 +25,6 @@ set(SOFAGENERAL_TARGETS
SofaGeneralTopology
SofaGeneralVisual
SofaBoundaryCondition
SofaComponentGeneral
SofaConstraint
SofaGeneralEngine
SofaGraphComponent
Expand All @@ -41,11 +33,13 @@ set(SOFAGENERAL_TARGETS
SofaValidation
)

if(SOFA_HAVE_NEWMAT)
find_package(Newmat QUIET)
if(Newmat_FOUND)
list(APPEND SOFAGENERAL_TARGETS SofaDenseSolver)
endif()
sofa_set_bool(SOFAGENERAL_HAVE_SOFADENSESOLVER VALUE ${Newmat_FOUND})

foreach(TARGET ${SOFAGENERAL_TARGETS})
foreach(TARGET ${SOFAGENERAL_TARGETS} SofaComponentGeneral)
add_subdirectory(../modules/${TARGET} ${CMAKE_CURRENT_BINARY_DIR}/${TARGET})
target_include_directories(${TARGET} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../modules>")
target_include_directories(${TARGET} PUBLIC "$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>")
Expand All @@ -55,6 +49,9 @@ foreach(TARGET ${SOFAGENERAL_TARGETS})
set_target_properties(${TARGET} PROPERTIES VERSION ${SOFAGENERAL_VERSION})
endforeach()

# SofaGeneral/config.h
configure_file(config.h.in "${CMAKE_BINARY_DIR}/include/${PROJECT_NAME}/config.h")
install(FILES "${CMAKE_BINARY_DIR}/include/${PROJECT_NAME}/config.h" DESTINATION "include/${PROJECT_NAME}/${PROJECT_NAME}" COMPONENT headers)

## CMake package configurations files
# CMake package configurations files
sofa_write_package_config_files(SofaGeneral ${SOFAGENERAL_VERSION})
25 changes: 16 additions & 9 deletions SofaGeneral/SofaGeneralConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,24 @@

@PACKAGE_INIT@

find_package(SofaCommon REQUIRED)
set(SOFAGENERAL_HAVE_SOFADENSESOLVER @SOFAGENERAL_HAVE_SOFADENSESOLVER@)
set(SOFADENSESOLVER_HAVE_NEWMAT @SOFADENSESOLVER_HAVE_NEWMAT@)
set(SOFAGENERALLOADER_HAVE_ZLIB @SOFAGENERALLOADER_HAVE_ZLIB@)

set(SOFA_HAVE_NEWMAT @SOFA_HAVE_NEWMAT@)
set(SOFA_HAVE_PARDISO @SOFA_HAVE_PARDISO@)
find_package(SofaCommon REQUIRED)

if(SOFA_HAVE_NEWMAT)
find_package(Newmat REQUIRED)
if(SOFADENSESOLVER_HAVE_NEWMAT)
find_package(Newmat QUIET REQUIRED)
endif()

if(NOT TARGET SofaComponentGeneral)
include("${CMAKE_CURRENT_LIST_DIR}/SofaGeneralTargets.cmake")
if(SOFAGENERALLOADER_HAVE_ZLIB)
find_package(ZLIB QUIET REQUIRED)
endif()

check_required_components(@SOFAGENERAL_TARGETS@)
foreach(target @SOFAGENERAL_TARGETS@ SofaComponentGeneral)
if(NOT TARGET ${target})
include("${CMAKE_CURRENT_LIST_DIR}/SofaGeneralTargets.cmake")
break()
endif()
endforeach()

check_required_components(@SOFAGENERAL_TARGETS@ SofaComponentGeneral)
17 changes: 6 additions & 11 deletions SofaGeneral/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@

#include <SofaCommon/config.h>

#cmakedefine SOFA_HAVE_NEWMAT
#cmakedefine SOFA_HAVE_PARDISO
#define SOFAGENERAL_HAVE_SOFADENSESOLVER ${SOFAGENERAL_HAVE_SOFADENSESOLVER}

#ifdef SOFA_BUILD_GENERAL_DEFORMABLE
# define SOFA_TARGET SofaGeneralDeformable
Expand Down Expand Up @@ -174,21 +173,17 @@
# define SOFA_CONSTRAINT_API SOFA_IMPORT_DYNAMIC_LIBRARY
#endif

#ifdef SOFA_HAVE_NEWMAT
# ifdef SOFA_BUILD_DENSE_SOLVER
# define SOFA_TARGET SofaDenseSolver
# define SOFA_DENSE_SOLVER_API SOFA_EXPORT_DYNAMIC_LIBRARY
# else
# define SOFA_DENSE_SOLVER_API SOFA_IMPORT_DYNAMIC_LIBRARY
# endif
#ifdef SOFA_BUILD_DENSE_SOLVER
# define SOFA_TARGET SofaDenseSolver
# define SOFA_DENSE_SOLVER_API SOFA_EXPORT_DYNAMIC_LIBRARY
#else
# define SOFA_DENSE_SOLVER_API SOFA_IMPORT_DYNAMIC_LIBRARY
#endif

#ifdef SOFA_HAVE_PARDISO
#ifdef SOFA_BUILD_PARDISO_SOLVER
# define SOFA_PARDISO_SOLVER_API SOFA_EXPORT_DYNAMIC_LIBRARY
#else
# define SOFA_PARDISO_SOLVER_API SOFA_IMPORT_DYNAMIC_LIBRARY
#endif
#endif

#endif
116 changes: 17 additions & 99 deletions SofaGui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,6 @@ find_package(SofaGeneral REQUIRED)
find_package(SofaMisc REQUIRED)
find_package(SofaAdvanced REQUIRED)

option(SOFA_NO_QT "Force Sofa to not take into account the Qt library" OFF)

if(NOT SOFA_NO_QT)
## Qt5
set(QT_USE_IMPORTED_TARGETS 1)

# Search for Qt to see if we can auto-enable stuff
find_package(Qt5 COMPONENTS Core QUIET)

## Thoses variables are used in SofaGuiConfig.cmake.in
if(Qt5_FOUND)
set(SOFA_HAVE_QT 1)
endif()
set(SOFA_QT5 ${Qt5_FOUND})
else()
set(SOFA_HAVE_QT 0)
set(SOFA_QT5 0)
endif(NOT SOFA_NO_QT)

set(SOFAGUI_TARGETS "")

## Version
Expand All @@ -44,87 +25,24 @@ endif()
add_subdirectory(../applications/sofa/gui/SofaGuiCommon ${CMAKE_CURRENT_BINARY_DIR}/SofaGuiCommon)
list(APPEND SOFAGUI_TARGETS SofaGuiCommon)

if(NOT SOFA_NO_QT)
## Qt GUI
# Check if Qt(4/5) is present ; if not, disable ability to compile Qt things
set(SOFA_HAVE_QT_LIBRARIES 1)
find_package(Qt5 COMPONENTS Core QUIET)
if(NOT Qt5Core_FOUND)
set(SOFA_HAVE_QT_LIBRARIES 0)
## SofaGuiQt
option(SOFAGUI_QT "Compile the Qt GUI" ON)
if(SOFAGUI_QT)
list(APPEND SOFAGUI_TARGETS SofaGuiQt)
add_subdirectory(../applications/sofa/gui/qt ${CMAKE_CURRENT_BINARY_DIR}/SofaGuiQt)
endif()
sofa_set_bool(SOFAGUI_HAVE_SOFAGUIQT VALUE ${SOFAGUI_QT}) # see config.h.in

## OpenGL-based GUIs
if(NOT SOFA_NO_OPENGL)
## SofaHeadlessRecorder
option(SOFAGUI_HEADLESS_RECORDER "Compile the headless recorder (Linux only)" OFF)
if(SOFAGUI_HEADLESS_RECORDER)
list(APPEND SOFAGUI_TARGETS SofaHeadlessRecorder)
add_subdirectory(../applications/sofa/gui/headlessRecorder ${CMAKE_CURRENT_BINARY_DIR}/SofaHeadlessRecorder)
endif()

if(SOFA_HAVE_QT_LIBRARIES)
option(SOFAGUI_QT "Compile the Qt GUI" ON)
if(SOFAGUI_QT)

## Qt GUI options, used in the relevant CMakeLists.txt
## VSync
option(SOFAGUI_ENABLE_VSYNC "Enable vertical refresh sync" OFF)
if(SOFAGUI_ENABLE_VSYNC)
set(SOFA_GUI_VSYNC_ 1) # config.h.in
else()
set(SOFA_GUI_VSYNC_ 0) # config.h.in
endif()

## QWT
option(SOFAGUI_ENABLE_QWT "Enable QWT for Qt GUIs")
if(SOFAGUI_ENABLE_QWT)
set(SOFA_HAVE_QWT 1) # cmakedefine
endif()

## Qt native menu
set(DEFAULT_SOFAGUI_ENABLE_NATIVE_MENU ON)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(DEFAULT_SOFAGUI_ENABLE_NATIVE_MENU OFF)
endif()

option(SOFAGUI_ENABLE_NATIVE_MENU "Enable Qt to use the operating system's native menu for the Qt GUI" ${DEFAULT_SOFAGUI_ENABLE_NATIVE_MENU})
if(SOFAGUI_ENABLE_NATIVE_MENU)
set(SOFA_GUI_NATIVE_MENU 1)
endif()

set(SOFA_GUI_QT 1) # cmakedefine
list(APPEND SOFAGUI_TARGETS SofaGuiQt)
add_subdirectory(../applications/sofa/gui/qt ${CMAKE_CURRENT_BINARY_DIR}/SofaGuiQt)
endif(SOFAGUI_QT)

# Qt things with OpenGL deps
if(NOT SOFA_NO_OPENGL)

option(SOFAGUI_HEADLESS_RECORDER "Compile the headless recorder (Linux only)" OFF)
if(SOFAGUI_HEADLESS_RECORDER)
set(SOFA_GUI_HEADLESS_RECORDER 1) # cmakedefine
list(APPEND SOFAGUI_TARGETS SofaHeadlessRecorder)
add_subdirectory(../applications/sofa/gui/headlessRecorder ${CMAKE_CURRENT_BINARY_DIR}/SofaHeadlessRecorder)
endif(SOFAGUI_HEADLESS_RECORDER)

if(SOFAGUI_QT)
set(SOFA_GUI_QT_OPENGL 1) # cmakedefine
list(APPEND SOFAGUI_TARGETS SofaGuiQtOpenGL)
add_subdirectory(../applications/sofa/gui/qt/gl ${CMAKE_CURRENT_BINARY_DIR}/SofaGuiQtOpenGL)

## QtViewer
option(SOFAGUI_QTVIEWER "Compile the QtViewer for the Qt GUI" ON)
if(SOFAGUI_QTVIEWER)
set(SOFA_GUI_QTVIEWER 1) # cmakedefine
endif()

## QglViewer
option(SOFAGUI_QGLVIEWER "Compile the QGLViewer for the Qt GUI" ON)
if(SOFAGUI_QGLVIEWER)
set(SOFA_GUI_QGLVIEWER 1) # cmakedefine
find_package(QGLViewer QUIET)
if(NOT QGLViewer_FOUND)
add_subdirectory(${CMAKE_SOURCE_DIR}/extlibs/libQGLViewer-2.7.1/QGLViewer ${CMAKE_BINARY_DIR}/extlibs/QGLViewer)
endif()
endif()

endif(SOFAGUI_QT)
endif(NOT SOFA_NO_OPENGL)
else()
message("Cannot find any Qt libraries on your system, please set Qt5_DIR or Qt4_DIR if you want to compile GUIs using Qt")
endif(SOFA_HAVE_QT_LIBRARIES)
endif(NOT SOFA_NO_QT)
sofa_set_bool(SOFAGUI_HAVE_SOFAHEADLESSRECORDER VALUE ${SOFAGUI_HEADLESS_RECORDER}) # see config.h.in
endif()

## SofaGuiMain
list(APPEND SOFAGUI_TARGETS SofaGuiMain)
Expand Down
Loading