diff --git a/.circleci/config.yml b/.circleci/config.yml index 86249f21..6e680829 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,5 +1,5 @@ --- -version: 2 +version: 2.1 jobs: build-armhf-stretch: machine: true @@ -99,7 +99,7 @@ jobs: docker: - image: circleci/buildpack-deps:bionic-scm environment: - - BUILD_GTK3: 1 + - BUILD_GTK3: true - OCPN_TARGET: bionic-gtk3 steps: - checkout @@ -134,7 +134,7 @@ jobs: docker: - image: circleci/buildpack-deps:focal-scm environment: - - BUILD_GTK3: 1 + - BUILD_GTK3: true - OCPN_TARGET: focal-gtk3 steps: - checkout diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ea545fd..9fd3c675 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,8 @@ -##--------------------------------------------------------------------------- -# Author: jongough aka. Jon Gough -## Copyright: -## License: wxWidgets License -##--------------------------------------------------------------------------- +# --------------------------------------------------------------------------- +# Author: jongough aka. Jon Gough Copyright: License: wxWidgets License +# --------------------------------------------------------------------------- + +set(CMLOC "CMakeLists: ") cmake_minimum_required(VERSION 3.1.1) if(COMMAND cmake_policy) @@ -10,33 +10,35 @@ if(COMMAND cmake_policy) cmake_policy(SET CMP0043 NEW) endif(POLICY CMP0043) cmake_policy(SET CMP0048 NEW) - message(STATUS "CMP0048 set to New") + message(STATUS "${CMLOC}CMP0048 set to New") if(POLICY CMP0077) cmake_policy(SET CMP0077 NEW) endif(POLICY CMP0077) endif(COMMAND cmake_policy) -SET(VERBOSE_NAME "OCPN_Draw") +set(VERBOSE_NAME "OCPN_Draw") set(COMMON_NAME "OCPN Draw") set(TITLE_NAME "OCPNDRAW") set(PACKAGE_CONTACT "Jon Gough") set(PACKAGE "ocpn_draw") -SET(VERSION_MAJOR "1") -SET(VERSION_MINOR "8") -SET(VERSION_PATCH "0") -set(VERSION_TWEAK "0") -SET(VERSION_DATE "04/06/2020") -SET(OCPN_MIN_VERSION "ov50") -SET(OCPN_API_VERSION_MAJOR "1") -SET(OCPN_API_VERSION_MINOR "16") -SET(OD_API_VERSION_MAJOR "1") -SET(OD_API_VERSION_MINOR "1") - -MESSAGE(STATUS "OD Version: ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_TWEAK}") -MESSAGE(STATUS "OD API Version: ${OD_API_VERSION_MAJOR}.${OD_API_VERSION_MINOR}") -MESSAGE(STATUS "OCPN API Verson: ${OCPN_API_VERSION_MAJOR}.${OCPN_API_VERSION_MINOR}") -MESSAGE(STATUS "OCPN Min Verson: ${OCPN_MIN_VERSION}") +project(${PACKAGE}) + +set(VERSION_MAJOR "1") +set(VERSION_MINOR "8") +set(VERSION_PATCH "0") +set(VERSION_TWEAK "5") +set(VERSION_DATE "08/06/2020") +set(OCPN_MIN_VERSION "ov50") +set(OCPN_API_VERSION_MAJOR "1") +set(OCPN_API_VERSION_MINOR "16") +set(OD_API_VERSION_MAJOR "1") +set(OD_API_VERSION_MINOR "1") + +message(STATUS "${CMLOC}OD Version: ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_TWEAK}") +message(STATUS "${CMLOC}OD API Version: ${OD_API_VERSION_MAJOR}.${OD_API_VERSION_MINOR}") +message(STATUS "${CMLOC}OCPN API Verson: ${OCPN_API_VERSION_MAJOR}.${OCPN_API_VERSION_MINOR}") +message(STATUS "${CMLOC}OCPN Min Verson: ${OCPN_MIN_VERSION}") set(PARENT "opencpn") @@ -44,63 +46,62 @@ set(PARENT "opencpn") set(GIT_REPOSITORY_SERVER "github.com") # Builds repository sufficies -set(PROD "prod") #Standard Repos -set(BETA "beta") #Standard Repos -set(ALPHA "alpha") #Standard Repos +set(PROD "prod") # Standard Repos +set(BETA "beta") # Standard Repos +set(ALPHA "alpha") # Standard Repos set(CLOUDSMITH_USER "jon-gough") -# set this if your cloudsmith repository name does not match your git repository name -#set(CLOUDSMITH_BASE_REPOSITORY "${GIT_REPOSITORY_NAME}") -set(XML_INFO_URL "https://opencpn.org/OpenCPN/plugins/ocpn_draw.html") +# set this if your cloudsmith repository name does not match your git repository name set(CLOUDSMITH_BASE_REPOSITORY "${GIT_REPOSITORY_NAME}") +set(XML_INFO_URL "https://opencpn.org/OpenCPN/plugins/draw.html") set(XML_SUMMARY "Drawing Plugin to allow extra objects to be drawn and used within OCPN") set(XML_DESCRIPTION "OCPN_DRAW (OD) is a plugin that extends the capability of OCPN to include non-standard object: Boundaries, Boundary Points, Text Points, Dead Reckoning paths, Electronic Bearing Lines (EBL) and Guard Zones. The plugin also has an API to allow other plugins to directly interact with it.") -## -## ----- Modify section above to include all the details for your plugin ----- ## -## +# +# ----- Modify section above to include all the details for your plugin ----- ## +# -## -## ----- Modify section below if there are special requirements for the plugin ----- ## -## +# +# ----- Modify section below if there are special requirements for the plugin ----- ## +# option(PLUGIN_USE_SVG "Use SVG graphics" ON) set(CMAKE_CXX_STANDARD 11) # Use local version of GLU library -SET(USE_LOCAL_GLU TRUE) +set(USE_LOCAL_GLU TRUE) # Prefer libGL.so to libOpenGL.so, see CMP0072 set(OpenGL_GL_PREFERENCE "LEGACY") option(USE_GL "Enable OpenGL support" ON) -message(STATUS "USE_GL: ${USE_GL}") +message(STATUS "${CMLOC}USE_GL: ${USE_GL}") -SET(BUNDLE_DATA FALSE) -SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build" ) -SET_PROPERTY( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "None" "Debug" "Release" "RelWithDebInfo" "MinSizeRel" ) - -MESSAGE (STATUS "Build type: ${CMAKE_BUILD_TYPE}") +set(BUNDLE_DATA FALSE) +set(CMAKE_BUILD_TYPE + "Release" + CACHE STRING "Choose the type of build") +set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "None" "Debug" "Release" "RelWithDebInfo" "MinSizeRel") +message(STATUS "${CMLOC}Build type: ${CMAKE_BUILD_TYPE}") include("cmake/PluginSetup.cmake") -SET(CMAKE_VERBOSE_MAKEFILE ON) +set(CMAKE_VERBOSE_MAKEFILE ON) option(Plugin_CXX11 "Use c++11" OFF) -## -## ----- Modify section above if there are special requirements for the plugin ----- ## -## - -INCLUDE("cmake/PluginConfigure.cmake") +# +# ----- Modify section above if there are special requirements for the plugin ----- ## +# -## -## ----- Change below to match project requirements ----- ## -## +include("cmake/PluginConfigure.cmake") -ADD_DEFINITIONS(-DUSE_S57) +# +# ----- Change below to match project requirements ----- ## +# +add_definitions(-DUSE_S57) -SET(SRCS +set(SRCS src/Boundary.cpp src/BoundaryCSVImport.cpp src/BoundaryMan.cpp @@ -154,10 +155,9 @@ SET(SRCS src/PILPropertiesDialogImpl.cpp src/PointMan.cpp src/TextPoint.cpp - src/TextPointCSVImport.cpp -) + src/TextPointCSVImport.cpp) -SET(HDRS +set(HDRS include/ocpn_draw_pi.h include/Boundary.h include/BoundaryCSVImport.h @@ -214,10 +214,9 @@ SET(HDRS include/PILPropertiesDialogImpl.h include/PILProp.h include/TextPoint.h - include/TextPointCSVImport.h -) + include/TextPointCSVImport.h) -SET(OCPNSRC +set(OCPNSRC ocpnsrc/bbox.cpp ocpnsrc/cutil.cpp ocpnsrc/geodesic.cpp @@ -227,10 +226,8 @@ SET(OCPNSRC ocpnsrc/TexFont.cpp ocpnsrc/wxJSON/jsonreader.cpp ocpnsrc/wxJSON/jsonval.cpp - ocpnsrc/wxJSON/jsonwriter.cpp - -) -SET(OCPNHDRS + ocpnsrc/wxJSON/jsonwriter.cpp) +set(OCPNHDRS ocpninclude/AISTargetAlertDialog.h ocpninclude/AISTargetQueryDialog.h ocpninclude/bbox.h @@ -251,134 +248,113 @@ SET(OCPNHDRS ocpninclude/wx/json_defs.h ocpninclude/wx/jsonreader.h ocpninclude/wx/jsonval.h - ocpninclude/wx/jsonwriter.h -) - -SET(EXTSRC - ${EXTSRC} - extsrc/clipper.cpp - extsrc/pugixml.cpp -) - -SET(EXTINCLUDE - ${EXTINCLUDE} - extinclude/clipper.hpp - extinclude/pugiconfig.hpp - extinclude/pugixml.hpp -) - -IF(APPLE) - OPTION(OD_JSON_SCHEMA_VALIDATOR "Use JSON Schema validator" OFF) -ELSE(APPLE) - OPTION(OD_JSON_SCHEMA_VALIDATOR "Use JSON Schema validator" ON) -ENDIF(APPLE) - -IF(OD_JSON_SCHEMA_VALIDATOR) - MESSAGE(STATUS "Using JSON Schema validation - warning this changes the 'flavour' of the executable and it may not be compatible with OpenCPN") - ADD_DEFINITIONS(-DOD_JSON_SCHEMA_VALIDATOR) - MESSAGE(STATUS "Adding JSON Schema validation") - - SET(EXTSRC - ${EXTSRC} - extsrc/json-schema-validator/json-schema-draft7.json.cpp - extsrc/json-schema-validator/json-uri.cpp - extsrc/json-schema-validator/json-validator.cpp - ) - SET(EXTINCLUDE - ${EXTINCLUDE} - extinclude/nlohmann/json.hpp - extinclude/json-schema-validator/json-schema.hpp - ) - INCLUDE_DIRECTORIES(BEFORE ${PROJECT_SOURCE_DIR}/extinclude/json-schema-validator) -ELSE(OD_JSON_SCHEMA_VALIDATOR) - MESSAGE(STATUS "Not using JSON Schema validation - warning invalid JSON 'may' cause unexpected crashes") -ENDIF(OD_JSON_SCHEMA_VALIDATOR) - -OPTION(OD_USE_SVG "Use SVG graphics" ON) - -IF(OD_USE_SVG) - MESSAGE(STATUS "SVG support enabled...") - IF(NOT QT_ANDROID) - - ADD_DEFINITIONS(-DODraw_USE_SVG) - ENDIF(NOT QT_ANDROID) -ENDIF(OD_USE_SVG) - -IF(OCPN_MIN_VERSION) - MESSAGE(STATUS "Using O5 MUI") - IF(NOT QT_ANDROID) - ADD_DEFINITIONS(-DODraw_USE_MUI) - ENDIF(NOT QT_ANDROID) -ENDIF(OCPN_MIN_VERSION) - -INCLUDE_DIRECTORIES(BEFORE ${PROJECT_SOURCE_DIR}/extsrc/mygdal ) -INCLUDE_DIRECTORIES(BEFORE ${PROJECT_SOURCE_DIR}/ocpninclude) -INCLUDE_DIRECTORIES(BEFORE ${PROJECT_SOURCE_DIR}/ocpnsrc/glu/include) -INCLUDE_DIRECTORIES(BEFORE ${PROJECT_SOURCE_DIR}/extinclude) -INCLUDE_DIRECTORIES(BEFORE ${PROJECT_SOURCE_DIR}/ocpninclude/wxcurl) -INCLUDE_DIRECTORIES(BEFORE ${PROJECT_SOURCE_DIR}/ocpninclude/wxcurl/include) -INCLUDE_DIRECTORIES(BEFORE ${PROJECT_SOURCE_DIR}/ocpninclude/GL) -INCLUDE_DIRECTORIES(BEFORE ${PROJECT_SOURCE_DIR}/ocpnsrc/lz4) -INCLUDE_DIRECTORIES(BEFORE ${PROJECT_SOURCE_DIR}/ocpnsrc/bitmaps) - -IF(UNIX) - INCLUDE("cmake/FindTinyXML.cmake") - FIND_PACKAGE(TinyXML QUIET) -ENDIF(UNIX) - -IF(TINYXML_FOUND) - message (STATUS "Building with system tinyxml") - INCLUDE_DIRECTORIES(${TINYXML_INCLUDE_DIR}) - ADD_LIBRARY(${PACKAGE_NAME} SHARED ${SRCS} ${HDRS} ${OCPNSRC} ${EXTSRC}) - TARGET_LINK_LIBRARIES(${PACKAGE_NAME} ${TINYXML_LIBRARIES}) -ELSE(TINYXML_FOUND) - message (STATUS "Building with embedded tinyxml") - INCLUDE_DIRECTORIES(extsrc/tinyxml/) - SET(SRC_LTINYXML - extsrc/tinyxml/tinyxml.cpp - extsrc/tinyxml/tinyxmlparser.cpp - extsrc/tinyxml/tinyxmlerror.cpp - ) - ADD_LIBRARY(${PACKAGE_NAME} SHARED ${SRCS} ${HDRS} ${OCPNSRC} ${EXTSRC} ${SRC_LTINYXML}) -ENDIF(TINYXML_FOUND) - -ADD_DEFINITIONS(-DTIXML_USE_STL) - -IF(UNIX AND NOT APPLE) - IF(OD_JSON_SCHEMA_VALIDATOR) - # Change OS/ABI to be UNIX - System V to make it run with OCPN - SET(lib_name lib${PACKAGE_NAME}.so) - MESSAGE(STATUS "lib-name: ${lib_name}") - FIND_FILE(elfedit elfedit) - IF(NOT (${elfedit} STREQUAL "elfedit-NOTFOUND")) - MESSAGE(STATUS "Will ensure OS/ABI is set to 0 to match OCPN") - ADD_CUSTOM_COMMAND( - TARGET ${PACKAGE_NAME} - POST_BUILD - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS ${PACKAGE_NAME} - COMMENT " Running post build action on ${lib_name}." - COMMAND sh -c 'elfedit --input-osabi=Linux --output-osabi=none ${lib_name} || (echo 0) ' - ) - ELSE(NOT (${elfedit} STREQUAL "elfedit-NOTFOUND")) - MESSAGE(STATUS "Cannot correct OS/ABI to match OCPN if it is generated incorrectly. Package binutils needed") - ENDIF(NOT (${elfedit} STREQUAL "elfedit-NOTFOUND")) - ENDIF(OD_JSON_SCHEMA_VALIDATOR) -ENDIF(UNIX AND NOT APPLE) - -get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) + ocpninclude/wx/jsonwriter.h) + +set(EXTSRC ${EXTSRC} extsrc/clipper.cpp extsrc/pugixml.cpp) + +set(EXTINCLUDE ${EXTINCLUDE} extinclude/clipper.hpp extinclude/pugiconfig.hpp extinclude/pugixml.hpp) + +if(APPLE) + option(OD_JSON_SCHEMA_VALIDATOR "Use JSON Schema validator" OFF) +else(APPLE) + option(OD_JSON_SCHEMA_VALIDATOR "Use JSON Schema validator" ON) +endif(APPLE) + +if(OD_JSON_SCHEMA_VALIDATOR) + message(STATUS "${CMLOC}Using JSON Schema validation - warning this changes the 'flavour' of the executable and it may not be compatible with OpenCPN") + add_definitions(-DOD_JSON_SCHEMA_VALIDATOR) + message(STATUS "${CMLOC}Adding JSON Schema validation") + + set(EXTSRC ${EXTSRC} extsrc/json-schema-validator/json-schema-draft7.json.cpp extsrc/json-schema-validator/json-uri.cpp extsrc/json-schema-validator/json-validator.cpp) + set(EXTINCLUDE ${EXTINCLUDE} extinclude/nlohmann/json.hpp extinclude/json-schema-validator/json-schema.hpp) + include_directories(BEFORE ${PROJECT_SOURCE_DIR}/extinclude/json-schema-validator) +else(OD_JSON_SCHEMA_VALIDATOR) + message(STATUS "${CMLOC}Not using JSON Schema validation - warning invalid JSON 'may' cause unexpected crashes") +endif(OD_JSON_SCHEMA_VALIDATOR) + +option(OD_USE_SVG "Use SVG graphics" ON) + +if(OD_USE_SVG) + message(STATUS "${CMLOC}SVG support enabled...") + if(NOT QT_ANDROID) + + add_definitions(-DODraw_USE_SVG) + endif(NOT QT_ANDROID) +endif(OD_USE_SVG) + +if(OCPN_MIN_VERSION) + message(STATUS "${CMLOC}Using O5 MUI") + if(NOT QT_ANDROID) + add_definitions(-DODraw_USE_MUI) + endif(NOT QT_ANDROID) +endif(OCPN_MIN_VERSION) + +include_directories(BEFORE ${PROJECT_SOURCE_DIR}/extsrc/mygdal) +include_directories(BEFORE ${PROJECT_SOURCE_DIR}/ocpninclude) +include_directories(BEFORE ${PROJECT_SOURCE_DIR}/ocpnsrc/glu/include) +include_directories(BEFORE ${PROJECT_SOURCE_DIR}/extinclude) +include_directories(BEFORE ${PROJECT_SOURCE_DIR}/ocpninclude/wxcurl) +include_directories(BEFORE ${PROJECT_SOURCE_DIR}/ocpninclude/wxcurl/include) +include_directories(BEFORE ${PROJECT_SOURCE_DIR}/ocpninclude/GL) +include_directories(BEFORE ${PROJECT_SOURCE_DIR}/ocpnsrc/lz4) +include_directories(BEFORE ${PROJECT_SOURCE_DIR}/ocpnsrc/bitmaps) + +if(UNIX) + include("cmake/FindTinyXML.cmake") + find_package(TinyXML QUIET) +endif(UNIX) + +if(TINYXML_FOUND) + message(STATUS "Building with system tinyxml") + include_directories(${TINYXML_INCLUDE_DIR}) + add_library(${PACKAGE_NAME} SHARED ${SRCS} ${HDRS} ${OCPNSRC} ${EXTSRC}) + target_link_libraries(${PACKAGE_NAME} ${TINYXML_LIBRARIES}) +else(TINYXML_FOUND) + message(STATUS "Building with embedded tinyxml") + include_directories(extsrc/tinyxml/) + set(SRC_LTINYXML extsrc/tinyxml/tinyxml.cpp extsrc/tinyxml/tinyxmlparser.cpp extsrc/tinyxml/tinyxmlerror.cpp) + add_library(${PACKAGE_NAME} SHARED ${SRCS} ${HDRS} ${OCPNSRC} ${EXTSRC} ${SRC_LTINYXML}) +endif(TINYXML_FOUND) + +add_definitions(-DTIXML_USE_STL) + +if(UNIX AND NOT APPLE) + if(OD_JSON_SCHEMA_VALIDATOR) + # Change OS/ABI to be UNIX - System V to make it run with OCPN + set(lib_name lib${PACKAGE_NAME}.so) + message(STATUS "${CMLOC}lib-name: ${lib_name}") + find_file(elfedit elfedit) + if(NOT (${elfedit} STREQUAL "elfedit-NOTFOUND")) + message(STATUS "${CMLOC}Will ensure OS/ABI is set to 0 to match OCPN") + add_custom_command( + TARGET ${PACKAGE_NAME} + POST_BUILD + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${PACKAGE_NAME} + COMMENT " Running post build action on ${lib_name}." + COMMAND sh -c 'elfedit --input-osabi=Linux --output-osabi=none ${lib_name} || (echo 0) ') + else(NOT (${elfedit} STREQUAL "elfedit-NOTFOUND")) + message(STATUS "${CMLOC}Cannot correct OS/ABI to match OCPN if it is generated incorrectly. Package binutils needed") + endif(NOT (${elfedit} STREQUAL "elfedit-NOTFOUND")) + endif(OD_JSON_SCHEMA_VALIDATOR) +endif(UNIX AND NOT APPLE) + +get_property( + dirs + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + PROPERTY INCLUDE_DIRECTORIES) foreach(dir ${dirs}) - message(STATUS "dir='${dir}'") + message(STATUS "${CMLOC}dir='${dir}'") endforeach() -## -## ----- Change above to match project requirements ----- ## -## +# +# ----- Change above to match project requirements ----- ## +# -## -## ----- do not change - needed to build app ----- ## -## +# +# ----- do not change - needed to build app ----- ## +# -INCLUDE("cmake/PluginInstall.cmake") -INCLUDE("cmake/PluginLocalization.cmake") -INCLUDE("cmake/PluginPackage.cmake") +include("cmake/PluginInstall.cmake") +include("cmake/PluginLocalization.cmake") +include("cmake/PluginPackage.cmake") diff --git a/Forms/PathAndPointManagerDialog.fbp b/Forms/PathAndPointManagerDialog.fbp index 6f093fd5..5476655a 100644 --- a/Forms/PathAndPointManagerDialog.fbp +++ b/Forms/PathAndPointManagerDialog.fbp @@ -120,7 +120,7 @@ Paths - 0 + 1 1 1 @@ -1282,7 +1282,7 @@ Layers - 1 + 0 1 1 diff --git a/Forms/PathAndPointManagerDialogDef.cpp b/Forms/PathAndPointManagerDialogDef.cpp index c3d4a802..0723121f 100644 --- a/Forms/PathAndPointManagerDialogDef.cpp +++ b/Forms/PathAndPointManagerDialogDef.cpp @@ -50,7 +50,7 @@ PathAndPointManagerDialogDef::PathAndPointManagerDialogDef( wxWindow* parent, wx m_panelPath->SetSizer( bSizer2 ); m_panelPath->Layout(); bSizer2->Fit( m_panelPath ); - m_notebookPathAndPointManager->AddPage( m_panelPath, _("Paths"), false ); + m_notebookPathAndPointManager->AddPage( m_panelPath, _("Paths"), true ); m_panelODPoint = new wxPanel( m_notebookPathAndPointManager, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizer3; bSizer3 = new wxBoxSizer( wxHORIZONTAL ); @@ -120,7 +120,7 @@ PathAndPointManagerDialogDef::PathAndPointManagerDialogDef( wxWindow* parent, wx m_panelLayer->SetSizer( bSizer4 ); m_panelLayer->Layout(); bSizer4->Fit( m_panelLayer ); - m_notebookPathAndPointManager->AddPage( m_panelLayer, _("Layers"), true ); + m_notebookPathAndPointManager->AddPage( m_panelLayer, _("Layers"), false ); m_bSizerDialog->Add( m_notebookPathAndPointManager, 1, wxEXPAND | wxALL, 5 ); diff --git a/ci/circleci-build-debian.sh b/ci/circleci-build-debian.sh index f424faef..cd2f30a9 100644 --- a/ci/circleci-build-debian.sh +++ b/ci/circleci-build-debian.sh @@ -15,7 +15,7 @@ rm -f ./*all.deb tag=$(git tag --contains HEAD) -if [ -n "$BUILD_GTK3" ]; then +if [ -n "$BUILD_GTK3" ] && [ "$BUILD_GTK3" = "true" ]; then sudo update-alternatives --set wx-config /usr/lib/*-linux-*/wx/config/gtk3-unicode-3.0 fi diff --git a/cmake/FindTinyXML.cmake b/cmake/FindTinyXML.cmake index 2f3bc3c6..65d30cb1 100644 --- a/cmake/FindTinyXML.cmake +++ b/cmake/FindTinyXML.cmake @@ -1,26 +1,22 @@ -# - Find TinyXML -# Find the native TinyXML includes and library +# * Find TinyXML Find the native TinyXML includes and library # -# TINYXML_FOUND - True if TinyXML found. -# TINYXML_INCLUDE_DIR - where to find tinyxml.h, etc. -# TINYXML_LIBRARIES - List of libraries when using TinyXML. +# TINYXML_FOUND - True if TinyXML found. TINYXML_INCLUDE_DIR - where to find tinyxml.h, etc. TINYXML_LIBRARIES - List of libraries when using TinyXML. # -IF( TINYXML_INCLUDE_DIR ) +if(TINYXML_INCLUDE_DIR) # Already in cache, be silent - SET( TinyXML_FIND_QUIETLY TRUE ) -ENDIF( TINYXML_INCLUDE_DIR ) + set(TinyXML_FIND_QUIETLY TRUE) +endif(TINYXML_INCLUDE_DIR) -FIND_PATH( TINYXML_INCLUDE_DIR "tinyxml.h" - PATH_SUFFIXES "tinyxml" ) +find_path(TINYXML_INCLUDE_DIR "tinyxml.h" PATH_SUFFIXES "tinyxml") -FIND_LIBRARY( TINYXML_LIBRARIES - NAMES "tinyxml" - PATH_SUFFIXES "tinyxml" ) +find_library( + TINYXML_LIBRARIES + NAMES "tinyxml" + PATH_SUFFIXES "tinyxml") -# handle the QUIETLY and REQUIRED arguments and set TINYXML_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE( "FindPackageHandleStandardArgs" ) -FIND_PACKAGE_HANDLE_STANDARD_ARGS( "TinyXML" DEFAULT_MSG TINYXML_INCLUDE_DIR TINYXML_LIBRARIES ) +# handle the QUIETLY and REQUIRED arguments and set TINYXML_FOUND to TRUE if all listed variables are TRUE +include("FindPackageHandleStandardArgs") +find_package_handle_standard_args("TinyXML" DEFAULT_MSG TINYXML_INCLUDE_DIR TINYXML_LIBRARIES) -MARK_AS_ADVANCED( TINYXML_INCLUDE_DIR TINYXML_LIBRARIES ) +mark_as_advanced(TINYXML_INCLUDE_DIR TINYXML_LIBRARIES) diff --git a/cmake/PluginConfigure.cmake b/cmake/PluginConfigure.cmake index 260f7f2f..689422ef 100644 --- a/cmake/PluginConfigure.cmake +++ b/cmake/PluginConfigure.cmake @@ -2,10 +2,13 @@ # Author: Jon Gough (Based on the work of Sean D'Epagnier and Pavel Kalian) Copyright: 2019 License: GPLv3+ # --------------------------------------------------------------------------- -message(STATUS "*** Staging to build ${PACKAGE_NAME} ***") +set(SAVE_CMLOC ${CMLOC}) +set(CMLOC "PluginConfigure: ") -message(STATUS "CIRCLECI: ${CIRCLECLI}, Env CIRCLECI: $ENV{CIRCLECI}") -message(STATUS "TRAVIS: ${TRAVIS}, Env TRAVIS: $ENV{TRAVIS}") +message(STATUS "${CMLOC}*** Staging to build ${PACKAGE_NAME} ***") + +message(STATUS "${CMLOC}CIRCLECI: ${CIRCLECLI}, Env CIRCLECI: $ENV{CIRCLECI}") +message(STATUS "${CMLOC}TRAVIS: ${TRAVIS}, Env TRAVIS: $ENV{TRAVIS}") set(GIT_REPOSITORY "") @@ -27,24 +30,19 @@ else() COMMAND git rev-parse --abbrev-ref HEAD WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE GIT_REPOSITORY_BRANCH - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - if(${GIT_REPOSITORY_BRANCH} EQUAL "") - message(STATUS "Setting default GIT repository branch - master") + OUTPUT_STRIP_TRAILING_WHITESPACE) + if("${GIT_REPOSITORY_BRANCH}" STREQUAL "") + message(STATUS "${CMLOC}Setting default GIT repository branch - master") set(GIT_REPOSITORY_BRANCH "master") endif() execute_process( COMMAND git tag --contains WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE GIT_REPOSITORY_TAG - OUTPUT_STRIP_TRAILING_WHITESPACE - ) + OUTPUT_VARIABLE GIT_REPOSITORY_TAG OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process( COMMAND git remote WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE GIT_REPOSITORY_REMOTE - OUTPUT_STRIP_TRAILING_WHITESPACE - ) + OUTPUT_VARIABLE GIT_REPOSITORY_REMOTE OUTPUT_STRIP_TRAILING_WHITESPACE) string(REGEX MATCH ".*[\n\r]" FIRST_LINE ${GIT_REPOSITORY_REMOTE}) if(NOT ${FIRST_LINE} STREQUAL "") string(REGEX REPLACE "[\n\r]" "" GIT_REPOSITORY_REMOTE ${FIRST_LINE}) @@ -52,19 +50,17 @@ else() execute_process( COMMAND git remote get-url ${GIT_REPOSITORY_REMOTE} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE GIT_REPOSITORY_URL - OUTPUT_STRIP_TRAILING_WHITESPACE - ) + OUTPUT_VARIABLE GIT_REPOSITORY_URL OUTPUT_STRIP_TRAILING_WHITESPACE) string(FIND ${GIT_REPOSITORY_URL} ${GIT_REPOSITORY_SERVER} START_URL REVERSE) string(LENGTH ${GIT_REPOSITORY_SERVER} STRING_LENGTH) math(EXPR START_URL "${START_URL}+1+${STRING_LENGTH}") string(LENGTH ${GIT_REPOSITORY_URL} STRING_LENGTH) - message(STATUS "START_URL: ${START_URL}, STRING_LENGTH: ${STRING_LENGTH}") + message(STATUS "${CMLOC}START_URL: ${START_URL}, STRING_LENGTH: ${STRING_LENGTH}") string(SUBSTRING ${GIT_REPOSITORY_URL} ${START_URL} ${STRING_LENGTH} GIT_REPOSITORY) endif() -message(STATUS "GIT_REPOSITORY: ${GIT_REPOSITORY}") -message(STATUS "Git Branch: \"${GIT_REPOSITORY_BRANCH}\"") -message(STATUS "Git Tag: \"${GIT_REPOSITORY_TAG}\"") +message(STATUS "${CMLOC}GIT_REPOSITORY: ${GIT_REPOSITORY}") +message(STATUS "${CMLOC}Git Branch: \"${GIT_REPOSITORY_BRANCH}\"") +message(STATUS "${CMLOC}Git Tag: \"${GIT_REPOSITORY_TAG}\"") if("${GIT_REPOSITORY_BRANCH}" STREQUAL "") set(GIT_BRANCH_OR_TAG "tag") set(GIT_REPOSITORY_ITEM ${GIT_REPOSITORY_TAG}) @@ -72,116 +68,138 @@ else() set(GIT_BRANCH_OR_TAG "branch") set(GIT_REPOSITORY_ITEM ${GIT_REPOSITORY_BRANCH}) endif() -message(STATUS "GIT_BRANCH_OR_TAG: ${GIT_BRANCH_OR_TAG}") -message(STATUS "GIT_REPOSITORY_ITEM: ${GIT_REPOSITORY_ITEM}") +message(STATUS "${CMLOC}GIT_BRANCH_OR_TAG: ${GIT_BRANCH_OR_TAG}") +message(STATUS "${CMLOC}GIT_REPOSITORY_ITEM: ${GIT_REPOSITORY_ITEM}") if(NOT DEFINED CLOUDSMITH_BASE_REPOSITORY AND NOT ${GIT_REPOSITORY} STREQUAL "") - string(FIND ${GIT_REPOSITORY} "/" START_NAME REVERSE) + string(FIND ${GIT_REPOSITORY} "/" START_NAME REVERSE) math(EXPR START_NAME "${START_NAME}+1") string(LENGTH ${GIT_REPOSITORY} STRING_LENGTH) - message(STATUS "START_NAME: ${START_NAME}, STRING_LENGTH: ${STRING_LENGTH}") + message(STATUS "${CMLOC}START_NAME: ${START_NAME}, STRING_LENGTH: ${STRING_LENGTH}") string(SUBSTRING ${GIT_REPOSITORY} ${START_NAME} ${STRING_LENGTH} CLOUDSMITH_BASE_REPOSITORY) endif() -message(STATUS "CLOUDSMITH_BASE_REPOSITORY: ${CLOUDSMITH_BASE_REPOSITORY}") +message(STATUS "${CMLOC}CLOUDSMITH_BASE_REPOSITORY: ${CLOUDSMITH_BASE_REPOSITORY}") # Do the version.h & wxWTranslateCatalog configuration into the build output directory, thereby allowing building from a read-only source tree. if(NOT SKIP_VERSION_CONFIG) - set(BUILD_INCLUDE_PATH ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}) - configure_file(cmake/in-files/version.h.in ${BUILD_INCLUDE_PATH}/include/version.h) - configure_file(cmake/in-files/wxWTranslateCatalog.h.in ${BUILD_INCLUDE_PATH}/include/wxWTranslateCatalog.h) - include_directories(${BUILD_INCLUDE_PATH}/include) + set(BUILD_INCLUDE_PATH ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}) + configure_file(cmake/in-files/version.h.in ${BUILD_INCLUDE_PATH}/include/version.h) + configure_file(cmake/in-files/wxWTranslateCatalog.h.in ${BUILD_INCLUDE_PATH}/include/wxWTranslateCatalog.h) + include_directories(${BUILD_INCLUDE_PATH}/include) endif(NOT SKIP_VERSION_CONFIG) # configure xml file for circleci -message(STATUS "OCPN_TARGET: $ENV{OCPN_TARGET}") +message(STATUS "${CMLOC}OCPN_TARGET: $ENV{OCPN_TARGET}") if(NOT DEFINED $ENV{OCPN_TARGET}) set($ENV{OCPN_TARGET} ${PKG_TARGET}) - message(STATUS "Setting OCPN_TARGET") -endif(NOT DEFINED $ENV{OCPN_TARGET}) -if($ENV{OCPN_TARGET} MATCHES "(.*)gtk3") - set(PKG_TARGET_FULL "${PKG_TARGET}-gtk3") - message(STATUS "Found gtk3") -else($ENV{OCPN_TARGET} MATCHES "(.*)gtk3") - set(PKG_TARGET_FULL "${PKG_TARGET}") -endif($ENV{OCPN_TARGET} MATCHES "(.*)gtk3") - -message(STATUS "PKG_TARGET_FULL: ${PKG_TARGET_FULL}") -message(STATUS "*.in files generated in ${CMAKE_CURRENT_BINARY_DIR}") + message(STATUS "${CMLOC}Setting OCPN_TARGET") +endif() + +if("$ENV{BUILD_GTK3}" STREQUAL "true") + set(PKG_TARGET_GTK "-gtk3") + message(STATUS "${CMLOC}Found gtk3") +else() + set(PKG_TARGET_GTK "") +endif() +message(STATUS "${CMLOC}PKG_TARGET_GTK: ${PKG_TARGET_GTK}") + +if(UNIX) + # Handle gtk3 build variant + string(STRIP "${PKG_TARGET}" PKG_TARGET) + string(TOLOWER "${PKG_TARGET}" PKG_TARGET) + + # Generate architecturally uniques names for linux output packages + if(ARCH MATCHES "arm64") + set(PKG_TARGET_ARCH "-ARM64") + elseif(ARCH MATCHES "armhf") + set(PKG_TARGET_ARCH "-ARMHF") + elseif(ARCH MATCHES "i386") + set(PKG_TARGET_ARCH "-i386") + else() + set(PKG_TARGET_ARCH "-x86_64") + endif() +else() + set(PKG_TARGET_ARCH "-${ARCH}") +endif() + +set(PKG_TARGET_FULL "${PKG_TARGET}${PKG_TARGET_GTK}${PKG_TARGET_ARCH}") +message(STATUS "${CMLOC}PKG_TARGET_FULL: ${PKG_TARGET}${PKG_TARGET_GTK}${PKG_TARGET_ARCH}") +message(STATUS "${CMLOC}*.in files generated in ${CMAKE_CURRENT_BINARY_DIR}") configure_file(${CMAKE_SOURCE_DIR}/cmake/in-files/plugin.xml.in ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGING_NAME}.xml) configure_file(${CMAKE_SOURCE_DIR}/cmake/in-files/pkg_version.sh.in ${CMAKE_CURRENT_BINARY_DIR}/pkg_version.sh) configure_file(${CMAKE_SOURCE_DIR}/cmake/in-files/cloudsmith-upload.sh.in ${CMAKE_CURRENT_BINARY_DIR}/cloudsmith-upload.sh @ONLY) -message(STATUS "Checking OCPN_FLATPAK_CONFIG: ${OCPN_FLATPAK_CONFIG}") + +message(STATUS "${CMLOC}Checking OCPN_FLATPAK_CONFIG: ${OCPN_FLATPAK_CONFIG}") if(OCPN_FLATPAK_CONFIG) - configure_file(${CMAKE_SOURCE_DIR}/cmake/in-files/org.opencpn.OpenCPN.Plugin.yaml.in ${CMAKE_CURRENT_BINARY_DIR}/flatpak/org.opencpn.OpenCPN.Plugin.${PACKAGE}.yaml) + configure_file(${CMAKE_SOURCE_DIR}/cmake/in-files/org.opencpn.OpenCPN.Plugin.yaml.in ${CMAKE_CURRENT_BINARY_DIR}/flatpak/org.opencpn.OpenCPN.Plugin.${PACKAGE}.yaml) - message(STATUS "Done OCPN_FLATPAK CONFIG") - message(STATUS "Directory used: ${CMAKE_CURRENT_BINARY_DIR}/flatpak") - message(STATUS "Git Branch: ${GIT_REPOSITORY_BRANCH}") - return() + message(STATUS "${CMLOC}Done OCPN_FLATPAK CONFIG") + message(STATUS "${CMLOC}Directory used: ${CMAKE_CURRENT_BINARY_DIR}/flatpak") + message(STATUS "${CMLOC}Git Branch: ${GIT_REPOSITORY_BRANCH}") + set(CMLOC ${SAVE_CMLOC}) + return() endif(OCPN_FLATPAK_CONFIG) + set(CMAKE_VERBOSE_MAKEFILE ON) include_directories(${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/src) # SET(PROFILING 1) if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") - add_definitions("-DDEBUG_BUILD") - set(CMAKE_INSTALL_DO_STRIP FALSE) - set(CPACK_DEBIAN_DEBUGINFO_PACKAGE YES) - message(STATUS "DEBUG available") + add_definitions("-DDEBUG_BUILD") + set(CMAKE_INSTALL_DO_STRIP FALSE) + set(CPACK_DEBIAN_DEBUGINFO_PACKAGE YES) + message(STATUS "${CMLOC}DEBUG available") endif(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") if(NOT WIN32 AND NOT APPLE) - add_definitions("-Wall -Wno-unused -fexceptions -rdynamic -fvisibility=hidden") - add_definitions(" -fno-strict-aliasing") - message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") - if(CMAKE_BUILD_TYPE STREQUAL "Debug") - add_definitions(" -O0 -g") - message(STATUS "Optimisation: -O0 -g") - elseif(CMAKE_BUILD_TYPE STREQUAL "Release") - add_definitions(" -O2 ") - message(STATUS "Optimisation: -O2") - elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") - add_definitions(" -O2 -g") - message(STATUS "Optimisation: -O2 -g") - else(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") - add_definitions(" -O2") - message(STATUS "Optimisation: -O2") - endif(CMAKE_BUILD_TYPE STREQUAL "Debug") - - add_definitions(" -DPREFIX=\\\"${CMAKE_INSTALL_PREFIX}\\\"") - # profiling with gprof - # ADD_DEFINITIONS( -pg ) SET(CMAKE_EXE_LINKER_FLAGS -pg) - # profiling with gcov - # ADD_DEFINITIONS( "-fprofile-arcs -ftest-coverage" ) SET(EXTRA_LIBS ${EXTRA_LIBS} "gcov") + add_definitions("-Wall -Wno-unused -fexceptions -rdynamic -fvisibility=hidden") + add_definitions(" -fno-strict-aliasing") + message(STATUS "${CMLOC}Build type: ${CMAKE_BUILD_TYPE}") + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + add_definitions(" -O0 -g") + message(STATUS "${CMLOC}Optimisation: -O0 -g") + elseif(CMAKE_BUILD_TYPE STREQUAL "Release") + add_definitions(" -O2 ") + message(STATUS "${CMLOC}Optimisation: -O2") + elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") + add_definitions(" -O2 -g") + message(STATUS "${CMLOC}Optimisation: -O2 -g") + else(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") + add_definitions(" -O2") + message(STATUS "${CMLOC}Optimisation: -O2") + endif(CMAKE_BUILD_TYPE STREQUAL "Debug") + + add_definitions(" -DPREFIX=\\\"${CMAKE_INSTALL_PREFIX}\\\"") + # profiling with gprof ADD_DEFINITIONS( -pg ) SET(CMAKE_EXE_LINKER_FLAGS -pg) profiling with gcov ADD_DEFINITIONS( "-fprofile-arcs -ftest-coverage" ) SET(EXTRA_LIBS ${EXTRA_LIBS} "gcov") endif(NOT WIN32 AND NOT APPLE) if(MINGW) - add_definitions("-Wall -Wno-unused -Wno-cpp -fexceptions") - add_definitions(" -g -fno-strict-aliasing") + add_definitions("-Wall -Wno-unused -Wno-cpp -fexceptions") + add_definitions(" -g -fno-strict-aliasing") endif(MINGW) if(APPLE) - add_definitions("-Wall -Wno-unused -fexceptions -Wno-overloaded-virtual") - add_definitions(" -g -fno-strict-aliasing") - add_definitions(" -Wno-deprecated -Wno-deprecated-declarations -Wno-unknown-pragmas") - add_definitions(" -D_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_") + add_definitions("-Wall -Wno-unused -fexceptions -Wno-overloaded-virtual") + add_definitions(" -g -fno-strict-aliasing") + add_definitions(" -Wno-deprecated -Wno-deprecated-declarations -Wno-unknown-pragmas") + add_definitions(" -D_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_") endif(APPLE) # Add some definitions to satisfy MS if(MSVC) - add_definitions(-D__MSVC__) - add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE) - add_definitions(-D HAVE_SNPRINTF) - message(STATUS "Set SNPRINTF") + add_definitions(-D__MSVC__) + add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE) + add_definitions(-D HAVE_SNPRINTF) + message(STATUS "${CMLOC}Set SNPRINTF") else(MSVC) - if(NOT APPLE) - set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-Bsymbolic") - else(NOT APPLE) - set(CMAKE_SHARED_LINKER_FLAGS "-Wl -undefined dynamic_lookup") - endif(NOT APPLE) + if(NOT APPLE) + set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-Bsymbolic") + else(NOT APPLE) + set(CMAKE_SHARED_LINKER_FLAGS "-Wl -undefined dynamic_lookup") + endif(NOT APPLE) endif(MSVC) set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) @@ -189,22 +207,22 @@ set(BUILD_SHARED_LIBS TRUE) # Allow multiprocess compile if(MSVC) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") endif(MSVC) if(WIN32) - if(MSVC) - set(CMAKE_C_FLAGS_DEBUG "/MP /MDd /Ob0 /Od /D_DEBUG /Zi /RTC1") - set(CMAKE_C_FLAGS_MINSIZEREL "/MP /MD /O1 /Ob1 /D NDEBUG") - set(CMAKE_C_FLAGS_RELEASE "/MP /MD /O2 /Ob2 /D NDEBUG /Zi") - set(CMAKE_C_FLAGS_RELWITHDEBINFO "/MP /MD /O2 /Ob1 /D NDEBUG /Zi") - set(CMAKE_CXX_FLAGS_DEBUG "/MP /MDd /Ob0 /Od /D_DEBUG /Zi /RTC1 /EHa") - set(CMAKE_CXX_FLAGS_MINSIZEREL "/MP /MD /O1 /Ob1 /D NDEBUG /EHa") - set(CMAKE_CXX_FLAGS_RELEASE "/MP /MD /O2 /Ob2 /D NDEBUG /Zi /EHa") - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MP /MD /O2 /Ob1 /D NDEBUG /Zi /EHa") - set(CMAKE_EXE_LINKER_FLAGS /DEBUG) - endif(MSVC) + if(MSVC) + set(CMAKE_C_FLAGS_DEBUG "/MP /MDd /Ob0 /Od /D_DEBUG /Zi /RTC1") + set(CMAKE_C_FLAGS_MINSIZEREL "/MP /MD /O1 /Ob1 /D NDEBUG") + set(CMAKE_C_FLAGS_RELEASE "/MP /MD /O2 /Ob2 /D NDEBUG /Zi") + set(CMAKE_C_FLAGS_RELWITHDEBINFO "/MP /MD /O2 /Ob1 /D NDEBUG /Zi") + set(CMAKE_CXX_FLAGS_DEBUG "/MP /MDd /Ob0 /Od /D_DEBUG /Zi /RTC1 /EHa") + set(CMAKE_CXX_FLAGS_MINSIZEREL "/MP /MD /O1 /Ob1 /D NDEBUG /EHa") + set(CMAKE_CXX_FLAGS_RELEASE "/MP /MD /O2 /Ob2 /D NDEBUG /Zi /EHa") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MP /MD /O2 /Ob1 /D NDEBUG /Zi /EHa") + set(CMAKE_EXE_LINKER_FLAGS /DEBUG) + endif(MSVC) endif(WIN32) set(wxWidgets_USE_LIBS @@ -219,185 +237,189 @@ set(wxWidgets_USE_LIBS option(USE_GL "Enable OpenGL support" ON) # Search for opengles, short of running a program to test the speed of acceleration, I simply use gles on "native linux" arm systems -if(ARCH MATCHES "arm*" AND (NOT QT_ANDROID) AND USE_GL MATCHES "ON") - find_path(OPENGLESv1_INCLUDE_DIR GLES/gl.h) - if(OPENGLESv1_INCLUDE_DIR) - message(STATUS "Found OpenGLESv1") +if(ARCH MATCHES "arm*" + AND (NOT QT_ANDROID) + AND USE_GL MATCHES "ON") + find_path(OPENGLESv1_INCLUDE_DIR GLES/gl.h) + if(OPENGLESv1_INCLUDE_DIR) + message(STATUS "${CMLOC}Found OpenGLESv1") + add_definitions(-DocpnUSE_GLES) + add_definitions(-DocpnUSE_GL) + + set(OPENGLES_FOUND "YES") + set(OPENGL_FOUND "YES") + + set(wxWidgets_USE_LIBS ${wxWidgets_USE_LIBS} gl) + add_subdirectory(src/glshim) + + set(OPENGL_LIBRARIES "GL_static" "EGL" "X11" "drm") + endif() +endif() + +# Building for QT_ANDROID involves a cross-building environment, So the include directories, flags, etc must be stated explicitly without trying to locate them on the host build system. +if(QT_ANDROID AND USE_GL MATCHES "ON") + message(STATUS "${CMLOC}Using GLESv1 for Android") add_definitions(-DocpnUSE_GLES) add_definitions(-DocpnUSE_GL) + add_definitions(-DARMHF) set(OPENGLES_FOUND "YES") set(OPENGL_FOUND "YES") set(wxWidgets_USE_LIBS ${wxWidgets_USE_LIBS} gl) add_subdirectory(src/glshim) - - set(OPENGL_LIBRARIES "GL_static" "EGL" "X11" "drm") - endif() -endif() - -# Building for QT_ANDROID involves a cross-building environment, So the include directories, flags, etc must be stated explicitly without trying to locate them on the host build system. -if(QT_ANDROID AND USE_GL MATCHES "ON") - message(STATUS "Using GLESv1 for Android") - add_definitions(-DocpnUSE_GLES) - add_definitions(-DocpnUSE_GL) - add_definitions(-DARMHF) - - set(OPENGLES_FOUND "YES") - set(OPENGL_FOUND "YES") - - set(wxWidgets_USE_LIBS ${wxWidgets_USE_LIBS} gl) - add_subdirectory(src/glshim) endif(QT_ANDROID AND USE_GL MATCHES "ON") if((NOT OPENGLES_FOUND) AND (NOT QT_ANDROID)) - if(USE_GL MATCHES "ON") - message(STATUS "Finding package OpenGL") - find_package(OpenGL) - else(USE_GL MATCHES "ON") - message(STATUS "OpenGL disabled by option...") - endif(USE_GL MATCHES "ON") - - if(OPENGL_FOUND) - - set(wxWidgets_USE_LIBS ${wxWidgets_USE_LIBS} gl) - include_directories(${OPENGL_INCLUDE_DIR}) - - message(STATUS "Found OpenGL...") - message(STATUS " Lib: " ${OPENGL_LIBRARIES}) - message(STATUS " Include: " ${OPENGL_INCLUDE_DIR}) - add_definitions(-DocpnUSE_GL) - - # We need to remove GLU from the OPENGL_LIBRARIES list - foreach(_currentLibFile ${OPENGL_LIBRARIES}) - set(UCNAME ${_currentLibFile}) - string(TOUPPER ${UCNAME} UCNAME) - if(NOT ${UCNAME} MATCHES "(.*)GLU(.*)") - set(REVISED_OPENGL_LIBRARIES ${_currentLibFile} ${REVISED_OPENGL_LIBRARIES}) - endif() - endforeach(_currentLibFile) - - set(OPENGL_LIBRARIES ${REVISED_OPENGL_LIBRARIES}) - message(STATUS " Revised GL Lib: " ${OPENGL_LIBRARIES}) - - else(OPENGL_FOUND) - message(STATUS "OpenGL not found...") - endif(OPENGL_FOUND) + if(USE_GL MATCHES "ON") + message(STATUS "${CMLOC}Finding package OpenGL") + find_package(OpenGL) + else(USE_GL MATCHES "ON") + message(STATUS "${CMLOC}OpenGL disabled by option...") + endif(USE_GL MATCHES "ON") + + if(OPENGL_FOUND) + + set(wxWidgets_USE_LIBS ${wxWidgets_USE_LIBS} gl) + include_directories(${OPENGL_INCLUDE_DIR}) + + message(STATUS "${CMLOC}Found OpenGL...") + message(STATUS "${CMLOC} Lib: " ${OPENGL_LIBRARIES}) + message(STATUS "${CMLOC} Include: " ${OPENGL_INCLUDE_DIR}) + add_definitions(-DocpnUSE_GL) + + # We need to remove GLU from the OPENGL_LIBRARIES list + foreach(_currentLibFile ${OPENGL_LIBRARIES}) + set(UCNAME ${_currentLibFile}) + string(TOUPPER ${UCNAME} UCNAME) + if(NOT ${UCNAME} MATCHES "(.*)GLU(.*)") + set(REVISED_OPENGL_LIBRARIES ${_currentLibFile} ${REVISED_OPENGL_LIBRARIES}) + endif() + endforeach(_currentLibFile) + + set(OPENGL_LIBRARIES ${REVISED_OPENGL_LIBRARIES}) + message(STATUS "${CMLOC} Revised GL Lib: " ${OPENGL_LIBRARIES}) + + else(OPENGL_FOUND) + message(STATUS "${CMLOC}OpenGL not found...") + endif(OPENGL_FOUND) endif() if(USE_LOCAL_GLU) - message(STATUS " Adding local GLU") - add_subdirectory(ocpnsrc/glu) - set(OPENGL_LIBRARIES "GLU_static" ${OPENGL_LIBRARIES}) - message(STATUS " Revised GL Lib (with local): " ${OPENGL_LIBRARIES}) + message(STATUS "${CMLOC} Adding local GLU") + add_subdirectory(ocpnsrc/glu) + set(OPENGL_LIBRARIES "GLU_static" ${OPENGL_LIBRARIES}) + message(STATUS "${CMLOC} Revised GL Lib (with local): " ${OPENGL_LIBRARIES}) endif(USE_LOCAL_GLU) if(NOT QT_ANDROID) - # Find wxWidgets here, and the setting get inherited by all plugins. These options can be used to set the linux widgets build type - set(wxWidgets_USE_DEBUG OFF) - set(wxWidgets_USE_UNICODE ON) - set(wxWidgets_USE_UNIVERSAL OFF) - set(wxWidgets_USE_STATIC OFF) - - set(WXWIDGETS_FORCE_VERSION CACHE STRING "Force usage of a specific wxWidgets version.") - if(WXWIDGETS_FORCE_VERSION) - set(wxWidgets_CONFIG_OPTIONS --version=${WXWIDGETS_FORCE_VERSION}) - endif() - - message(STATUS "wxWidgets components: ${wxWidgets_USE_LIBS}") - find_package(wxWidgets REQUIRED COMPONENTS ${wxWidgets_USE_LIBS}) - - if(MSVC) - # Exclude wxexpat.lib, since we use our own version. Other things are excluded as well, but we don't need them - set(wxWidgets_EXCLUDE_COMMON_LIBRARIES TRUE) - endif(MSVC) - - if(WIN32 - OR APPLE - OR QT_ANDROID) - if(MSYS) - # this is to convert msys to windows paths, and handle the missing /usr - string(REGEX REPLACE "/usr/local" ";C:/MinGW/msys/1.0/local" wxWidgets_INCLUDE_DIRS ${wxWidgets_INCLUDE_DIRS}) - endif(MSYS) - endif( - WIN32 - OR APPLE - OR QT_ANDROID) - - include(${wxWidgets_USE_FILE}) - - message(STATUS "Found wxWidgets...") - message(STATUS " wxWidgets Include: ${wxWidgets_INCLUDE_DIRS}") - message(STATUS " wxWidgets Libraries: ${wxWidgets_LIBRARIES}") - - # We need to remove GLU from the wxWidgets_LIBRARIES list It only appears to get on the list for MSW... - foreach(_currentLibFile ${wxWidgets_LIBRARIES}) - set(UCNAME ${_currentLibFile}) - string(TOUPPER ${UCNAME} UCNAME) - if(NOT ${UCNAME} MATCHES "(.*)GLU(.*)") - set(REVISED_wxWidgets_LIBRARIES ${REVISED_wxWidgets_LIBRARIES} ${_currentLibFile}) + # Find wxWidgets here, and the setting get inherited by all plugins. These options can be used to set the linux widgets build type + set(wxWidgets_USE_DEBUG OFF) + set(wxWidgets_USE_UNICODE ON) + set(wxWidgets_USE_UNIVERSAL OFF) + set(wxWidgets_USE_STATIC OFF) + + set(WXWIDGETS_FORCE_VERSION CACHE STRING "Force usage of a specific wxWidgets version.") + if(WXWIDGETS_FORCE_VERSION) + set(wxWidgets_CONFIG_OPTIONS --version=${WXWIDGETS_FORCE_VERSION}) endif() - endforeach(_currentLibFile) - set(wxWidgets_LIBRARIES ${REVISED_wxWidgets_LIBRARIES}) - message(STATUS " Revised wxWidgets Libraries: ${wxWidgets_LIBRARIES}") + message(STATUS "${CMLOC}wxWidgets components: ${wxWidgets_USE_LIBS}") + find_package(wxWidgets REQUIRED COMPONENTS ${wxWidgets_USE_LIBS}) + + if(MSVC) + # Exclude wxexpat.lib, since we use our own version. Other things are excluded as well, but we don't need them + set(wxWidgets_EXCLUDE_COMMON_LIBRARIES TRUE) + endif(MSVC) + + if(WIN32 + OR APPLE + OR QT_ANDROID) + if(MSYS) + # this is to convert msys to windows paths, and handle the missing /usr + string(REGEX REPLACE "/usr/local" ";C:/MinGW/msys/1.0/local" wxWidgets_INCLUDE_DIRS ${wxWidgets_INCLUDE_DIRS}) + endif(MSYS) + endif( + WIN32 + OR APPLE + OR QT_ANDROID) + + include(${wxWidgets_USE_FILE}) + + message(STATUS "${CMLOC}Found wxWidgets...") + message(STATUS "${CMLOC} wxWidgets Include: ${wxWidgets_INCLUDE_DIRS}") + message(STATUS "${CMLOC} wxWidgets Libraries: ${wxWidgets_LIBRARIES}") + + # We need to remove GLU from the wxWidgets_LIBRARIES list It only appears to get on the list for MSW... + foreach(_currentLibFile ${wxWidgets_LIBRARIES}) + set(UCNAME ${_currentLibFile}) + string(TOUPPER ${UCNAME} UCNAME) + if(NOT ${UCNAME} MATCHES "(.*)GLU(.*)") + set(REVISED_wxWidgets_LIBRARIES ${REVISED_wxWidgets_LIBRARIES} ${_currentLibFile}) + endif() + endforeach(_currentLibFile) + set(wxWidgets_LIBRARIES ${REVISED_wxWidgets_LIBRARIES}) + + message(STATUS "${CMLOC} Revised wxWidgets Libraries: ${wxWidgets_LIBRARIES}") endif(NOT QT_ANDROID) if(NOT WIN32 AND NOT APPLE AND NOT QT_ANDROID) - option(OCPN_FORCE_GTK3 "Force the build to use GTK3" OFF) - - if(NOT OCPN_FORCE_GTK3) - find_package(GTK2) - endif(NOT OCPN_FORCE_GTK3) - - if(GTK2_FOUND) - set(wxWidgets_CONFIG_OPTIONS ${wxWidgets_CONFIG_OPTIONS} --toolkit=gtk2) - include_directories(${GTK2_INCLUDE_DIRS}) - set(GTK_LIBRARIES ${GTK2_LIBRARIES}) - message(STATUS "Building against GTK2...") - else(GTK2_FOUND) - find_package(GTK3) - include_directories(${GTK3_INCLUDE_DIRS}) - set(GTK_LIBRARIES ${GTK3_LIBRARIES}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__WXGTK3__") - set(wxWidgets_CONFIG_OPTIONS ${wxWidgets_CONFIG_OPTIONS} --toolkit=gtk3) - message(STATUS "Building against GTK3...") - endif(GTK2_FOUND) - set(EXTRA_LIBS ${EXTRA_LIBS} ${GTK_LIBRARIES}) + option(OCPN_FORCE_GTK3 "Force the build to use GTK3" OFF) + + if(NOT OCPN_FORCE_GTK3) + find_package(GTK2) + endif(NOT OCPN_FORCE_GTK3) + + if(GTK2_FOUND) + set(wxWidgets_CONFIG_OPTIONS ${wxWidgets_CONFIG_OPTIONS} --toolkit=gtk2) + include_directories(${GTK2_INCLUDE_DIRS}) + set(GTK_LIBRARIES ${GTK2_LIBRARIES}) + message(STATUS "${CMLOC}Building against GTK2...") + else(GTK2_FOUND) + find_package(GTK3) + include_directories(${GTK3_INCLUDE_DIRS}) + set(GTK_LIBRARIES ${GTK3_LIBRARIES}) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__WXGTK3__") + set(wxWidgets_CONFIG_OPTIONS ${wxWidgets_CONFIG_OPTIONS} --toolkit=gtk3) + message(STATUS "${CMLOC}Building against GTK3...") + endif(GTK2_FOUND) + set(EXTRA_LIBS ${EXTRA_LIBS} ${GTK_LIBRARIES}) endif( - NOT WIN32 - AND NOT APPLE - AND NOT QT_ANDROID) + NOT WIN32 + AND NOT APPLE + AND NOT QT_ANDROID) # On Android, PlugIns need a specific linkage set.... if(QT_ANDROID) - # These libraries are needed to create PlugIns on Android. - - set(OCPN_Core_LIBRARIES - # Presently, Android Plugins are built in the core tree, so the variables {wxQT_BASE}, etc. - # flow to this module from above. If we want to build Android plugins out-of-core, this will need improvement. - # TODO This is pretty ugly, but there seems no way to avoid specifying a full path in a cross build.... - /home/dsr/Projects/opencpn_sf/opencpn/build-opencpn-Android_for_armeabi_v7a_GCC_4_8_Qt_5_5_0-Debug/libopencpn.so - ${wxQt_Base}/${wxQt_Build}/lib/libwx_baseu-3.1-arm-linux-androideabi.a - ${wxQt_Base}/${wxQt_Build}/lib/libwx_qtu_core-3.1-arm-linux-androideabi.a - ${wxQt_Base}/${wxQt_Build}/lib/libwx_qtu_html-3.1-arm-linux-androideabi.a - ${wxQt_Base}/${wxQt_Build}/lib/libwx_baseu_xml-3.1-arm-linux-androideabi.a - ${wxQt_Base}/${wxQt_Build}/lib/libwx_qtu_qa-3.1-arm-linux-androideabi.a - ${wxQt_Base}/${wxQt_Build}/lib/libwx_qtu_adv-3.1-arm-linux-androideabi.a - ${wxQt_Base}/${wxQt_Build}/lib/libwx_qtu_aui-3.1-arm-linux-androideabi.a - ${wxQt_Base}/${wxQt_Build}/lib/libwx_baseu_net-3.1-arm-linux-androideabi.a - ${wxQt_Base}/${wxQt_Build}/lib/libwx_qtu_gl-3.1-arm-linux-androideabi.a - ${Qt_Base}/android_armv7/lib/libQt5Core.so - ${Qt_Base}/android_armv7/lib/libQt5OpenGL.so - ${Qt_Base}/android_armv7/lib/libQt5Widgets.so - ${Qt_Base}/android_armv7/lib/libQt5Gui.so - ${Qt_Base}/android_armv7/lib/libQt5AndroidExtras.so - # ${NDK_Base}/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/libgnustl_shared.so - ) + # These libraries are needed to create PlugIns on Android. + + set(OCPN_Core_LIBRARIES + # Presently, Android Plugins are built in the core tree, so the variables {wxQT_BASE}, etc. + # flow to this module from above. If we want to build Android plugins out-of-core, this will need improvement. + # TODO This is pretty ugly, but there seems no way to avoid specifying a full path in a cross build.... + /home/dsr/Projects/opencpn_sf/opencpn/build-opencpn-Android_for_armeabi_v7a_GCC_4_8_Qt_5_5_0-Debug/libopencpn.so + ${wxQt_Base}/${wxQt_Build}/lib/libwx_baseu-3.1-arm-linux-androideabi.a + ${wxQt_Base}/${wxQt_Build}/lib/libwx_qtu_core-3.1-arm-linux-androideabi.a + ${wxQt_Base}/${wxQt_Build}/lib/libwx_qtu_html-3.1-arm-linux-androideabi.a + ${wxQt_Base}/${wxQt_Build}/lib/libwx_baseu_xml-3.1-arm-linux-androideabi.a + ${wxQt_Base}/${wxQt_Build}/lib/libwx_qtu_qa-3.1-arm-linux-androideabi.a + ${wxQt_Base}/${wxQt_Build}/lib/libwx_qtu_adv-3.1-arm-linux-androideabi.a + ${wxQt_Base}/${wxQt_Build}/lib/libwx_qtu_aui-3.1-arm-linux-androideabi.a + ${wxQt_Base}/${wxQt_Build}/lib/libwx_baseu_net-3.1-arm-linux-androideabi.a + ${wxQt_Base}/${wxQt_Build}/lib/libwx_qtu_gl-3.1-arm-linux-androideabi.a + ${Qt_Base}/android_armv7/lib/libQt5Core.so + ${Qt_Base}/android_armv7/lib/libQt5OpenGL.so + ${Qt_Base}/android_armv7/lib/libQt5Widgets.so + ${Qt_Base}/android_armv7/lib/libQt5Gui.so + ${Qt_Base}/android_armv7/lib/libQt5AndroidExtras.so + # ${NDK_Base}/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/libgnustl_shared.so + ) endif(QT_ANDROID) find_package(Gettext REQUIRED) + +set(CMLOC ${SAVE_CMLOC}) diff --git a/cmake/PluginInstall.cmake b/cmake/PluginInstall.cmake index 185e3c95..3b7923f4 100644 --- a/cmake/PluginInstall.cmake +++ b/cmake/PluginInstall.cmake @@ -2,147 +2,158 @@ # Author: Pavel Kalian (Based on the work of Sean D'Epagnier) Copyright: 2014 License: GPLv3+ # --------------------------------------------------------------------------- +set(CMLOC "PluginInstall: ") + if(OCPN_FLATPAK_CONFIG) - return() + return() endif(OCPN_FLATPAK_CONFIG) if(NOT APPLE) - target_link_libraries(${PACKAGE_NAME} ${wxWidgets_LIBRARIES} ${EXTRA_LIBS}) + target_link_libraries(${PACKAGE_NAME} ${wxWidgets_LIBRARIES} ${EXTRA_LIBS}) endif(NOT APPLE) if(WIN32) - if(MSVC) - # TARGET_LINK_LIBRARIES(${PACKAGE_NAME} gdiplus.lib glu32.lib) - target_link_libraries(${PACKAGE_NAME} ${OPENGL_LIBRARIES}) - - set(OPENCPN_IMPORT_LIB "${CMAKE_SOURCE_DIR}/api-16/opencpn.lib") - endif(MSVC) - - if(MINGW) - # assuming wxwidgets is compiled with unicode, this is needed for mingw headers - add_definitions(" -DUNICODE") - TARGET_LINK_LIBRARIES(${PACKAGE_NAME} ${OPENGL_LIBRARIES}) -# SET(OPENCPN_IMPORT_LIB "${PARENT}.dll") - SET( CMAKE_SHARED_LINKER_FLAGS "-L../buildwin" ) -# target_link_libraries(${PACKAGE_NAME} ${OPENGL_LIBRARIES}) - set(OPENCPN_IMPORT_LIB "${CMAKE_SOURCE_DIR}/api-16/libopencpn.dll.a") - endif(MINGW) - - target_link_libraries(${PACKAGE_NAME} ${OPENCPN_IMPORT_LIB}) + if(MSVC) + # TARGET_LINK_LIBRARIES(${PACKAGE_NAME} gdiplus.lib glu32.lib) + target_link_libraries(${PACKAGE_NAME} ${OPENGL_LIBRARIES}) + + set(OPENCPN_IMPORT_LIB "${CMAKE_SOURCE_DIR}/api-16/opencpn.lib") + endif(MSVC) + + if(MINGW) + # assuming wxwidgets is compiled with unicode, this is needed for mingw headers + add_definitions(" -DUNICODE") + target_link_libraries(${PACKAGE_NAME} ${OPENGL_LIBRARIES}) + # SET(OPENCPN_IMPORT_LIB "${PARENT}.dll") + set(CMAKE_SHARED_LINKER_FLAGS "-L../buildwin") + # target_link_libraries(${PACKAGE_NAME} ${OPENGL_LIBRARIES}) + set(OPENCPN_IMPORT_LIB "${CMAKE_SOURCE_DIR}/api-16/libopencpn.dll.a") + endif(MINGW) + + target_link_libraries(${PACKAGE_NAME} ${OPENCPN_IMPORT_LIB}) endif(WIN32) if(UNIX) - if(PROFILING) - find_library( - GCOV_LIBRARY - NAMES gcov - PATHS /usr/lib/gcc/i686-pc-linux-gnu/4.7) - - set(EXTRA_LIBS ${EXTRA_LIBS} ${GCOV_LIBRARY}) - endif(PROFILING) + if(PROFILING) + find_library( + GCOV_LIBRARY + NAMES gcov + PATHS /usr/lib/gcc/i686-pc-linux-gnu/4.7) + + set(EXTRA_LIBS ${EXTRA_LIBS} ${GCOV_LIBRARY}) + endif(PROFILING) endif(UNIX) if(APPLE) - install(TARGETS ${PACKAGE_NAME} RUNTIME LIBRARY DESTINATION OpenCPN.app/Contents/PlugIns) - if(EXISTS ${PROJECT_SOURCE_DIR}/data) - install(DIRECTORY data DESTINATION OpenCPN.app/Contents/SharedSupport/plugins/${PACKAGE_NAME}) - endif() + install( + TARGETS ${PACKAGE_NAME} + RUNTIME + LIBRARY DESTINATION OpenCPN.app/Contents/PlugIns) + if(EXISTS ${PROJECT_SOURCE_DIR}/data) + install(DIRECTORY data DESTINATION OpenCPN.app/Contents/SharedSupport/plugins/${PACKAGE_NAME}) + endif() - find_package(ZLIB REQUIRED) - target_link_libraries(${PACKAGE_NAME} ${ZLIB_LIBRARIES}) + find_package(ZLIB REQUIRED) + target_link_libraries(${PACKAGE_NAME} ${ZLIB_LIBRARIES}) endif(APPLE) if(UNIX AND NOT APPLE) - find_package(BZip2 REQUIRED) - include_directories(${BZIP2_INCLUDE_DIR}) - find_package(ZLIB REQUIRED) - include_directories(${ZLIB_INCLUDE_DIR}) - target_link_libraries(${PACKAGE_NAME} ${BZIP2_LIBRARIES} ${ZLIB_LIBRARY}) + find_package(BZip2 REQUIRED) + include_directories(${BZIP2_INCLUDE_DIR}) + find_package(ZLIB REQUIRED) + include_directories(${ZLIB_INCLUDE_DIR}) + target_link_libraries(${PACKAGE_NAME} ${BZIP2_LIBRARIES} ${ZLIB_LIBRARY}) endif(UNIX AND NOT APPLE) set(PARENT opencpn) # Based on code from nohal if(NOT CMAKE_INSTALL_PREFIX) - set(CMAKE_INSTALL_PREFIX ${TENTATIVE_PREFIX}) + set(CMAKE_INSTALL_PREFIX ${TENTATIVE_PREFIX}) endif(NOT CMAKE_INSTALL_PREFIX) -message(STATUS "*** Will install to ${CMAKE_INSTALL_PREFIX} ***") +message(STATUS "${CMLOC}*** Will install to ${CMAKE_INSTALL_PREFIX} ***") set(PREFIX_DATA share) set(PREFIX_PKGDATA ${PREFIX_DATA}/${PACKAGE_NAME}) -#set(PREFIX_LIB "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}") -SET(PREFIX_LIB lib) +# set(PREFIX_LIB "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}") +set(PREFIX_LIB lib) if(WIN32) - message(STATUS "Install Prefix: ${CMAKE_INSTALL_PREFIX}") - set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/../OpenCPN) - if(CMAKE_CROSSCOMPILING) - install(TARGETS ${PACKAGE_NAME} RUNTIME DESTINATION "plugins") - set(INSTALL_DIRECTORY "plugins/${PACKAGE_NAME}") - else(CMAKE_CROSSCOMPILING) - install(TARGETS ${PACKAGE_NAME} RUNTIME DESTINATION "plugins") - set(INSTALL_DIRECTORY "plugins\\\\${PACKAGE_NAME}") - endif(CMAKE_CROSSCOMPILING) - - if(EXISTS ${PROJECT_SOURCE_DIR}/data) - install(DIRECTORY data DESTINATION "${INSTALL_DIRECTORY}") - message(STATUS "Install Data: ${INSTALL_DIRECTORY}") - endif(EXISTS ${PROJECT_SOURCE_DIR}/data) - - # fix for missing dll's FILE(GLOB gtkdll_files "${CMAKE_CURRENT_SOURCE_DIR}/buildwin/gtk/*.dll") INSTALL(FILES ${gtkdll_files} DESTINATION ".") FILE(GLOB expatdll_files - # "${CMAKE_CURRENT_SOURCE_DIR}/buildwin/expat-2.1.0/*.dll") INSTALL(FILES ${expatdll_files} DESTINATION ".") + message(STATUS "${CMLOC}Install Prefix: ${CMAKE_INSTALL_PREFIX}") + set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/../OpenCPN) + if(CMAKE_CROSSCOMPILING) + install(TARGETS ${PACKAGE_NAME} RUNTIME DESTINATION "plugins") + set(INSTALL_DIRECTORY "plugins/${PACKAGE_NAME}") + else(CMAKE_CROSSCOMPILING) + install(TARGETS ${PACKAGE_NAME} RUNTIME DESTINATION "plugins") + set(INSTALL_DIRECTORY "plugins\\\\${PACKAGE_NAME}") + endif(CMAKE_CROSSCOMPILING) + + if(EXISTS ${PROJECT_SOURCE_DIR}/data) + install(DIRECTORY data DESTINATION "${INSTALL_DIRECTORY}") + message(STATUS "${CMLOC}Install Data: ${INSTALL_DIRECTORY}") + endif(EXISTS ${PROJECT_SOURCE_DIR}/data) + + # fix for missing dll's FILE(GLOB gtkdll_files "${CMAKE_CURRENT_SOURCE_DIR}/buildwin/gtk/*.dll") INSTALL(FILES ${gtkdll_files} DESTINATION ".") FILE(GLOB expatdll_files + # "${CMAKE_CURRENT_SOURCE_DIR}/buildwin/expat-2.1.0/*.dll") INSTALL(FILES ${expatdll_files} DESTINATION ".") endif(WIN32) if(UNIX AND NOT APPLE) - set(PREFIX_PARENTDATA ${PREFIX_DATA}/${PARENT}) - set(PREFIX_PARENTLIB ${PREFIX_LIB}/${PARENT}) - message(STATUS "PREFIX_PARENTLIB: ${PREFIX_PARENTLIB}") - install( - TARGETS ${PACKAGE_NAME} - RUNTIME - LIBRARY DESTINATION ${PREFIX_PARENTLIB}) - - if(EXISTS ${PROJECT_SOURCE_DIR}/data) - install(DIRECTORY data DESTINATION ${PREFIX_PARENTDATA}/plugins/${PACKAGE_NAME}) - message(STATUS "Install data: ${PREFIX_PARENTDATA}/plugins/${PACKAGE_NAME}") - endif() - if(EXISTS ${PROJECT_SOURCE_DIR}/UserIcons) - install(DIRECTORY UserIcons DESTINATION ${PREFIX_PARENTDATA}/plugins/${PACKAGE_NAME}) - set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${PROJECT_SOURCE_DIR}/script/postinst") - set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${PROJECT_SOURCE_DIR}/script/postinst") - message(STATUS "Install UserIcons: ${PREFIX_PARENTDATA}/plugins/${PACKAGE_NAME}") - endif() + set(PREFIX_PARENTDATA ${PREFIX_DATA}/${PARENT}) + set(PREFIX_PARENTLIB ${PREFIX_LIB}/${PARENT}) + message(STATUS "${CMLOC}PREFIX_PARENTLIB: ${PREFIX_PARENTLIB}") + install( + TARGETS ${PACKAGE_NAME} + RUNTIME + LIBRARY DESTINATION ${PREFIX_PARENTLIB}) + + if(EXISTS ${PROJECT_SOURCE_DIR}/data) + install(DIRECTORY data DESTINATION ${PREFIX_PARENTDATA}/plugins/${PACKAGE_NAME}) + message(STATUS "${CMLOC}Install data: ${PREFIX_PARENTDATA}/plugins/${PACKAGE_NAME}") + endif() + if(EXISTS ${PROJECT_SOURCE_DIR}/UserIcons) + install(DIRECTORY UserIcons DESTINATION ${PREFIX_PARENTDATA}/plugins/${PACKAGE_NAME}) + set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${PROJECT_SOURCE_DIR}/script/postinst") + set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${PROJECT_SOURCE_DIR}/script/postinst") + message(STATUS "${CMLOC}Install UserIcons: ${PREFIX_PARENTDATA}/plugins/${PACKAGE_NAME}") + endif() endif(UNIX AND NOT APPLE) if(APPLE) - # For Apple build, we need to copy the "data" directory contents to the build directory, so that the packager can pick them up. - if(NOT EXISTS "${PROJECT_BINARY_DIR}/data/") - file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/data/") - message("Generating data directory") - endif() - - file(GLOB_RECURSE PACKAGE_DATA_FILES LIST_DIRECTORIES true ${CMAKE_SOURCE_DIR}/data/*) - - foreach(_currentDataFile ${PACKAGE_DATA_FILES}) - message(STATUS "copying: ${_currentDataFile}") - file(COPY ${_currentDataFile} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/data) - endforeach(_currentDataFile) - - if(EXISTS ${PROJECT_SOURCE_DIR}/UserIcons) - file(GLOB_RECURSE PACKAGE_DATA_FILES LIST_DIRECTORIES true ${CMAKE_SOURCE_DIR}/UserIcons/*) - - foreach(_currentDataFile ${PACKAGE_DATA_FILES}) - message(STATUS "copying: ${_currentDataFile}") - file(COPY ${_currentDataFile} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/UserIcons) - endforeach(_currentDataFile) - endif() - - install( - TARGETS ${PACKAGE_NAME} - RUNTIME - LIBRARY DESTINATION OpenCPN.app/Contents/PlugIns) - message(STATUS "Install Target: OpenCPN.app/Contents/PlugIns") + # For Apple build, we need to copy the "data" directory contents to the build directory, so that the packager can pick them up. + if(NOT EXISTS "${PROJECT_BINARY_DIR}/data/") + file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/data/") + message("Generating data directory") + endif() + + file( + GLOB_RECURSE PACKAGE_DATA_FILES + LIST_DIRECTORIES true + ${CMAKE_SOURCE_DIR}/data/*) + + foreach(_currentDataFile ${PACKAGE_DATA_FILES}) + message(STATUS "${CMLOC}copying: ${_currentDataFile}") + file(COPY ${_currentDataFile} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/data) + endforeach(_currentDataFile) + + if(EXISTS ${PROJECT_SOURCE_DIR}/UserIcons) + file( + GLOB_RECURSE PACKAGE_DATA_FILES + LIST_DIRECTORIES true + ${CMAKE_SOURCE_DIR}/UserIcons/*) + + foreach(_currentDataFile ${PACKAGE_DATA_FILES}) + message(STATUS "${CMLOC}copying: ${_currentDataFile}") + file(COPY ${_currentDataFile} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/UserIcons) + endforeach(_currentDataFile) + endif() + + install( + TARGETS ${PACKAGE_NAME} + RUNTIME + LIBRARY DESTINATION OpenCPN.app/Contents/PlugIns) + message(STATUS "${CMLOC}Install Target: OpenCPN.app/Contents/PlugIns") endif(APPLE) diff --git a/cmake/PluginLocalization.cmake b/cmake/PluginLocalization.cmake index 09c94e0b..58aa2604 100644 --- a/cmake/PluginLocalization.cmake +++ b/cmake/PluginLocalization.cmake @@ -2,19 +2,23 @@ # Author: Pavel Kalian / Sean D'Epagnier Copyright: License: GPLv3+ # --------------------------------------------------------------------------- +set(SAVE_CMLOC ${CMLOC}) +set(CMLOC "PluginLocalization: ") + if(OCPN_FLATPAK_CONFIG) - return() + set(CMLOC ${SAVE_CMLOC}) + return() endif(OCPN_FLATPAK_CONFIG) -message(STATUS "Starting POTFILE generation") +message(STATUS "${CMLOC}Starting POTFILE generation") set(POTFILE ${CMAKE_CURRENT_SOURCE_DIR}/po/POTFILES.in) file(REMOVE ${POTFILE}.test) foreach(POTLINE IN ITEMS ${SRCS}) - file(APPEND ${POTFILE}.test "${POTLINE}\n") + file(APPEND ${POTFILE}.test "${POTLINE}\n") endforeach(POTLINE) foreach(POTLINE IN ITEMS ${HDRS}) - file(APPEND ${POTFILE}.test "${POTLINE}\n") + file(APPEND ${POTFILE}.test "${POTLINE}\n") endforeach(POTLINE) # convert crlf to lf for consistency and make copy_if_different work correctly configure_file(${POTFILE}.test ${POTFILE}.test NEWLINE_STYLE UNIX) @@ -23,88 +27,93 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${POTFILE}.test ${ find_program(GETTEXT_XGETTEXT_EXECUTABLE xgettext) string(REPLACE "_pi" "" I18N_NAME ${PACKAGE_NAME}) if(GETTEXT_XGETTEXT_EXECUTABLE) - add_custom_command( - OUTPUT po/${PACKAGE_NAME}.pot.dummy - COMMAND - ${GETTEXT_XGETTEXT_EXECUTABLE} --force-po -F --package-name=${PACKAGE_NAME} --package-version="${PACKAGE_VERSION}" --output=po/${PACKAGE_NAME}.pot --keyword=_ --width=80 - --files-from=${CMAKE_CURRENT_SOURCE_DIR}/po/POTFILES.in - DEPENDS po/POTFILES.in po/${PACKAGE_NAME}.pot - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMENT "${I18N_NAME}-pot-update [${PACKAGE_NAME}]: Generated pot file.") - add_custom_target( - ${I18N_NAME}-pot-update - COMMENT "[${PACKAGE_NAME}]-pot-update: Done." - DEPENDS po/${PACKAGE_NAME}.pot.dummy) + add_custom_command( + OUTPUT po/${PACKAGE_NAME}.pot.dummy + COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} --force-po -F --package-name=${PACKAGE_NAME} --package-version="${PACKAGE_VERSION}" --output=po/${PACKAGE_NAME}.pot --keyword=_ --width=80 --files-from=${CMAKE_CURRENT_SOURCE_DIR}/po/POTFILES.in + DEPENDS po/POTFILES.in po/${PACKAGE_NAME}.pot + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "${I18N_NAME}-pot-update [${PACKAGE_NAME}]: Generated pot file.") + add_custom_target( + ${I18N_NAME}-pot-update + COMMENT "[${PACKAGE_NAME}]-pot-update: Done." + DEPENDS po/${PACKAGE_NAME}.pot.dummy) endif(GETTEXT_XGETTEXT_EXECUTABLE) macro(GETTEXT_UPDATE_PO _potFile) - set(_poFiles ${_potFile}) - get_filename_component(_absPotFile ${_potFile} ABSOLUTE) + set(_poFiles ${_potFile}) + get_filename_component(_absPotFile ${_potFile} ABSOLUTE) - foreach(_currentPoFile ${ARGN}) - get_filename_component(_absFile ${_currentPoFile} ABSOLUTE) - get_filename_component(_poBasename ${_absFile} NAME_WE) + foreach(_currentPoFile ${ARGN}) + get_filename_component(_absFile ${_currentPoFile} ABSOLUTE) + get_filename_component(_poBasename ${_absFile} NAME_WE) - add_custom_command( - OUTPUT ${_absFile}.dummy - COMMAND - ${GETTEXT_MSGMERGE_EXECUTABLE} --width=80 --strict --quiet --update --backup=none --no-location -s ${_absFile} ${_absPotFile} - DEPENDS ${_absPotFile} ${_absFile} - COMMENT "${I18N_NAME}-po-update [${_poBasename}]: Updated po file.") + add_custom_command( + OUTPUT ${_absFile}.dummy + COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --width=80 --strict --quiet --update --backup=none --no-location -s ${_absFile} ${_absPotFile} + DEPENDS ${_absPotFile} ${_absFile} + COMMENT "${I18N_NAME}-po-update [${_poBasename}]: Updated po file.") - set(_poFiles ${_poFiles} ${_absFile}.dummy) + set(_poFiles ${_poFiles} ${_absFile}.dummy) - endforeach(_currentPoFile) + endforeach(_currentPoFile) - add_custom_target( - ${I18N_NAME}-po-update - COMMENT "[${PACKAGE_NAME}]-po-update: Done." - DEPENDS ${_poFiles}) + add_custom_target( + ${I18N_NAME}-po-update + COMMENT "[${PACKAGE_NAME}]-po-update: Done." + DEPENDS ${_poFiles}) endmacro(GETTEXT_UPDATE_PO) if(GETTEXT_MSGMERGE_EXECUTABLE) - file(GLOB PACKAGE_PO_FILES po/*.po) - gettext_update_po(po/${PACKAGE_NAME}.pot ${PACKAGE_PO_FILES}) + file(GLOB PACKAGE_PO_FILES po/*.po) + gettext_update_po(po/${PACKAGE_NAME}.pot ${PACKAGE_PO_FILES}) endif(GETTEXT_MSGMERGE_EXECUTABLE) set(_gmoFiles) macro(GETTEXT_BUILD_MO) - file(MAKE_DIRECTORY "Resources") - message(STATUS "Creating Resources directory") - add_custom_target( - create_resources_dir ALL - COMMAND ${CMAKE_COMMAND} -E make_directory "./Resources" - ) - foreach(_poFile ${ARGN}) - get_filename_component(_absFile ${_poFile} ABSOLUTE) - get_filename_component(_poBasename ${_absFile} NAME_WE) - set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_poBasename}.mo) - - add_custom_command( - OUTPUT ${_gmoFile} - COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_absFile} - COMMAND ${CMAKE_COMMAND} -E copy ${_gmoFile} "Resources/${_poBasename}.lproj/${PACKAGE_NAME}.mo" - DEPENDS ${_absFile} - COMMENT "${I18N_NAME}-i18n [${_poBasename}]: Created mo file.") - - if(APPLE) - install(FILES ${_gmoFile} DESTINATION OpenCPN.app/Contents/Resources/${_poBasename}.lproj RENAME ${PACKAGE_NAME}.mo) - message(STATUS "Install language files to: OpenCPN.app/Contents/Resources/${_poBasename}.lproj renamed to: ${PACKAGE_NAME}.mo") - else(APPLE) - install(FILES ${_gmoFile} DESTINATION ${PREFIX_DATA}/locale/${_poBasename}/LC_MESSAGES RENAME ${PACKAGE_NAME}.mo) - message(STATUS "Install language files to: ${PREFIX_DATA}/locale/${_poBasename}/LC_MESSAGES renamed to: ${PACKAGE_NAME}.mo") - endif(APPLE) - - set(_gmoFiles ${_gmoFiles} ${_gmoFile}) - endforeach(_poFile) + file(MAKE_DIRECTORY "Resources") + message(STATUS "${CMLOC}Creating Resources directory") + add_custom_target(create_resources_dir ALL COMMAND ${CMAKE_COMMAND} -E make_directory "./Resources") + foreach(_poFile ${ARGN}) + get_filename_component(_absFile ${_poFile} ABSOLUTE) + get_filename_component(_poBasename ${_absFile} NAME_WE) + set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_poBasename}.mo) + + add_custom_command( + OUTPUT ${_gmoFile} + COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_absFile} + COMMAND ${CMAKE_COMMAND} -E copy ${_gmoFile} "Resources/${_poBasename}.lproj/${PACKAGE_NAME}.mo" + DEPENDS ${_absFile} + COMMENT "${I18N_NAME}-i18n [${_poBasename}]: Created mo file.") + + if(APPLE) + install( + FILES ${_gmoFile} + DESTINATION OpenCPN.app/Contents/Resources/${_poBasename}.lproj + RENAME ${PACKAGE_NAME}.mo) + message(STATUS "${CMLOC}Install language files to: OpenCPN.app/Contents/Resources/${_poBasename}.lproj renamed to: ${PACKAGE_NAME}.mo") + else(APPLE) + install( + FILES ${_gmoFile} + DESTINATION ${PREFIX_DATA}/locale/${_poBasename}/LC_MESSAGES + RENAME ${PACKAGE_NAME}.mo) + message(STATUS "${CMLOC}Install language files to: ${PREFIX_DATA}/locale/${_poBasename}/LC_MESSAGES renamed to: ${PACKAGE_NAME}.mo") + endif(APPLE) + + set(_gmoFiles ${_gmoFiles} ${_gmoFile}) + endforeach(_poFile) endmacro(GETTEXT_BUILD_MO) if(GETTEXT_MSGFMT_EXECUTABLE) - file(GLOB PACKAGE_PO_FILES po/*.po) - gettext_build_mo(${PACKAGE_PO_FILES}) - add_custom_target(${I18N_NAME}-i18n COMMENT "${PACKAGE_NAME}-i18n: Done." DEPENDS ${_gmoFiles}) - add_dependencies(${PACKAGE_NAME} ${I18N_NAME}-i18n) + file(GLOB PACKAGE_PO_FILES po/*.po) + gettext_build_mo(${PACKAGE_PO_FILES}) + add_custom_target( + ${I18N_NAME}-i18n + COMMENT "${PACKAGE_NAME}-i18n: Done." + DEPENDS ${_gmoFiles}) + add_dependencies(${PACKAGE_NAME} ${I18N_NAME}-i18n) endif(GETTEXT_MSGFMT_EXECUTABLE) file(MAKE_DIRECTORY "Resources") -message(STATUS "Creating Resources directory") +message(STATUS "${CMLOC}Creating Resources directory") + +set(CMLOC ${SAVE_CMLOC}) diff --git a/cmake/PluginPackage.cmake b/cmake/PluginPackage.cmake index 51799e21..569acd56 100644 --- a/cmake/PluginPackage.cmake +++ b/cmake/PluginPackage.cmake @@ -2,26 +2,31 @@ # Author: Pavel Kalian (Based on the work of Sean D'Epagnier) Copyright: 2014 License: GPLv3+ # --------------------------------------------------------------------------- +set(SAVE_CMLOC ${CMLOC}) +set(CMLOC "PluginPackage: ") + # build a FLATPAK installer package -message(STATUS "Package: OCPN_FLATPAK_CONFIG: ${OCPN_FLATPAK_CONFIG}") +message(STATUS "${CMLOC}Package: OCPN_FLATPAK_CONFIG: ${OCPN_FLATPAK_CONFIG}") if(OCPN_FLATPAK_CONFIG) - # On a flatpak build lib libraries such as LibGL and wxWidgets are only available in the flatpak sandbox. Thus, building flatpak must be done before attempts to locate these non-existing libraries - # in the host i. e., before any FindLibrary(), FindWxWidgets(), etc. - find_program(TAR NAMES gtar tar) - if(NOT TAR) - message(FATAL_ERROR "tar not found, required for OCPN_FLATPAK") - endif() - add_custom_target( - flatpak-build ALL - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/flatpak - COMMAND cat ${CMAKE_CURRENT_BINARY_DIR}/flatpak/org.opencpn.OpenCPN.Plugin.${PACKAGE}.yaml - COMMAND /usr/bin/flatpak-builder --force-clean -v ${CMAKE_CURRENT_BINARY_DIR}/app ${CMAKE_CURRENT_BINARY_DIR}/flatpak/org.opencpn.OpenCPN.Plugin.${PACKAGE}.yaml) - add_custom_target("flatpak-pkg") - add_custom_command(TARGET flatpak-pkg - COMMAND ${TAR} -czf ${PKG_NVR}-${ARCH}_${PKG_TARGET_NVR}.tar.gz --transform 's|.*/files/|${PACKAGE}-flatpak-${PACKAGE_VERSION}/|' ${CMAKE_CURRENT_BINARY_DIR}/app/files - COMMAND chmod -R a+wr ../build) - return() + # On a flatpak build lib libraries such as LibGL and wxWidgets are only available in the flatpak sandbox. Thus, building flatpak must be done before attempts to locate these non-existing libraries in the host i. e., before any FindLibrary(), FindWxWidgets(), etc. + find_program(TAR NAMES gtar tar) + if(NOT TAR) + message(FATAL_ERROR "tar not found, required for OCPN_FLATPAK") + endif() + add_custom_target( + flatpak-build ALL + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/flatpak + COMMAND cat ${CMAKE_CURRENT_BINARY_DIR}/flatpak/org.opencpn.OpenCPN.Plugin.${PACKAGE}.yaml + COMMAND /usr/bin/flatpak-builder --force-clean -v ${CMAKE_CURRENT_BINARY_DIR}/app ${CMAKE_CURRENT_BINARY_DIR}/flatpak/org.opencpn.OpenCPN.Plugin.${PACKAGE}.yaml) + add_custom_target("flatpak-pkg") + add_custom_command( + TARGET flatpak-pkg + COMMAND ${TAR} -czf ${PKG_NVR}-${ARCH}_${PKG_TARGET_NVR}.tar.gz --transform 's|.*/files/|${PACKAGE}-flatpak-${PACKAGE_VERSION}/|' ${CMAKE_CURRENT_BINARY_DIR}/app/files + COMMAND chmod -R a+wr ../build) + + set(CMLOC ${SAVE_CMLOC}) + return() endif(OCPN_FLATPAK_CONFIG) # build a CPack driven installer package @@ -32,46 +37,45 @@ set(CPACK_PACKAGE_VERSION "${PACKAGE_VERSION}-${OCPN_MIN_VERSION}") set(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_CURRENT_BINARY_DIR};${PACKAGE_NAME};ALL;/") if(WIN32) - # The TGZ (tar.gz) is used by experimental plugin manager, - set(CPACK_GENERATOR "NSIS;TGZ") + # The TGZ (tar.gz) is used by experimental plugin manager, + set(CPACK_GENERATOR "NSIS;TGZ") - # override install directory to put package files in the opencpn directory - set(CPACK_PACKAGE_INSTALL_DIRECTORY "OpenCPN") + # override install directory to put package files in the opencpn directory + set(CPACK_PACKAGE_INSTALL_DIRECTORY "OpenCPN") - set(CPACK_NSIS_PACKAGE_NAME "${PACKAGE_NAME}") + set(CPACK_NSIS_PACKAGE_NAME "${PACKAGE_NAME}") - # Let cmake find NSIS.template.in - set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/buildwin") + # Let cmake find NSIS.template.in + set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/buildwin") -# These lines set the name of the Windows Start Menu shortcut and the icon that goes with it - set(CPACK_NSIS_DISPLAY_NAME "OpenCPN ${PACKAGE_NAME}") + # These lines set the name of the Windows Start Menu shortcut and the icon that goes with it + set(CPACK_NSIS_DISPLAY_NAME "OpenCPN ${PACKAGE_NAME}") - set(CPACK_PACKAGE_FILE_NAME "${PACKAGE_FILE_NAME}_${CPACK_PACKAGE_VERSION}-${OCPN_MIN_VERSION}_win32") - message(STATUS "CPACK_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}") + set(CPACK_PACKAGE_FILE_NAME "${PACKAGE_FILE_NAME}_${CPACK_PACKAGE_VERSION}-${OCPN_MIN_VERSION}_win32") + message(STATUS "${CMLOC}CPACK_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}") - set(CPACK_NSIS_DIR "${PROJECT_SOURCE_DIR}/buildwin/NSIS_Unicode") #Gunther - set(CPACK_BUILDWIN_DIR "${PROJECT_SOURCE_DIR}/buildwin") # Gunther + set(CPACK_NSIS_DIR "${PROJECT_SOURCE_DIR}/buildwin/NSIS_Unicode") # Gunther + set(CPACK_BUILDWIN_DIR "${PROJECT_SOURCE_DIR}/buildwin") # Gunther - message(STATUS "FILE: ${CPACK_PACKAGE_FILE_NAME}") + message(STATUS "${CMLOC}FILE: ${CPACK_PACKAGE_FILE_NAME}") else(WIN32) - set(CPACK_PACKAGE_INSTALL_DIRECTORY ${PACKAGE_NAME}) + set(CPACK_PACKAGE_INSTALL_DIRECTORY ${PACKAGE_NAME}) endif(WIN32) if(CMAKE_BUILD_TYPE STREQUAL "Debug") - set(CPACK_STRIP_FILES "") - message(STATUS "Not stripping debug information from module") + set(CPACK_STRIP_FILES "") + message(STATUS "${CMLOC}Not stripping debug information from module") else(CMAKE_BUILD_TYPE STREQUAL "DEBUG") - set(CPACK_STRIP_FILES "${PACKAGE_NAME}") - message(STATUS "Stripping debug information from module") + set(CPACK_STRIP_FILES "${PACKAGE_NAME}") + message(STATUS "${CMLOC}Stripping debug information from module") endif(CMAKE_BUILD_TYPE STREQUAL "Debug") - set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/gpl.txt") if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/README") - message(STATUS "Using generic cpack package description file.") - set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README") - set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README") + message(STATUS "${CMLOC}Using generic cpack package description file.") + set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README") + set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README") endif() # SET(CPACK_SOURCE_GENERATOR "TGZ") @@ -81,74 +85,75 @@ set(CPACK_SOURCE_IGNORE_FILES "^${CMAKE_CURRENT_SOURCE_DIR}/.git/*" "^${CMAKE_CU if(UNIX AND NOT APPLE) - # need apt-get install rpm, for rpmbuild - set(PACKAGE_DEPS "opencpn, bzip2, gzip") - set(CPACK_GENERATOR "DEB;TGZ") - - set(CPACK_DEBIAN_PACKAGE_DEPENDS ${PACKAGE_DEPS}) - set(CPACK_DEBIAN_PACKAGE_RECOMMENDS ${PACKAGE_RECS}) - set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${ARCH}) - set(CPACK_DEBIAN_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}") - set(CPACK_DEBIAN_PACKAGE_SECTION "misc") - set(CPACK_DEBIAN_COMPRESSION_TYPE "xz") # requires my patches to cmake - set(CPACK_CMAKE_GENERATOR Ninja) - set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PACKAGE_NAME} PlugIn for OpenCPN") - set(CPACK_PACKAGE_DESCRIPTION "${PACKAGE_NAME} PlugIn for OpenCPN") - set(CPACK_SET_DESTDIR ON) + # need apt-get install rpm, for rpmbuild + set(PACKAGE_DEPS "opencpn, bzip2, gzip") + set(CPACK_GENERATOR "DEB;TGZ") + + set(CPACK_DEBIAN_PACKAGE_DEPENDS ${PACKAGE_DEPS}) + set(CPACK_DEBIAN_PACKAGE_RECOMMENDS ${PACKAGE_RECS}) + set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${ARCH}) + set(CPACK_DEBIAN_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}") + set(CPACK_DEBIAN_PACKAGE_SECTION "misc") + set(CPACK_DEBIAN_COMPRESSION_TYPE "xz") # requires my patches to cmake + set(CPACK_CMAKE_GENERATOR Ninja) + set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PACKAGE_NAME} PlugIn for OpenCPN") + set(CPACK_PACKAGE_DESCRIPTION "${PACKAGE_NAME} PlugIn for OpenCPN") + set(CPACK_SET_DESTDIR ON) endif(UNIX AND NOT APPLE) if(NOT STANDALONE MATCHES "BUNDLED") - if(APPLE) - message(STATUS "*** Staging to build PlugIn OSX Package ***") + if(APPLE) + message(STATUS "${CMLOC}*** Staging to build PlugIn OSX Package ***") - # Copy a bunch of files so the Packages installer builder can find them relative to ${CMAKE_CURRENT_BINARY_DIR} This avoids absolute paths in the chartdldr_pi.pkgproj file + # Copy a bunch of files so the Packages installer builder can find them relative to ${CMAKE_CURRENT_BINARY_DIR} This avoids absolute paths in the chartdldr_pi.pkgproj file - configure_file(${PROJECT_SOURCE_DIR}/cmake/gpl.txt ${CMAKE_CURRENT_BINARY_DIR}/license.txt COPYONLY) + configure_file(${PROJECT_SOURCE_DIR}/cmake/gpl.txt ${CMAKE_CURRENT_BINARY_DIR}/license.txt COPYONLY) - configure_file(${PROJECT_SOURCE_DIR}/buildosx/InstallOSX/pkg_background.jpg ${CMAKE_CURRENT_BINARY_DIR}/pkg_background.jpg COPYONLY) + configure_file(${PROJECT_SOURCE_DIR}/buildosx/InstallOSX/pkg_background.jpg ${CMAKE_CURRENT_BINARY_DIR}/pkg_background.jpg COPYONLY) - # Patch the pkgproj.in file to make the output package name conform to Xxx-Plugin_x.x.pkg format Key is: NAME ${VERBOSE_NAME}-Plugin_${VERSION_MAJOR}.${VERSION_MINOR} + # Patch the pkgproj.in file to make the output package name conform to Xxx-Plugin_x.x.pkg format Key is: NAME ${VERBOSE_NAME}-Plugin_${VERSION_MAJOR}.${VERSION_MINOR} - configure_file(${PROJECT_SOURCE_DIR}/buildosx/InstallOSX/plugin.pkgproj.in ${CMAKE_CURRENT_BINARY_DIR}/${VERBOSE_NAME}.pkgproj) + configure_file(${PROJECT_SOURCE_DIR}/buildosx/InstallOSX/plugin.pkgproj.in ${CMAKE_CURRENT_BINARY_DIR}/${VERBOSE_NAME}.pkgproj) - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${VERBOSE_NAME}-Plugin_${PACKAGE_VERSION}_${OCPN_MIN_VERSION}.pkg - COMMAND /usr/local/bin/packagesbuild -F ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${VERBOSE_NAME}.pkgproj - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS ${PACKAGE_NAME} - COMMENT "create-pkg [${PACKAGE_NAME}]: Generating pkg file.") + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${VERBOSE_NAME}-Plugin_${PACKAGE_VERSION}_${OCPN_MIN_VERSION}.pkg + COMMAND /usr/local/bin/packagesbuild -F ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${VERBOSE_NAME}.pkgproj + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${PACKAGE_NAME} + COMMENT "create-pkg [${PACKAGE_NAME}]: Generating pkg file.") - add_custom_target( - create-pkg - COMMENT "create-pkg: Done." - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${VERBOSE_NAME}-Plugin_${PACKAGE_VERSION}_${OCPN_MIN_VERSION}.pkg) + add_custom_target( + create-pkg + COMMENT "create-pkg: Done." + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${VERBOSE_NAME}-Plugin_${PACKAGE_VERSION}_${OCPN_MIN_VERSION}.pkg) - set(CPACK_GENERATOR "TGZ") - endif(APPLE) + set(CPACK_GENERATOR "TGZ") + endif(APPLE) - set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PACKAGE_NAME} PlugIn for OpenCPN") - set(CPACK_PACKAGE_DESCRIPTION "${PACKAGE_NAME} PlugIn for OpenCPN") - set(CPACK_PACKAGE_FILE_NAME "${PACKAGING_NAME}") - message(STATUS "CPACK_PACKAGE_FILE_NAME: ${CPACK_PACKAGE_FILE_NAME}") + set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PACKAGE_NAME} PlugIn for OpenCPN") + set(CPACK_PACKAGE_DESCRIPTION "${PACKAGE_NAME} PlugIn for OpenCPN") + set(CPACK_PACKAGE_FILE_NAME "${PACKAGING_NAME}") + message(STATUS "${CMLOC}CPACK_PACKAGE_FILE_NAME: ${CPACK_PACKAGE_FILE_NAME}") - if(WIN32) - set(CPACK_SET_DESTDIR OFF) - message(STATUS "FILE: ${CPACK_PACKAGE_FILE_NAME}") - add_custom_command( - OUTPUT ${CPACK_PACKAGE_FILE_NAME} - COMMAND - signtool sign /v /f \\cert\\OpenCPNSPC.pfx /d http://www.opencpn.org /t http://timestamp.verisign.com/scripts/timstamp.dll ${CPACK_PACKAGE_FILE_NAME} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS ${PACKAGE_NAME} - COMMENT "Code-Signing: ${CPACK_PACKAGE_FILE_NAME}") - add_custom_target( - codesign - COMMENT "code signing: Done." - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${CPACK_PACKAGE_FILE_NAME}) - endif(WIN32) + if(WIN32) + set(CPACK_SET_DESTDIR OFF) + message(STATUS "${CMLOC}FILE: ${CPACK_PACKAGE_FILE_NAME}") + add_custom_command( + OUTPUT ${CPACK_PACKAGE_FILE_NAME} + COMMAND signtool sign /v /f \\cert\\OpenCPNSPC.pfx /d http://www.opencpn.org /t http://timestamp.verisign.com/scripts/timstamp.dll ${CPACK_PACKAGE_FILE_NAME} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${PACKAGE_NAME} + COMMENT "Code-Signing: ${CPACK_PACKAGE_FILE_NAME}") + add_custom_target( + codesign + COMMENT "code signing: Done." + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${CPACK_PACKAGE_FILE_NAME}) + endif(WIN32) - message(STATUS "CPACK_PACKAGE_VERSION: ${CPACK_PACKAGE_VERSION}, PACKAGE_VERSION ${PACKAGE_VERSION}, CPACK_PACKAGE_FILE_NAME: ${CPACK_PACKAGE_FILE_NAME}") - include(CPack) + message(STATUS "${CMLOC}CPACK_PACKAGE_VERSION: ${CPACK_PACKAGE_VERSION}, PACKAGE_VERSION ${PACKAGE_VERSION}, CPACK_PACKAGE_FILE_NAME: ${CPACK_PACKAGE_FILE_NAME}") + include(CPack) endif(NOT STANDALONE MATCHES "BUNDLED") + +set(CMLOC ${SAVE_CMLOC}) diff --git a/cmake/PluginSetup.cmake b/cmake/PluginSetup.cmake index 814fd925..fa3bcad9 100644 --- a/cmake/PluginSetup.cmake +++ b/cmake/PluginSetup.cmake @@ -1,211 +1,234 @@ -# +# --------------------------------------------------------------------------- +# Author: Jon Gough based on the work of Pavel Kalian (Based on the work of Sean D'Epagnier) Copyright: 2020 License: GPLv3+ +# --------------------------------------------------------------------------- + +set(SAVE_CMLOC ${CMLOC}) +set(CMLOC "PluginSetup: ") + # Export variables used in plugin setup: GIT_HASH, GIT_COMMIT, PKG_TARGET, PKG_TARGET_VERSION and PKG_NVR if(NOT ${PACKAGE} MATCHES "(.*)_pi") - set(PACKAGE_NAME ${PACKAGE}_pi) - set(PACKAGE_FILE_NAME "${PACKAGE}_pi") + set(PACKAGE_NAME ${PACKAGE}_pi) + set(PACKAGE_FILE_NAME "${PACKAGE}_pi") else(NOT ${PACKAGE} MATCHES "(.*)_pi") - set(PACKAGE_NAME ${PACKAGE}) - set(PACKAGE_FILE_NAME "${PACKAGE}") + set(PACKAGE_NAME ${PACKAGE}) + set(PACKAGE_FILE_NAME "${PACKAGE}") endif(NOT ${PACKAGE} MATCHES "(.*)_pi") string(TOUPPER "${PACKAGE}" TITLE_NAME) -project(${PACKAGE_NAME} VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_TWEAK}) -message(STATUS "PROJECT_VERSION: ${PROJECT_VERSION}") +project(${PACKAGE} VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_TWEAK}) +message(STATUS "${CMLOC}PROJECT_VERSION: ${PROJECT_VERSION}") set(PACKAGE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_TWEAK}") -message(STATUS "${VERBOSE_NAME} Version: ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_TWEAK}") -message(STATUS "OPCN_FLATPAK: ${OCPN_FLATPAK}") +message(STATUS "${CMLOC}${VERBOSE_NAME} Version: ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_TWEAK}") +message(STATUS "${CMLOC}OPCN_FLATPAK: ${OCPN_FLATPAK}") set(PKG_NVR ${PACKAGE_NAME}-${PROJECT_VERSION}) set(PKG_URL "https://dl.cloudsmith.io/public/--pkg_repo--/raw/names/--name--/versions/--version--/--filename--") execute_process( - COMMAND git log -1 --format=%h - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE GIT_HASH - OUTPUT_STRIP_TRAILING_WHITESPACE) + COMMAND git log -1 --format=%h + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process( - COMMAND git log -1 --format=%ci - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE GIT_COMMIT_DATE - OUTPUT_STRIP_TRAILING_WHITESPACE) + COMMAND git log -1 --format=%ci + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_COMMIT_DATE OUTPUT_STRIP_TRAILING_WHITESPACE) -message(STATUS "OCPN_FLATPAK_CONFIG: ${OCPN_FLATPAK_CONFIG}, UNIX: ${UNIX}") +message(STATUS "${CMLOC}OCPN_FLATPAK_CONFIG: ${OCPN_FLATPAK_CONFIG}, UNIX: ${UNIX}") if(OCPN_FLATPAK_CONFIG OR OCPN_FLATPAK_BUILD) - set(PKG_TARGET "flatpak") - set(PKG_TARGET_VERSION "18.08") # As of flatpak/*yaml + set(PKG_TARGET "flatpak") + set(PKG_TARGET_VERSION "18.08") # As of flatpak/*yaml elseif(MINGW) - set(PKG_TARGET "mingw") - if(CMAKE_SYSTEM_VERSION) - set(PKG_TARGET_VERSION ${CMAKE_SYSTEM_VERSION}) - else() - set(PKG_TARGET_VERSION 10) - endif() + set(PKG_TARGET "mingw") + if(CMAKE_SYSTEM_VERSION) + set(PKG_TARGET_VERSION ${CMAKE_SYSTEM_VERSION}) + else() + set(PKG_TARGET_VERSION 10) + endif() elseif(MSVC) - set(PKG_TARGET "msvc") - if(CMAKE_SYSTEM_VERSION) - set(PKG_TARGET_VERSION ${CMAKE_SYSTEM_VERSION}) - elseif(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION) - set(PKG_TARGET_VERSION ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}) - else() - set(PKG_TARGET_VERSION 10) - endif() + set(PKG_TARGET "msvc") + if(CMAKE_SYSTEM_VERSION) + set(PKG_TARGET_VERSION ${CMAKE_SYSTEM_VERSION}) + elseif(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION) + set(PKG_TARGET_VERSION ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}) + else() + set(PKG_TARGET_VERSION 10) + endif() elseif(APPLE) - set(PKG_TARGET "darwin") - execute_process(COMMAND "sw_vers" "-productVersion" OUTPUT_VARIABLE PKG_TARGET_VERSION) + set(PKG_TARGET "darwin") + execute_process(COMMAND "sw_vers" "-productVersion" OUTPUT_VARIABLE PKG_TARGET_VERSION) elseif(UNIX) - # Some linux dist: - execute_process(COMMAND "lsb_release" "-is" OUTPUT_VARIABLE PKG_TARGET) - execute_process(COMMAND "lsb_release" "-rs" OUTPUT_VARIABLE PKG_TARGET_VERSION) - #string(REPLACE "_pi" "" PKG_NVR ${PKG_NVR}) - #set(PKG_NVR "${PKG_NVR}") + # Some linux dist: + execute_process(COMMAND "lsb_release" "-is" OUTPUT_VARIABLE PKG_TARGET) + execute_process(COMMAND "lsb_release" "-rs" OUTPUT_VARIABLE PKG_TARGET_VERSION) else() - set(PKG_TARGET "unknown") - set(PKG_TARGET_VERSION 1) + set(PKG_TARGET "unknown") + set(PKG_TARGET_VERSION 1) endif() if(NOT WIN32) # default set(ARCH "i386") - set(LIB_INSTALL_DIR "lib") - if(EXISTS /etc/debian_version) - set(PACKAGE_FORMAT "DEB") - set(PACKAGE_DEPS "libc6, libwxgtk3.0-0, wx3.0-i18n, libglu1-mesa (>= 7.0.0), libgl1-mesa-glx (>= 7.0.0), zlib1g, bzip2, libportaudio2") - set(PACKAGE_RECS "xcalib,xdg-utils") - set(LIB_INSTALL_DIR "lib") - if(CMAKE_SIZEOF_VOID_P MATCHES "8") - set(ARCH "amd64") - # SET (LIB_INSTALL_DIR "lib64") - else(CMAKE_SIZEOF_VOID_P MATCHES "8") - set(ARCH "i386") - endif(CMAKE_SIZEOF_VOID_P MATCHES "8") - SET(TENTATIVE_PREFIX "/usr/local") - #set(TENTATIVE_PREFIX "/usr") - endif(EXISTS /etc/debian_version) - if(EXISTS /etc/redhat-release) - set(PACKAGE_FORMAT "RPM") - # SET (PACKAGE_DEPS "wxGTK mesa-libGLU mesa-libGL gettext zlib bzip2 portaudio") - if(CMAKE_SIZEOF_VOID_P MATCHES "8") - set(ARCH "x86_64") - set(LIB_INSTALL_DIR "lib64") - else(CMAKE_SIZEOF_VOID_P MATCHES "8") - set(ARCH "i386") - set(LIB_INSTALL_DIR "lib") - endif(CMAKE_SIZEOF_VOID_P MATCHES "8") - endif(EXISTS /etc/redhat-release) - if(EXISTS /etc/suse-release OR EXISTS /etc/SuSE-release) - set(PACKAGE_FORMAT "RPM") - # SET (PACKAGE_DEPS "libwx_baseu-2_8-0-wxcontainer MesaGLw libbz2-1 portaudio") - if(CMAKE_SIZEOF_VOID_P MATCHES "8") - set(ARCH "x86_64") - set(LIB_INSTALL_DIR "lib64") - else(CMAKE_SIZEOF_VOID_P MATCHES "8") - set(ARCH "i386") + if(UNIX AND NOT APPLE) + + message(STATUS "${CMLOC}*** Will install to ${CMAKE_INSTALL_PREFIX} ***") + + if(EXISTS /etc/debian_version) + message(STATUS "${CMLOC}*** Debian detected ***") + set(PACKAGE_FORMAT "DEB") + set(PACKAGE_DEPS "libc6, libwxgtk3.0-0, wx3.0-i18n, libglu1-mesa (>= 7.0.0), libgl1-mesa-glx (>= 7.0.0), zlib1g, bzip2, libportaudio2") + set(PACKAGE_RECS "xcalib,xdg-utils") set(LIB_INSTALL_DIR "lib") - endif(CMAKE_SIZEOF_VOID_P MATCHES "8") - endif(EXISTS /etc/suse-release OR EXISTS /etc/SuSE-release) - if(EXISTS /etc/gentoo-release) - set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}") - endif(EXISTS /etc/gentoo-release) + if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm*") + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(ARCH "arm64") + add_definitions(-DOCPN_ARM64) + else(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(ARCH "armhf") + add_definitions(-DOCPN_ARMHF) + endif(CMAKE_SIZEOF_VOID_P MATCHES "8") + else(CMAKE_SYSTEM_PROCESSOR MATCHES "arm*") + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(ARCH "x86_64") + else(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(ARCH "i386") + endif(CMAKE_SIZEOF_VOID_P MATCHES "8") + endif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm*") + endif(EXISTS /etc/debian_version) + if(NOT DEFINED PACKAGE_FORMAT) + if(EXISTS /app) + message(STATUS "*** Flatpak detected ***") + set(PACKAGE_FORMAT "TGZ") + set(ARCH "x86_64") + set(LIB_INSTALL_DIR "lib") + endif(EXISTS /app) + endif(NOT DEFINED PACKAGE_FORMAT) + + if(NOT DEFINED PACKAGE_FORMAT) + if(EXISTS /etc/redhat-release) + message(STATUS "${CMLOC}*** Redhat detected ***") + set(PACKAGE_FORMAT "RPM") + set(PACKAGE_DEPS "opencpn") + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(ARCH "x86_64") + set(LIB_INSTALL_DIR "lib64") + else(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(ARCH "i386") + set(LIB_INSTALL_DIR "lib") + endif(CMAKE_SIZEOF_VOID_P MATCHES "8") + endif(EXISTS /etc/redhat-release) + endif(NOT DEFINED PACKAGE_FORMAT) + + if(NOT DEFINED PACKAGE_FORMAT) + if(EXISTS /etc/os-release + OR EXISTS /etc/sysconfig/SuSEfirewall2.d + OR EXISTS /etc/suse-release + OR EXISTS /etc/SuSE-release) + message(STATUS "${CMLOC}*** OpenSUSE detected ***") + set(PACKAGE_FORMAT "RPM") + set(PACKAGE_DEPS "opencpn") + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(ARCH "x86_64") + set(LIB_INSTALL_DIR "lib") + else(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(ARCH "i386") + set(LIB_INSTALL_DIR "lib") + endif(CMAKE_SIZEOF_VOID_P MATCHES "8") + endif( + EXISTS /etc/os-release + OR EXISTS /etc/sysconfig/SuSEfirewall2.d + OR EXISTS /etc/suse-release + OR EXISTS /etc/SuSE-release) + endif(NOT DEFINED PACKAGE_FORMAT) + + endif(UNIX AND NOT APPLE) + if(APPLE) - if(CMAKE_SIZEOF_VOID_P MATCHES "8") - # IF (CMAKE_OSX_64) - set(ARCH "x86_64") - # ENDIF (CMAKE_OSX_64) - endif(CMAKE_SIZEOF_VOID_P MATCHES "8") - endif() + set(ARCH "x86_64") + endif(APPLE) + else(NOT WIN32) - # On WIN32 probably CMAKE_SIZEOF_VOID_P EQUAL 8, but we don't use it at all now... set(ARCH "x86_64") endif(NOT WIN32) -if(UNIX AND NOT APPLE) - if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm*") - set(ARCH "armhf") - IF (CMAKE_SIZEOF_VOID_P MATCHES "8") - SET (ARCH "arm64") - ELSE () - SET (ARCH "armhf") - ENDIF () - endif() -endif(UNIX AND NOT APPLE) -message(STATUS "ARCH: ${ARCH}") +message(STATUS "${CMLOC}ARCH: ${ARCH}") string(STRIP ${PKG_TARGET} PKG_TARGET) string(TOLOWER ${PKG_TARGET} PKG_TARGET) string(STRIP ${PKG_TARGET_VERSION} PKG_TARGET_VERSION) string(TOLOWER ${PKG_TARGET_VERSION} PKG_TARGET_VERSION) set(PKG_TARGET_NVR ${PKG_TARGET}-${PKG_TARGET_VERSION}) -message(STATUS "PluginSetup: PKG_TARGET: ${PKG_TARGET}, PKG_TARGET_VERSION: ${PKG_TARGET_VERSION}") +message(STATUS "${CMLOC}PluginSetup: PKG_TARGET: ${PKG_TARGET}, PKG_TARGET_VERSION: ${PKG_TARGET_VERSION}") if(DEFINED ENV{OCPN_TARGET}) set(PACKAGING_NAME "${PKG_NVR}_${PKG_TARGET}-${ARCH}_${PKG_TARGET_VERSION}-$ENV{OCPN_TARGET}") else(DEFINED ENV{OCPN_TARGET}) set(PACKAGING_NAME "${PKG_NVR}_${PKG_TARGET}-${ARCH}_${PKG_TARGET_VERSION}") endif(DEFINED ENV{OCPN_TARGET}) -message(STATUS "PACKAGING_NAME: ${PACKAGING_NAME}") +message(STATUS "${CMLOC}PACKAGING_NAME: ${PACKAGING_NAME}") set(PLUGIN_NAME ${PACKAGE}-plugin-${PKG_TARGET}-${ARCH}_${PKG_TARGET_VERSION}) if(Plugin_CXX11) - message(STATUS "Attempting to use c++11") - include(CheckCXXCompilerFlag) - check_cxx_compiler_flag("-std=c++11" COMPILER_SUPPORTS_CXX11) - check_cxx_compiler_flag("-std=c++0x" COMPILER_SUPPORTS_CXX0X) - if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - set(Plugin_USE_CXX11 ON) - elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") - set(Plugin_USE_CXX11 ON) - else() - message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") - set(Plugin_USE_CXX11 OFF) - endif() + message(STATUS "${CMLOC}Attempting to use c++11") + include(CheckCXXCompilerFlag) + check_cxx_compiler_flag("-std=c++11" COMPILER_SUPPORTS_CXX11) + check_cxx_compiler_flag("-std=c++0x" COMPILER_SUPPORTS_CXX0X) + if(COMPILER_SUPPORTS_CXX11) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + set(Plugin_USE_CXX11 ON) + elseif(COMPILER_SUPPORTS_CXX0X) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") + set(Plugin_USE_CXX11 ON) + else() + message(STATUS "${CMLOC}The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") + set(Plugin_USE_CXX11 OFF) + endif() else() - set(Plugin_USE_CXX11 OFF) + set(Plugin_USE_CXX11 OFF) endif() if(Plugin_USE_CXX11) - message(STATUS "Allowing use of c++11") + message(STATUS "${CMLOC}Allowing use of c++11") endif() -message(STATUS "CMAKE version: ${CMAKE_VERSION}") +message(STATUS "${CMLOC}CMAKE version: ${CMAKE_VERSION}") if(CMAKE_VERSION VERSION_GREATER 3.4) - set(ENABLE_CLANG_TIDY - OFF - CACHE BOOL "Add clang-tidy automatically to builds") - if(ENABLE_CLANG_TIDY) - find_program( - CLANG_TIDY_EXE - NAMES "clang-tidy" - PATHS /usr/local/opt/llvm/bin) - if(CLANG_TIDY_EXE) - message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}") - # For more, see http://clang.llvm.org/extra/clang-tidy/ set(CLANG_TIDY_CHECKS "-*,modernize-*") - set(CLANG_TIDY_CHECKS "-*,performance-*") - set(CMAKE_CXX_CLANG_TIDY - "${CLANG_TIDY_EXE};-checks=${CLANG_TIDY_CHECKS};-header-filter='${CMAKE_SOURCE_DIR}/*'" - CACHE STRING "" FORCE) - else() - message(AUTHOR_WARNING "clang-tidy not found!") - set(CMAKE_CXX_CLANG_TIDY - "" - CACHE STRING "" FORCE) # delete it + set(ENABLE_CLANG_TIDY + OFF + CACHE BOOL "Add clang-tidy automatically to builds") + if(ENABLE_CLANG_TIDY) + find_program( + CLANG_TIDY_EXE + NAMES "clang-tidy" + PATHS /usr/local/opt/llvm/bin) + if(CLANG_TIDY_EXE) + message(STATUS "${CMLOC}clang-tidy found: ${CLANG_TIDY_EXE}") + # For more, see http://clang.llvm.org/extra/clang-tidy/ set(CLANG_TIDY_CHECKS "-*,modernize-*") + set(CLANG_TIDY_CHECKS "-*,performance-*") + set(CMAKE_CXX_CLANG_TIDY + "${CLANG_TIDY_EXE};-checks=${CLANG_TIDY_CHECKS};-header-filter='${CMAKE_SOURCE_DIR}/*'" + CACHE STRING "" FORCE) + else() + message(AUTHOR_WARNING "clang-tidy not found!") + set(CMAKE_CXX_CLANG_TIDY + "" + CACHE STRING "" FORCE) # delete it + endif() endif() - endif() endif() if(CMAKE_VERSION VERSION_GREATER 3.9) - set(ENABLE_CPPCHECK - OFF - CACHE BOOL "Add cppcheck automatically to builds") - if(ENABLE_CPPCHECK) - find_program(CPPCHECK_EXECUTABLE NAMES "cppcheck") - set(CMAKE_CXX_CPPCHECK ${CPPCHECK_EXECUTABLE}) - endif() + set(ENABLE_CPPCHECK + OFF + CACHE BOOL "Add cppcheck automatically to builds") + if(ENABLE_CPPCHECK) + find_program(CPPCHECK_EXECUTABLE NAMES "cppcheck") + set(CMAKE_CXX_CPPCHECK ${CPPCHECK_EXECUTABLE}) + endif() endif() - +set(CMLOC ${SAVE_CMLOC}) diff --git a/cmake/in-files/version.h.in b/cmake/in-files/version.h.in index 3f4c7ca2..0d78d39a 100644 --- a/cmake/in-files/version.h.in +++ b/cmake/in-files/version.h.in @@ -6,6 +6,10 @@ #define PLUGIN_VERSION_TWEAK ${VERSION_TWEAK} #define PLUGIN_VERSION_DATE "${VERSION_DATE}" #define PLUGIN_COMMON_NAME "${COMMON_NAME}" +#define OCPN_MIN_VERSION ${OCPN_MIN_VERSION} // API version of OCPN to use #define OCPN_API_VERSION_MAJOR ${OCPN_API_VERSION_MAJOR} #define OCPN_API_VERSION_MINOR ${OCPN_API_VERSION_MINOR} +// OD API Version +#define OD_API_VERSION_MAJOR ${OD_API_VERSION_MAJOR} +#define OD_API_VERSION_MINOR ${OD_API_VERSION_MINOR} diff --git a/src/PathAndPointManagerDialogDef.cpp b/src/PathAndPointManagerDialogDef.cpp index c3d4a802..0723121f 100644 --- a/src/PathAndPointManagerDialogDef.cpp +++ b/src/PathAndPointManagerDialogDef.cpp @@ -50,7 +50,7 @@ PathAndPointManagerDialogDef::PathAndPointManagerDialogDef( wxWindow* parent, wx m_panelPath->SetSizer( bSizer2 ); m_panelPath->Layout(); bSizer2->Fit( m_panelPath ); - m_notebookPathAndPointManager->AddPage( m_panelPath, _("Paths"), false ); + m_notebookPathAndPointManager->AddPage( m_panelPath, _("Paths"), true ); m_panelODPoint = new wxPanel( m_notebookPathAndPointManager, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizer3; bSizer3 = new wxBoxSizer( wxHORIZONTAL ); @@ -120,7 +120,7 @@ PathAndPointManagerDialogDef::PathAndPointManagerDialogDef( wxWindow* parent, wx m_panelLayer->SetSizer( bSizer4 ); m_panelLayer->Layout(); bSizer4->Fit( m_panelLayer ); - m_notebookPathAndPointManager->AddPage( m_panelLayer, _("Layers"), true ); + m_notebookPathAndPointManager->AddPage( m_panelLayer, _("Layers"), false ); m_bSizerDialog->Add( m_notebookPathAndPointManager, 1, wxEXPAND | wxALL, 5 );