mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
cmake: lowercase all built-in calls
e.g. SET() -> set() ELSEIF() -> elseif() Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
8c4ef161b2
commit
ea2ffd6c32
1 changed files with 145 additions and 145 deletions
290
CMakeLists.txt
290
CMakeLists.txt
|
@ -5,26 +5,26 @@ cmake_minimum_required(VERSION 2.8.11)
|
||||||
|
|
||||||
# global settings
|
# global settings
|
||||||
|
|
||||||
SET(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
SET(CMAKE_AUTOUIC ON)
|
set(CMAKE_AUTOUIC ON)
|
||||||
OPTION(LIBGIT2_FROM_PKGCONFIG "use pkg-config to retrieve libgit2" OFF)
|
option(LIBGIT2_FROM_PKGCONFIG "use pkg-config to retrieve libgit2" OFF)
|
||||||
OPTION(LIBDC_FROM_PKGCONFIG "use pkg-config to retrieve libdivecomputer" OFF)
|
option(LIBDC_FROM_PKGCONFIG "use pkg-config to retrieve libdivecomputer" OFF)
|
||||||
OPTION(NO_MARBLE "disable the marble widget" OFF)
|
option(NO_MARBLE "disable the marble widget" OFF)
|
||||||
OPTION(NO_TESTS "disable the tests" OFF)
|
option(NO_TESTS "disable the tests" OFF)
|
||||||
OPTION(NO_DOCS "disable the docs" OFF)
|
option(NO_DOCS "disable the docs" OFF)
|
||||||
|
|
||||||
SET(CMAKE_MODULE_PATH ${${PROJECT_NAME}_SOURCE_DIR}/cmake/Modules)
|
set(CMAKE_MODULE_PATH ${${PROJECT_NAME}_SOURCE_DIR}/cmake/Modules)
|
||||||
INCLUDE_DIRECTORIES(. ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} qt-ui qt-ui/profile)
|
include_directories(. ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} qt-ui qt-ui/profile)
|
||||||
|
|
||||||
# compiler specific settings
|
# compiler specific settings
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUXX)
|
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUXX)
|
||||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 ")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 ")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# pkgconfig for required libraries
|
# pkgconfig for required libraries
|
||||||
FIND_PACKAGE(PkgConfig)
|
find_package(PkgConfig)
|
||||||
INCLUDE(cmake/Modules/pkgconfig_helper.cmake)
|
include(cmake/Modules/pkgconfig_helper.cmake)
|
||||||
|
|
||||||
pkg_config_library(LIBXML libxml-2.0 REQUIRED)
|
pkg_config_library(LIBXML libxml-2.0 REQUIRED)
|
||||||
pkg_config_library(LIBSQLITE3 sqlite3 REQUIRED)
|
pkg_config_library(LIBSQLITE3 sqlite3 REQUIRED)
|
||||||
|
@ -34,107 +34,107 @@ pkg_config_library(LIBUSB libusb-1.0 QUIET)
|
||||||
|
|
||||||
# more libraries with special handling in case we build them ourselves
|
# more libraries with special handling in case we build them ourselves
|
||||||
|
|
||||||
IF(LIBGIT2_FROM_PKGCONFIG)
|
if(LIBGIT2_FROM_PKGCONFIG)
|
||||||
pkg_config_library(LIBGIT2 libgit2 REQUIRED)
|
pkg_config_library(LIBGIT2 libgit2 REQUIRED)
|
||||||
SET(LIBGIT2_LIBRARIES "")
|
set(LIBGIT2_LIBRARIES "")
|
||||||
ELSE()
|
else()
|
||||||
FIND_PACKAGE(LIBGIT2 REQUIRED)
|
find_package(LIBGIT2 REQUIRED)
|
||||||
INCLUDE_DIRECTORIES(${LIBGIT2_INCLUDE_DIR})
|
include_directories(${LIBGIT2_INCLUDE_DIR})
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
IF(LIBDC_FROM_PKGCONFIG)
|
if(LIBDC_FROM_PKGCONFIG)
|
||||||
pkg_config_library(LIBDC libdivecomputer REQUIRED)
|
pkg_config_library(LIBDC libdivecomputer REQUIRED)
|
||||||
SET(LIBDIVECOMPUTER_LIBRARIES "")
|
set(LIBDIVECOMPUTER_LIBRARIES "")
|
||||||
ELSE()
|
else()
|
||||||
FIND_PACKAGE(Libdivecomputer REQUIRED)
|
find_package(Libdivecomputer REQUIRED)
|
||||||
INCLUDE_DIRECTORIES(${LIBDIVECOMPUTER_INCLUDE_DIR})
|
include_directories(${LIBDIVECOMPUTER_INCLUDE_DIR})
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
# optional marble
|
# optional marble
|
||||||
|
|
||||||
IF(NOT NO_MARBLE)
|
if(NOT NO_MARBLE)
|
||||||
FIND_PACKAGE(MARBLE QUIET)
|
find_package(MARBLE QUIET)
|
||||||
IF(MARBLE_FOUND)
|
if(MARBLE_FOUND)
|
||||||
include_directories(${MARBLE_INCLUDE_DIR})
|
include_directories(${MARBLE_INCLUDE_DIR})
|
||||||
ELSE()
|
else()
|
||||||
SET(NO_MARBLE ON)
|
set(NO_MARBLE ON)
|
||||||
ENDIF()
|
endif()
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
IF(NO_MARBLE)
|
if(NO_MARBLE)
|
||||||
message(STATUS marble NOT AVAIL)
|
message(STATUS marble NOT AVAIL)
|
||||||
ADD_DEFINITIONS(-DNO_MARBLE)
|
add_definitions(-DNO_MARBLE)
|
||||||
SET(MARBLE_LIBRARIES "")
|
set(MARBLE_LIBRARIES "")
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
SET(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${LIBDIVECOMPUTER_LIBRARIES} ${LIBGIT2_LIBRARIES} -lusb-1.0)
|
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${LIBDIVECOMPUTER_LIBRARIES} ${LIBGIT2_LIBRARIES} -lusb-1.0)
|
||||||
|
|
||||||
# handle out of tree build correctly
|
# handle out of tree build correctly
|
||||||
|
|
||||||
STRING(COMPARE EQUAL "${${PROJECT_NAME}_SOURCE_DIR}" "${${PROJECT_NAME}_BINARY_DIR}" insource)
|
string(COMPARE EQUAL "${${PROJECT_NAME}_SOURCE_DIR}" "${${PROJECT_NAME}_BINARY_DIR}" insource)
|
||||||
GET_FILENAME_COMPONENT(PARENTDIR ${${PROJECT_NAME}_SOURCE_DIR} PATH)
|
get_filename_component(PARENTDIR ${${PROJECT_NAME}_SOURCE_DIR} PATH)
|
||||||
STRING(COMPARE EQUAL "${${PROJECT_NAME}_SOURCE_DIR}" "${PARENTDIR}" insourcesubdir)
|
string(COMPARE EQUAL "${${PROJECT_NAME}_SOURCE_DIR}" "${PARENTDIR}" insourcesubdir)
|
||||||
IF(NOT (insource OR insourcedir))
|
if(NOT (insource OR insourcedir))
|
||||||
IF(NOT NO_MARBLE)
|
if(NOT NO_MARBLE)
|
||||||
add_custom_target(link_marble_data ALL COMMAND rm -f marbledata && ln -s ${${PROJECT_NAME}_SOURCE_DIR}/marbledata ${${PROJECT_NAME}_BINARY_DIR}/marbledata)
|
add_custom_target(link_marble_data ALL COMMAND rm -f marbledata && ln -s ${${PROJECT_NAME}_SOURCE_DIR}/marbledata ${${PROJECT_NAME}_BINARY_DIR}/marbledata)
|
||||||
ENDIF()
|
endif()
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
# configure Qt.
|
# configure Qt.
|
||||||
|
|
||||||
FIND_PACKAGE(Qt5 REQUIRED COMPONENTS Core Concurrent Widgets Network WebKitWidgets PrintSupport Svg Test LinguistTools)
|
find_package(Qt5 REQUIRED COMPONENTS Core Concurrent Widgets Network WebKitWidgets PrintSupport Svg Test LinguistTools)
|
||||||
SET(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network Qt5::WebKitWidgets Qt5::PrintSupport Qt5::Svg)
|
set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network Qt5::WebKitWidgets Qt5::PrintSupport Qt5::Svg)
|
||||||
SET(QT_TEST_LIBRARIES ${QT_LIBRARIES} Qt5::Test)
|
set(QT_TEST_LIBRARIES ${QT_LIBRARIES} Qt5::Test)
|
||||||
|
|
||||||
# Generate the ssrf-config.h every 'make'
|
# Generate the ssrf-config.h every 'make'
|
||||||
|
|
||||||
FILE(WRITE ${CMAKE_BINARY_DIR}/version.h.in
|
file(WRITE ${CMAKE_BINARY_DIR}/version.h.in
|
||||||
"#define VERSION_STRING \"@VERSION_STRING@\"
|
"#define VERSION_STRING \"@VERSION_STRING@\"
|
||||||
#define GIT_VERSION_STRING \"@GIT_VERSION_STRING@\"
|
#define GIT_VERSION_STRING \"@GIT_VERSION_STRING@\"
|
||||||
#define CANONICAL_VERSION_STRING \"@CANONICAL_VERSION_STRING@\"
|
#define CANONICAL_VERSION_STRING \"@CANONICAL_VERSION_STRING@\"
|
||||||
")
|
")
|
||||||
|
|
||||||
FILE(WRITE ${CMAKE_BINARY_DIR}/version.cmake "
|
file(WRITE ${CMAKE_BINARY_DIR}/version.cmake "
|
||||||
IF (\${APPLE})
|
if(\${APPLE})
|
||||||
SET(VER_OS darwin)
|
set(VER_OS darwin)
|
||||||
ELSEIF (\${WIN32})
|
elseif(\${WIN32})
|
||||||
SET(VER_OS win)
|
set(VER_OS win)
|
||||||
ELSE ()
|
else()
|
||||||
SET(VER_OS linux)
|
set(VER_OS linux)
|
||||||
ENDIF ()
|
endif()
|
||||||
IF(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")
|
if(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")
|
||||||
SET(VER_OS win)
|
set(VER_OS win)
|
||||||
ENDIF ()
|
endif()
|
||||||
EXECUTE_PROCESS(
|
execute_process(
|
||||||
COMMAND sh scripts/get-version \${VER_OS}
|
COMMAND sh scripts/get-version \${VER_OS}
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
OUTPUT_VARIABLE VERSION_STRING
|
OUTPUT_VARIABLE VERSION_STRING
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
EXECUTE_PROCESS(
|
execute_process(
|
||||||
COMMAND sh scripts/get-version linux
|
COMMAND sh scripts/get-version linux
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
OUTPUT_VARIABLE GIT_VERSION_STRING
|
OUTPUT_VARIABLE GIT_VERSION_STRING
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
EXECUTE_PROCESS(
|
execute_process(
|
||||||
COMMAND sh scripts/get-version full
|
COMMAND sh scripts/get-version full
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
OUTPUT_VARIABLE CANONICAL_VERSION_STRING
|
OUTPUT_VARIABLE CANONICAL_VERSION_STRING
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
CONFIGURE_FILE(\${SRC} \${DST} @ONLY)
|
configure_file(\${SRC} \${DST} @ONLY)
|
||||||
IF(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")
|
if(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")
|
||||||
EXECUTE_PROCESS(
|
execute_process(
|
||||||
COMMAND cat ${CMAKE_SOURCE_DIR}/packaging/windows/subsurface.nsi.in
|
COMMAND cat ${CMAKE_SOURCE_DIR}/packaging/windows/subsurface.nsi.in
|
||||||
COMMAND sed -e \"s/VERSIONTOKEN/\${VERSION_STRING}/\"
|
COMMAND sed -e \"s/VERSIONTOKEN/\${VERSION_STRING}/\"
|
||||||
COMMAND sed -e \"s/PRODVTOKEN/\${CANONICAL_VERSION_STRING}/\"
|
COMMAND sed -e \"s/PRODVTOKEN/\${CANONICAL_VERSION_STRING}/\"
|
||||||
OUTPUT_FILE ${CMAKE_BINARY_DIR}/staging/subsurface.nsi
|
OUTPUT_FILE ${CMAKE_BINARY_DIR}/staging/subsurface.nsi
|
||||||
)
|
)
|
||||||
ENDIF()
|
endif()
|
||||||
")
|
")
|
||||||
|
|
||||||
ADD_CUSTOM_TARGET(
|
add_custom_target(
|
||||||
version ALL COMMAND ${CMAKE_COMMAND} ${CMAKE_COMMAND}
|
version ALL COMMAND ${CMAKE_COMMAND} ${CMAKE_COMMAND}
|
||||||
-D SRC=${CMAKE_BINARY_DIR}/version.h.in
|
-D SRC=${CMAKE_BINARY_DIR}/version.h.in
|
||||||
-D DST=${CMAKE_BINARY_DIR}/ssrf-version.h
|
-D DST=${CMAKE_BINARY_DIR}/ssrf-version.h
|
||||||
|
@ -144,44 +144,44 @@ ADD_CUSTOM_TARGET(
|
||||||
|
|
||||||
# set up the different target platforms
|
# set up the different target platforms
|
||||||
|
|
||||||
SET(PLATFORM_SRC unknown_platform.c)
|
set(PLATFORM_SRC unknown_platform.c)
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
set(SUBSURFACE_TARGET subsurface)
|
set(SUBSURFACE_TARGET subsurface)
|
||||||
SET(PLATFORM_SRC linux.c)
|
set(PLATFORM_SRC linux.c)
|
||||||
# in some builds we appear to be missing libz for some strange reason...
|
# in some builds we appear to be missing libz for some strange reason...
|
||||||
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lz)
|
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lz)
|
||||||
ENDIF()
|
endif()
|
||||||
IF(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
set(SUBSURFACE_TARGET Subsurface)
|
set(SUBSURFACE_TARGET Subsurface)
|
||||||
SET(PLATFORM_SRC macos.c)
|
set(PLATFORM_SRC macos.c)
|
||||||
FIND_LIBRARY(APP_SERVICES_LIBRARY ApplicationServices )
|
find_library(APP_SERVICES_LIBRARY ApplicationServices)
|
||||||
SET(EXTRA_LIBS ${APP_SERVICES_LIBRARY})
|
set(EXTRA_LIBS ${APP_SERVICES_LIBRARY})
|
||||||
SET(ICON_FILE ${CMAKE_SOURCE_DIR}/packaging/macosx/Subsurface.icns)
|
set(ICON_FILE ${CMAKE_SOURCE_DIR}/packaging/macosx/Subsurface.icns)
|
||||||
SET(MACOSX_BUNDLE_INFO_STRING "Subsurface")
|
set(MACOSX_BUNDLE_INFO_STRING "Subsurface")
|
||||||
SET(MACOSX_BUNDLE_ICON_FILE Subsurface.icns)
|
set(MACOSX_BUNDLE_ICON_FILE Subsurface.icns)
|
||||||
SET(MACOSX_BUNDLE_GUI_IDENTIFIER "org.subsurface-divelog")
|
set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.subsurface-divelog")
|
||||||
SET(MACOSX_BUNDLE_BUNDLE_NAME "Subsurface")
|
set(MACOSX_BUNDLE_BUNDLE_NAME "Subsurface")
|
||||||
SET(MACOSX_BUNDLE_BUNDLE_VERSION "4.4.1")
|
set(MACOSX_BUNDLE_BUNDLE_VERSION "4.4.1")
|
||||||
SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "4.4.1")
|
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "4.4.1")
|
||||||
SET(MACOSX_BUNDLE_LONG_VERSION_STRING "4.4.1")
|
set(MACOSX_BUNDLE_LONG_VERSION_STRING "4.4.1")
|
||||||
SET(MACOSX_BUNDLE_COPYRIGHT "Linus Torvalds, Dirk Hohndel, Tomaz Canabrava, and others")
|
set(MACOSX_BUNDLE_COPYRIGHT "Linus Torvalds, Dirk Hohndel, Tomaz Canabrava, and others")
|
||||||
SET_SOURCE_FILES_PROPERTIES(${ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
|
set_source_files_properties(${ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
|
||||||
SET(SUBSURFACE_PKG MACOSX_BUNDLE ${ICON_FILE})
|
set(SUBSURFACE_PKG MACOSX_BUNDLE ${ICON_FILE})
|
||||||
ENDIF()
|
endif()
|
||||||
IF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
set(SUBSURFACE_TARGET subsurface)
|
set(SUBSURFACE_TARGET subsurface)
|
||||||
SET(PLATFORM_SRC windows.c)
|
set(PLATFORM_SRC windows.c)
|
||||||
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lwsock32)
|
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lwsock32)
|
||||||
remove_definitions(-DUNICODE)
|
remove_definitions(-DUNICODE)
|
||||||
add_definitions(-mwindows)
|
add_definitions(-mwindows)
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
# include translations
|
# include translations
|
||||||
add_subdirectory(translations)
|
add_subdirectory(translations)
|
||||||
|
|
||||||
# compile the core library, in C.
|
# compile the core library, in C.
|
||||||
|
|
||||||
SET(SUBSURFACE_CORE_LIB_SRCS
|
set(SUBSURFACE_CORE_LIB_SRCS
|
||||||
cochran.c
|
cochran.c
|
||||||
datatrak.c
|
datatrak.c
|
||||||
deco.c
|
deco.c
|
||||||
|
@ -229,7 +229,7 @@ SET(SUBSURFACE_CORE_LIB_SRCS
|
||||||
|
|
||||||
# the interface, in C++
|
# the interface, in C++
|
||||||
|
|
||||||
SET(SUBSURFACE_INTERFACE
|
set(SUBSURFACE_INTERFACE
|
||||||
qt-ui/updatemanager.cpp
|
qt-ui/updatemanager.cpp
|
||||||
qt-ui/about.cpp
|
qt-ui/about.cpp
|
||||||
qt-ui/completionmodels.cpp
|
qt-ui/completionmodels.cpp
|
||||||
|
@ -269,7 +269,7 @@ SET(SUBSURFACE_INTERFACE
|
||||||
|
|
||||||
# the profile widget
|
# the profile widget
|
||||||
|
|
||||||
SET(SUBSURFACE_PROFILE_LIB_SRCS
|
set(SUBSURFACE_PROFILE_LIB_SRCS
|
||||||
qt-ui/profile/profilewidget2.cpp
|
qt-ui/profile/profilewidget2.cpp
|
||||||
qt-ui/profile/diverectitem.cpp
|
qt-ui/profile/diverectitem.cpp
|
||||||
qt-ui/profile/divepixmapitem.cpp
|
qt-ui/profile/divepixmapitem.cpp
|
||||||
|
@ -287,7 +287,7 @@ SET(SUBSURFACE_PROFILE_LIB_SRCS
|
||||||
|
|
||||||
# the yearly statistics widget.
|
# the yearly statistics widget.
|
||||||
|
|
||||||
SET(SUBSURFACE_STATISTICS_LIB_SRCS
|
set(SUBSURFACE_STATISTICS_LIB_SRCS
|
||||||
qt-ui/statistics/statisticswidget.cpp
|
qt-ui/statistics/statisticswidget.cpp
|
||||||
qt-ui/statistics/yearstatistics.cpp
|
qt-ui/statistics/yearstatistics.cpp
|
||||||
qt-ui/statistics/statisticsbar.cpp
|
qt-ui/statistics/statisticsbar.cpp
|
||||||
|
@ -296,7 +296,7 @@ SET(SUBSURFACE_STATISTICS_LIB_SRCS
|
||||||
|
|
||||||
# the main app.
|
# the main app.
|
||||||
|
|
||||||
SET(SUBSURFACE_APP
|
set(SUBSURFACE_APP
|
||||||
main.cpp
|
main.cpp
|
||||||
qt-gui.cpp
|
qt-gui.cpp
|
||||||
qthelper.cpp
|
qthelper.cpp
|
||||||
|
@ -304,31 +304,31 @@ SET(SUBSURFACE_APP
|
||||||
|
|
||||||
# create the libraries
|
# create the libraries
|
||||||
|
|
||||||
FILE(GLOB SUBSURFACE_UI qt-ui/*.ui)
|
file(GLOB SUBSURFACE_UI qt-ui/*.ui)
|
||||||
QT5_WRAP_UI(SUBSURFACE_UI_HDRS ${SUBSURFACE_UI})
|
qt5_wrap_ui(SUBSURFACE_UI_HDRS ${SUBSURFACE_UI})
|
||||||
QT5_ADD_RESOURCES(SUBSURFACE_RESOURCES subsurface.qrc)
|
qt5_add_resources(SUBSURFACE_RESOURCES subsurface.qrc)
|
||||||
|
|
||||||
ADD_LIBRARY(subsurface_corelib STATIC ${SUBSURFACE_CORE_LIB_SRCS} )
|
add_library(subsurface_corelib STATIC ${SUBSURFACE_CORE_LIB_SRCS} )
|
||||||
TARGET_LINK_LIBRARIES(subsurface_corelib ${QT_LIBRARIES})
|
target_link_libraries(subsurface_corelib ${QT_LIBRARIES})
|
||||||
ADD_LIBRARY(subsurface_profile STATIC ${SUBSURFACE_PROFILE_LIB_SRCS})
|
add_library(subsurface_profile STATIC ${SUBSURFACE_PROFILE_LIB_SRCS})
|
||||||
TARGET_LINK_LIBRARIES(subsurface_profile ${QT_LIBRARIES})
|
target_link_libraries(subsurface_profile ${QT_LIBRARIES})
|
||||||
ADD_LIBRARY(subsurface_statistics STATIC ${SUBSURFACE_STATISTICS_LIB_SRCS})
|
add_library(subsurface_statistics STATIC ${SUBSURFACE_STATISTICS_LIB_SRCS})
|
||||||
TARGET_LINK_LIBRARIES(subsurface_statistics ${QT_LIBRARIES})
|
target_link_libraries(subsurface_statistics ${QT_LIBRARIES})
|
||||||
ADD_LIBRARY(subsurface_generated_ui STATIC ${SUBSURFACE_UI_HDRS})
|
add_library(subsurface_generated_ui STATIC ${SUBSURFACE_UI_HDRS})
|
||||||
TARGET_LINK_LIBRARIES(subsurface_generated_ui ${QT_LIBRARIES})
|
target_link_libraries(subsurface_generated_ui ${QT_LIBRARIES})
|
||||||
ADD_LIBRARY(subsurface_interface STATIC ${SUBSURFACE_INTERFACE})
|
add_library(subsurface_interface STATIC ${SUBSURFACE_INTERFACE})
|
||||||
TARGET_LINK_LIBRARIES(subsurface_interface ${QT_LIBRARIES} ${MARBLE_LIBRARIES})
|
target_link_libraries(subsurface_interface ${QT_LIBRARIES} ${MARBLE_LIBRARIES})
|
||||||
|
|
||||||
# add pthread to the end of the library list on Linux
|
# add pthread to the end of the library list on Linux
|
||||||
# this is only needed on Ubuntu (why do these idiots break everything?)
|
# this is only needed on Ubuntu (why do these idiots break everything?)
|
||||||
# but shouldn't hurt on other Linux versions
|
# but shouldn't hurt on other Linux versions
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
SET(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lpthread)
|
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lpthread)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# create the executables
|
# create the executables
|
||||||
|
|
||||||
ADD_EXECUTABLE(${SUBSURFACE_TARGET} ${SUBSURFACE_PKG} ${SUBSURFACE_APP} ${SUBSURFACE_RESOURCES})
|
add_executable(${SUBSURFACE_TARGET} ${SUBSURFACE_PKG} ${SUBSURFACE_APP} ${SUBSURFACE_RESOURCES})
|
||||||
target_link_libraries(${SUBSURFACE_TARGET}
|
target_link_libraries(${SUBSURFACE_TARGET}
|
||||||
subsurface_generated_ui
|
subsurface_generated_ui
|
||||||
subsurface_interface
|
subsurface_interface
|
||||||
|
@ -338,46 +338,46 @@ target_link_libraries(${SUBSURFACE_TARGET}
|
||||||
${SUBSURFACE_LINK_LIBRARIES}
|
${SUBSURFACE_LINK_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
ADD_DEPENDENCIES(subsurface_statistics subsurface_generated_ui)
|
add_dependencies(subsurface_statistics subsurface_generated_ui)
|
||||||
ADD_DEPENDENCIES(subsurface_profile subsurface_generated_ui)
|
add_dependencies(subsurface_profile subsurface_generated_ui)
|
||||||
ADD_DEPENDENCIES(subsurface_interface subsurface_generated_ui)
|
add_dependencies(subsurface_interface subsurface_generated_ui)
|
||||||
ADD_DEPENDENCIES(subsurface_generated_ui version)
|
add_dependencies(subsurface_generated_ui version)
|
||||||
ADD_DEPENDENCIES(subsurface_corelib version)
|
add_dependencies(subsurface_corelib version)
|
||||||
|
|
||||||
# add platform specific actions
|
# add platform specific actions
|
||||||
IF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
ADD_CUSTOM_COMMAND(
|
add_custom_command(
|
||||||
OUTPUT ${CMAKE_BINARY_DIR}/qt.conf
|
OUTPUT ${CMAKE_BINARY_DIR}/qt.conf
|
||||||
COMMAND echo \"[Paths]\" > ${CMAKE_BINARY_DIR}/qt.conf \; echo \"Prefix=.\" >> ${CMAKE_BINARY_DIR}/qt.conf
|
COMMAND echo \"[Paths]\" > ${CMAKE_BINARY_DIR}/qt.conf \; echo \"Prefix=.\" >> ${CMAKE_BINARY_DIR}/qt.conf
|
||||||
)
|
)
|
||||||
ADD_CUSTOM_TARGET(
|
add_custom_target(
|
||||||
generate_qtconf
|
generate_qtconf
|
||||||
DEPENDS ${CMAKE_BINARY_DIR}/qt.conf
|
DEPENDS ${CMAKE_BINARY_DIR}/qt.conf
|
||||||
)
|
)
|
||||||
ADD_DEPENDENCIES(${SUBSURFACE_TARGET} generate_qtconf)
|
add_dependencies(${SUBSURFACE_TARGET} generate_qtconf)
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
# QTest based tests
|
# QTest based tests
|
||||||
|
|
||||||
MACRO(test NAME FILE)
|
macro(test NAME FILE)
|
||||||
ADD_EXECUTABLE(${NAME} tests/${FILE} ${SUBSURFACE_RESOURCES})
|
add_executable(${NAME} tests/${FILE} ${SUBSURFACE_RESOURCES})
|
||||||
TARGET_LINK_LIBRARIES(${NAME} subsurface_corelib ${QT_TEST_LIBRARIES} ${SUBSURFACE_LINK_LIBRARIES})
|
target_link_libraries(${NAME} subsurface_corelib ${QT_TEST_LIBRARIES} ${SUBSURFACE_LINK_LIBRARIES})
|
||||||
ADD_TEST(NAME ${NAME} COMMAND ${NAME})
|
add_test(NAME ${NAME} COMMAND ${NAME})
|
||||||
ENDMACRO()
|
endmacro()
|
||||||
|
|
||||||
ENABLE_TESTING()
|
enable_testing()
|
||||||
ADD_DEFINITIONS(-DSUBSURFACE_SOURCE="${CMAKE_SOURCE_DIR}")
|
add_definitions(-DSUBSURFACE_SOURCE="${CMAKE_SOURCE_DIR}")
|
||||||
ADD_DEFINITIONS(-g)
|
add_definitions(-g)
|
||||||
IF(NOT NO_TESTS)
|
if(NOT NO_TESTS)
|
||||||
test(TestUnitConversion testunitconversion.cpp)
|
test(TestUnitConversion testunitconversion.cpp)
|
||||||
test(TestProfile testprofile.cpp)
|
test(TestProfile testprofile.cpp)
|
||||||
test(TestGpsCoords testgpscoords.cpp)
|
test(TestGpsCoords testgpscoords.cpp)
|
||||||
test(TestParse testparse.cpp)
|
test(TestParse testparse.cpp)
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
IF(NOT NO_DOCS)
|
if(NOT NO_DOCS)
|
||||||
ADD_CUSTOM_TARGET(documentation ALL mkdir -p ${CMAKE_BINARY_DIR}/Documentation/ \\; make -C ${CMAKE_SOURCE_DIR}/Documentation OUT=${CMAKE_BINARY_DIR}/Documentation/ doc)
|
add_custom_target(documentation ALL mkdir -p ${CMAKE_BINARY_DIR}/Documentation/ \\; make -C ${CMAKE_SOURCE_DIR}/Documentation OUT=${CMAKE_BINARY_DIR}/Documentation/ doc)
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
# install Subsurface
|
# install Subsurface
|
||||||
# first some variables with files that need installing
|
# first some variables with files that need installing
|
||||||
|
@ -432,7 +432,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
# this is a hack - but I don't know how else to find the macdeployqt program if it's not in the PATH
|
# this is a hack - but I don't know how else to find the macdeployqt program if it's not in the PATH
|
||||||
string(REPLACE moc macdeployqt MACDEPLOYQT ${QT_MOC_EXECUTABLE})
|
string(REPLACE moc macdeployqt MACDEPLOYQT ${QT_MOC_EXECUTABLE})
|
||||||
install(CODE "execute_process(COMMAND ${MACDEPLOYQT} Subsurface.app)")
|
install(CODE "execute_process(COMMAND ${MACDEPLOYQT} Subsurface.app)")
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
# Windows bundling rules
|
# Windows bundling rules
|
||||||
|
@ -458,16 +458,16 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
# next figure out the DLLs we need to include in the installer
|
# next figure out the DLLs we need to include in the installer
|
||||||
# since this needs to run at install time we create a new cmake
|
# since this needs to run at install time we create a new cmake
|
||||||
# script that then gets executed at install time with install(CODE...)
|
# script that then gets executed at install time with install(CODE...)
|
||||||
FILE(WRITE ${CMAKE_BINARY_DIR}/dlllist.cmake "
|
file(WRITE ${CMAKE_BINARY_DIR}/dlllist.cmake "
|
||||||
MESSAGE(STATUS \"processing dlllist.cmake\")
|
message(STATUS \"processing dlllist.cmake\")
|
||||||
# figure out which command to use for objdump
|
# figure out which command to use for objdump
|
||||||
EXECUTE_PROCESS(
|
execute_process(
|
||||||
COMMAND ${CMAKE_C_COMPILER} -dumpmachine
|
COMMAND ${CMAKE_C_COMPILER} -dumpmachine
|
||||||
OUTPUT_VARIABLE OBJDUMP
|
OUTPUT_VARIABLE OBJDUMP
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
# figure out where we should search for libraries
|
# figure out where we should search for libraries
|
||||||
EXECUTE_PROCESS(
|
execute_process(
|
||||||
COMMAND ${CMAKE_C_COMPILER} -print-search-dirs
|
COMMAND ${CMAKE_C_COMPILER} -print-search-dirs
|
||||||
COMMAND sed -nE \"/^libraries: =/{s///;s,/lib/?\\\(:|\\\$\\\$\\\),/bin\\\\1,g;p;q;}\"
|
COMMAND sed -nE \"/^libraries: =/{s///;s,/lib/?\\\(:|\\\$\\\$\\\),/bin\\\\1,g;p;q;}\"
|
||||||
OUTPUT_VARIABLE ADDPATH
|
OUTPUT_VARIABLE ADDPATH
|
||||||
|
@ -478,7 +478,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
# instead and drop the command name from it (before the
|
# instead and drop the command name from it (before the
|
||||||
# first space) -- this will fail if the full path for the
|
# first space) -- this will fail if the full path for the
|
||||||
# linker used contains a space...
|
# linker used contains a space...
|
||||||
EXECUTE_PROCESS(
|
execute_process(
|
||||||
COMMAND tail -1 CMakeFiles/subsurface.dir/link.txt
|
COMMAND tail -1 CMakeFiles/subsurface.dir/link.txt
|
||||||
COMMAND cut -d\\ -f 2-
|
COMMAND cut -d\\ -f 2-
|
||||||
OUTPUT_VARIABLE LINKER_LINE
|
OUTPUT_VARIABLE LINKER_LINE
|
||||||
|
@ -486,7 +486,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
)
|
)
|
||||||
# finally run our win-ldd.pl script against that to
|
# finally run our win-ldd.pl script against that to
|
||||||
# collect all the required dlls
|
# collect all the required dlls
|
||||||
EXECUTE_PROCESS(
|
execute_process(
|
||||||
COMMAND sh -c \"OBJDUMP=\${OBJDUMP}-objdump PATH=$ENV{PATH}:\${ADDPATH} perl ${CMAKE_SOURCE_DIR}/scripts/win-ldd.pl ${SUBSURFACE_TARGET}.exe \${LINKER_LINE}\"
|
COMMAND sh -c \"OBJDUMP=\${OBJDUMP}-objdump PATH=$ENV{PATH}:\${ADDPATH} perl ${CMAKE_SOURCE_DIR}/scripts/win-ldd.pl ${SUBSURFACE_TARGET}.exe \${LINKER_LINE}\"
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||||
OUTPUT_VARIABLE DLLS
|
OUTPUT_VARIABLE DLLS
|
||||||
|
@ -497,7 +497,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
# executing 'install' as a command seems hacky, but you
|
# executing 'install' as a command seems hacky, but you
|
||||||
# can't use the install() cmake function in a script
|
# can't use the install() cmake function in a script
|
||||||
foreach(DLL \${DLLLIST})
|
foreach(DLL \${DLLLIST})
|
||||||
EXECUTE_PROCESS(COMMAND install \${DLL} \${STAGING})
|
execute_process(COMMAND install \${DLL} \${STAGING})
|
||||||
endforeach()
|
endforeach()
|
||||||
")
|
")
|
||||||
# the script we created above is now added as a command to run at
|
# the script we created above is now added as a command to run at
|
||||||
|
@ -517,12 +517,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
COMMAND ${MAKENSIS} ${WINDOWSSTAGING}/subsurface.nsi
|
COMMAND ${MAKENSIS} ${WINDOWSSTAGING}/subsurface.nsi
|
||||||
DEPENDS fake_install
|
DEPENDS fake_install
|
||||||
)
|
)
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||||
# Android template directory
|
# Android template directory
|
||||||
SET(ANDROID_PACKAGE_SOURCE_DIR, ${CMAKE_BINARY_DIR}/android)
|
set(ANDROID_PACKAGE_SOURCE_DIR, ${CMAKE_BINARY_DIR}/android)
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
install(DIRECTORY marbledata/maps DESTINATION share/subsurface/data)
|
install(DIRECTORY marbledata/maps DESTINATION share/subsurface/data)
|
||||||
|
@ -534,10 +534,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
install(DIRECTORY theme DESTINATION share/subsurface)
|
install(DIRECTORY theme DESTINATION share/subsurface)
|
||||||
install(FILES ${TRANSLATIONS} DESTINATION share/subsurface/translations)
|
install(FILES ${TRANSLATIONS} DESTINATION share/subsurface/translations)
|
||||||
install(TARGETS ${SUBSURFACE_TARGET} DESTINATION bin)
|
install(TARGETS ${SUBSURFACE_TARGET} DESTINATION bin)
|
||||||
IF(DEFINED LIBMARBLEDEVEL)
|
if(DEFINED LIBMARBLEDEVEL)
|
||||||
install(
|
install(
|
||||||
CODE "file(GLOB SSRFMARBLE_SHLIBS \"${LIBMARBLEDEVEL}/lib/libssrfmarblewidget.so*\")"
|
CODE "file(GLOB SSRFMARBLE_SHLIBS \"${LIBMARBLEDEVEL}/lib/libssrfmarblewidget.so*\")"
|
||||||
CODE "file(INSTALL \${SSRFMARBLE_SHLIBS} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)"
|
CODE "file(INSTALL \${SSRFMARBLE_SHLIBS} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)"
|
||||||
)
|
)
|
||||||
ENDIF()
|
endif()
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
Loading…
Reference in a new issue