diff --git a/CMakeLists.txt b/CMakeLists.txt index 79706acb..46fa26fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,7 @@ set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/find" "${PROJECT_SOURCE_DIR}/ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) +set_directory_properties(PROPERTIES EP_BASE "${PROJECT_BINARY_DIR}/external") add_definitions(-D_USE_MATH_DEFINES) @@ -77,7 +78,7 @@ macro(add_includes_ldflags LDFLAGS INCLUDES) endmacro (add_includes_ldflags LDFLAGS INCLUDES) find_package(CXX17 REQUIRED COMPONENTS optional) -find_package(Filesystem REQUIRED COMPONENTS Boost Final Experimental) +find_package(Filesystem REQUIRED COMPONENTS ghc Final Experimental) # libexec if (WIN32) @@ -319,6 +320,7 @@ message(" Configuration: Compiler: ${CMAKE_CXX_COMPILER} CppUnit enabled: ${ENABLE_CPPUNIT} + Filesystem library: ${CXX_FILESYSTEM_NAMESPACE} ") option(CMAKE_DEBUG_INCLUDES_LDFLAGS "List include dirs and ldflags for xournalpp target" OFF) diff --git a/azure-pipelines/release.yml b/azure-pipelines/release.yml index c5ddecdd..b346cb02 100644 --- a/azure-pipelines/release.yml +++ b/azure-pipelines/release.yml @@ -43,7 +43,7 @@ stages: name: 'VersionRelease' displayName: 'Set Version Information for Release' workingDirectory: ./build - condition: and(ne(variables['Build.Reason'], 'Schedule'), ne(variables['runForRelease'], 'False')) # Run for non-scheduled (release) + condition: or(eq(variables['Build.Reason'], 'IndividualCI'), ne(variables['runForRelease'], 'False')) # Run for non-scheduled (release) - stage: Release jobs: - job: 'Ubuntu' diff --git a/azure-pipelines/steps/build_mac.yml b/azure-pipelines/steps/build_mac.yml index 8afde65d..b456d1af 100644 --- a/azure-pipelines/steps/build_mac.yml +++ b/azure-pipelines/steps/build_mac.yml @@ -33,16 +33,6 @@ steps: fi unzip ninja-mac.zip -d /Users/git-bin/gtk/inst/bin displayName: 'Get Ninja' - - bash: | - set -e - # Using SourceForge instead of bintray due to boostorg/boost#299 - curl -L -o boost_1_72_0.tar.gz https://sourceforge.net/projects/boost/files/boost/1.72.0/boost_1_72_0.tar.gz/download - tar -xzf boost_1_72_0.tar.gz - cd boost_1_72_0 - ./bootstrap.sh --prefix=/usr/local/boost-1.72.0 - sudo ./b2 cxxflags="-std=c++17" --with-system --with-filesystem variant=release link=static threading=multi install - export DYLD_LIBRARY_PATH=/usr/local/boost-1.72.0/lib:$DYLD_LIBRARY_PATH - displayName: 'Build boost' - bash: | export PATH="$HOME/.local/bin:/Users/git-bin/gtk/inst/bin:$PATH" cmake -GNinja -DCMAKE_INSTALL_PREFIX:PATH=/Users/git-bin/gtk/inst .. -DCMAKE_BUILD_TYPE=${{ parameters.build_type }} ${{ parameters.cmake_flags }} diff --git a/cmake/find/FindFilesystem.cmake b/cmake/find/FindFilesystem.cmake index 2321aca8..3c05a919 100644 --- a/cmake/find/FindFilesystem.cmake +++ b/cmake/find/FindFilesystem.cmake @@ -1,6 +1,11 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. +# Original file from CMake Community Modules by vector-of-bool +# (https://github.com/vector-of-bool/CMakeCM) +# +# With modifications by the Xournal++ Team + #[=======================================================================[.rst: FindFilesystem @@ -105,6 +110,7 @@ endif () include(CMakePushCheckState) include(CheckIncludeFileCXX) include(CheckCXXSourceCompiles) +include(ExternalProject) cmake_push_check_state() @@ -121,7 +127,7 @@ endif () # Warn on any unrecognized components set(extra_components ${want_components}) -list(REMOVE_ITEM extra_components Final Experimental Boost) +list(REMOVE_ITEM extra_components Final Experimental Boost ghc) foreach (component IN LISTS extra_components) message(WARNING "Extraneous find_package component for Filesystem: ${component}") endforeach () @@ -236,13 +242,37 @@ if (NOT _found AND "Boost" IN_LIST want_components) find_package(Boost COMPONENTS filesystem) if (TARGET Boost::filesystem) set(_found TRUE) - set(CXX_FILESYSTEM_HEADER boost/filesystem.hpp CACHE STRING "The header that should be included to obtain the filesystem APIs") - set(CXX_FILESYSTEM_NAMESPACE boost::filesystem CACHE STRING "The C++ namespace that contains the filesystem APIs") + set(CXX_FILESYSTEM_HEADER boost/filesystem.hpp CACHE STRING "The header that should be included to obtain the filesystem APIs" FORCE) + set(CXX_FILESYSTEM_NAMESPACE boost::filesystem CACHE STRING "The C++ namespace that contains the filesystem APIs" FORCE) add_library(std_filesystem INTERFACE) target_compile_features(std_filesystem INTERFACE cxx_std_17) target_link_libraries(std_filesystem INTERFACE Boost::boost Boost::filesystem) add_library(std::filesystem ALIAS std_filesystem) endif () +elseif (NOT _found AND "ghc" IN_LIST want_components) + message("-- Using ghc::filesystem (git download)") + set (GHC_FILESYSTEM ghcFilesystem_git) + ExternalProject_Add(${GHC_FILESYSTEM} + GIT_REPOSITORY "https://github.com/gulrak/filesystem.git" + GIT_TAG "v1.3.2" + LOG_DOWNLOAD 1 + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + UPDATE_COMMAND "" + INSTALL_COMMAND "" + ) + set(_found TRUE) + set(CXX_FILESYSTEM_HEADER ghc/filesystem.hpp CACHE STRING "The header that should be included to obtain the filesystem APIs" FORCE) + set(CXX_FILESYSTEM_NAMESPACE ghc::filesystem CACHE STRING "The C++ namespace that contains the filesystem APIs" FORCE) + + add_library(std_filesystem INTERFACE) + add_dependencies(std_filesystem ghcFilesystem_git) + target_compile_features(std_filesystem INTERFACE cxx_std_17) + ExternalProject_Get_Property(${GHC_FILESYSTEM} SOURCE_DIR) + file(MAKE_DIRECTORY "${SOURCE_DIR}/include") + target_include_directories(std_filesystem INTERFACE "${SOURCE_DIR}/include") + + add_library(std::filesystem ALIAS std_filesystem) endif () diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d9480db0..e615c29e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -84,6 +84,7 @@ unset (xournalpp_SOURCES_RECURSE) add_library (xournalpp-core OBJECT ${xournalpp_SOURCES}) add_dependencies (xournalpp-core util) target_compile_features (xournalpp-core PUBLIC ${PROJECT_CXX_FEATURES}) +target_link_libraries(xournalpp-core util) ## xournalpp main program ## add_executable (xournalpp diff --git a/src/gui/Layout.cpp b/src/gui/Layout.cpp index 77d9bf02..e346f93b 100644 --- a/src/gui/Layout.cpp +++ b/src/gui/Layout.cpp @@ -109,7 +109,7 @@ void Layout::updateVisibility() { } if (mostPageNr) { - this->view->getControl()->firePageSelected(mostPageNr.value()); + this->view->getControl()->firePageSelected(*mostPageNr); } }