Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,9 @@ elseif(WIN32)
endif()
endif()

option(CORRADE_WITH_FILESYSTEM "Build Filesystem library" ON)
option(CORRADE_WITH_INTERCONNECT "Build Interconnect library" ON)
option(CORRADE_WITH_PLUGINMANAGER "Build PluginManager library" ON)
cmake_dependent_option(CORRADE_WITH_PLUGINMANAGER "Build PluginManager library" ON "NOT CORRADE_WITH_FILESYSTEM" ON)
option(CORRADE_WITH_TESTSUITE "Build TestSuite library" ON)
cmake_dependent_option(CORRADE_WITH_UTILITY "Build Utility library" ON "NOT CORRADE_WITH_INTERCONNECT;NOT CORRADE_WITH_PLUGINMANAGER;NOT CORRADE_WITH_TESTSUITE" ON)
# If we're crosscompiling and the native executable is found, we can skip
Expand Down Expand Up @@ -539,6 +540,40 @@ if(CORRADE_BUILD_DEPRECATED AND CORRADE_INCLUDE_INSTALL_PREFIX AND NOT CORRADE_I
set(CORRADE_INCLUDE_INSTALL_DIR ${CORRADE_INCLUDE_INSTALL_PREFIX}/${CORRADE_INCLUDE_INSTALL_DIR})
endif()

# Separate install dirs for debug and release plugins
set(CORRADE_PLUGINS_DEBUG_BINARY_INSTALL_DIR ${CORRADE_BINARY_INSTALL_DIR}/corrade-d)
set(CORRADE_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR ${CORRADE_LIBRARY_INSTALL_DIR}/corrade-d)
set(CORRADE_PLUGINS_RELEASE_BINARY_INSTALL_DIR ${CORRADE_BINARY_INSTALL_DIR}/corrade)
set(CORRADE_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR ${CORRADE_LIBRARY_INSTALL_DIR}/corrade)

set(CORRADE_PLUGINS_FILESYSTEM_DEBUG_BINARY_INSTALL_DIR ${CORRADE_PLUGINS_DEBUG_BINARY_INSTALL_DIR}/filesystems)
set(CORRADE_PLUGINS_FILESYSTEM_DEBUG_LIBRARY_INSTALL_DIR ${CORRADE_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR}/filesystems)
set(CORRADE_PLUGINS_FILESYSTEM_RELEASE_BINARY_INSTALL_DIR ${CORRADE_PLUGINS_RELEASE_BINARY_INSTALL_DIR}/filesystems)
set(CORRADE_PLUGINS_FILESYSTEM_RELEASE_LIBRARY_INSTALL_DIR ${CORRADE_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR}/filesystems)

# Make these paths configurable from outside. This is *not* PATH, because CMake
# always converts the path to an absolute location internally, making it
# impossible to specify relative paths there. Sorry in advance for not having
# the dir selection button in CMake GUI.
set(CORRADE_PLUGINS_DEBUG_DIR ""
CACHE STRING "Base directory where to look for Corrade plugins for debug builds")
set(CORRADE_PLUGINS_RELEASE_DIR ""
CACHE STRING "Base directory where to look for Corrade plugins for release builds")
set(CORRADE_PLUGINS_DIR ""
CACHE STRING "Base directory where to look for Corrade plugins")

# Plugin directories. Set only if the above are non-empty. otherwise empty as
# well.
if(CORRADE_PLUGINS_DIR)
set(CORRADE_PLUGINS_FILESYSTEM_DIR ${CORRADE_PLUGINS_DIR}/filesystems)
endif()
if(CORRADE_PLUGINS_DEBUG_DIR)
set(CORRADE_PLUGINS_FILESYSTEM_DEBUG_DIR ${CORRADE_PLUGINS_DEBUG_DIR}/filesystems)
endif()
if(CORRADE_PLUGINS_RELEASE_DIR)
set(CORRADE_PLUGINS_FILESYSTEM_RELEASE_DIR ${CORRADE_PLUGINS_RELEASE_DIR}/filesystems)
endif()

# Library version. CORRADE_VERSION_YEAR/MONTH is used in
# src/Corrade/CMakeLists.txt to generate the version.h header.
set(CORRADE_LIBRARY_VERSION 2.4)
Expand Down
12 changes: 12 additions & 0 deletions doc/building-corrade.dox
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,8 @@ By default the library is built with everything included. Using the following
`CORRADE_WITH_*` CMake options you can specify which parts will be built and
which not:

- `CORRADE_WITH_FILESYSTEM` --- Build the @ref Filesystem library. Enables
also building of the PluginManager library.
- `CORRADE_WITH_INTERCONNECT` --- Build the @ref Interconnect library.
Enables also building of the Utility library.
- `CORRADE_WITH_MAIN` --- build The @ref main "Main" library. Enabled
Expand Down Expand Up @@ -674,6 +676,16 @@ compatibility if `CORRADE_BUILD_DEPRECATED` isn't disabled.
with the unified sysroot layout. Defaults to ``.``. If a relative path is
used, it's relative to `CMAKE_INSTALL_PREFIX`.

Various plugin interfaces search for plugins in locations and order documented
in @ref PluginManager::implicitPluginSearchPaths() and equivalent functions in
plugin interfaces. In most cases the implicit behavior does the right
thing, but if you need to override those, use the `CORRADE_PLUGINS_DIR`,
`CORRADE_PLUGINS_DEBUG_DIR` and `CORRADE_PLUGINS_RELEASE_DIR` CMake variables.
Those are empty by default, which means no hardcoded path is used. Another
option is supplying the plugin search path to the @ref PluginManager::Manager
constructor either using the same CMake variables (passed through to
preprocessor, see @ref corrade-cmake) or via any other means.

@subsection building-corrade-tests Building and running tests

Building of tests is controlled by the following options:
Expand Down
14 changes: 10 additions & 4 deletions doc/corrade-cmake.dox
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,21 @@ following:

- `Corrade_FOUND` --- Whether the base library was found
- `CORRADE_LIB_SUFFIX_MODULE` --- Path to `CorradeLibSuffix.cmake` module,
which tries to autodetect value of `LIB_SUFFIX` variable
- `CORRADE_INCLUDE_INSTALL_PREFIX` --- Prefix where to put
platform-independent include and other files, defaults to `.`. If a
relative path is used, it's relative to `CMAKE_INSTALL_PREFIX`.
which tries to autodetect the `LIB_SUFFIX` variable
- `CORRADE_PLUGINS_DEBUG_DIR` --- Base directory with dynamic plugins for
debug builds, defaults to `corrade-d/` subdirectory of dir where Corrade libraries were found
- `CORRADE_PLUGINS_RELEASE_DIR` --- Base directory with dynamic plugins for
release builds, defaults to `corrade/` subdirectory of dir where Corrade
libraries were found
- `CORRADE_PLUGINS_DIR` --- Base directory with dynamic plugins, defaults to
`CORRADE_PLUGINS_RELEASE_DIR` in release builds and multi-configuration
builds or to `CORRADE_PLUGINS_DEBUG_DIR` in debug builds

This command will try to find only the base library, not the optional
components, which are:

- `Containers` --- @ref Containers library
- `Filesystem` --- @ref Filesystem library
- `Interconnect` --- @ref Interconnect library
- `Main` --- @ref main "Main" library
- `PluginManager` --- @ref PluginManager library
Expand Down
50 changes: 44 additions & 6 deletions modules/FindCorrade.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,24 @@
# This module tries to find the base Corrade library and then defines the
# following:
#
# Corrade_FOUND - Whether the base library was found
# CORRADE_LIB_SUFFIX_MODULE - Path to CorradeLibSuffix.cmake module
# Corrade_FOUND - Whether the base library was found
# CORRADE_LIB_SUFFIX_MODULE - Path to CorradeLibSuffix.cmake module
# CORRADE_PLUGINS_DEBUG_DIR - Base directory with dynamic plugins for
# debug builds, defaults to corrade-d/ subdirectory of dir where Corrade
# libraries were found
# CORRADE_PLUGINS_RELEASE_DIR - Base directory with dynamic plugins for
# release builds, defaults to corrade/ subdirectory of dir where Corrade
# libraries were found
# CORRADE_PLUGINS_DIR - Base directory with dynamic plugins,
# defaults to :variable:`CORRADE_PLUGINS_RELEASE_DIR` in release builds and
# multi-configuration builds or to :variable:`CORRADE_PLUGINS_DEBUG_DIR` in
# debug builds
#
# This command will try to find only the base library, not the optional
# components, which are:
#
# Containers - Containers library
# Filesystem - Filesystem library
# Interconnect - Interconnect library
# Main - Main library
# PluginManager - PluginManager library
Expand Down Expand Up @@ -137,6 +148,18 @@
# C++11, 14, 17 or 20 in cases where it's not possible to use
# :prop_tgt:`CORRADE_CXX_STANDARD`. Not defined if a standard switch is
# already present in :variable:`CMAKE_CXX_FLAGS`.
# CORRADE_BINARY_INSTALL_DIR - Binary installation directory
# CORRADE_LIBRARY_INSTALL_DIR - Library installation directory
# CORRADE_PLUGINS_[DEBUG|RELEASE]_BINARY_INSTALL_DIR - Plugin binary
# installation directory
# CORRADE_PLUGINS_[DEBUG|RELEASE]_LIBRARY_INSTALL_DIR - Plugin library
# installation directory
# CORRADE_PLUGINS_FILESYSTEM_[DEBUG|RELEASE]_BINARY_INSTALL_DIR - Filesystem
# plugin binary installation directory
# CORRADE_PLUGINS_FILESYSTEM_[DEBUG|RELEASE]_LIBRARY_INSTALL_DIR - Filesystem
# plugin library installation directory
# CORRADE_INCLUDE_INSTALL_DIR - Header installation directory
# CORRADE_PLUGINS_INCLUDE_INSTALL_DIR - Plugin header installation directory
#
# Corrade provides these macros and functions:
#
Expand Down Expand Up @@ -373,7 +396,7 @@ set(CORRADE_LIB_SUFFIX_MODULE ${_CORRADE_MODULE_DIR}/CorradeLibSuffix.cmake)
# Component distinction (listing them explicitly to avoid mistakes with finding
# unknown components)
set(_CORRADE_LIBRARY_COMPONENTS
Containers Interconnect Main PluginManager TestSuite Utility)
Containers Filesystem Interconnect Main PluginManager TestSuite Utility)
# These libraries are excluded from DLL detection if Corrade is built as shared
set(_CORRADE_LIBRARY_COMPONENTS_ALWAYS_STATIC
Main)
Expand All @@ -386,10 +409,11 @@ set(_CORRADE_EXECUTABLE_COMPONENTS rc)
# Currently everything is enabled implicitly. Keep in sync with Corrade's root
# CMakeLists.txt.
set(_CORRADE_IMPLICITLY_ENABLED_COMPONENTS
Containers Interconnect Main PluginManager TestSuite Utility rc)
Containers Filesystem Interconnect Main PluginManager TestSuite Utility rc)

