|
|
|
|
|
## gui - CMakeLists.txt
|
|
|
STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX)
|
|
|
SET(SQPGUI_LIBRARY_NAME "${LIBRARY_PREFFIX}_gui${DEBUG_SUFFIX}")
|
|
|
SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
|
|
|
SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
|
|
SET(UI_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/ui")
|
|
|
SET(RES_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/resources")
|
|
|
|
|
|
# Include gui directory
|
|
|
include_directories("${INCLUDES_DIR}")
|
|
|
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
|
|
|
|
|
|
# Set a variable to display a warning in the version files.
|
|
|
SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.")
|
|
|
|
|
|
#
|
|
|
# Find Qt modules
|
|
|
#
|
|
|
SCIQLOP_FIND_QT(Core Widgets PrintSupport)
|
|
|
|
|
|
#
|
|
|
# Find dependent libraries
|
|
|
# ========================
|
|
|
find_package(sciqlop-core)
|
|
|
|
|
|
SET(LIBRARIES ${SCIQLOP-CORE_LIBRARIES})
|
|
|
|
|
|
INCLUDE_DIRECTORIES(${SCIQLOP-CORE_INCLUDE_DIR})
|
|
|
|
|
|
# Add sqpcore to the list of libraries to use
|
|
|
list(APPEND LIBRARIES ${SQPCORE_LIBRARY_NAME})
|
|
|
|
|
|
# Add dependent shared libraries
|
|
|
list(APPEND SHARED_LIBRARIES ${SQPCORE_SHARED_LIBRARIES})
|
|
|
|
|
|
|
|
|
# Ui files
|
|
|
FILE (GLOB_RECURSE PROJECT_FORMS ${UI_FOLDER}/*.ui)
|
|
|
|
|
|
# Resources files
|
|
|
FILE (GLOB_RECURSE PROJECT_RESOURCES ${RES_FOLDER}/*.qrc)
|
|
|
|
|
|
#
|
|
|
# Compile the library library
|
|
|
#
|
|
|
FILE (GLOB_RECURSE MODULE_SOURCES
|
|
|
${INCLUDES_DIR}/*.h
|
|
|
${SOURCES_DIR}/*.c
|
|
|
${SOURCES_DIR}/*.cpp
|
|
|
${SOURCES_DIR}/*.h
|
|
|
${PROJECT_FORMS})
|
|
|
|
|
|
QT5_ADD_RESOURCES(RCC_HDRS
|
|
|
${PROJECT_RESOURCES}
|
|
|
)
|
|
|
|
|
|
QT5_WRAP_UI(UIS_HDRS
|
|
|
${PROJECT_FORMS}
|
|
|
)
|
|
|
|
|
|
|
|
|
ADD_LIBRARY(${SQPGUI_LIBRARY_NAME} ${MODULE_SOURCES} ${UIS_HDRS} ${RCC_HDRS})
|
|
|
set_property(TARGET ${SQPGUI_LIBRARY_NAME} PROPERTY CXX_STANDARD 14)
|
|
|
set_property(TARGET ${SQPGUI_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
|
|
|
|
|
|
TARGET_LINK_LIBRARIES(${SQPGUI_LIBRARY_NAME} ${LIBRARIES})
|
|
|
qt5_use_modules(${SQPGUI_LIBRARY_NAME} Core Widgets PrintSupport)
|
|
|
|
|
|
|
|
|
INSTALL(TARGETS ${SQPGUI_LIBRARY_NAME}
|
|
|
RUNTIME DESTINATION ${INSTALL_BINARY_DIR}
|
|
|
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
|
|
|
ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR}
|
|
|
)
|
|
|
add_dependencies(${SQPGUI_LIBRARY_NAME} ${SQPCORE_LIBRARY_NAME})
|
|
|
|
|
|
# Find CATALOGUE_API
|
|
|
include_directories("${CATALOGUEAPI_INCLUDE}")
|
|
|
TARGET_LINK_LIBRARIES(${SQPGUI_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES})
|
|
|
INSTALL(TARGETS ${SQPGUI_LIBRARY_NAME}
|
|
|
RUNTIME DESTINATION ${INSTALL_BINARY_DIR}
|
|
|
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
|
|
|
ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR}
|
|
|
)
|
|
|
|
|
|
add_dependencies(${SQPGUI_LIBRARY_NAME} CatalogueAPI)
|
|
|
|
|
|
# From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html
|
|
|
# Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order.
|
|
|
# The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets
|
|
|
IF(BUILD_SHARED_LIBS)
|
|
|
SET_TARGET_PROPERTIES(${SQPGUI_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT")
|
|
|
ELSE()
|
|
|
TARGET_COMPILE_DEFINITIONS(${SQPGUI_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES")
|
|
|
ENDIF()
|
|
|
|
|
|
# Set the variable to parent scope so that the other projects can copy the
|
|
|
# dependent shared libraries
|
|
|
SCIQLOP_SET_TO_PARENT_SCOPE(SQPGUI_LIBRARY_NAME)
|
|
|
|
|
|
# Copy extern shared libraries to the lib folder
|
|
|
SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPGUI_LIBRARY_NAME})
|
|
|
|
|
|
# Add the files to the list of files to be analyzed
|
|
|
LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
|
|
|
SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
|
|
|
# Vera++ exclusion files
|
|
|
LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
|
|
|
SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
|
|
|
|
|
|
#
|
|
|
# Compile the tests
|
|
|
#
|
|
|
IF(BUILD_TESTS)
|
|
|
INCLUDE_DIRECTORIES(${SOURCES_DIR})
|
|
|
FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
|
|
|
FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
|
|
|
SET( TEST_LIBRARIES ${SQPGUI_LIBRARY_NAME})
|
|
|
|
|
|
FOREACH( testFile ${TESTS_SOURCES} )
|
|
|
GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
|
|
|
GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
|
|
|
|
|
|
# Add to the list of sources files all the sources in the same
|
|
|
# directory that aren't another test
|
|
|
FILE (GLOB currentTestSources
|
|
|
${testDirectory}/*.c
|
|
|
${testDirectory}/*.cpp
|
|
|
${testDirectory}/*.h)
|
|
|
LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
|
|
|
# LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
|
|
|
|
|
|
ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
|
|
|
set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14)
|
|
|
set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON)
|
|
|
TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} )
|
|
|
qt5_use_modules(${testName} Test)
|
|
|
|
|
|
ADD_TEST( NAME ${testName} COMMAND ${testName} )
|
|
|
|
|
|
SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES})
|
|
|
ENDFOREACH( testFile )
|
|
|
|
|
|
LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
|
|
|
LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
|
|
|
LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
|
|
|
SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
|
|
|
ENDIF(BUILD_TESTS)
|
|
|
|
|
|
#
|
|
|
# Set the files that must be formatted by clang-format.
|
|
|
#
|
|
|
LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
|
|
|
SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
|
|
|
|
|
|
#
|
|
|
# Set the directories that doxygen must browse to generate the
|
|
|
# documentation.
|
|
|
#
|
|
|
# Source directories:
|
|
|
LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
|
|
|
LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
|
|
|
SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
|
|
|
# Source directories to exclude from the documentation generation
|
|
|
#LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
|
|
|
SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
|
|
|
|
|
|
#
|
|
|
# Set the directories with the sources to analyze and propagate the
|
|
|
# modification to the parent scope
|
|
|
#
|
|
|
# Source directories to analyze:
|
|
|
LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
|
|
|
LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
|
|
|
SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
|
|
|
# Source directories to exclude from the analysis
|
|
|
#LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
|
|
|
SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
|
|
|
|