diff --git a/CMake/Dependencies.cmake b/CMake/Dependencies.cmake new file mode 100644 index 000000000..09d87392b --- /dev/null +++ b/CMake/Dependencies.cmake @@ -0,0 +1,48 @@ +#[[ +Function to print a message to the console indicating a dependency hasn't been found +Arguments: + - friendly_name: Friendly name of the target + - target_name: Name of the CMake target the project is supposed to link against +]] +function(report_not_found_dependency friendly_name target_name) + message(FATAL_ERROR + "${friendly_name} has not been found by CMake. If you are consuming RmlUi as a subdirectory " + "inside another CMake project, please ensure that ${friendly_name} can be linked using \"${target_name}\" " + "as its target name. You can create an ALIAS target to offer an alternative name for a CMake target." + ) +endfunction() + +# Freetype +if(NOT RMLUI_NO_FONT_INTERFACE_DEFAULT) + # Declaring Freetype as a soft dependency so that it doesn't error out if the package + # is declared by other means + find_package("Freetype") + + # Instead of relying on the Freetype_NOTFOUND variable, we check directly for the target + if(NOT TARGET Freetype::Freetype) + report_not_found_dependency("Freetype" Freetype::Freetype) + endif() + + # Warn about problematic versions of the library with MSVC + if(DEFINED FREETYPE_VERSION_STRING) + if((${FREETYPE_VERSION_STRING} VERSION_GREATER_EQUAL "2.11.0") AND (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")) + message(WARNING "Using Freetype 2.11.0 or greater with MSVC can cause issues.") + endif() + else() + if(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC") + message(WARNING "Using Freetype 2.11.0 or greater with MSVC can cause issues.") + endif() + endif() +endif() + +# rlottie +if(RMLUI_ENABLE_LOTTIE_PLUGIN) + # Declaring rlottie as a soft dependency so that it doesn't error out if the package + # is declared by other means + find_package("rlottie") + + # Instead of relying on the rlottie_NOTFOUND variable, we check directly for the target + if(NOT TARGET rlottie::rlottie) + report_not_found_dependency("rlottie" rlottie::rlottie) + endif() +endif() diff --git a/CMake/SamplesDependencies.cmake b/CMake/SamplesDependencies.cmake new file mode 100644 index 000000000..73058f298 --- /dev/null +++ b/CMake/SamplesDependencies.cmake @@ -0,0 +1,23 @@ +#[[ +Function to print a message to the console indicating a dependency hasn't been found +Arguments: + - friendly_name: Friendly name of the target + - target_name: Name of the CMake target the project is supposed to link against +]] +function(report_not_found_dependency friendly_name target_name) + message(FATAL_ERROR + "${friendly_name} has not been found by CMake. If you are consuming RmlUi as a subdirectory " + "inside another CMake project, please ensure that ${friendly_name} can be linked using \"${target_name}\" " + "as its target name. You can create an ALIAS target to offer an alternative name for a CMake target." + ) +endfunction() + +# GLFW +# Declaring GLFW as a soft dependency so that it doesn't error out if the package +# is declared by other means +find_package("glfw3" "3.3") + +# Instead of relying on the glfw3_NOTFOUND variable, we check directly for the target +if(NOT TARGET glfw) + report_not_found_dependency("GLFW" glfw) +endif() diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..2d43f27ee --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,37 @@ +# Using CMake 3.10.2 as minimum to support all platforms of interest +# https://github.com/mikke89/RmlUi/issues/198#issuecomment-1246957062 +cmake_minimum_required(VERSION "3.10.2") + +# Define CMake project +project("RmlUi" + VERSION "6.0" + DESCRIPTION "C++ user interface package based on the HTML and CSS standards" + LANGUAGES "C" "CXX" +) + +# Set minimum required C++ standard +set(CMAKE_CXX_STANDARD_REQUIRED "14") + +# Declare project-specific options +# "RMLUI_" prefix is included in order to take advantage of the fact that the +# CMake GUI can group variables based on their prefix to make more clear +# which options are specific to this project +option(RMLUI_BUILD_SAMPLES "Build samples of the library." OFF) +option(RMLUI_NO_FONT_INTERFACE_DEFAULT "Do not include the default font engine in the build. Allows building without the FreeType dependency, but a custom font engine must be created and set." OFF) +option(RMLUI_ENABLE_LOTTIE_PLUGIN "Enable plugin for Lottie animations. Requires the rlottie library." OFF) +option(RMLUI_ENABLE_SVG_PLUGIN "Enable plugin for SVG images. Requires the lunasvg library." OFF) +set(RMLUI_SAMPLES_BACKEND "GLFW_GL3" CACHE STRING "Backend ID to use when building the RmlUi samples. Choose one from ./CMake/BackendFileList.cmake.") + + +# Add custom CMake modules path for external dependencies +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake/Modules") + +# Set up external dependencies +include("CMake/Dependencies.cmake") + +# Add CMake subdirectories +add_subdirectory("Source") + +if(RMLUI_BUILD_SAMPLES) + add_subdirectory("Samples") +endif() diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..e6b6d3f89 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,45 @@ +# RmlUi contribution guidelines + +## CMake + +The RmlUi project aims to be both compiled standalone and as a subfolder inside a bigger CMake project, allowing other CMake projects to integrate the library in their build pipeline without too much hassle. For this reason, the following conventions must be followed when editing CMake code for the project: + +- **Follow the [Modern CMake](https://cliutils.gitlab.io/modern-cmake/) conventions** + +- **Go simple:** CMake already allows to do many things without reinventing the wheel. Most code often written in a CMake build script is +not necessarily related to the project itself but to covering specific compilation scenarios and to set certain flags that aren't really +necessary as a means to pre-configure the project without having to input the options at configure time via the CMake CLI. This is a bad +practice that quickly increases the complexity of the build script. Instead: + - **For flags and options related to cross-compilation scenarios**, [CMake toolchain files](https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html) should be used to set such flags and options. + - **If a compiler or compiler version is being problematic** about something, use a [CMake initial cache script](https://cmake.org/cmake/help/latest/manual/cmake.1.html#options) or CMake preset and advise the user to use it. This way, the consumer will always know when the compilation settings are being diverted from the compiler's default settings. + + Although not recommended, [CMake toolchain files](https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html) can be used as well as long as the [`CMAKE_SYSTEM_NAME`](https://cmake.org/cmake/help/latest/variable/CMAKE_SYSTEM_NAME.html) variable doesn't get set in the toolchain file. + + - **For platform-specific and case-specific flags** like building shared libraries or building framework packages for iOS and macOS, this + should be specified by the consumer, not by the project itself. For this, CMake toolchain files, CMake presets and initial cache scripts can be used. + + - **To share CMake flag configurations to save consumers time** use [CMake presets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html), [CMake initial cache scripts](https://cmake.org/cmake/help/latest/manual/cmake.1.html#options) and ready-to-copy CLI commands in the documentation. + +- **Assume the person building the library is a consumer:** To save trouble to consumers, the default behavior of the CMake project should be oriented towards the bare minimum needed for the library to work (tests disabled, compilation of examples disabled, additional plugins disabled...). If the consumer needs anything more, they should be the ones tweaking the behavior of the project to suit their needs via CMake options. + +- **Use quotes to declare string literals:** + If not quoted and depending on the scenario, CMake and some of its functions might read a string literal might get misunderstood as a variable reference. It also helps with readability. + +- **Avoid setting global variables at all costs:** These should be set, if necessary, by the consumer via the CLI, a CMake configure preset, a CMake initial cache script or CMake variables coming from a parent CMake project, not by the project itself. This includes, among others, the widely used `CMAKE__FLAGS`. + +- **Avoid setting compiler and/or linker flags at all costs:** + Many projects have the habit of setting + compiler flags for things like preventing certain irremediable compiler warnings from appearing + in the compiler logs and to mitigate other compiler-specific issues, often creating an unnecessary + dependency on certain compilers, increasing the complexity of build scripts and potentially + creating issues with the project consuming the library. + + Both the code and the CMake project should aim to be as toolchain-agnostic as possible and therefore avoid + any kind of compiler-specific code as much as possible. **In the event that compiler flags need to be set and used in every possible use case of the library, please do so on a target basis** using either [CMake compile features](https://cmake.org/cmake/help/latest/manual/cmake-compile-features.7.html) + and [`target_compile_features()`](https://cmake.org/cmake/help/latest/command/target_compile_features.html) when possible or [`target_compile_options()`](https://cmake.org/cmake/help/latest/command/target_compile_options.html). The use of such flags by the project by default needs to be noted in the documentation in order to help consumers predict and mitigate any issues that may arise when consuming the library. + + If the goal is to save time for consumers to set certain options, these should be instead reproduced in a [CMake configure preset](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html#configure-preset), a [CMake initial cache script](https://cmake.org/cmake/help/latest/manual/cmake.1.html#options) (for CMake versions without preset support) and specified in the documentation so that the consumer is always aware of which options are being used to compile the library. + +* **Do not reference [`CMAKE_SOURCE_DIR`](https://cmake.org/cmake/help/latest/variable/CMAKE_SOURCE_DIR.html):** RmlUi aims to be consumable by other CMake projects when being included as a CMake sub-project using [`add_subdirectory()`](https://cmake.org/cmake/help/latest/command/add_subdirectory.html). In this scenario, `CMAKE_SOURCE_DIR` won't point to the top source directory of the RmlUi source, but to the top source directory of the parent CMake project consuming RmlUi. For this reason, **reference [`PROJECT_SOURCE_DIR`](https://cmake.org/cmake/help/latest/variable/PROJECT_SOURCE_DIR.html) instead**. + +- **Use [generator expressions](https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html) when relevant instead of their CMake variable counterparts:** To find the folder where the executable has been built or to simply find the current build type, CMake variables like `CMAKE_BUILD_TYPE` and `CMAKE_BINARY_DIR` have been used, but this behavior is not recommended as every build system has its own conventions when it comes to folder paths and not all details are known at configure time, specially when multi-config build systems like MSBuild are used. For this reason, it is strongly advised to use CMake generator expressions whenever possible to ensure the project can be compiled regardless of the build system used. If a CMake feature you need to use doesn't work with generator expressions, try making a CMake script and [calling it at build time](https://cmake.org/cmake/help/latest/manual/cmake.1.html#run-a-script) using [`add_custom_command()`](https://cmake.org/cmake/help/latest/command/add_custom_command.html) or create an issue or discussion in the RmlUi directory. diff --git a/Samples/CMakeLists.txt b/Samples/CMakeLists.txt new file mode 100644 index 000000000..4037006f8 --- /dev/null +++ b/Samples/CMakeLists.txt @@ -0,0 +1,12 @@ +# Declare dependencies for samples +include("${PROJECT_SOURCE_DIR}/CMake/SamplesDependencies.cmake") + +# Change the runtime output directory of all target declared in this scope +# This is needed so that the shell library can find the samples asset files +# when running them from a CMake binary directory +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +# Add shell library for the samples +add_subdirectory("shell") + +add_subdirectory("basic") diff --git a/Samples/basic/CMakeLists.txt b/Samples/basic/CMakeLists.txt new file mode 100644 index 000000000..aea722514 --- /dev/null +++ b/Samples/basic/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory("demo") +add_subdirectory("lottie") diff --git a/Samples/basic/demo/CMakeLists.txt b/Samples/basic/demo/CMakeLists.txt new file mode 100644 index 000000000..6d827fc7e --- /dev/null +++ b/Samples/basic/demo/CMakeLists.txt @@ -0,0 +1,5 @@ +add_executable(rmlui_samples_demo + src/main.cpp +) + +target_link_libraries(rmlui_samples_demo PRIVATE rmlui_samples_shell) diff --git a/Samples/basic/lottie/CMakeLists.txt b/Samples/basic/lottie/CMakeLists.txt new file mode 100644 index 000000000..46595ba1e --- /dev/null +++ b/Samples/basic/lottie/CMakeLists.txt @@ -0,0 +1,5 @@ +add_executable(rmlui_samples_lottie + src/main.cpp +) + +target_link_libraries(rmlui_samples_lottie PRIVATE rmlui_samples_shell) diff --git a/Samples/shell/CMakeLists.txt b/Samples/shell/CMakeLists.txt new file mode 100644 index 000000000..418f7fefd --- /dev/null +++ b/Samples/shell/CMakeLists.txt @@ -0,0 +1,20 @@ +# Quoting the source file paths isn't necessary because add_library() doesn't read +# CMake variables, just strings +add_library(rmlui_samples_shell + src/PlatformExtensions.cpp + src/RendererExtensions.cpp + src/Shell.cpp + src/ShellFileInterface.cpp +) + +# Add sources for the backend +include("${PROJECT_SOURCE_DIR}/CMake/BackendFileList.cmake") +target_sources(rmlui_samples_shell PRIVATE ${${RMLUI_SAMPLES_BACKEND}_SRC_FILES} ${${RMLUI_SAMPLES_BACKEND}_HDR_FILES}) + +target_include_directories(rmlui_samples_shell PUBLIC "include" "${PROJECT_SOURCE_DIR}/Backends") + +# Link against required libraries for backend +target_link_libraries(rmlui_samples_shell PRIVATE glfw) + +target_link_libraries(rmlui_samples_shell PUBLIC RmlUi::RmlUi RmlUi::Debugger) + diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt new file mode 100644 index 000000000..66a26e46a --- /dev/null +++ b/Source/CMakeLists.txt @@ -0,0 +1,7 @@ +# Add plugin directories +add_subdirectory("Lottie") + +# Add main RmlUi directory +add_subdirectory("Core") + +add_subdirectory("Debugger") diff --git a/Source/Core/CMakeLists.txt b/Source/Core/CMakeLists.txt new file mode 100644 index 000000000..18ff8bcd3 --- /dev/null +++ b/Source/Core/CMakeLists.txt @@ -0,0 +1,263 @@ +# Declare core RmlUi library +# Not explicitly setting library type so that it can be chosen by consumer +# using BUILD_SHARED_LIBS +# +# Although not necessary, header files are also included to improve IntelliSense +# capabilities on IDEs and language servers +# +# Tip: On UNIX systems you can run this on the current source folder to get the +# entire list of files in the folder copied on the files.txt file: +# +# ls *.cpp *.h > files.txt +# +# After running it, you can copy the text in that file and paste it here as a list +# of source files +# +# Quoting the source file paths isn't necessary because add_library() doesn't read +# CMake variables, just strings +add_library(rmlui_core + BaseXMLParser.cpp + Box.cpp + Clock.cpp + Clock.h + ComputedValues.cpp + ComputeProperty.cpp + ComputeProperty.h + Context.cpp + ContextInstancer.cpp + ContextInstancerDefault.cpp + ContextInstancerDefault.h + ConvolutionFilter.cpp + Core.cpp + DataController.cpp + DataControllerDefault.cpp + DataControllerDefault.h + DataController.h + DataExpression.cpp + DataExpression.h + DataModel.cpp + DataModel.h + DataModelHandle.cpp + DataTypeRegister.cpp + DataVariable.cpp + DataView.cpp + DataViewDefault.cpp + DataViewDefault.h + DataView.h + Decorator.cpp + DecoratorGradient.cpp + DecoratorGradient.h + DecoratorInstancer.cpp + DecoratorNinePatch.cpp + DecoratorNinePatch.h + DecoratorTiledBox.cpp + DecoratorTiledBox.h + DecoratorTiledBoxInstancer.cpp + DecoratorTiledBoxInstancer.h + DecoratorTiled.cpp + DecoratorTiled.h + DecoratorTiledHorizontal.cpp + DecoratorTiledHorizontal.h + DecoratorTiledHorizontalInstancer.cpp + DecoratorTiledHorizontalInstancer.h + DecoratorTiledImage.cpp + DecoratorTiledImage.h + DecoratorTiledImageInstancer.cpp + DecoratorTiledImageInstancer.h + DecoratorTiledInstancer.cpp + DecoratorTiledInstancer.h + DecoratorTiledVertical.cpp + DecoratorTiledVertical.h + DecoratorTiledVerticalInstancer.cpp + DecoratorTiledVerticalInstancer.h + DocumentHeader.cpp + DocumentHeader.h + ElementAnimation.cpp + ElementAnimation.h + ElementBackgroundBorder.cpp + ElementBackgroundBorder.h + Element.cpp + ElementDecoration.cpp + ElementDecoration.h + ElementDefinition.cpp + ElementDefinition.h + ElementDocument.cpp + ElementHandle.cpp + ElementHandle.h + ElementInstancer.cpp + ElementScroll.cpp + ElementStyle.cpp + ElementStyle.h + ElementText.cpp + ElementUtilities.cpp + Event.cpp + EventDispatcher.cpp + EventDispatcher.h + EventInstancer.cpp + EventInstancerDefault.cpp + EventInstancerDefault.h + EventListenerInstancer.cpp + EventSpecification.cpp + EventSpecification.h + Factory.cpp + FileInterface.cpp + FileInterfaceDefault.cpp + FileInterfaceDefault.h + FontEffectBlur.cpp + FontEffectBlur.h + FontEffect.cpp + FontEffectGlow.cpp + FontEffectGlow.h + FontEffectInstancer.cpp + FontEffectOutline.cpp + FontEffectOutline.h + FontEffectShadow.cpp + FontEffectShadow.h + FontEngineInterface.cpp + GeometryBackgroundBorder.cpp + GeometryBackgroundBorder.h + Geometry.cpp + GeometryDatabase.cpp + GeometryDatabase.h + GeometryUtilities.cpp + IdNameMap.h + Log.cpp + Math.cpp + Memory.cpp + Memory.h + ObserverPtr.cpp + Plugin.cpp + PluginRegistry.cpp + PluginRegistry.h + Pool.h + precompiled.h + Profiling.cpp + PropertiesIterator.h + PropertiesIteratorView.cpp + Property.cpp + PropertyDefinition.cpp + PropertyDictionary.cpp + PropertyParserAnimation.cpp + PropertyParserAnimation.h + PropertyParserColour.cpp + PropertyParserColour.h + PropertyParserDecorator.cpp + PropertyParserDecorator.h + PropertyParserFontEffect.cpp + PropertyParserFontEffect.h + PropertyParserKeyword.cpp + PropertyParserKeyword.h + PropertyParserNumber.cpp + PropertyParserNumber.h + PropertyParserRatio.cpp + PropertyParserRatio.h + PropertyParserString.cpp + PropertyParserString.h + PropertyParserTransform.cpp + PropertyParserTransform.h + PropertyShorthandDefinition.h + PropertySpecification.cpp + RenderInterface.cpp + ScrollController.cpp + ScrollController.h + Spritesheet.cpp + Stream.cpp + StreamFile.cpp + StreamFile.h + StreamMemory.cpp + StringUtilities.cpp + StyleSheetContainer.cpp + StyleSheet.cpp + StyleSheetFactory.cpp + StyleSheetFactory.h + StyleSheetNode.cpp + StyleSheetNode.h + StyleSheetParser.cpp + StyleSheetParser.h + StyleSheetSelector.cpp + StyleSheetSelector.h + StyleSheetSpecification.cpp + SystemInterface.cpp + TemplateCache.cpp + TemplateCache.h + Template.cpp + Template.h + Texture.cpp + TextureDatabase.cpp + TextureDatabase.h + TextureLayout.cpp + TextureLayout.h + TextureLayoutRectangle.cpp + TextureLayoutRectangle.h + TextureLayoutRow.cpp + TextureLayoutRow.h + TextureLayoutTexture.cpp + TextureLayoutTexture.h + TextureResource.cpp + TextureResource.h + Transform.cpp + TransformPrimitive.cpp + TransformState.cpp + TransformState.h + TransformUtilities.cpp + TransformUtilities.h + Tween.cpp + TypeConverter.cpp + URL.cpp + Variant.cpp + WidgetScroll.cpp + WidgetScroll.h + XMLNodeHandlerBody.cpp + XMLNodeHandlerBody.h + XMLNodeHandler.cpp + XMLNodeHandlerDefault.cpp + XMLNodeHandlerDefault.h + XMLNodeHandlerHead.cpp + XMLNodeHandlerHead.h + XMLNodeHandlerTemplate.cpp + XMLNodeHandlerTemplate.h + XMLParser.cpp + XMLParseTools.cpp + XMLParseTools.h +) + +# Add public include directories +target_include_directories(rmlui_core PUBLIC "${PROJECT_SOURCE_DIR}/Include") + +# Add alias for the library so that a namespaced name can be used in the rest +# of the project to link against it +add_library(RmlUi::RmlUi ALIAS rmlui_core) + +# Set additional target properties +set_target_properties(rmlui_core PROPERTIES + # Add export name so that it can be exported with a namespaced name instead + # of using the name we actually used to declare the target + EXPORT_NAME "RmlUi::RmlUi" +) + +# Add the RmlUi element sources +add_subdirectory("Elements") +target_link_libraries(rmlui_core PRIVATE rmlui_core_elements) + +# Add the RmlUi layout sources +add_subdirectory("Layout") +target_link_libraries(rmlui_core PRIVATE rmlui_core_layout) + +# Negotiate usage of the default font engine +if(RMLUI_NO_FONT_INTERFACE_DEFAULT) + # Pass information to code via compile definition + target_compile_definitions(rmlui_core PRIVATE "RMLUI_NO_FONT_INTERFACE_DEFAULT") +else() + # Link against the default font engine + # Adding the subdirectory inside the conditional block so that compilation doesn't + # fail when CMake tries to build all targets, effectively hiding the CMake target from + # the build system if the default font interface is disabled + add_subdirectory("FontEngineDefault") + target_link_libraries(rmlui_core PRIVATE rmlui_core_fontenginedefault) +endif() + +# Negotiate usage of the Lottie plugin +if(RMLUI_ENABLE_LOTTIE_PLUGIN) + # Link against the Lottie plugin + target_link_libraries(rmlui_core PRIVATE rmlui_lottie) +endif() diff --git a/Source/Core/Elements/CMakeLists.txt b/Source/Core/Elements/CMakeLists.txt new file mode 100644 index 000000000..90bc9689f --- /dev/null +++ b/Source/Core/Elements/CMakeLists.txt @@ -0,0 +1,64 @@ +# Declare library +# +# Although not necessary, header files are also included to improve IntelliSense +# capabilities on IDEs and language servers +# +# Tip: On UNIX systems you can run this on the current source folder to get the +# entire list of files in the folder copied on the files.txt file: +# +# ls *.cpp *.h > files.txt +# +# After running it, you can copy the text in that file and paste it here as a list +# of source files +# +# Quoting the source file paths isn't necessary because list() doesn't read +# CMake variables, just strings +add_library(rmlui_core_elements INTERFACE) + +target_sources(rmlui_core_elements INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR}/ElementFormControl.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/ElementFormControlInput.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/ElementFormControlSelect.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/ElementFormControlTextArea.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/ElementForm.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/ElementImage.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/ElementImage.h + ${CMAKE_CURRENT_SOURCE_DIR}/ElementLabel.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/ElementLabel.h + ${CMAKE_CURRENT_SOURCE_DIR}/ElementProgress.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/ElementTabSet.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/ElementTextSelection.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/ElementTextSelection.h + ${CMAKE_CURRENT_SOURCE_DIR}/InputTypeButton.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InputTypeButton.h + ${CMAKE_CURRENT_SOURCE_DIR}/InputTypeCheckbox.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InputTypeCheckbox.h + ${CMAKE_CURRENT_SOURCE_DIR}/InputType.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InputType.h + ${CMAKE_CURRENT_SOURCE_DIR}/InputTypeRadio.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InputTypeRadio.h + ${CMAKE_CURRENT_SOURCE_DIR}/InputTypeRange.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InputTypeRange.h + ${CMAKE_CURRENT_SOURCE_DIR}/InputTypeSubmit.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InputTypeSubmit.h + ${CMAKE_CURRENT_SOURCE_DIR}/InputTypeText.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InputTypeText.h + ${CMAKE_CURRENT_SOURCE_DIR}/WidgetDropDown.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/WidgetDropDown.h + ${CMAKE_CURRENT_SOURCE_DIR}/WidgetSlider.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/WidgetSlider.h + ${CMAKE_CURRENT_SOURCE_DIR}/WidgetTextInput.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/WidgetTextInput.h + ${CMAKE_CURRENT_SOURCE_DIR}/WidgetTextInputMultiLine.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/WidgetTextInputMultiLine.h + ${CMAKE_CURRENT_SOURCE_DIR}/WidgetTextInputSingleLine.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/WidgetTextInputSingleLine.h + ${CMAKE_CURRENT_SOURCE_DIR}/WidgetTextInputSingleLinePassword.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/WidgetTextInputSingleLinePassword.h + ${CMAKE_CURRENT_SOURCE_DIR}/XMLNodeHandlerSelect.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/XMLNodeHandlerSelect.h + ${CMAKE_CURRENT_SOURCE_DIR}/XMLNodeHandlerTabSet.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/XMLNodeHandlerTabSet.h + ${CMAKE_CURRENT_SOURCE_DIR}/XMLNodeHandlerTextArea.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/XMLNodeHandlerTextArea.h +) diff --git a/Source/Core/FontEngineDefault/CMakeLists.txt b/Source/Core/FontEngineDefault/CMakeLists.txt new file mode 100644 index 000000000..6c402d10b --- /dev/null +++ b/Source/Core/FontEngineDefault/CMakeLists.txt @@ -0,0 +1,40 @@ +# Declare library +# +# Although not necessary, header files are also included to improve IntelliSense +# capabilities on IDEs and language servers +# +# Tip: On UNIX systems you can run this on the current source folder to get the +# entire list of files in the folder copied on the files.txt file: +# +# ls *.cpp *.h > files.txt +# +# After running it, you can copy the text in that file and paste it here as a list +# of source files +# +# Quoting the source file paths isn't necessary because list() doesn't read +# CMake variables, just strings +add_library(rmlui_core_fontenginedefault INTERFACE) + +# Using absolute paths to prevent improper interpretation of relative paths +# Relative paths can be used once the minimum CMake version is greater or +# equal than CMake 3.13 +target_sources(rmlui_core_fontenginedefault INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR}/FontEngineInterfaceDefault.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/FontEngineInterfaceDefault.h + ${CMAKE_CURRENT_SOURCE_DIR}/FontFace.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/FontFace.h + ${CMAKE_CURRENT_SOURCE_DIR}/FontFaceHandleDefault.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/FontFaceHandleDefault.h + ${CMAKE_CURRENT_SOURCE_DIR}/FontFaceLayer.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/FontFaceLayer.h + ${CMAKE_CURRENT_SOURCE_DIR}/FontFamily.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/FontFamily.h + ${CMAKE_CURRENT_SOURCE_DIR}/FontProvider.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/FontProvider.h + ${CMAKE_CURRENT_SOURCE_DIR}/FontTypes.h + ${CMAKE_CURRENT_SOURCE_DIR}/FreeTypeInterface.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/FreeTypeInterface.h +) + +# Link library against Freetype +target_link_libraries(rmlui_core_fontenginedefault INTERFACE Freetype::Freetype) diff --git a/Source/Core/Layout/CMakeLists.txt b/Source/Core/Layout/CMakeLists.txt new file mode 100644 index 000000000..3ba6e772b --- /dev/null +++ b/Source/Core/Layout/CMakeLists.txt @@ -0,0 +1,57 @@ +# Declare library +# +# Although not necessary, header files are also included to improve IntelliSense +# capabilities on IDEs and language servers +# +# Tip: On UNIX systems you can run this on the current source folder to get the +# entire list of files in the folder copied on the files.txt file: +# +# ls *.cpp *.h > files.txt +# +# After running it, you can copy the text in that file and paste it here as a list +# of source files +# +# Quoting the source file paths isn't necessary because list() doesn't read +# CMake variables, just strings +add_library(rmlui_core_layout INTERFACE) + +# Using absolute paths to prevent improper interpretation of relative paths +# Relative paths can be used once the minimum CMake version is greater or +# equal than CMake 3.13 +target_sources(rmlui_core_layout INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR}/BlockContainer.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/BlockContainer.h + ${CMAKE_CURRENT_SOURCE_DIR}/BlockFormattingContext.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/BlockFormattingContext.h + ${CMAKE_CURRENT_SOURCE_DIR}/ContainerBox.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/ContainerBox.h + ${CMAKE_CURRENT_SOURCE_DIR}/FlexFormattingContext.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/FlexFormattingContext.h + ${CMAKE_CURRENT_SOURCE_DIR}/FloatedBoxSpace.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/FloatedBoxSpace.h + ${CMAKE_CURRENT_SOURCE_DIR}/FormattingContext.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/FormattingContext.h + ${CMAKE_CURRENT_SOURCE_DIR}/InlineBox.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InlineBox.h + ${CMAKE_CURRENT_SOURCE_DIR}/InlineContainer.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InlineContainer.h + ${CMAKE_CURRENT_SOURCE_DIR}/InlineLevelBox.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/InlineLevelBox.h + ${CMAKE_CURRENT_SOURCE_DIR}/InlineTypes.h + ${CMAKE_CURRENT_SOURCE_DIR}/LayoutBox.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/LayoutBox.h + ${CMAKE_CURRENT_SOURCE_DIR}/LayoutDetails.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/LayoutDetails.h + ${CMAKE_CURRENT_SOURCE_DIR}/LayoutEngine.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/LayoutEngine.h + ${CMAKE_CURRENT_SOURCE_DIR}/LayoutPools.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/LayoutPools.h + ${CMAKE_CURRENT_SOURCE_DIR}/LineBox.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/LineBox.h + ${CMAKE_CURRENT_SOURCE_DIR}/ReplacedFormattingContext.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/ReplacedFormattingContext.h + ${CMAKE_CURRENT_SOURCE_DIR}/TableFormattingContext.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/TableFormattingContext.h + ${CMAKE_CURRENT_SOURCE_DIR}/TableFormattingDetails.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/TableFormattingDetails.h +) diff --git a/Source/Debugger/CMakeLists.txt b/Source/Debugger/CMakeLists.txt new file mode 100644 index 000000000..a1592aca6 --- /dev/null +++ b/Source/Debugger/CMakeLists.txt @@ -0,0 +1,52 @@ +# Declare core RmlUi debugger +# Not explicitly setting library type so that it can be chosen by consumer +# using BUILD_SHARED_LIBS +# +# Although not necessary, header files are also included to improve IntelliSense +# capabilities on IDEs and language servers +# +# Tip: On UNIX systems you can run this on the current source folder to get the +# entire list of files in the folder copied on the files.txt file: +# +# ls *.cpp *.h > files.txt +# +# After running it, you can copy the text in that file and paste it here as a list +# of source files +# +# Quoting the source file paths isn't necessary because add_library() doesn't read +# CMake variables, just strings +add_library(rmlui_debugger + BeaconSource.h + CommonSource.h + Debugger.cpp + DebuggerPlugin.cpp + DebuggerPlugin.h + DebuggerSystemInterface.cpp + DebuggerSystemInterface.h + ElementContextHook.cpp + ElementContextHook.h + ElementInfo.cpp + ElementInfo.h + ElementLog.cpp + ElementLog.h + FontSource.h + Geometry.cpp + Geometry.h + InfoSource.h + LogSource.h + MenuSource.h +) + +# Add public include directories +target_include_directories(rmlui_debugger PUBLIC "${PROJECT_SOURCE_DIR}/Include") + +# Add alias for the library so that a namespaced name can be used in the rest +# of the project to link against it +add_library(RmlUi::Debugger ALIAS rmlui_debugger) + +# Set additional target properties +set_target_properties(rmlui_debugger PROPERTIES + # Add export name so that it can be exported with a namespaced name instead + # of using the name we actually used to declare the target + EXPORT_NAME "RmlUi::Debugger" +) diff --git a/Source/Lottie/CMakeLists.txt b/Source/Lottie/CMakeLists.txt new file mode 100644 index 000000000..650feb300 --- /dev/null +++ b/Source/Lottie/CMakeLists.txt @@ -0,0 +1,31 @@ +# Declare library +# +# Although not necessary, header files are also included to improve IntelliSense +# capabilities on IDEs and language servers +# +# Tip: On UNIX systems you can run this on the current source folder to get the +# entire list of files in the folder copied on the files.txt file: +# +# ls *.cpp *.h > files.txt +# +# After running it, you can copy the text in that file and paste it here as a list +# of source files +# +# Quoting the source file paths isn't necessary because list() doesn't read +# CMake variables, just strings +add_library(rmlui_lottie INTERFACE) + +# Using absolute paths to prevent improper interpretation of relative paths +# Relative paths can be used once the minimum CMake version is greater or +# equal than CMake 3.13 +target_sources(rmlui_lottie INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR}/ElementLottie.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/LottiePlugin.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/LottiePlugin.h +) + +# Link library against rlottie +target_link_libraries(rmlui_lottie INTERFACE rlottie::rlottie) + +# Notify both private and public sources about the usage of the plugin +target_compile_definitions(rmlui_lottie INTERFACE "RMLUI_ENABLE_LOTTIE_PLUGIN")