# Inter-component dependencies
set(_CORRADE_Containers_DEPENDENCIES Utility)
set(_CORRADE_Filesystem_DEPENDENCIES PluginManager)
set(_CORRADE_Interconnect_DEPENDENCIES Containers Utility)
set(_CORRADE_PluginManager_DEPENDENCIES Containers Utility rc)
set(_CORRADE_TestSuite_DEPENDENCIES Containers Utility Main) # see below
Expand Down Expand Up @@ -582,6 +606,7 @@ foreach(_component ${Corrade_FIND_COMPONENTS})
endif()

# No special setup for Containers library
# No special setup for Filesystem library

# Interconnect library
if(_component STREQUAL Interconnect)
Expand Down Expand Up @@ -736,6 +761,7 @@ if(NOT CMAKE_VERSION VERSION_LESS 3.16)
set(_CORRADE_REASON_FAILURE_MESSAGE REASON_FAILURE_MESSAGE "${_CORRADE_REASON_FAILURE_MESSAGE}")
endif()

# Complete the check with also all components
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Corrade REQUIRED_VARS
CORRADE_INCLUDE_DIR
Expand All @@ -744,12 +770,24 @@ find_package_handle_standard_args(Corrade REQUIRED_VARS
HANDLE_COMPONENTS
${_CORRADE_REASON_FAILURE_MESSAGE})

# Finalize the finding process
include(${CORRADE_USE_MODULE})

# Installation dirs
include(${CORRADE_LIB_SUFFIX_MODULE})
set(CORRADE_BINARY_INSTALL_DIR bin)
set(CORRADE_LIBRARY_INSTALL_DIR lib${LIB_SUFFIX})
set(CORRADE_INCLUDE_INSTALL_DIR include/Corrade)

set(CORRADE_PLUGINS_INCLUDE_INSTALL_DIR include/CorradePlugins)
set(CORRADE_PLUGINS_DEBUG_BINARY_INSTALL_DIR ${CORRADE_BINARY_INSTALL_DIR}/corrade-d)
set(CORRADE_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR ${CORRADE_LIBRARY_INSTALL_DIR}/corrade-d)
set(CORRADE_PLUGINS_RELEASE_BINARY_INSTALL_DIR ${CORRADE_BINARY_INSTALL_DIR}/corrade)
set(CORRADE_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR ${CORRADE_LIBRARY_INSTALL_DIR}/corrade)
if(CORRADE_BUILD_DEPRECATED AND CORRADE_INCLUDE_INSTALL_PREFIX AND NOT CORRADE_INCLUDE_INSTALL_PREFIX STREQUAL ".")
message(DEPRECATION "CORRADE_INCLUDE_INSTALL_PREFIX is obsolete as its primary use was for old Android NDK versions. Please switch to the NDK r19+ layout instead of using this variable and recreate your build directory to get rid of this warning.")
set(CORRADE_INCLUDE_INSTALL_DIR ${CORRADE_INCLUDE_INSTALL_PREFIX}/${CORRADE_INCLUDE_INSTALL_DIR})
endif()

set(CORRADE_PLUGINS_FILESYSTEM_DEBUG_BINARY_INSTALL_DIR ${CORRADE_PLUGINS_DEBUG_BINARY_INSTALL_DIR}/filesystems)
set(CORRADE_PLUGINS_FILESYSTEM_DEBUG_LIBRARY_INSTALL_DIR ${CORRADE_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR}/filesystems)
set(CORRADE_PLUGINS_FILESYSTEM_RELEASE_BINARY_INSTALL_DIR ${CORRADE_PLUGINS_RELEASE_BINARY_INSTALL_DIR}/filesystems)
set(CORRADE_PLUGINS_FILESYSTEM_RELEASE_LIBRARY_INSTALL_DIR ${CORRADE_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR}/filesystems)
4 changes: 4 additions & 0 deletions src/Corrade/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ if(CORRADE_WITH_UTILITY) # Cyclic dependency of Containers and Utility
add_subdirectory(Containers)
endif()

if(CORRADE_WITH_FILESYSTEM)
add_subdirectory(Filesystem)
endif()

if(CORRADE_WITH_INTERCONNECT)
add_subdirectory(Interconnect)
endif()
Expand Down
33 changes: 33 additions & 0 deletions src/Corrade/Filesystem/AbstractFilesystem.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
This file is part of Corrade.

Copyright © 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016,
2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025
Vladimír Vondruš <mosra@centrum.cz>

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/

#include "AbstractFilesystem.h"

namespace Corrade { namespace Filesystem {



}}
Loading