From deb90b7f09f7da236e61d08a24756e929f97b210 Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Mon, 13 Mar 2023 12:54:56 +0100 Subject: [PATCH 01/29] CMake: Rename old CMakeLists.txt --- CMakeLists.txt => CMakeLists_old.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename CMakeLists.txt => CMakeLists_old.txt (100%) diff --git a/CMakeLists.txt b/CMakeLists_old.txt similarity index 100% rename from CMakeLists.txt rename to CMakeLists_old.txt From 104fdb35d3ea6320733bde72b38b1c4365ec49a5 Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Wed, 12 Apr 2023 12:13:59 +0200 Subject: [PATCH 02/29] CMake modernization Partial re-write of the CMake project from scratch using modern CMake conventions. Available samples: benchmark, demo, lottie --- .github/workflows/build.yml | 88 ++-- CMake/BackendFileList.cmake | 121 ------ CMake/Backends.cmake | 158 +++++++ CMake/BackendsDependencies.cmake | 239 +++++++++++ CMake/Dependencies.cmake | 49 +++ .../{Modules => Modules.old}/FindLuaJIT.cmake | 0 .../FindPkgMacros.cmake | 0 CMake/{Modules => Modules.old}/FindSDL2.cmake | 0 .../FindSDL2_image.cmake | 0 CMake/{Modules => Modules.old}/FindSFML.cmake | 0 .../{Modules => Modules.old}/FindTracy.cmake | 0 .../Findlunasvg.cmake | 0 CMake/Modules/Emscripten/FindFreetype.cmake | 56 +++ CMake/Modules/Emscripten/FindOpenGL.cmake | 74 ++++ CMake/Modules/Emscripten/FindSDL.cmake | 68 +++ CMake/Modules/Emscripten/FindSDL_image.cmake | 73 ++++ CMake/Modules/Emscripten/Findglfw3.cmake | 58 +++ CMake/SamplesShellDependencies.cmake | 78 ++++ CMakeLists.txt | 41 ++ CONTRIBUTING.md | 47 +++ Include/RmlUi/Core/Header.h | 2 +- Include/RmlUi/Debugger/Header.h | 2 +- Samples/CMakeLists.txt | 42 ++ Samples/basic/CMakeLists.txt | 10 + Samples/basic/benchmark/CMakeLists.txt | 7 + Samples/basic/demo/CMakeLists.txt | 7 + Samples/basic/lottie/CMakeLists.txt | 7 + Samples/shell/CMakeLists.txt | 27 ++ Source/CMakeLists.txt | 8 + Source/Core/CMakeLists.txt | 396 ++++++++++++++++++ Source/Core/Elements/CMakeLists.txt | 71 ++++ Source/Core/FontEngineDefault/CMakeLists.txt | 44 ++ Source/Core/Layout/CMakeLists.txt | 61 +++ Source/Debugger/CMakeLists.txt | 79 ++++ Source/Lottie/CMakeLists.txt | 40 ++ Source/Lua/CMakeLists.txt | 13 + Source/SVG/CMakeLists.txt | 6 + 37 files changed, 1811 insertions(+), 161 deletions(-) delete mode 100644 CMake/BackendFileList.cmake create mode 100644 CMake/Backends.cmake create mode 100644 CMake/BackendsDependencies.cmake create mode 100644 CMake/Dependencies.cmake rename CMake/{Modules => Modules.old}/FindLuaJIT.cmake (100%) rename CMake/{Modules => Modules.old}/FindPkgMacros.cmake (100%) rename CMake/{Modules => Modules.old}/FindSDL2.cmake (100%) rename CMake/{Modules => Modules.old}/FindSDL2_image.cmake (100%) rename CMake/{Modules => Modules.old}/FindSFML.cmake (100%) rename CMake/{Modules => Modules.old}/FindTracy.cmake (100%) rename CMake/{Modules => Modules.old}/Findlunasvg.cmake (100%) create mode 100644 CMake/Modules/Emscripten/FindFreetype.cmake create mode 100644 CMake/Modules/Emscripten/FindOpenGL.cmake create mode 100644 CMake/Modules/Emscripten/FindSDL.cmake create mode 100644 CMake/Modules/Emscripten/FindSDL_image.cmake create mode 100644 CMake/Modules/Emscripten/Findglfw3.cmake create mode 100644 CMake/SamplesShellDependencies.cmake create mode 100644 CMakeLists.txt create mode 100644 CONTRIBUTING.md create mode 100644 Samples/CMakeLists.txt create mode 100644 Samples/basic/CMakeLists.txt create mode 100644 Samples/basic/benchmark/CMakeLists.txt create mode 100644 Samples/basic/demo/CMakeLists.txt create mode 100644 Samples/basic/lottie/CMakeLists.txt create mode 100644 Samples/shell/CMakeLists.txt create mode 100644 Source/CMakeLists.txt create mode 100644 Source/Core/CMakeLists.txt create mode 100644 Source/Core/Elements/CMakeLists.txt create mode 100644 Source/Core/FontEngineDefault/CMakeLists.txt create mode 100644 Source/Core/Layout/CMakeLists.txt create mode 100644 Source/Debugger/CMakeLists.txt create mode 100644 Source/Lottie/CMakeLists.txt create mode 100644 Source/Lua/CMakeLists.txt create mode 100644 Source/SVG/CMakeLists.txt diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index edf41bb17..d0a440817 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,12 +4,13 @@ on: [push, pull_request] jobs: Linux: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest env: BUILD_TYPE: Release - CC: ${{ matrix.cc }} - CXX: ${{ matrix.cxx }} + CC: "${{ matrix.cc }}" + CXX: "${{ matrix.cxx }}" + CMAKE_PREFIX_PATH: "/usr" strategy: fail-fast: false @@ -17,24 +18,24 @@ jobs: include: - cc: clang cxx: clang++ - cmake_options: -DENABLE_PRECOMPILED_HEADERS=OFF -DSAMPLES_BACKEND=GLFW_GL2 + cmake_options: -DRMLUI_ENABLE_PRECOMPILED_HEADERS=OFF -DRMLUI_SAMPLES_BACKEND=GLFW_GL2 - cc: clang cxx: clang++ - cmake_options: -DSAMPLES_BACKEND=SDL_VK - - cmake_options: -DBUILD_TESTING=ON -DENABLE_PRECOMPILED_HEADERS=OFF + cmake_options: -DRMLUI_SAMPLES_BACKEND=SDL_VK -DSDL_LIBRARY=SDL2 -DSDL_INCLUDE_DIR=/usr/include/SDL2 + - cmake_options: -DRMLUI_BUILD_TESTING=ON -DRMLUI_ENABLE_PRECOMPILED_HEADERS=OFF enable_testing: true - - cmake_options: -DNO_FONT_INTERFACE_DEFAULT=ON -DENABLE_LOTTIE_PLUGIN=ON -DSAMPLES_BACKEND=X11_GL2 - - cmake_options: -DDISABLE_RTTI_AND_EXCEPTIONS=ON -DSAMPLES_BACKEND=SDL_GL2 - - cmake_options: -DNO_THIRDPARTY_CONTAINERS=ON -DSAMPLES_BACKEND=SFML_GL2 - - cmake_options: -DSAMPLES_BACKEND=SDL_VK -DRMLUI_VK_DEBUG=ON -DENABLE_PRECOMPILED_HEADERS=OFF -DCMAKE_BUILD_TYPE=Debug + - cmake_options: -DRMLUI_ENABLE_LOTTIE_PLUGIN=ON -DRMLUI_SAMPLES_BACKEND=X11_GL2 + - cmake_options: -DRMLUI_DISABLE_RTTI_AND_EXCEPTIONS=ON -DRMLUI_SAMPLES_BACKEND=SDL_GL2 -DSDL_LIBRARY=SDL2 -DSDL_INCLUDE_DIR=/usr/include/SDL2 -DSDL_IMAGE_LIBRARY=/usr/lib/x86_64-linux-gnu/libSDL2_image-2.0.so.0 -DSDL_IMAGE_INCLUDE_DIR=/usr/include/SDL2 + - cmake_options: -DRMLUI_NO_THIRDPARTY_CONTAINERS=ON -DRMLUI_SAMPLES_BACKEND=SFML_GL2 + - cmake_options: -DRMLUI_SAMPLES_BACKEND=SDL_VK -DRMLUI_VK_DEBUG=ON -DRMLUI_ENABLE_PRECOMPILED_HEADERS=OFF -DCMAKE_BUILD_TYPE=Debug -DSDL_LIBRARY=SDL2 -DSDL_INCLUDE_DIR=/usr/include/SDL2 steps: - uses: actions/checkout@v3 - name: Install Dependencies run: |- - sudo apt-get update - sudo apt-get install cmake ninja-build libsdl2-dev libsdl2-image-dev libfreetype6-dev libglew-dev liblua5.2-dev libsfml-dev librlottie-dev libglfw3-dev + sudo apt update -yq + sudo apt install -yq cmake ninja-build clang libsdl2-dev libsdl2-image-dev libfreetype6-dev libglew-dev liblua5.2-dev libsfml-dev librlottie-dev libglfw3-dev - name: Create Build Environment run: cmake -E make_directory ${{github.workspace}}/Build @@ -42,7 +43,7 @@ jobs: - name: Configure CMake working-directory: ${{github.workspace}}/Build run: >- - cmake $GITHUB_WORKSPACE -G Ninja -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_LUA_BINDINGS=ON -DBUILD_SAMPLES=ON -DWARNINGS_AS_ERRORS=ON + cmake $GITHUB_WORKSPACE -G Ninja -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DRMLUI_BUILD_LUA_BINDINGS=ON -DRMLUI_BUILD_SAMPLES=ON -DWARNINGS_AS_ERRORS=ON ${{ matrix.cmake_options }} - name: Build @@ -65,8 +66,8 @@ jobs: fail-fast: false matrix: include: - - cmake_options: -DSAMPLES_BACKEND=auto - - cmake_options: -DSAMPLES_BACKEND=GLFW_GL2 + # - cmake_options: -DRMLUI_SAMPLES_BACKEND=auto + - cmake_options: -DRMLUI_SAMPLES_BACKEND=GLFW_GL2 steps: - uses: actions/checkout@v3 @@ -80,7 +81,7 @@ jobs: - name: Configure CMake working-directory: ${{github.workspace}}/Build run: >- - cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_LUA_BINDINGS=ON -DBUILD_SAMPLES=ON -DWARNINGS_AS_ERRORS=ON + cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DRMLUI_BUILD_LUA_BINDINGS=ON -DRMLUI_BUILD_SAMPLES=ON -DWARNINGS_AS_ERRORS=ON ${{ matrix.cmake_options }} - name: Build @@ -99,15 +100,22 @@ jobs: fail-fast: false matrix: include: - - cmake_options: -DSAMPLES_BACKEND=auto -DENABLE_PRECOMPILED_HEADERS=OFF - - cmake_options: -DSAMPLES_BACKEND=Win32_VK -DRMLUI_VK_DEBUG=ON - - cmake_options: -DSAMPLES_BACKEND=SDL_VK -DBUILD_LUA_BINDINGS_FOR_LUAJIT=ON + # - cmake_options: -DRMLUI_SAMPLES_BACKEND=auto -DRMLUI_ENABLE_PRECOMPILED_HEADERS=OFF + # After upgrading minimum CMake to >= 3.18, CMake should automatically find Vulkan using the VULKAN_SDK environment variable + - cmake_options: -DRMLUI_SAMPLES_BACKEND=Win32_VK -DRMLUI_VK_DEBUG=ON -DVulkan_LIBRARY="C:\VulkanSDK\1.3.250.1\Lib\vulkan-1.lib" -DVulkan_INCLUDE_DIR="C:\VulkanSDK\1.3.250.1\Include\vulkan" + - cmake_options: -DRMLUI_SAMPLES_BACKEND=SDL_VK -DRMLUI_BUILD_LUA_BINDINGS_FOR_LUAJIT=ON -DVulkan_LIBRARY="C:\VulkanSDK\1.3.250.1\Lib\vulkan-1.lib" -DVulkan_INCLUDE_DIR="C:\VulkanSDK\1.3.250.1\Include\vulkan" steps: - uses: actions/checkout@v3 + - name: Enable Developer Command Prompt + uses: ilammy/msvc-dev-cmd@v1.12.1 + - name: Install Dependencies - run: C:\vcpkg\vcpkg install freetype[core] sdl2[core,vulkan] lua[core] luajit + run: |- + Invoke-WebRequest -Uri https://sdk.lunarg.com/sdk/download/1.3.250.1/windows/VulkanSDK-1.3.250.1-Installer.exe -OutFile vulkansdk.exe + .\vulkansdk.exe --confirm-command --accept-licenses --default-answer in com.lunarg.vulkan + C:\vcpkg\vcpkg install freetype[core] sdl2[core,vulkan] lua[core] luajit - name: Create Build Environment run: cmake -E make_directory ${{github.workspace}}/Build @@ -115,9 +123,8 @@ jobs: - name: Configure CMake working-directory: ${{github.workspace}}/Build run: >- - cmake $env:GITHUB_WORKSPACE -A x64 -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=$env:BUILD_TYPE -DBUILD_LUA_BINDINGS=ON -DBUILD_SAMPLES=ON -DWARNINGS_AS_ERRORS=ON - -DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" - ${{ matrix.cmake_options }} + cmake $env:GITHUB_WORKSPACE -A x64 -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=$env:BUILD_TYPE -DRMLUI_BUILD_LUA_BINDINGS=ON -DRMLUI_BUILD_SAMPLES=ON -DWARNINGS_AS_ERRORS=ON + -DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" ${{ matrix.cmake_options }} -DRMLUI_USING_VCPKG=TRUE - name: Build working-directory: ${{github.workspace}}/Build @@ -125,31 +132,36 @@ jobs: Emscripten: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Install Dependencies run: |- - sudo apt-get update - sudo apt-get install cmake - wget -q https://github.com/emscripten-core/emsdk/archive/master.tar.gz - tar -xvf master.tar.gz - emsdk-master/emsdk update - emsdk-master/emsdk install latest - emsdk-master/emsdk activate latest - + sudo apt update -yq + sudo apt install -yq cmake + + - name: Install Emscripten SDK + run: |- + cd ~ + git clone https://github.com/emscripten-core/emsdk.git --depth 1 + cd emsdk + ./emsdk install latest + ./emsdk activate latest + - name: Create Build Environment run: cmake -E make_directory Build - name: Configure CMake run: |- - source emsdk-master/emsdk_env.sh - cd Build - emcmake cmake $GITHUB_WORKSPACE -DBUILD_SAMPLES=ON -DBUILD_SHARED_LIBS=OFF -DWARNINGS_AS_ERRORS=ON -DEMSCRIPTEN_EXE_FLAGS="-O1" + source ~/emsdk/emsdk_env.sh + cmake -S . -B Build -DCMAKE_BUILD_TYPE=Debug -DRMLUI_BUILD_SAMPLES=ON -DRMLUI_SAMPLES_BACKEND=SDL_GL3 \ + -DBUILD_SHARED_LIBS=OFF -DWARNINGS_AS_ERRORS=ON -DRMLUI_EMSCRIPTEN_EXE_FLAGS="-O1" \ + -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake \ + -DCMAKE_MODULE_PATH=$GITHUB_WORKSPACE/CMake/Modules/Emscripten - name: Build + working-directory: ${{github.workspace}}/Build run: |- - source emsdk-master/emsdk_env.sh - cd Build - emmake make -j4 + source ~/emsdk/emsdk_env.sh + cmake --build . --config $env:BUILD_TYPE diff --git a/CMake/BackendFileList.cmake b/CMake/BackendFileList.cmake deleted file mode 100644 index 50b45bb9a..000000000 --- a/CMake/BackendFileList.cmake +++ /dev/null @@ -1,121 +0,0 @@ -set(BACKEND_COMMON_HDR_FILES - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend.h -) - -set(Win32_GL2_SRC_FILES - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_Win32.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_Win32_GL2.cpp -) -set(Win32_GL2_HDR_FILES - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_Win32.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Include_Windows.h -) - -set(Win32_VK_SRC_FILES - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_Win32.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_VK.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_Win32_VK.cpp -) -set(Win32_VK_HDR_FILES - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_Win32.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_VK.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Vulkan/ShadersCompiledSPV.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Vulkan/vk_mem_alloc.h -) - -set(X11_GL2_SRC_FILES - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_X11.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_X11_GL2.cpp -) -set(X11_GL2_HDR_FILES - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_X11.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Include_Xlib.h -) - -set(SDL_GL2_SRC_FILES - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_SDL_GL2.cpp -) -set(SDL_GL2_HDR_FILES - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.h -) - -set(SDL_GL3_SRC_FILES - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL3.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_SDL_GL3.cpp -) -set(SDL_GL3_HDR_FILES - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL3.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Include_GL3.h -) - -set(SDL_VK_SRC_FILES - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_VK.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_SDL_VK.cpp -) -set(SDL_VK_HDR_FILES - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_VK.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Vulkan/ShadersCompiledSPV.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Vulkan/vk_mem_alloc.h -) - -set(SDL_SDLrenderer_SRC_FILES - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_SDL.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_SDL_SDLrenderer.cpp -) -set(SDL_SDLrenderer_HDR_FILES - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_SDL.h -) - -set(SFML_GL2_SRC_FILES - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SFML.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_SFML_GL2.cpp -) -set(SFML_GL2_HDR_FILES - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SFML.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.h -) - -set(GLFW_GL2_SRC_FILES - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_GLFW.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_GLFW_GL2.cpp -) -set(GLFW_GL2_HDR_FILES - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_GLFW.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.h -) - -set(GLFW_GL3_SRC_FILES - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_GLFW.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL3.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_GLFW_GL3.cpp -) -set(GLFW_GL3_HDR_FILES - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_GLFW.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL3.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Include_GL3.h -) - -set(GLFW_VK_SRC_FILES - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_GLFW.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_VK.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_GLFW_VK.cpp -) -set(GLFW_VK_HDR_FILES - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_GLFW.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_VK.h -) diff --git a/CMake/Backends.cmake b/CMake/Backends.cmake new file mode 100644 index 000000000..375161fb2 --- /dev/null +++ b/CMake/Backends.cmake @@ -0,0 +1,158 @@ +# List of available backends +list(APPEND RMLUI_SAMPLES_AVAILABLE_BACKENDS + "Win32_GL2" + "Win32_VK" + "X11_GL2" + "SDL_GL2" + "SDL_GL3" + "SDL_VK" + "SDL_SDLrenderer" + "SFML_GL2" + "GLFW_GL2" + "GLFW_GL3" + "GLFW_VK" +) + +list(APPEND RMLUI_BACKEND_COMMON_HDR_FILES + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend.h +) + +add_library(rmlui_backend_Win32_GL2 INTERFACE) +target_sources(rmlui_backend_Win32_GL2 INTERFACE + ${RMLUI_BACKEND_COMMON_HDR_FILES} + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_Win32.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_Win32_GL2.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_Win32.h + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.h + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Include_Windows.h +) +target_link_libraries(rmlui_backend_Win32_GL2 INTERFACE OpenGL::GL) + +add_library(rmlui_backend_Win32_VK INTERFACE) +target_sources(rmlui_backend_Win32_VK INTERFACE + ${RMLUI_BACKEND_COMMON_HDR_FILES} + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_Win32.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_VK.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_Win32_VK.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_Win32.h + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_VK.h + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Vulkan/ShadersCompiledSPV.h + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Vulkan/vk_mem_alloc.h +) +target_link_libraries(rmlui_backend_Win32_VK INTERFACE Vulkan::Vulkan) + +add_library(rmlui_backend_X11_GL2 INTERFACE) +target_sources(rmlui_backend_X11_GL2 INTERFACE + ${RMLUI_BACKEND_COMMON_HDR_FILES} + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_X11.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_X11_GL2.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_X11.h + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.h + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Include_Xlib.h +) + +# RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE: +# Once the minimum CMake version is CMake >= 3.14, "${X11_LIBRARIES}" should +# be substituted by "X11:X11" in addition to any of the other imported that might +# be required. More info: +# https://cmake.org/cmake/help/latest/module/FindX11.html +target_link_libraries(rmlui_backend_X11_GL2 INTERFACE OpenGL::GL ${X11_LIBRARIES}) + +add_library(rmlui_backend_SDL_GL2 INTERFACE) +target_sources(rmlui_backend_SDL_GL2 INTERFACE + ${RMLUI_BACKEND_COMMON_HDR_FILES} + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_SDL_GL2.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.h + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.h +) +target_link_libraries(rmlui_backend_SDL_GL2 INTERFACE OpenGL::GL SDL::SDL GLEW::GLEW SDL::Image) + +add_library(rmlui_backend_SDL_GL3 INTERFACE) +target_sources(rmlui_backend_SDL_GL3 INTERFACE + ${RMLUI_BACKEND_COMMON_HDR_FILES} + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL3.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_SDL_GL3.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.h + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL3.h + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Include_GL3.h +) +target_link_libraries(rmlui_backend_SDL_GL3 INTERFACE OpenGL::GL SDL::SDL SDL::Image) + +add_library(rmlui_backend_SDL_VK INTERFACE) +target_sources(rmlui_backend_SDL_VK INTERFACE + ${RMLUI_BACKEND_COMMON_HDR_FILES} + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_VK.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_SDL_VK.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.h + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_VK.h + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Vulkan/ShadersCompiledSPV.h + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Vulkan/vk_mem_alloc.h +) +target_link_libraries(rmlui_backend_SDL_VK INTERFACE Vulkan::Vulkan SDL::SDL) + +add_library(rmlui_backend_SDL_SDLrenderer INTERFACE) +target_sources(rmlui_backend_SDL_SDLrenderer INTERFACE + ${RMLUI_BACKEND_COMMON_HDR_FILES} + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_SDL.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_SDL_SDLrenderer.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.h + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_SDL.h +) +target_link_libraries(rmlui_backend_SDL_SDLrenderer INTERFACE SDL::SDL SDL::Image) + +add_library(rmlui_backend_SFML_GL2 INTERFACE) +target_sources(rmlui_backend_SFML_GL2 INTERFACE + ${RMLUI_BACKEND_COMMON_HDR_FILES} + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SFML.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_SFML_GL2.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SFML.h + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.h +) +target_link_libraries(rmlui_backend_SFML_GL2 INTERFACE OpenGL::GL + rmlui_SFML_old_wrapper SFML::Graphics SFML::Window SFML::System +) +if(WIN32) + target_link_libraries(rmlui_backend_SFML_GL2 INTERFACE SFML::Main) +endif() + +add_library(rmlui_backend_GLFW_GL2 INTERFACE) +target_sources(rmlui_backend_GLFW_GL2 INTERFACE + ${RMLUI_BACKEND_COMMON_HDR_FILES} + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_GLFW.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_GLFW_GL2.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_GLFW.h + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.h +) +target_link_libraries(rmlui_backend_GLFW_GL2 INTERFACE OpenGL::GL glfw) + +add_library(rmlui_backend_GLFW_GL3 INTERFACE) +target_sources(rmlui_backend_GLFW_GL3 INTERFACE + ${RMLUI_BACKEND_COMMON_HDR_FILES} + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_GLFW.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL3.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_GLFW_GL3.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_GLFW.h + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL3.h + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Include_GL3.h +) +target_link_libraries(rmlui_backend_GLFW_GL3 INTERFACE OpenGL::GL glfw) + +add_library(rmlui_backend_GLFW_VK INTERFACE) +target_sources(rmlui_backend_GLFW_VK INTERFACE + ${RMLUI_BACKEND_COMMON_HDR_FILES} + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_GLFW.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_VK.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_GLFW_VK.cpp + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_GLFW.h + ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_VK.h +) +target_link_libraries(rmlui_backend_GLFW_VK INTERFACE Vulkan::Vulkan glfw) diff --git a/CMake/BackendsDependencies.cmake b/CMake/BackendsDependencies.cmake new file mode 100644 index 000000000..8d64ee863 --- /dev/null +++ b/CMake/BackendsDependencies.cmake @@ -0,0 +1,239 @@ +#[[ +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." + "\nIf you are consuming RmlUi as a subdirectory inside another CMake project, please ensure that " + "${friendly_name} can be found by CMake or at least being linked using \"${target_name}\" as its " + "target name. You can create an ALIAS target to offer an alternative name for a CMake target." + ) +endfunction() + +# --- Window/input APIs --- +# SDL +if(RMLUI_SAMPLES_BACKEND MATCHES "^SDL") + # All dependencies are searched as soft dependencies so that they won't error out if the library + # is declared by other means + if(RMLUI_USING_VCPKG) + # vcpkg uses a different name for their SDL find module and target than the official CMake one + find_package("SDL2") + + # If the target has been successfully imported + if(TARGET SDL2::SDL2) + # Report SDL as found + set(SDL_FOUND TRUE) + + # Add the target to SDL_LIBRARIES + # This way no other pieces of code will need to be modified for the CMake project to work with vcpkg's SDL + list(APPEND SDL_LIBRARIES SDL2::SDL2) + endif() + else() + find_package("SDL" "2") + endif() + + # RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE: + # In CMake 3.19 the IMPORTED target SDL::SDL is available when using the FindSDL find module. + # More info: https://cmake.org/cmake/help/latest/module/FindSDL.html + # Current code operates using a hybrid mode by detecting either the variable or the target due to the possibility + # of package managers such as Conan and vcpkg of setting up SDL in their own way but always following the + # target naming conventions of the official CMake find modules + if(NOT TARGET SDL::SDL AND NOT SDL_FOUND) + report_not_found_dependency("SDL" SDL::SDL) + endif() + + # Set up the detected SDL as the SDL::SDL INTERFACE target if it hasn't already been created + # This is done for consistent referencing across the CMake code regardless of the CMake version used + if(NOT TARGET SDL::SDL) + add_library(SDL INTERFACE) + add_library(SDL::SDL ALIAS SDL) + + # Any CMake target linking against SDL::SDL will link against the SDL libraries and have + # their include directories added to their target properties + target_link_libraries(SDL INTERFACE ${SDL_LIBRARIES}) + target_include_directories(SDL INTERFACE ${SDL_INCLUDE_DIRS}) + endif() + + # SDL_GL2 backend requires GLEW + if(RMLUI_SAMPLES_BACKEND STREQUAL "SDL_GL2" AND NOT TARGET GLEW::GLEW) + find_package(GLEW) + if(NOT TARGET GLEW::GLEW) + report_not_found_dependency("GLEW" GLEW::GLEW) + endif() + endif() + + # Check version requirement for the SDL renderer + if(RMLUI_SAMPLES_BACKEND STREQUAL "SDL_SDLrenderer" AND SDL_VERSION VERSION_LESS "2.0.20") + message(FATAL_ERROR "SDL native renderer backend (${RMLUI_SAMPLES_BACKEND}) requires SDL 2.0.20 (found ${SDL_VERSION}).") + endif() + + # List of SDL backends that require SDL_image to work with samples + list(APPEND RMLUI_SDL_BACKENDS_WITH_SDLIMAGE "SDL_GL2" "SDL_GL3" "SDL_SDLrenderer") + + # Determine if the selected SDL backend requires SDL_image + list(FIND RMLUI_SDL_BACKENDS_WITH_SDLIMAGE ${RMLUI_SAMPLES_BACKEND} index) + if(index EQUAL "-1") + # If the backend hasn't been found in the list, SDL_image isn't required + set(RMLUI_SDLIMAGE_REQUIRED FALSE) + else() + # If the backend has been found in the list, SDL_image is required + set(RMLUI_SDLIMAGE_REQUIRED TRUE) + endif() + # Clear scope + unset(index) + unset(RMLUI_SDL_BACKENDS_WITH_SDLIMAGE) + + # Require SDL_image if needed + if(RMLUI_SDLIMAGE_REQUIRED) + find_package("SDL_image" "2") + + # RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE: + # FindSDL_image doesn't provide an imported target to check against + # Using old method of using a variable to check + if(NOT SDL_IMAGE_FOUND AND NOT TARGET SDL::Image) + report_not_found_dependency("SDL_image" SDL::Image) + endif() + + # RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE: + # No official target name has been decided for SDL_image yet, but we pretend there's one + # to make the code more future-proof + # For us, its name will be SDL::Image + if(NOT TARGET SDL::Image) + add_library(SDLimage INTERFACE) + add_library(SDL::Image ALIAS SDLimage) + + # Any CMake target linking against SDL::Image will link against the SDL_image libraries + # and have their include directories added to their target properties + target_link_libraries(SDLimage INTERFACE ${SDL_IMAGE_LIBRARIES}) + target_include_directories(SDLimage INTERFACE ${SDL_IMAGE_INCLUDE_DIRS}) + endif() + endif() +endif() + +# GLFW +if(RMLUI_SAMPLES_BACKEND MATCHES "^GLFW") + find_package("glfw3" "3.3") + + # Instead of relying on the _FOUND variable, we check directly for the target + if(NOT TARGET glfw) + report_not_found_dependency("GLFW" glfw) + endif() +endif() + +# SFML +if(RMLUI_SAMPLES_BACKEND MATCHES "^SFML") + # For compatibility with SFML >= 2.7, component names might need to be capitalized (Graphics, Window, ...) + if (WIN32) + find_package("SFML" "2" COMPONENTS graphics window system main) + else() + find_package("SFML" "2" COMPONENTS graphics window system) + endif() + + if(NOT SFML_FOUND) + report_not_found_dependency("SFML" SFML::SFML) + endif() + + #[[ + Starting with SFML 2.7, the recommended method to find the library is using + the official config file which sets up targets for each module of the library. + The names of the targets follow the namespaced target names convention. + + When one of the required modules isn't present as a SFML:: target, + that means SFML < 2.7 is being used and we need to set up the target(s) by ourselves. + + In SFML 2.5 the first iteration of the SFMLConfig.cmake file was introduced, which + uses a target-oriented approach to exposing the different modules of SFML but it doesn't + use the same names as the config file from SFML 2.7. + + In SFML <= 2.4 the old official find module is still in use which uses the old variable-based + approach. + #]] + + # Because we always require the window module, we can use it to determine which method CMake has used + # to find SFML + if(NOT TARGET SFML::Window) + list(APPEND RMLUI_SFML_REQUIRED_COMPONENTS "Graphics" "Window" "System") + if(WIN32) + list(APPEND RMLUI_SFML_REQUIRED_COMPONENTS "Main") + endif() + + # Because we always require the window module, we can use it to determine which iteration of the config + # module is being used + if(TARGET sfml-window) + #[[ + If sfml-window exists, then that means the version is either SFML 2.5 or 2.6 which set up + module-specific CMake targets but with different names using a config file. + + Therefore, we need to alias the target names to match those declared by SFML 2.7 and used by RmlUi. + #]] + + # For each SFML component the project requires + foreach(sfml_component ${RMLUI_SFML_REQUIRED_COMPONENTS}) + # Make the component name lowercase + string(TOLOWER ${sfml_component} sfml_component_lower) + + if(TARGET sfml-${sfml_component_lower}) + # If the target exists, alias it + add_library(SFML::${sfml_component} ALIAS sfml-${sfml_component_lower}) + endif() + endforeach() + + # Because module-specific targets already exist, there's no need for the wrapper for the older find module + # Set up wrapper target as dumb target + add_library(rmlui_SFML_old_wrapper INTERFACE) + elseif() + #[[ + If sfml-window doesn't exist, then SFML version is <= 2.4 and the old-variable approach used in their + old official find module needs to be wrapped. + #]] + + # Create our own custom INTERFACE target + add_library(rmlui_SFML_old_wrapper INTERFACE) + + # Set up the custom target with all the libraries + target_link_libraries(rmlui_SFML_old_wrapper INTERFACE ${SFML_LIBRARIES}) + target_include_directories(rmlui_SFML_old_wrapper INTERFACE ${SFML_INCLUDE_DIR}) + + # Create dumb targets to replace the modern component-specific targets + foreach(sfml_component ${RMLUI_SFML_REQUIRED_COMPONENTS}) + add_library(rmlui_SFML_${sfml_component} INTERFACE) + add_library(SFML::${sfml_component} ALIAS rmlui_SFML_${sfml_component}) + endforeach() + endif() + endif() +endif() + +# X11 +if(RMLUI_SAMPLES_BACKEND MATCHES "^X11") + find_package("X11") +endif() + +# --- Rendering APIs --- +# OpenGL +# RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE: +# OpenGL handling changes in CMake 3.11, requiring to set CMake policy CMP0072 +# More info: https://cmake.org/cmake/help/latest/policy/CMP0072.html +if(RMLUI_SAMPLES_BACKEND MATCHES "GL2$") + find_package("OpenGL" "2") + if(NOT TARGET OpenGL::GL) + report_not_found_dependency("OpenGL" OpenGL::GL) + endif() +endif() + +if(RMLUI_SAMPLES_BACKEND MATCHES "GL3$") + find_package("OpenGL" "3") + if(NOT TARGET OpenGL::GL) + report_not_found_dependency("OpenGL" OpenGL::GL) + endif() +endif() + +# Vulkan +if(RMLUI_SAMPLES_BACKEND MATCHES "VK$") + find_package("Vulkan") + if(NOT TARGET Vulkan::Vulkan) + report_not_found_dependency("Vulkan" Vulkan::Vulkan) + endif() +endif() diff --git a/CMake/Dependencies.cmake b/CMake/Dependencies.cmake new file mode 100644 index 000000000..a7efa5699 --- /dev/null +++ b/CMake/Dependencies.cmake @@ -0,0 +1,49 @@ +#[[ +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." + "\nIf you are consuming RmlUi as a subdirectory inside another CMake project, please ensure that " + "${friendly_name} can be found by CMake or at least being 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(RMLUI_FONT_INTERFACE STREQUAL "freetype") + # 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/Modules/FindLuaJIT.cmake b/CMake/Modules.old/FindLuaJIT.cmake similarity index 100% rename from CMake/Modules/FindLuaJIT.cmake rename to CMake/Modules.old/FindLuaJIT.cmake diff --git a/CMake/Modules/FindPkgMacros.cmake b/CMake/Modules.old/FindPkgMacros.cmake similarity index 100% rename from CMake/Modules/FindPkgMacros.cmake rename to CMake/Modules.old/FindPkgMacros.cmake diff --git a/CMake/Modules/FindSDL2.cmake b/CMake/Modules.old/FindSDL2.cmake similarity index 100% rename from CMake/Modules/FindSDL2.cmake rename to CMake/Modules.old/FindSDL2.cmake diff --git a/CMake/Modules/FindSDL2_image.cmake b/CMake/Modules.old/FindSDL2_image.cmake similarity index 100% rename from CMake/Modules/FindSDL2_image.cmake rename to CMake/Modules.old/FindSDL2_image.cmake diff --git a/CMake/Modules/FindSFML.cmake b/CMake/Modules.old/FindSFML.cmake similarity index 100% rename from CMake/Modules/FindSFML.cmake rename to CMake/Modules.old/FindSFML.cmake diff --git a/CMake/Modules/FindTracy.cmake b/CMake/Modules.old/FindTracy.cmake similarity index 100% rename from CMake/Modules/FindTracy.cmake rename to CMake/Modules.old/FindTracy.cmake diff --git a/CMake/Modules/Findlunasvg.cmake b/CMake/Modules.old/Findlunasvg.cmake similarity index 100% rename from CMake/Modules/Findlunasvg.cmake rename to CMake/Modules.old/Findlunasvg.cmake diff --git a/CMake/Modules/Emscripten/FindFreetype.cmake b/CMake/Modules/Emscripten/FindFreetype.cmake new file mode 100644 index 000000000..e7b4eed81 --- /dev/null +++ b/CMake/Modules/Emscripten/FindFreetype.cmake @@ -0,0 +1,56 @@ +#[[ + Custom find module for Freetype for Emscripten compilation. + + Input variables: + none + Output variables: + Freetype_FOUND + FREETYPE_VERSION_STRING + + Resulting targets: + Freetype::Freetype + + More info: + https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html +#]] + +include(FindPackageHandleStandardArgs) +include(FindPackageMessage) + +# If no version was specified, set default +if(NOT DEFINED Freetype_FIND_VERSION) + set(Freetype_FIND_VERSION "2") +endif() + +# Check if requested Freetype version is valid +# Emscripten SDK only provides Freetype 2.x +if((Freetype_FIND_VERSION VERSION_LESS "2") OR (Freetype_FIND_VERSION VERSION_GREATER_EQUAL "3")) + message(FATAL_ERROR "The requested Freetype version ${Freetype_FIND_VERSION} is invalid.") +endif() + +# Emscripten includes Freetype support as part of it's SDK, meaning there's no need to find it +set(Freetype_FOUND TRUE) +add_library(freetype INTERFACE) +add_library(Freetype::Freetype ALIAS freetype) + +# Set found Freetype version +# Version set based on latest Emscripten SDK at the time of writing this file +set(FREETYPE_VERSION_STRING "2.6") + +# Enable compilation and linking against Freetype +target_compile_options(freetype INTERFACE "-sUSE_FREETYPE=1") +target_link_libraries(freetype INTERFACE "-sUSE_FREETYPE=1") + +# Get final compiler and linker flags to print them +get_target_property(Freetype_COMPILE_FLAGS freetype "INTERFACE_COMPILE_OPTIONS") +get_target_property(Freetype_LINK_FLAGS freetype "INTERFACE_LINK_OPTIONS") + +find_package_message( + "Freetype" + "Freetype ${FREETYPE_VERSION_STRING} has been found as part of the Emscripten SDK." + "[${Freetype_COMPILE_FLAGS}][${Freetype_LINK_FLAGS}]" +) + +# Clean scope +unset(Freetype_COMPILE_FLAGS) +unset(Freetype_LINK_FLAGS) diff --git a/CMake/Modules/Emscripten/FindOpenGL.cmake b/CMake/Modules/Emscripten/FindOpenGL.cmake new file mode 100644 index 000000000..4909d1757 --- /dev/null +++ b/CMake/Modules/Emscripten/FindOpenGL.cmake @@ -0,0 +1,74 @@ +#[[ + Custom find module for OpenGL ES for Emscripten compilation. + + Input variables: + OpenGL_ENABLE_EMULATION + + Output variables: + OpenGL_FOUND + OpenGL_VERSION + + Resulting targets: + OpenGL::GL + + More info: + https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html +#]] + +include(FindPackageHandleStandardArgs) +include(FindPackageMessage) + +# If no version was specified, set default +if(NOT DEFINED OpenGL_FIND_VERSION) + set(OpenGL_FIND_VERSION "3") +endif() + +# Check if requested OpenGL version is valid +if((OpenGL_FIND_VERSION VERSION_LESS "1") OR (OpenGL_FIND_VERSION VERSION_GREATER_EQUAL "4")) + message(FATAL_ERROR "The requested OpenGL version ${OpenGL_FIND_VERSION} is invalid.") +endif() + +# Emscripten includes OpenGL ES support as part of it's SDK, meaning there's no need to find it +set(OpenGL_FOUND TRUE) +add_library(opengl INTERFACE) +add_library(OpenGL::GL ALIAS opengl) + +# Set found OpenGL version +if((OpenGL_FIND_VERSION VERSION_GREATER_EQUAL "1") AND (OpenGL_FIND_VERSION VERSION_LESS "2")) + set(OpenGL_VERSION "1") +elseif((OpenGL_FIND_VERSION VERSION_GREATER_EQUAL "2") AND (OpenGL_FIND_VERSION VERSION_LESS "3")) + set(OpenGL_VERSION "2") +elseif((OpenGL_FIND_VERSION VERSION_GREATER_EQUAL "3") AND (OpenGL_FIND_VERSION VERSION_LESS "4")) + set(OpenGL_VERSION "3") +endif() + +#[[ + The Emscripten SDK already makes OpenGL available by default without any additional configuration. + However, additional settings might be needed in some cases. +#]] + +# Handle OpenGL 1 edge case +# More info: https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html#emulation-of-older-desktop-opengl-api-features +if(OpenGL_VERSION VERSION_EQUAL "1") + target_link_libraries(opengl INTERFACE "-sLEGACY_GL_EMULATION") +endif() + +# Handle OpenGL ES software emulation +# More info: https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html#opengl-es-2-0-3-0-emulation +if(OpenGL_ENABLE_EMULATION AND OpenGL_VERSION VERSION_GREATER_EQUAL "2") + target_link_libraries(opengl INTERFACE "-sFULL_ES${OpenGL_VERSION}") +endif() + +# Get final compiler and linker flags to print them +get_target_property(OpenGL_COMPILE_FLAGS opengl "INTERFACE_COMPILE_OPTIONS") +get_target_property(OpenGL_LINK_FLAGS opengl "INTERFACE_LINK_OPTIONS") + +find_package_message( + "OpenGL" + "OpenGL ${OpenGL_VERSION} has been found as part of the Emscripten SDK." + "[${OpenGL_COMPILE_FLAGS}][${OpenGL_LINK_FLAGS}]" +) + +# Clean scope +unset(OpenGL_COMPILE_FLAGS) +unset(OpenGL_LINK_FLAGS) diff --git a/CMake/Modules/Emscripten/FindSDL.cmake b/CMake/Modules/Emscripten/FindSDL.cmake new file mode 100644 index 000000000..2197f6bbe --- /dev/null +++ b/CMake/Modules/Emscripten/FindSDL.cmake @@ -0,0 +1,68 @@ +#[[ + Custom find module for SDL for Emscripten compilation. + + Input variables: + none + Output variables: + SDL_FOUND + SDL_VERSION + + Resulting targets: + SDL::SDL + + More info: + https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html +#]] + +include(FindPackageHandleStandardArgs) +include(FindPackageMessage) + +# If no version was specified, set default +if(NOT DEFINED SDL_FIND_VERSION) + set(SDL_FIND_VERSION "1") +endif() + +# Check if requested SDL version is valid +if((SDL_FIND_VERSION VERSION_LESS "1") OR (SDL_FIND_VERSION VERSION_GREATER_EQUAL "3")) + message(FATAL_ERROR "The requested SDL version ${SDL_FIND_VERSION} is invalid.") +endif() + +# Emscripten includes SDL support as part of it's SDK, meaning there's no need to find it +set(SDL_FOUND TRUE) +add_library(sdl INTERFACE) +add_library(SDL::SDL ALIAS sdl) + +# Set found SDL version based on latest Emscripten SDK at the time of writing this file +if((SDL_FIND_VERSION VERSION_GREATER_EQUAL "1") AND (SDL_FIND_VERSION VERSION_LESS "2")) + # Version set based on the information on $EMSDK/upstream/emscripten/src/settings.js + set(SDL_VERSION "1.3") + + # Version number to pass to compiler + set(SDL_EMSCRIPTEN_COMPILER_SELECTED_VERSION "1") + +elseif((SDL_FIND_VERSION VERSION_GREATER_EQUAL "2") AND (SDL_FIND_VERSION VERSION_LESS "3")) + # Version set based on latest Emscripten SDK at the time of writing this file + set(SDL_VERSION "2.24.2") + + # Version number to pass to compiler + set(SDL_EMSCRIPTEN_COMPILER_SELECTED_VERSION "2") +endif() + +# Enable compilation and linking against SDL +target_compile_options(sdl INTERFACE "-sUSE_SDL=${SDL_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") +target_link_libraries(sdl INTERFACE "-sUSE_SDL=${SDL_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") + +# Get final compiler and linker flags to print them +get_target_property(SDL_COMPILE_FLAGS sdl "INTERFACE_COMPILE_OPTIONS") +get_target_property(SDL_LINK_FLAGS sdl "INTERFACE_LINK_OPTIONS") + +find_package_message( + "SDL" + "SDL ${SDL_VERSION} has been found as part of the Emscripten SDK." + "[${SDL_COMPILE_FLAGS}][${SDL_LINK_FLAGS}]" +) + +# Clean scope +unset(SDL_COMPILE_FLAGS) +unset(SDL_COMPILE_FLAGS) +unset(SDL_EMSCRIPTEN_COMPILER_SELECTED_VERSION) diff --git a/CMake/Modules/Emscripten/FindSDL_image.cmake b/CMake/Modules/Emscripten/FindSDL_image.cmake new file mode 100644 index 000000000..e47ca9693 --- /dev/null +++ b/CMake/Modules/Emscripten/FindSDL_image.cmake @@ -0,0 +1,73 @@ +#[[ + Custom find module for SDL_image for Emscripten compilation. + + Input variables: + none + Output variables: + SDL_image_FOUND + SDL_image_VERSION + + Resulting targets: + SDL::Image + + More info: + https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html +#]] + +include(FindPackageHandleStandardArgs) +include(FindPackageMessage) + +# If no version was specified, set default +if(NOT DEFINED SDL_image_FIND_VERSION) + set(SDL_image_FIND_VERSION "1") +endif() + +# Check if requested SDL version is valid +if((SDL_image_FIND_VERSION VERSION_LESS "1") OR (SDL_image_FIND_VERSION VERSION_GREATER_EQUAL "3")) + message(FATAL_ERROR "The requested SDL_image version ${SDL_image_FIND_VERSION} is invalid.") +endif() + +message(WARNING + "SDL_image with Emscripten can only be used if SDL usage is also enabled. " + "The version number of both libraries must match as well." +) + +# Emscripten includes SDL support as part of it's SDK, meaning there's no need to find it +set(SDL_image_FOUND TRUE) +add_library(sdl_image INTERFACE) +add_library(SDL::Image ALIAS sdl_image) + +# Set found SDL_image version based on latest Emscripten SDK at the time of writing this file +if((SDL_image_FIND_VERSION VERSION_GREATER_EQUAL "1") AND (SDL_image_FIND_VERSION VERSION_LESS "2")) + # Version set based on the information on $EMSDK/upstream/emscripten/src/settings.js + set(SDL_image_VERSION "1.3") + + # Version number to pass to compiler + set(SDL_image_EMSCRIPTEN_COMPILER_SELECTED_VERSION "1") + +elseif((SDL_image_FIND_VERSION VERSION_GREATER_EQUAL "2") AND (SDL_image_FIND_VERSION VERSION_LESS "3")) + # Version set based on latest Emscripten SDK at the time of writing this file + set(SDL_image_VERSION "2.24.2") + + # Version number to pass to compiler + set(SDL_image_EMSCRIPTEN_COMPILER_SELECTED_VERSION "2") +endif() + +# Enable compilation and linking against SDL +target_compile_options(sdl_image INTERFACE "-sUSE_SDL_IMAGE=${SDL_image_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") +target_link_libraries(sdl_image INTERFACE "-sUSE_SDL_IMAGE=${SDL_image_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") + +# Get final compiler and linker flags to print them +get_target_property(SDL_image_COMPILE_FLAGS sdl_image "INTERFACE_COMPILE_OPTIONS") +get_target_property(SDL_image_LINK_FLAGS sdl_image "INTERFACE_LINK_OPTIONS") + +find_package_message( + "SDL_image" + "SDL_image ${SDL_image_VERSION} has been found as part of the Emscripten SDK." + "[${SDL_image_COMPILE_FLAGS}][${SDL_image_LINK_FLAGS}]" +) + +# Clean scope +unset(SDL_image_COMPILE_FLAGS) +unset(SDL_image_COMPILE_FLAGS) +unset(SDL_image_EMSCRIPTEN_COMPILER_SELECTED_VERSION) diff --git a/CMake/Modules/Emscripten/Findglfw3.cmake b/CMake/Modules/Emscripten/Findglfw3.cmake new file mode 100644 index 000000000..7c1bce32f --- /dev/null +++ b/CMake/Modules/Emscripten/Findglfw3.cmake @@ -0,0 +1,58 @@ +#[[ + Custom find module for GLFW for Emscripten compilation. + + Input variables: + none + Output variables: + glfw3_FOUND + glfw3_VERSION + + Resulting targets: + glfw + + More info: + https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html +#]] + +include(FindPackageHandleStandardArgs) +include(FindPackageMessage) + +# If no version was specified, set default +if(NOT DEFINED glfw3_FIND_VERSION) + set(glfw3_FIND_VERSION "1") +endif() + +# Check if requested GLFW version is valid +if((glfw3_FIND_VERSION VERSION_LESS "3") OR (glfw3_FIND_VERSION VERSION_GREATER_EQUAL "4")) + message(FATAL_ERROR "The requested GLFW version ${glfw3_FIND_VERSION} is invalid.") +endif() + +# Emscripten includes GLFW support as part of it's SDK, meaning there's no need to find it +set(glfw3_FOUND TRUE) +add_library(glfw INTERFACE) + +# Set found GLFW version based on latest Emscripten SDK at the time of writing this file +# Version set based on latest Emscripten SDK at the time of writing this file +set(glfw3_VERSION "3") + +# Version number to pass to compiler +set(glfw3_EMSCRIPTEN_COMPILER_SELECTED_VERSION ${glfw3_VERSION}) + +# Enable compilation and linking against GLFW +target_compile_options(glfw INTERFACE "-sUSE_GLFW=${glfw3_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") +target_link_libraries(glfw INTERFACE "-sUSE_GLFW=${glfw3_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") + +# Get final compiler and linker flags to print them +get_target_property(glfw3_COMPILE_FLAGS glfw "INTERFACE_COMPILE_OPTIONS") +get_target_property(glfw3_LINK_FLAGS glfw "INTERFACE_LINK_OPTIONS") + +find_package_message( + "glfw3" + "GLFW ${glfw3_VERSION} has been found as part of the Emscripten SDK." + "[${glfw3_COMPILE_FLAGS}][${glfw3_LINK_FLAGS}]" +) + +# Clean scope +unset(glfw3_COMPILE_FLAGS) +unset(glfw3_COMPILE_FLAGS) +unset(glfw3_EMSCRIPTEN_COMPILER_SELECTED_VERSION) \ No newline at end of file diff --git a/CMake/SamplesShellDependencies.cmake b/CMake/SamplesShellDependencies.cmake new file mode 100644 index 000000000..5540b8158 --- /dev/null +++ b/CMake/SamplesShellDependencies.cmake @@ -0,0 +1,78 @@ +#[[ +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." + "\nIf you are consuming RmlUi as a subdirectory inside another CMake project, please ensure that " + "${friendly_name} can be found by CMake or at least being linked using \"${target_name}\" as its " + "target name. You can create an ALIAS target to offer an alternative name for a CMake target." + ) +endfunction() + +#[[ +Function to print a message to the console indicating a library from a native platform SDK hasn't been found +Arguments: + - library_name: Name of the library +]] +function(report_not_found_native_library library_name) + # Set SDK notice string + if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + set(SDK_NOTICE "In order to ensure it is found, install the Windows SDK and build RmlUi inside a Visual Studio Developer CLI environment.\n" + "More info: https://learn.microsoft.com/en-us/visualstudio/ide/reference/command-prompt-powershell" + ) + elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(SDK_NOTICE "In order to ensure it is found, install the macOS SDK.\n" + "More info: https://developer.apple.com/macos/" + ) + endif() + + # Print notice + message(NOTICE + "CMake failed to find the ${library_name} library. Depending on the compiler, underlying build system " + "and environment setup, linkage of the RmlUi samples executables might fail." + "\n${SDK_NOTICE}" + ) +endfunction() + +# RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE: +# CMake >= 3.18 introduces the REQUIRED option for find_library() calls. +# Guaranteeing the presence of the platform SDK by making these calls to find_library() +# REQUIRED should be investigated. +# More info: https://cmake.org/cmake/help/latest/command/find_library.html + +# Link against required libraries from Windows +if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + # Required to use the functions from the shlwapi.h header + find_library(Shlwapi NAMES "Shlwapi" "Shlwapi.lib" "Shlwapi.dll") + if(NOT Shlwapi) + report_not_found_native_library("Shlwapi") + + # Ignore the fact that the Shlwapi wasn't found and try to link against it anyway + set(Shlwapi "Shlwapi") + endif() + + # Set up wrapper target + add_library(windows_shell_shlwapi INTERFACE) + add_library(Windows::Shell::LightweightUtility ALIAS windows_shell_shlwapi) + target_link_libraries(windows_shell_shlwapi INTERFACE ${Shlwapi}) + +# Link against required libraries from macOS +elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + # Required to use the functions from the Cocoa framework + find_library(Cocoa NAMES "Cocoa" "Cocoa.framework") + if(NOT Cocoa) + report_not_found_native_library("Cocoa") + + # Ignore the fact that the Cocoa wasn't found and try to link against it anyway + set(Cocoa "Cocoa") + endif() + + # Set up wrapper target + add_library(macos_cocoa INTERFACE) + add_library(macOS::Cocoa ALIAS macos_cocoa) + target_link_libraries(macos_cocoa INTERFACE ${Cocoa}) +endif() diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..ef6222d2c --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,41 @@ +# 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" +) + +# Disable compiler-specific extensions +set(CMAKE_C_EXTENSIONS OFF) +set(CMAKE_CXX_EXTENSIONS OFF) + +# 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 +set(RMLUI_FONT_INTERFACE "freetype" CACHE STRING "Font engine to build RmlUi with. If left empty, RmlUi won't be built with any of the included font interfaces.") +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) +option(RMLUI_BUILD_SAMPLES "Build samples of the library." OFF) +set(RMLUI_SAMPLES_BACKEND "GLFW_GL3" CACHE STRING "Backend to use when building the RmlUi samples. Choose one from ./CMake/Backends.cmake.") +option(BUILD_SHARED_LIBS "CMake standard option. Choose whether to build RmlUi and RmlUi's debugger as shared libraries." OFF) +option(RMLUI_USING_VCPKG "If true, the CMake project will adapt its behavior to accept third-party dependencies from vcpkg." OFF) + +# Add custom CMake modules path for external dependencies +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake/Modules") +list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Dependencies") + +# Set up external dependencies +include("CMake/Dependencies.cmake") + +# Add CMake subdirectories +add_subdirectory("Source") + +# Add samples to the build project if enabled +if(RMLUI_BUILD_SAMPLES) + add_subdirectory("Samples") +endif() diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..8913b8e61 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,47 @@ +# 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 (Visual Studio) 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 repository. + +- **Every time the minimum CMake version is going to be raised, check for the `RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE` keyword in all CMake files (`*.cmake`, `CMakeLists.txt`):** This keyword appears in comments indicating improvements, changes or warnings in the CMake project that could be relevant once the minimum CMake version reaches a certain point. Contributors are invited to add more of these comments as they implement more code for the CMake project so that they can be later revised when the moment to increase the minimum CMake version comes. diff --git a/Include/RmlUi/Core/Header.h b/Include/RmlUi/Core/Header.h index 31516e46e..a6c1f8453 100644 --- a/Include/RmlUi/Core/Header.h +++ b/Include/RmlUi/Core/Header.h @@ -36,7 +36,7 @@ #if !defined RMLUI_STATIC_LIB #if defined RMLUI_PLATFORM_WIN32 - #if defined RmlCore_EXPORTS + #if defined RMLUICORE_EXPORTS #define RMLUICORE_API __declspec(dllexport) // Note: Changing a RMLUICORE_API_INLINE method // breaks ABI compatibility!! diff --git a/Include/RmlUi/Debugger/Header.h b/Include/RmlUi/Debugger/Header.h index 09a24ffde..76cd3fcc0 100644 --- a/Include/RmlUi/Debugger/Header.h +++ b/Include/RmlUi/Debugger/Header.h @@ -33,7 +33,7 @@ #if !defined RMLUI_STATIC_LIB #ifdef RMLUI_PLATFORM_WIN32 - #ifdef RmlDebugger_EXPORTS + #ifdef RMLUIDEBUGGER_EXPORTS #define RMLUIDEBUGGER_API __declspec(dllexport) #else #define RMLUIDEBUGGER_API __declspec(dllimport) diff --git a/Samples/CMakeLists.txt b/Samples/CMakeLists.txt new file mode 100644 index 000000000..dd614b576 --- /dev/null +++ b/Samples/CMakeLists.txt @@ -0,0 +1,42 @@ +# Check the font interface configuration +if(RMLUI_FONT_INTERFACE STREQUAL "") + # If RmlUi is being built with no font interface, then samples cannot be built + message(FATAL_ERROR "Building samples has been enabled, but no font interface has been selected.") +endif() + +# Declare dependencies for sample backend +include("${PROJECT_SOURCE_DIR}/CMake/BackendsDependencies.cmake") + +# Add information about the available backends specified in CMake/Backends.cmake +include("${PROJECT_SOURCE_DIR}/CMake/Backends.cmake") + +# Check if the specified backend is available +list(FIND RMLUI_SAMPLES_AVAILABLE_BACKENDS ${RMLUI_SAMPLES_BACKEND} backend_index) +if(backend_index EQUAL "-1") + # If the backend identifier isn't found in the list, return error + message(FATAL_ERROR "The RmlUi backend ID specified in RMLUI_SAMPLES_BACKEND is not valid.") +endif() + +# Negotiate Vulkan debugging for Vulkan-based backends +if(RMLUI_SAMPLES_BACKEND MATCHES "VK$") + option(RMLUI_VK_DEBUG "Enable debugging mode for Vulkan renderer." OFF) + mark_as_advanced(RMLUI_VK_DEBUG) + if(RMLUI_VK_DEBUG) + # Add compile definition for Vulkan debugging + target_compile_definitions(rmlui_backend_${RMLUI_SAMPLES_BACKEND} INTERFACE "RMLUI_VK_DEBUG") + endif() +endif() + +# Look for dependencies for the RmlUi samples shell +include("${PROJECT_SOURCE_DIR}/CMake/SamplesShellDependencies.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 samples's subdirectories +add_subdirectory("basic") diff --git a/Samples/basic/CMakeLists.txt b/Samples/basic/CMakeLists.txt new file mode 100644 index 000000000..8d4fdb6a5 --- /dev/null +++ b/Samples/basic/CMakeLists.txt @@ -0,0 +1,10 @@ +# Add CMake subdirectories of samples +add_subdirectory("benchmark") +add_subdirectory("demo") + +# Negotiate inclusion of Lottie sample +if(RMLUI_ENABLE_LOTTIE_PLUGIN) + add_subdirectory("lottie") +else() + message(NOTICE "Lottie sample disabled due to RMLUI_ENABLE_LOTTIE_PLUGIN=OFF") +endif() diff --git a/Samples/basic/benchmark/CMakeLists.txt b/Samples/basic/benchmark/CMakeLists.txt new file mode 100644 index 000000000..2f150fd56 --- /dev/null +++ b/Samples/basic/benchmark/CMakeLists.txt @@ -0,0 +1,7 @@ +# Declare executable +add_executable(rmlui_samples_benchmark WIN32 + src/main.cpp +) + +# Link shell library +target_link_libraries(rmlui_samples_benchmark PRIVATE rmlui_samples_shell) diff --git a/Samples/basic/demo/CMakeLists.txt b/Samples/basic/demo/CMakeLists.txt new file mode 100644 index 000000000..a12259d1e --- /dev/null +++ b/Samples/basic/demo/CMakeLists.txt @@ -0,0 +1,7 @@ +# Declare executable +add_executable(rmlui_samples_demo WIN32 + src/main.cpp +) + +# Link shell library +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..01212013b --- /dev/null +++ b/Samples/basic/lottie/CMakeLists.txt @@ -0,0 +1,7 @@ +# Declare executable +add_executable(rmlui_samples_lottie WIN32 + src/main.cpp +) + +# Link shell library +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..2e91e4ebd --- /dev/null +++ b/Samples/shell/CMakeLists.txt @@ -0,0 +1,27 @@ +# Quoting the source file paths isn't necessary because add_library() doesn't read +# CMake variables, just strings +add_library(rmlui_samples_shell STATIC + src/PlatformExtensions.cpp + src/RendererExtensions.cpp + src/Shell.cpp + src/ShellFileInterface.cpp +) + +# Add backend +target_link_libraries(rmlui_samples_shell PRIVATE rmlui_backend_${RMLUI_SAMPLES_BACKEND}) + +# Add include directories +target_include_directories(rmlui_samples_shell PUBLIC "include" "${PROJECT_SOURCE_DIR}/Backends") + +# Link against required libraries from Windows +if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + # Required to use the functions from the shlwapi.h header + target_link_libraries(rmlui_samples_shell PRIVATE Windows::Shell::LightweightUtility) +# Link against required libraries from macOS +elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + # Required to use the functions from the Cocoa framework + target_link_libraries(rmlui_samples_shell PRIVATE macOS::Cocoa) +endif() + +# Link against RmlUi and its debugger +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..86de312e5 --- /dev/null +++ b/Source/CMakeLists.txt @@ -0,0 +1,8 @@ +# Add plugin directories +add_subdirectory("Lottie") + +# Add main RmlUi directory +add_subdirectory("Core") + +# Add RmlUi debugger directory +add_subdirectory("Debugger") diff --git a/Source/Core/CMakeLists.txt b/Source/Core/CMakeLists.txt new file mode 100644 index 000000000..66f7da13c --- /dev/null +++ b/Source/Core/CMakeLists.txt @@ -0,0 +1,396 @@ +# 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 +) + +# Set C++14 as requirement +target_compile_features(rmlui_core PUBLIC "cxx_std_14") + +# Add public include directories +target_include_directories(rmlui_core PUBLIC "${PROJECT_SOURCE_DIR}/Include") + +# Add public headers as files in the project (it's not necessary but convenient for IDE integration) +# Setting them as PRIVATE so that it's addition doesn't propagate, it won't affect availability since +# the entire include directory has already been declared as public +target_sources(rmlui_core PRIVATE + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Config/Config.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Animation.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/BaseXMLParser.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Box.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Colour.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Colour.inl + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ComputedValues.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Containers/itlib/flat_map.hpp + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Containers/itlib/flat_set.hpp + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Containers/LICENSE.txt + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Containers/robin_hood.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Context.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ContextInstancer.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ConvolutionFilter.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Core.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/DataModelHandle.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/DataStructHandle.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/DataTypeRegister.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/DataTypes.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/DataVariable.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Debug.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Decorator.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/DecoratorInstancer.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Dictionary.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Element.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Element.inl + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ElementDocument.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ElementInstancer.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Input.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Log.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Math.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Matrix4.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Matrix4.inl + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/NumericValue.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ObserverPtr.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Platform.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Plugin.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Profiling.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/PropertiesIteratorView.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Property.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/PropertyDefinition.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/PropertyDictionary.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/PropertyIdSet.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/PropertyParser.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/PropertySpecification.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Rectangle.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ElementScroll.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ElementText.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ElementUtilities.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Event.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/EventInstancer.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/EventListener.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/EventListenerInstancer.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Factory.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FileInterface.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FontEffect.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FontEffectInstancer.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FontEngineInterface.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FontGlyph.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FontMetrics.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Geometry.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/GeometryUtilities.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Header.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ScriptInterface.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ScrollTypes.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Spritesheet.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Stream.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StreamMemory.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StringUtilities.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StyleSheet.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StyleSheetContainer.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StyleSheetSpecification.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StyleSheetTypes.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StyleTypes.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/SystemInterface.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Texture.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Traits.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Transform.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/TransformPrimitive.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Tween.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/TypeConverter.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/TypeConverter.inl + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Types.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Unit.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/URL.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Utilities.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Variant.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Variant.inl + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vector2.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vector2.inl + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vector3.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vector3.inl + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vector4.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vector4.inl + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vertex.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/XMLNodeHandler.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/XMLParser.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementForm.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementFormControl.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementFormControlInput.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementFormControlSelect.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementFormControlTextArea.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementProgress.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementTabSet.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ID.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/RenderInterface.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core.h +) + +# 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" + + # Change output name of the final library file + OUTPUT_NAME "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) + +# Avoid problems with MSVC's __dllspec() in static builds +get_target_property(rmlui_core_TYPE rmlui_core "TYPE") +if(rmlui_core_TYPE STREQUAL "STATIC_LIBRARY") + # If RmlUi is being compiled as a static library, notify code to disable usage of __dllspec() + # Since public headers also detect it, it needs to be a public definition + target_compile_definitions(rmlui_core PUBLIC "RMLUI_STATIC_LIB") +elseif(rmlui_core_TYPE STREQUAL "SHARED_LIBRARY") + # If RmlUi is being compiled as a shared library, notify code to export functions using __dllspec() + # For applications consuming the library, the headers will automatically use dllimport + # Platform and compiler handling is already done by code via pre-processor macros + target_compile_definitions(rmlui_core PRIVATE "RMLUICORE_EXPORTS") +endif() + +# Negotiate usage of the default font engine +# When any new font engine is added, it must be added here with an else if statement before the else case +if(RMLUI_FONT_INTERFACE STREQUAL "freetype") + # 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) +else() + # Pass information to code via compile definition + target_compile_definitions(rmlui_core PRIVATE "RMLUI_NO_FONT_INTERFACE_DEFAULT") +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..d24cca47a --- /dev/null +++ b/Source/Core/Elements/CMakeLists.txt @@ -0,0 +1,71 @@ +# 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) + +# Set C++14 as requirement +target_compile_features(rmlui_core_elements INTERFACE "cxx_std_14") + +# RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE: +# 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_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..4d6ff4fba --- /dev/null +++ b/Source/Core/FontEngineDefault/CMakeLists.txt @@ -0,0 +1,44 @@ +# 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) + +# Set C++14 as requirement +target_compile_features(rmlui_core_fontenginedefault INTERFACE "cxx_std_14") + +# RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE: +# 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..3283318ca --- /dev/null +++ b/Source/Core/Layout/CMakeLists.txt @@ -0,0 +1,61 @@ +# 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) + +# Set C++14 as requirement +target_compile_features(rmlui_core_layout INTERFACE "cxx_std_14") + +# RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE: +# 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..b00f5cbdb --- /dev/null +++ b/Source/Debugger/CMakeLists.txt @@ -0,0 +1,79 @@ +# 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 +) + +# Set C++14 as requirement +target_compile_features(rmlui_debugger PUBLIC "cxx_std_14") + +# Add public include directories +target_include_directories(rmlui_debugger PUBLIC "${PROJECT_SOURCE_DIR}/Include") + +# Add public headers as files in the project (it's not necessary but convenient for IDE integration) +# Setting them as PRIVATE so that it's addition doesn't propagate, it won't affect availability since +# the entire include directory has already been declared as public +target_sources(rmlui_debugger PRIVATE + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Debugger/Debugger.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Debugger/Header.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Debugger.h +) + +# Link against RmlUi +target_link_libraries(rmlui_debugger PUBLIC RmlUi::RmlUi) + +# 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) + +# Avoid problems with MSVC's __dllspec() in static builds +get_target_property(rmlui_debugger_TYPE rmlui_debugger "TYPE") +if(rmlui_debugger_TYPE STREQUAL "SHARED_LIBRARY") + # If RmlUi debugger is being compiled as a shared library, notify code to export functions using __dllspec() + # For applications consuming the library, the headers will automatically use dllimport + # Platform and compiler handling is already done by code via pre-processor macros + target_compile_definitions(rmlui_debugger PRIVATE "RMLUIDEBUGGER_EXPORTS") +endif() + +# 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" + + # Change output name of the final library file + OUTPUT_NAME "rmlui_debugger" +) diff --git a/Source/Lottie/CMakeLists.txt b/Source/Lottie/CMakeLists.txt new file mode 100644 index 000000000..bb7d7220e --- /dev/null +++ b/Source/Lottie/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_lottie INTERFACE) + +# Set C++14 as requirement +target_compile_features(rmlui_lottie INTERFACE "cxx_std_14") + +# RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE: +# 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 +) + +# Add public headers as files in the project (it's not necessary but convenient for IDE integration) +target_sources(rmlui_lottie INTERFACE + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Lottie/ElementLottie.h +) + +# Link library against rlottie +target_link_libraries(rmlui_lottie INTERFACE rlottie::rlottie) + +# Notify source files about the usage of the plugin +target_compile_definitions(rmlui_lottie INTERFACE "RMLUI_ENABLE_LOTTIE_PLUGIN") diff --git a/Source/Lua/CMakeLists.txt b/Source/Lua/CMakeLists.txt new file mode 100644 index 000000000..c940579f9 --- /dev/null +++ b/Source/Lua/CMakeLists.txt @@ -0,0 +1,13 @@ +# Placeholder CMake file + +# Add public headers as files in the project (it's not necessary but convenient for IDE integration) +target_sources(rmlui_lua INTERFACE + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/Header.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/IncludeLua.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/Interpreter.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/Lua.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/LuaType.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/LuaType.inl + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/Utilities.h + ${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua.h +) diff --git a/Source/SVG/CMakeLists.txt b/Source/SVG/CMakeLists.txt new file mode 100644 index 000000000..0afc4203f --- /dev/null +++ b/Source/SVG/CMakeLists.txt @@ -0,0 +1,6 @@ +# Placeholder CMake file + +# Add public headers as files in the project (it's not necessary but convenient for IDE integration) +target_sources(rmlui_svg INTERFACE + ${PROJECT_SOURCE_DIR}/Include/RmlUi/SVG/ElementSVG.h +) From e1ff002875b4553ff5d2c59e84f9eabdee55f501 Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Sat, 2 Sep 2023 14:29:01 +0200 Subject: [PATCH 03/29] Various fixes - Change vcpkg handling to automatically detect vcpkg via the VCPKG_TOOLCHAIN variable set by the official toolchain file - Change names of the function export compiler definitions - Change default behavior of BUILD_SHARED_LIBS to ON --- CMake/BackendsDependencies.cmake | 2 +- CMakeLists.txt | 3 +-- Include/RmlUi/Core/Header.h | 2 +- Include/RmlUi/Debugger/Header.h | 2 +- Source/Core/CMakeLists.txt | 2 +- Source/Debugger/CMakeLists.txt | 2 +- 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/CMake/BackendsDependencies.cmake b/CMake/BackendsDependencies.cmake index 8d64ee863..fd7a931a8 100644 --- a/CMake/BackendsDependencies.cmake +++ b/CMake/BackendsDependencies.cmake @@ -18,7 +18,7 @@ endfunction() if(RMLUI_SAMPLES_BACKEND MATCHES "^SDL") # All dependencies are searched as soft dependencies so that they won't error out if the library # is declared by other means - if(RMLUI_USING_VCPKG) + if(VCPKG_TOOLCHAIN) # vcpkg uses a different name for their SDL find module and target than the official CMake one find_package("SDL2") diff --git a/CMakeLists.txt b/CMakeLists.txt index ef6222d2c..8408b5584 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,8 +22,7 @@ option(RMLUI_ENABLE_LOTTIE_PLUGIN "Enable plugin for Lottie animations. Requires option(RMLUI_ENABLE_SVG_PLUGIN "Enable plugin for SVG images. Requires the lunasvg library." OFF) option(RMLUI_BUILD_SAMPLES "Build samples of the library." OFF) set(RMLUI_SAMPLES_BACKEND "GLFW_GL3" CACHE STRING "Backend to use when building the RmlUi samples. Choose one from ./CMake/Backends.cmake.") -option(BUILD_SHARED_LIBS "CMake standard option. Choose whether to build RmlUi and RmlUi's debugger as shared libraries." OFF) -option(RMLUI_USING_VCPKG "If true, the CMake project will adapt its behavior to accept third-party dependencies from vcpkg." OFF) +option(BUILD_SHARED_LIBS "CMake standard option. Choose whether to build RmlUi and RmlUi's debugger as shared libraries." ON) # Add custom CMake modules path for external dependencies list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake/Modules") diff --git a/Include/RmlUi/Core/Header.h b/Include/RmlUi/Core/Header.h index a6c1f8453..5bfded806 100644 --- a/Include/RmlUi/Core/Header.h +++ b/Include/RmlUi/Core/Header.h @@ -36,7 +36,7 @@ #if !defined RMLUI_STATIC_LIB #if defined RMLUI_PLATFORM_WIN32 - #if defined RMLUICORE_EXPORTS + #if defined RMLUI_CORE_EXPORTS #define RMLUICORE_API __declspec(dllexport) // Note: Changing a RMLUICORE_API_INLINE method // breaks ABI compatibility!! diff --git a/Include/RmlUi/Debugger/Header.h b/Include/RmlUi/Debugger/Header.h index 76cd3fcc0..0e3103ae6 100644 --- a/Include/RmlUi/Debugger/Header.h +++ b/Include/RmlUi/Debugger/Header.h @@ -33,7 +33,7 @@ #if !defined RMLUI_STATIC_LIB #ifdef RMLUI_PLATFORM_WIN32 - #ifdef RMLUIDEBUGGER_EXPORTS + #ifdef RMLUI_DEBUGGER_EXPORTS #define RMLUIDEBUGGER_API __declspec(dllexport) #else #define RMLUIDEBUGGER_API __declspec(dllimport) diff --git a/Source/Core/CMakeLists.txt b/Source/Core/CMakeLists.txt index 66f7da13c..00b28c636 100644 --- a/Source/Core/CMakeLists.txt +++ b/Source/Core/CMakeLists.txt @@ -372,7 +372,7 @@ elseif(rmlui_core_TYPE STREQUAL "SHARED_LIBRARY") # If RmlUi is being compiled as a shared library, notify code to export functions using __dllspec() # For applications consuming the library, the headers will automatically use dllimport # Platform and compiler handling is already done by code via pre-processor macros - target_compile_definitions(rmlui_core PRIVATE "RMLUICORE_EXPORTS") + target_compile_definitions(rmlui_core PRIVATE "RMLUI_CORE_EXPORTS") endif() # Negotiate usage of the default font engine diff --git a/Source/Debugger/CMakeLists.txt b/Source/Debugger/CMakeLists.txt index b00f5cbdb..a99e15820 100644 --- a/Source/Debugger/CMakeLists.txt +++ b/Source/Debugger/CMakeLists.txt @@ -65,7 +65,7 @@ if(rmlui_debugger_TYPE STREQUAL "SHARED_LIBRARY") # If RmlUi debugger is being compiled as a shared library, notify code to export functions using __dllspec() # For applications consuming the library, the headers will automatically use dllimport # Platform and compiler handling is already done by code via pre-processor macros - target_compile_definitions(rmlui_debugger PRIVATE "RMLUIDEBUGGER_EXPORTS") + target_compile_definitions(rmlui_debugger PRIVATE "RMLUI_DEBUGGER_EXPORTS") endif() # Set additional target properties From 7ad098fb180f47fead8c421105b324b8ed83cc64 Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Sat, 2 Sep 2023 23:05:34 +0200 Subject: [PATCH 04/29] Output compiled DLLs and samples in same directory --- Source/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 86de312e5..b27fb9699 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -1,3 +1,8 @@ +# Change the runtime output directory of all target declared in this scope +# This is needed so that in the event of building the project as a shared +# library, all DLLs required by samples will be properly found in Windows +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + # Add plugin directories add_subdirectory("Lottie") From 12467e15356ad265d6194888772b995c19311b11 Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Sun, 3 Sep 2023 12:39:40 +0200 Subject: [PATCH 05/29] Refactor SFML handling --- CMake/BackendsDependencies.cmake | 46 +++++++++++++++++--------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/CMake/BackendsDependencies.cmake b/CMake/BackendsDependencies.cmake index fd7a931a8..5015b191b 100644 --- a/CMake/BackendsDependencies.cmake +++ b/CMake/BackendsDependencies.cmake @@ -125,17 +125,6 @@ endif() # SFML if(RMLUI_SAMPLES_BACKEND MATCHES "^SFML") - # For compatibility with SFML >= 2.7, component names might need to be capitalized (Graphics, Window, ...) - if (WIN32) - find_package("SFML" "2" COMPONENTS graphics window system main) - else() - find_package("SFML" "2" COMPONENTS graphics window system) - endif() - - if(NOT SFML_FOUND) - report_not_found_dependency("SFML" SFML::SFML) - endif() - #[[ Starting with SFML 2.7, the recommended method to find the library is using the official config file which sets up targets for each module of the library. @@ -152,16 +141,31 @@ if(RMLUI_SAMPLES_BACKEND MATCHES "^SFML") approach. #]] - # Because we always require the window module, we can use it to determine which method CMake has used - # to find SFML - if(NOT TARGET SFML::Window) - list(APPEND RMLUI_SFML_REQUIRED_COMPONENTS "Graphics" "Window" "System") - if(WIN32) - list(APPEND RMLUI_SFML_REQUIRED_COMPONENTS "Main") - endif() + # List of required components in capital case + list(APPEND RMLUI_SFML_REQUIRED_COMPONENTS "Graphics" "Window" "System") + if(WIN32) + list(APPEND RMLUI_SFML_REQUIRED_COMPONENTS "Main") + endif() - # Because we always require the window module, we can use it to determine which iteration of the config - # module is being used + # Run find package with component names both capitalized and lower-cased + find_package("SFML" "2" COMPONENTS ${RMLUI_SFML_REQUIRED_COMPONENTS}) + list(TRANSFORM RMLUI_SFML_REQUIRED_COMPONENTS TOLOWER OUTPUT_VARIABLE RMLUI_SFML_REQUIRED_COMPONENTS_LOWER) + find_package("SFML" "2" COMPONENTS ${RMLUI_SFML_REQUIRED_COMPONENTS_LOWER}) + + # Since we are using find_package() in basic mode, we can check the _FOUND variable + if(NOT SFML_FOUND) + report_not_found_dependency("SFML" SFML::SFML) + endif() + + #[[ + Since the RmlUi CMake project uses the SFML 2.7 namespaced target names, if the version is lower wrappers + need to be set up. + + Because we always require the window module, we can use it to determine which iteration of the config. + #]] + + # If any of the mandatory SFML 2.7 targets isn't present, asume SFML < 2.7 has been found and set up wrappers + if(NOT TARGET SFML::Window) if(TARGET sfml-window) #[[ If sfml-window exists, then that means the version is either SFML 2.5 or 2.6 which set up @@ -184,7 +188,7 @@ if(RMLUI_SAMPLES_BACKEND MATCHES "^SFML") # Because module-specific targets already exist, there's no need for the wrapper for the older find module # Set up wrapper target as dumb target add_library(rmlui_SFML_old_wrapper INTERFACE) - elseif() + else() #[[ If sfml-window doesn't exist, then SFML version is <= 2.4 and the old-variable approach used in their old official find module needs to be wrapped. From a866f820edbf4ccad0682d8596c18e1e0815d6d7 Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Sun, 3 Sep 2023 13:26:51 +0200 Subject: [PATCH 06/29] Use IMPORTED targets for handled external dependencies --- CMake/BackendsDependencies.cmake | 17 +++++++---------- CMake/Modules/Emscripten/FindFreetype.cmake | 11 +++++------ CMake/Modules/Emscripten/FindOpenGL.cmake | 11 +++++------ CMake/Modules/Emscripten/FindSDL.cmake | 11 +++++------ CMake/Modules/Emscripten/FindSDL_image.cmake | 11 +++++------ CMake/Modules/Emscripten/Findglfw3.cmake | 2 +- CMake/SamplesShellDependencies.cmake | 10 ++++------ 7 files changed, 32 insertions(+), 41 deletions(-) diff --git a/CMake/BackendsDependencies.cmake b/CMake/BackendsDependencies.cmake index 5015b191b..ae7f369fc 100644 --- a/CMake/BackendsDependencies.cmake +++ b/CMake/BackendsDependencies.cmake @@ -48,13 +48,12 @@ if(RMLUI_SAMPLES_BACKEND MATCHES "^SDL") # Set up the detected SDL as the SDL::SDL INTERFACE target if it hasn't already been created # This is done for consistent referencing across the CMake code regardless of the CMake version used if(NOT TARGET SDL::SDL) - add_library(SDL INTERFACE) - add_library(SDL::SDL ALIAS SDL) + add_library(SDL::SDL INTERFACE IMPORTED) # Any CMake target linking against SDL::SDL will link against the SDL libraries and have # their include directories added to their target properties - target_link_libraries(SDL INTERFACE ${SDL_LIBRARIES}) - target_include_directories(SDL INTERFACE ${SDL_INCLUDE_DIRS}) + target_link_libraries(SDL::SDL INTERFACE ${SDL_LIBRARIES}) + target_include_directories(SDL::SDL INTERFACE ${SDL_INCLUDE_DIRS}) endif() # SDL_GL2 backend requires GLEW @@ -102,13 +101,12 @@ if(RMLUI_SAMPLES_BACKEND MATCHES "^SDL") # to make the code more future-proof # For us, its name will be SDL::Image if(NOT TARGET SDL::Image) - add_library(SDLimage INTERFACE) - add_library(SDL::Image ALIAS SDLimage) + add_library(SDL::Image INTERFACE IMPORTED) # Any CMake target linking against SDL::Image will link against the SDL_image libraries # and have their include directories added to their target properties - target_link_libraries(SDLimage INTERFACE ${SDL_IMAGE_LIBRARIES}) - target_include_directories(SDLimage INTERFACE ${SDL_IMAGE_INCLUDE_DIRS}) + target_link_libraries(SDL::Image INTERFACE ${SDL_IMAGE_LIBRARIES}) + target_include_directories(SDL::Image INTERFACE ${SDL_IMAGE_INCLUDE_DIRS}) endif() endif() endif() @@ -203,8 +201,7 @@ if(RMLUI_SAMPLES_BACKEND MATCHES "^SFML") # Create dumb targets to replace the modern component-specific targets foreach(sfml_component ${RMLUI_SFML_REQUIRED_COMPONENTS}) - add_library(rmlui_SFML_${sfml_component} INTERFACE) - add_library(SFML::${sfml_component} ALIAS rmlui_SFML_${sfml_component}) + add_library(SFML::${sfml_component} INTERFACE IMPORTED) endforeach() endif() endif() diff --git a/CMake/Modules/Emscripten/FindFreetype.cmake b/CMake/Modules/Emscripten/FindFreetype.cmake index e7b4eed81..5ca6615d3 100644 --- a/CMake/Modules/Emscripten/FindFreetype.cmake +++ b/CMake/Modules/Emscripten/FindFreetype.cmake @@ -30,20 +30,19 @@ endif() # Emscripten includes Freetype support as part of it's SDK, meaning there's no need to find it set(Freetype_FOUND TRUE) -add_library(freetype INTERFACE) -add_library(Freetype::Freetype ALIAS freetype) +add_library(Freetype::Freetype INTERFACE IMPORTED) # Set found Freetype version # Version set based on latest Emscripten SDK at the time of writing this file set(FREETYPE_VERSION_STRING "2.6") # Enable compilation and linking against Freetype -target_compile_options(freetype INTERFACE "-sUSE_FREETYPE=1") -target_link_libraries(freetype INTERFACE "-sUSE_FREETYPE=1") +target_compile_options(Freetype::Freetype INTERFACE "-sUSE_FREETYPE=1") +target_link_libraries(Freetype::Freetype INTERFACE "-sUSE_FREETYPE=1") # Get final compiler and linker flags to print them -get_target_property(Freetype_COMPILE_FLAGS freetype "INTERFACE_COMPILE_OPTIONS") -get_target_property(Freetype_LINK_FLAGS freetype "INTERFACE_LINK_OPTIONS") +get_target_property(Freetype_COMPILE_FLAGS Freetype::Freetype "INTERFACE_COMPILE_OPTIONS") +get_target_property(Freetype_LINK_FLAGS Freetype::Freetype "INTERFACE_LINK_OPTIONS") find_package_message( "Freetype" diff --git a/CMake/Modules/Emscripten/FindOpenGL.cmake b/CMake/Modules/Emscripten/FindOpenGL.cmake index 4909d1757..52dd2cc6f 100644 --- a/CMake/Modules/Emscripten/FindOpenGL.cmake +++ b/CMake/Modules/Emscripten/FindOpenGL.cmake @@ -30,8 +30,7 @@ endif() # Emscripten includes OpenGL ES support as part of it's SDK, meaning there's no need to find it set(OpenGL_FOUND TRUE) -add_library(opengl INTERFACE) -add_library(OpenGL::GL ALIAS opengl) +add_library(OpenGL::GL INTERFACE IMPORTED) # Set found OpenGL version if((OpenGL_FIND_VERSION VERSION_GREATER_EQUAL "1") AND (OpenGL_FIND_VERSION VERSION_LESS "2")) @@ -50,18 +49,18 @@ endif() # Handle OpenGL 1 edge case # More info: https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html#emulation-of-older-desktop-opengl-api-features if(OpenGL_VERSION VERSION_EQUAL "1") - target_link_libraries(opengl INTERFACE "-sLEGACY_GL_EMULATION") + target_link_libraries(OpenGL::GL INTERFACE "-sLEGACY_GL_EMULATION") endif() # Handle OpenGL ES software emulation # More info: https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html#opengl-es-2-0-3-0-emulation if(OpenGL_ENABLE_EMULATION AND OpenGL_VERSION VERSION_GREATER_EQUAL "2") - target_link_libraries(opengl INTERFACE "-sFULL_ES${OpenGL_VERSION}") + target_link_libraries(OpenGL::GL INTERFACE "-sFULL_ES${OpenGL_VERSION}") endif() # Get final compiler and linker flags to print them -get_target_property(OpenGL_COMPILE_FLAGS opengl "INTERFACE_COMPILE_OPTIONS") -get_target_property(OpenGL_LINK_FLAGS opengl "INTERFACE_LINK_OPTIONS") +get_target_property(OpenGL_COMPILE_FLAGS OpenGL::GL "INTERFACE_COMPILE_OPTIONS") +get_target_property(OpenGL_LINK_FLAGS OpenGL::GL "INTERFACE_LINK_OPTIONS") find_package_message( "OpenGL" diff --git a/CMake/Modules/Emscripten/FindSDL.cmake b/CMake/Modules/Emscripten/FindSDL.cmake index 2197f6bbe..e40016d31 100644 --- a/CMake/Modules/Emscripten/FindSDL.cmake +++ b/CMake/Modules/Emscripten/FindSDL.cmake @@ -29,8 +29,7 @@ endif() # Emscripten includes SDL support as part of it's SDK, meaning there's no need to find it set(SDL_FOUND TRUE) -add_library(sdl INTERFACE) -add_library(SDL::SDL ALIAS sdl) +add_library(SDL::SDL INTERFACE IMPORTED) # Set found SDL version based on latest Emscripten SDK at the time of writing this file if((SDL_FIND_VERSION VERSION_GREATER_EQUAL "1") AND (SDL_FIND_VERSION VERSION_LESS "2")) @@ -49,12 +48,12 @@ elseif((SDL_FIND_VERSION VERSION_GREATER_EQUAL "2") AND (SDL_FIND_VERSION VERSIO endif() # Enable compilation and linking against SDL -target_compile_options(sdl INTERFACE "-sUSE_SDL=${SDL_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") -target_link_libraries(sdl INTERFACE "-sUSE_SDL=${SDL_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") +target_compile_options(SDL::SDL INTERFACE "-sUSE_SDL=${SDL_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") +target_link_libraries(SDL::SDL INTERFACE "-sUSE_SDL=${SDL_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") # Get final compiler and linker flags to print them -get_target_property(SDL_COMPILE_FLAGS sdl "INTERFACE_COMPILE_OPTIONS") -get_target_property(SDL_LINK_FLAGS sdl "INTERFACE_LINK_OPTIONS") +get_target_property(SDL_COMPILE_FLAGS SDL::SDL "INTERFACE_COMPILE_OPTIONS") +get_target_property(SDL_LINK_FLAGS SDL::SDL "INTERFACE_LINK_OPTIONS") find_package_message( "SDL" diff --git a/CMake/Modules/Emscripten/FindSDL_image.cmake b/CMake/Modules/Emscripten/FindSDL_image.cmake index e47ca9693..f8b8a7c05 100644 --- a/CMake/Modules/Emscripten/FindSDL_image.cmake +++ b/CMake/Modules/Emscripten/FindSDL_image.cmake @@ -34,8 +34,7 @@ message(WARNING # Emscripten includes SDL support as part of it's SDK, meaning there's no need to find it set(SDL_image_FOUND TRUE) -add_library(sdl_image INTERFACE) -add_library(SDL::Image ALIAS sdl_image) +add_library(SDL::Image INTERFACE IMPORTED) # Set found SDL_image version based on latest Emscripten SDK at the time of writing this file if((SDL_image_FIND_VERSION VERSION_GREATER_EQUAL "1") AND (SDL_image_FIND_VERSION VERSION_LESS "2")) @@ -54,12 +53,12 @@ elseif((SDL_image_FIND_VERSION VERSION_GREATER_EQUAL "2") AND (SDL_image_FIND_VE endif() # Enable compilation and linking against SDL -target_compile_options(sdl_image INTERFACE "-sUSE_SDL_IMAGE=${SDL_image_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") -target_link_libraries(sdl_image INTERFACE "-sUSE_SDL_IMAGE=${SDL_image_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") +target_compile_options(SDL::Image INTERFACE "-sUSE_SDL_IMAGE=${SDL_image_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") +target_link_libraries(SDL::Image INTERFACE "-sUSE_SDL_IMAGE=${SDL_image_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") # Get final compiler and linker flags to print them -get_target_property(SDL_image_COMPILE_FLAGS sdl_image "INTERFACE_COMPILE_OPTIONS") -get_target_property(SDL_image_LINK_FLAGS sdl_image "INTERFACE_LINK_OPTIONS") +get_target_property(SDL_image_COMPILE_FLAGS SDL::Image "INTERFACE_COMPILE_OPTIONS") +get_target_property(SDL_image_LINK_FLAGS SDL::Image "INTERFACE_LINK_OPTIONS") find_package_message( "SDL_image" diff --git a/CMake/Modules/Emscripten/Findglfw3.cmake b/CMake/Modules/Emscripten/Findglfw3.cmake index 7c1bce32f..062202abe 100644 --- a/CMake/Modules/Emscripten/Findglfw3.cmake +++ b/CMake/Modules/Emscripten/Findglfw3.cmake @@ -29,7 +29,7 @@ endif() # Emscripten includes GLFW support as part of it's SDK, meaning there's no need to find it set(glfw3_FOUND TRUE) -add_library(glfw INTERFACE) +add_library(glfw INTERFACE IMPORTED) # Set found GLFW version based on latest Emscripten SDK at the time of writing this file # Version set based on latest Emscripten SDK at the time of writing this file diff --git a/CMake/SamplesShellDependencies.cmake b/CMake/SamplesShellDependencies.cmake index 5540b8158..848c92a84 100644 --- a/CMake/SamplesShellDependencies.cmake +++ b/CMake/SamplesShellDependencies.cmake @@ -56,9 +56,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows") endif() # Set up wrapper target - add_library(windows_shell_shlwapi INTERFACE) - add_library(Windows::Shell::LightweightUtility ALIAS windows_shell_shlwapi) - target_link_libraries(windows_shell_shlwapi INTERFACE ${Shlwapi}) + add_library(Windows::Shell::LightweightUtility INTERFACE IMPORTED) + target_link_libraries(Windows::Shell::LightweightUtility INTERFACE ${Shlwapi}) # Link against required libraries from macOS elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") @@ -72,7 +71,6 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() # Set up wrapper target - add_library(macos_cocoa INTERFACE) - add_library(macOS::Cocoa ALIAS macos_cocoa) - target_link_libraries(macos_cocoa INTERFACE ${Cocoa}) + add_library(macOS::Cocoa INTERFACE IMPORTED) + target_link_libraries(macOS::Cocoa INTERFACE ${Cocoa}) endif() From 95f94a8e6fd792055aa27b7cf1dc0505a1fce7b4 Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Mon, 4 Sep 2023 13:28:17 +0200 Subject: [PATCH 07/29] Put utility CMake functions in a separate file --- CMake/BackendsDependencies.cmake | 15 +---------- CMake/Dependencies.cmake | 15 +---------- CMake/SamplesShellDependencies.cmake | 40 +--------------------------- CMake/Utils.cmake | 39 +++++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 67 deletions(-) create mode 100644 CMake/Utils.cmake diff --git a/CMake/BackendsDependencies.cmake b/CMake/BackendsDependencies.cmake index ae7f369fc..ed19406f3 100644 --- a/CMake/BackendsDependencies.cmake +++ b/CMake/BackendsDependencies.cmake @@ -1,17 +1,4 @@ -#[[ -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." - "\nIf you are consuming RmlUi as a subdirectory inside another CMake project, please ensure that " - "${friendly_name} can be found by CMake or at least being linked using \"${target_name}\" as its " - "target name. You can create an ALIAS target to offer an alternative name for a CMake target." - ) -endfunction() +include("${PROJECT_SOURCE_DIR}/CMake/Utils.cmake") # --- Window/input APIs --- # SDL diff --git a/CMake/Dependencies.cmake b/CMake/Dependencies.cmake index a7efa5699..c1adc1faa 100644 --- a/CMake/Dependencies.cmake +++ b/CMake/Dependencies.cmake @@ -1,17 +1,4 @@ -#[[ -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." - "\nIf you are consuming RmlUi as a subdirectory inside another CMake project, please ensure that " - "${friendly_name} can be found by CMake or at least being linked using \"${target_name}\" as its " - "target name. You can create an ALIAS target to offer an alternative name for a CMake target." - ) -endfunction() +include("${PROJECT_SOURCE_DIR}/CMake/Utils.cmake") # Freetype if(RMLUI_FONT_INTERFACE STREQUAL "freetype") diff --git a/CMake/SamplesShellDependencies.cmake b/CMake/SamplesShellDependencies.cmake index 848c92a84..1086ce8dd 100644 --- a/CMake/SamplesShellDependencies.cmake +++ b/CMake/SamplesShellDependencies.cmake @@ -1,42 +1,4 @@ -#[[ -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." - "\nIf you are consuming RmlUi as a subdirectory inside another CMake project, please ensure that " - "${friendly_name} can be found by CMake or at least being linked using \"${target_name}\" as its " - "target name. You can create an ALIAS target to offer an alternative name for a CMake target." - ) -endfunction() - -#[[ -Function to print a message to the console indicating a library from a native platform SDK hasn't been found -Arguments: - - library_name: Name of the library -]] -function(report_not_found_native_library library_name) - # Set SDK notice string - if(CMAKE_SYSTEM_NAME STREQUAL "Windows") - set(SDK_NOTICE "In order to ensure it is found, install the Windows SDK and build RmlUi inside a Visual Studio Developer CLI environment.\n" - "More info: https://learn.microsoft.com/en-us/visualstudio/ide/reference/command-prompt-powershell" - ) - elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - set(SDK_NOTICE "In order to ensure it is found, install the macOS SDK.\n" - "More info: https://developer.apple.com/macos/" - ) - endif() - - # Print notice - message(NOTICE - "CMake failed to find the ${library_name} library. Depending on the compiler, underlying build system " - "and environment setup, linkage of the RmlUi samples executables might fail." - "\n${SDK_NOTICE}" - ) -endfunction() +include("${PROJECT_SOURCE_DIR}/CMake/Utils.cmake") # RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE: # CMake >= 3.18 introduces the REQUIRED option for find_library() calls. diff --git a/CMake/Utils.cmake b/CMake/Utils.cmake new file mode 100644 index 000000000..4b3a79e05 --- /dev/null +++ b/CMake/Utils.cmake @@ -0,0 +1,39 @@ +#[[ +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." + "\nIf you are consuming RmlUi as a subdirectory inside another CMake project, please ensure that " + "${friendly_name} can be found by CMake or at least being linked using \"${target_name}\" as its " + "target name. You can create an ALIAS target to offer an alternative name for a CMake target." + ) +endfunction() + +#[[ +Function to print a message to the console indicating a library from a native platform SDK hasn't been found +Arguments: + - library_name: Name of the library +]] +function(report_not_found_native_library library_name) + # Set SDK notice string + if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + set(SDK_NOTICE "In order to ensure it is found, install the Windows SDK and build RmlUi inside a Visual Studio Developer CLI environment.\n" + "More info: https://learn.microsoft.com/en-us/visualstudio/ide/reference/command-prompt-powershell" + ) + elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(SDK_NOTICE "In order to ensure it is found, install the macOS SDK.\n" + "More info: https://developer.apple.com/macos/" + ) + endif() + + # Print notice + message(NOTICE + "CMake failed to find the ${library_name} library. Depending on the compiler, underlying build system " + "and environment setup, linkage of the RmlUi samples executables might fail." + "\n${SDK_NOTICE}" + ) +endfunction() From 962bfd1c0f31ae53564eb64c6f5f711dac842a87 Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Wed, 6 Sep 2023 11:29:32 +0200 Subject: [PATCH 08/29] Implement enumerated lists for option selection --- CMake/Backends.cmake | 20 ++++++-------------- CMake/OptionsLists.cmake | 24 ++++++++++++++++++++++++ CMakeLists.txt | 25 ++++++++++++++++++++++++- Samples/CMakeLists.txt | 9 +-------- 4 files changed, 55 insertions(+), 23 deletions(-) create mode 100644 CMake/OptionsLists.cmake diff --git a/CMake/Backends.cmake b/CMake/Backends.cmake index 375161fb2..89e38f03e 100644 --- a/CMake/Backends.cmake +++ b/CMake/Backends.cmake @@ -1,17 +1,9 @@ -# List of available backends -list(APPEND RMLUI_SAMPLES_AVAILABLE_BACKENDS - "Win32_GL2" - "Win32_VK" - "X11_GL2" - "SDL_GL2" - "SDL_GL3" - "SDL_VK" - "SDL_SDLrenderer" - "SFML_GL2" - "GLFW_GL2" - "GLFW_GL3" - "GLFW_VK" -) +#[[ + Details about sample backends, their source code files and linking requirements + + Everytime a new backend gets added or its target name is modified, please update + the list of available backends found in OptionsLists.cmake +#]] list(APPEND RMLUI_BACKEND_COMMON_HDR_FILES ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend.h diff --git a/CMake/OptionsLists.cmake b/CMake/OptionsLists.cmake new file mode 100644 index 000000000..548e5e7f6 --- /dev/null +++ b/CMake/OptionsLists.cmake @@ -0,0 +1,24 @@ +#[[ + Lists of options available to configure some aspects of the project +#]] + +# List of available backends +list(APPEND RMLUI_SAMPLES_AVAILABLE_BACKENDS + "Win32_GL2" + "Win32_VK" + "X11_GL2" + "SDL_GL2" + "SDL_GL3" + "SDL_VK" + "SDL_SDLrenderer" + "SFML_GL2" + "GLFW_GL2" + "GLFW_GL3" + "GLFW_VK" +) + +# List of available font interfaces +list(APPEND RMLUI_AVAILABLE_FONT_INTERFACES + "none" + "freetype" +) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8408b5584..7b4d20023 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,13 +17,36 @@ set(CMAKE_CXX_EXTENSIONS OFF) # "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 -set(RMLUI_FONT_INTERFACE "freetype" CACHE STRING "Font engine to build RmlUi with. If left empty, RmlUi won't be built with any of the included font interfaces.") +set(RMLUI_FONT_INTERFACE "freetype" CACHE STRING "Font interface to build RmlUi with. If set to \"none\", RmlUi won't be built with any of the included font interfaces.") 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) option(RMLUI_BUILD_SAMPLES "Build samples of the library." OFF) set(RMLUI_SAMPLES_BACKEND "GLFW_GL3" CACHE STRING "Backend to use when building the RmlUi samples. Choose one from ./CMake/Backends.cmake.") option(BUILD_SHARED_LIBS "CMake standard option. Choose whether to build RmlUi and RmlUi's debugger as shared libraries." ON) +# Add lists of available options for those that support it +include("${PROJECT_SOURCE_DIR}/CMake/OptionsLists.cmake") + +# Set hints for non-boolean custom CMake options +set_property(CACHE RMLUI_SAMPLES_BACKEND PROPERTY STRINGS ${RMLUI_SAMPLES_AVAILABLE_BACKENDS}) +set_property(CACHE RMLUI_FONT_INTERFACE PROPERTY STRINGS ${RMLUI_AVAILABLE_FONT_INTERFACES}) + +# Check if the specified sample backend is available +list(FIND RMLUI_SAMPLES_AVAILABLE_BACKENDS ${RMLUI_SAMPLES_BACKEND} backend_index) +if(backend_index EQUAL "-1") + # If the backend identifier isn't found in the list, return error + message(FATAL_ERROR "The RmlUi backend ID specified in RMLUI_SAMPLES_BACKEND is not valid.") +endif() +unset(backend_index) + +# Check if the specified font interface is available +list(FIND RMLUI_AVAILABLE_FONT_INTERFACES ${RMLUI_FONT_INTERFACE} fontinterface_index) +if(fontinterface_index EQUAL "-1") + # If the backend identifier isn't found in the list, return error + message(FATAL_ERROR "The RmlUi font interface ID specified in RMLUI_FONT_INTERFACE is not valid.") +endif() +unset(fontinterface_index) + # Add custom CMake modules path for external dependencies list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake/Modules") list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Dependencies") diff --git a/Samples/CMakeLists.txt b/Samples/CMakeLists.txt index dd614b576..117a9f47b 100644 --- a/Samples/CMakeLists.txt +++ b/Samples/CMakeLists.txt @@ -1,5 +1,5 @@ # Check the font interface configuration -if(RMLUI_FONT_INTERFACE STREQUAL "") +if(RMLUI_FONT_INTERFACE STREQUAL "none") # If RmlUi is being built with no font interface, then samples cannot be built message(FATAL_ERROR "Building samples has been enabled, but no font interface has been selected.") endif() @@ -10,13 +10,6 @@ include("${PROJECT_SOURCE_DIR}/CMake/BackendsDependencies.cmake") # Add information about the available backends specified in CMake/Backends.cmake include("${PROJECT_SOURCE_DIR}/CMake/Backends.cmake") -# Check if the specified backend is available -list(FIND RMLUI_SAMPLES_AVAILABLE_BACKENDS ${RMLUI_SAMPLES_BACKEND} backend_index) -if(backend_index EQUAL "-1") - # If the backend identifier isn't found in the list, return error - message(FATAL_ERROR "The RmlUi backend ID specified in RMLUI_SAMPLES_BACKEND is not valid.") -endif() - # Negotiate Vulkan debugging for Vulkan-based backends if(RMLUI_SAMPLES_BACKEND MATCHES "VK$") option(RMLUI_VK_DEBUG "Enable debugging mode for Vulkan renderer." OFF) From 6304d182df7900c78ff33d153e1654696bf64a3d Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Wed, 6 Sep 2023 12:17:14 +0200 Subject: [PATCH 09/29] Add bitmapfont sample In order for this to work, the requirement for the font interface is now handled on a per-sample basis --- CMakeLists.txt | 2 +- Samples/CMakeLists.txt | 7 +++++-- Samples/basic/CMakeLists.txt | 3 ++- Samples/basic/benchmark/CMakeLists.txt | 14 ++++++++------ Samples/basic/bitmapfont/CMakeLists.txt | 11 +++++++++++ Samples/basic/demo/CMakeLists.txt | 14 ++++++++------ 6 files changed, 35 insertions(+), 16 deletions(-) create mode 100644 Samples/basic/bitmapfont/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b4d20023..9e5808873 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ set(CMAKE_CXX_EXTENSIONS OFF) # "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 -set(RMLUI_FONT_INTERFACE "freetype" CACHE STRING "Font interface to build RmlUi with. If set to \"none\", RmlUi won't be built with any of the included font interfaces.") +set(RMLUI_FONT_INTERFACE "freetype" CACHE STRING "Font interface to build RmlUi with. If set to \"none\", RmlUi won't be built with any of the included font interfaces and some samples might be disabled.") 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) option(RMLUI_BUILD_SAMPLES "Build samples of the library." OFF) diff --git a/Samples/CMakeLists.txt b/Samples/CMakeLists.txt index 117a9f47b..f439baebe 100644 --- a/Samples/CMakeLists.txt +++ b/Samples/CMakeLists.txt @@ -1,7 +1,10 @@ # Check the font interface configuration if(RMLUI_FONT_INTERFACE STREQUAL "none") - # If RmlUi is being built with no font interface, then samples cannot be built - message(FATAL_ERROR "Building samples has been enabled, but no font interface has been selected.") + # If RmlUi is being built with no font interface, then some samples cannot be built + message(NOTICE + "Building samples has been enabled, but no font interface has been selected. " + "Some samples might be disabled." + ) endif() # Declare dependencies for sample backend diff --git a/Samples/basic/CMakeLists.txt b/Samples/basic/CMakeLists.txt index 8d4fdb6a5..4ae83deb4 100644 --- a/Samples/basic/CMakeLists.txt +++ b/Samples/basic/CMakeLists.txt @@ -1,6 +1,7 @@ -# Add CMake subdirectories of samples +# Add CMake subdirectories of basic samples add_subdirectory("benchmark") add_subdirectory("demo") +add_subdirectory("bitmapfont") # Negotiate inclusion of Lottie sample if(RMLUI_ENABLE_LOTTIE_PLUGIN) diff --git a/Samples/basic/benchmark/CMakeLists.txt b/Samples/basic/benchmark/CMakeLists.txt index 2f150fd56..a5157b2bf 100644 --- a/Samples/basic/benchmark/CMakeLists.txt +++ b/Samples/basic/benchmark/CMakeLists.txt @@ -1,7 +1,9 @@ -# Declare executable -add_executable(rmlui_samples_benchmark WIN32 - src/main.cpp -) +if(NOT (RMLUI_FONT_INTERFACE STREQUAL "none")) + # Declare executable + add_executable(rmlui_samples_benchmark WIN32 + src/main.cpp + ) -# Link shell library -target_link_libraries(rmlui_samples_benchmark PRIVATE rmlui_samples_shell) + # Link shell library + target_link_libraries(rmlui_samples_benchmark PRIVATE rmlui_samples_shell) +endif() diff --git a/Samples/basic/bitmapfont/CMakeLists.txt b/Samples/basic/bitmapfont/CMakeLists.txt new file mode 100644 index 000000000..2288f42cc --- /dev/null +++ b/Samples/basic/bitmapfont/CMakeLists.txt @@ -0,0 +1,11 @@ +# Declare executable +add_executable(rmlui_samples_bitmapfont WIN32 + src/FontEngineBitmap.cpp + src/FontEngineBitmap.h + src/FontEngineInterfaceBitmap.cpp + src/FontEngineInterfaceBitmap.h + src/main.cpp +) + +# Link shell library +target_link_libraries(rmlui_samples_bitmapfont PRIVATE rmlui_samples_shell) diff --git a/Samples/basic/demo/CMakeLists.txt b/Samples/basic/demo/CMakeLists.txt index a12259d1e..19da91333 100644 --- a/Samples/basic/demo/CMakeLists.txt +++ b/Samples/basic/demo/CMakeLists.txt @@ -1,7 +1,9 @@ -# Declare executable -add_executable(rmlui_samples_demo WIN32 - src/main.cpp -) +if(NOT (RMLUI_FONT_INTERFACE STREQUAL "none")) + # Declare executable + add_executable(rmlui_samples_demo WIN32 + src/main.cpp + ) -# Link shell library -target_link_libraries(rmlui_samples_demo PRIVATE rmlui_samples_shell) + # Link shell library + target_link_libraries(rmlui_samples_demo PRIVATE rmlui_samples_shell) +endif() From d75db7504bbf9ae9f977b49f7143f8005becaff3 Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Thu, 7 Sep 2023 14:38:14 +0200 Subject: [PATCH 10/29] CI: Change Ubuntu version and fix SDL issues --- .github/workflows/build.yml | 14 +-- CMake/Backends.cmake | 28 ++++- CMake/BackendsDependencies.cmake | 103 ++++++++---------- CMake/Modules/CI/Linux/FindSDL2_image.cmake | 12 ++ CMake/Modules/Emscripten/FindSDL.cmake | 67 ------------ CMake/Modules/Emscripten/FindSDL2.cmake | 58 ++++++++++ CMake/Modules/Emscripten/FindSDL2_image.cmake | 63 +++++++++++ CMake/Modules/Emscripten/FindSDL_image.cmake | 72 ------------ 8 files changed, 211 insertions(+), 206 deletions(-) create mode 100644 CMake/Modules/CI/Linux/FindSDL2_image.cmake delete mode 100644 CMake/Modules/Emscripten/FindSDL.cmake create mode 100644 CMake/Modules/Emscripten/FindSDL2.cmake create mode 100644 CMake/Modules/Emscripten/FindSDL2_image.cmake delete mode 100644 CMake/Modules/Emscripten/FindSDL_image.cmake diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d0a440817..02edf6776 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,13 +4,12 @@ on: [push, pull_request] jobs: Linux: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 env: BUILD_TYPE: Release CC: "${{ matrix.cc }}" CXX: "${{ matrix.cxx }}" - CMAKE_PREFIX_PATH: "/usr" strategy: fail-fast: false @@ -21,13 +20,13 @@ jobs: cmake_options: -DRMLUI_ENABLE_PRECOMPILED_HEADERS=OFF -DRMLUI_SAMPLES_BACKEND=GLFW_GL2 - cc: clang cxx: clang++ - cmake_options: -DRMLUI_SAMPLES_BACKEND=SDL_VK -DSDL_LIBRARY=SDL2 -DSDL_INCLUDE_DIR=/usr/include/SDL2 + cmake_options: -DRMLUI_SAMPLES_BACKEND=SDL_VK - cmake_options: -DRMLUI_BUILD_TESTING=ON -DRMLUI_ENABLE_PRECOMPILED_HEADERS=OFF enable_testing: true - cmake_options: -DRMLUI_ENABLE_LOTTIE_PLUGIN=ON -DRMLUI_SAMPLES_BACKEND=X11_GL2 - - cmake_options: -DRMLUI_DISABLE_RTTI_AND_EXCEPTIONS=ON -DRMLUI_SAMPLES_BACKEND=SDL_GL2 -DSDL_LIBRARY=SDL2 -DSDL_INCLUDE_DIR=/usr/include/SDL2 -DSDL_IMAGE_LIBRARY=/usr/lib/x86_64-linux-gnu/libSDL2_image-2.0.so.0 -DSDL_IMAGE_INCLUDE_DIR=/usr/include/SDL2 - - cmake_options: -DRMLUI_NO_THIRDPARTY_CONTAINERS=ON -DRMLUI_SAMPLES_BACKEND=SFML_GL2 - - cmake_options: -DRMLUI_SAMPLES_BACKEND=SDL_VK -DRMLUI_VK_DEBUG=ON -DRMLUI_ENABLE_PRECOMPILED_HEADERS=OFF -DCMAKE_BUILD_TYPE=Debug -DSDL_LIBRARY=SDL2 -DSDL_INCLUDE_DIR=/usr/include/SDL2 + - cmake_options: -DRMLUI_DISABLE_RTTI_AND_EXCEPTIONS=ON -DRMLUI_SAMPLES_BACKEND=SDL_GL2 + - cmake_options: -DRMLUI_NO_THIRDPARTY_CONTAINERS=ON -DRMLUI_SAMPLES_BACKEND=SFML_GL2 + - cmake_options: -DRMLUI_SAMPLES_BACKEND=SDL_VK -DRMLUI_VK_DEBUG=ON -DRMLUI_ENABLE_PRECOMPILED_HEADERS=OFF -DCMAKE_BUILD_TYPE=Debug steps: - uses: actions/checkout@v3 @@ -44,6 +43,7 @@ jobs: working-directory: ${{github.workspace}}/Build run: >- cmake $GITHUB_WORKSPACE -G Ninja -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DRMLUI_BUILD_LUA_BINDINGS=ON -DRMLUI_BUILD_SAMPLES=ON -DWARNINGS_AS_ERRORS=ON + -DCMAKE_MODULE_PATH=$GITHUB_WORKSPACE/CMake/Modules/CI/Linux ${{ matrix.cmake_options }} - name: Build @@ -124,7 +124,7 @@ jobs: working-directory: ${{github.workspace}}/Build run: >- cmake $env:GITHUB_WORKSPACE -A x64 -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=$env:BUILD_TYPE -DRMLUI_BUILD_LUA_BINDINGS=ON -DRMLUI_BUILD_SAMPLES=ON -DWARNINGS_AS_ERRORS=ON - -DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" ${{ matrix.cmake_options }} -DRMLUI_USING_VCPKG=TRUE + -DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" ${{ matrix.cmake_options }} - name: Build working-directory: ${{github.workspace}}/Build diff --git a/CMake/Backends.cmake b/CMake/Backends.cmake index 89e38f03e..009f092ed 100644 --- a/CMake/Backends.cmake +++ b/CMake/Backends.cmake @@ -61,7 +61,7 @@ target_sources(rmlui_backend_SDL_GL2 INTERFACE ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.h ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.h ) -target_link_libraries(rmlui_backend_SDL_GL2 INTERFACE OpenGL::GL SDL::SDL GLEW::GLEW SDL::Image) +target_link_libraries(rmlui_backend_SDL_GL2 INTERFACE OpenGL::GL SDL2::SDL2 GLEW::GLEW SDL2_image::SDL2_image) add_library(rmlui_backend_SDL_GL3 INTERFACE) target_sources(rmlui_backend_SDL_GL3 INTERFACE @@ -73,7 +73,12 @@ target_sources(rmlui_backend_SDL_GL3 INTERFACE ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL3.h ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Include_GL3.h ) -target_link_libraries(rmlui_backend_SDL_GL3 INTERFACE OpenGL::GL SDL::SDL SDL::Image) +target_link_libraries(rmlui_backend_SDL_GL3 INTERFACE OpenGL::GL SDL2::SDL2 SDL2_image::SDL2_image) +if(UNIX) + # The OpenGL 3 renderer implementation uses dlopen/dlclose + # This is required in some UNIX and UNIX-like operating systems to load shared object files at runtime + target_link_libraries(rmlui_backend_SDL_GL3 INTERFACE ${CMAKE_DL_LIBS}) +endif() add_library(rmlui_backend_SDL_VK INTERFACE) target_sources(rmlui_backend_SDL_VK INTERFACE @@ -86,7 +91,12 @@ target_sources(rmlui_backend_SDL_VK INTERFACE ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Vulkan/ShadersCompiledSPV.h ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Vulkan/vk_mem_alloc.h ) -target_link_libraries(rmlui_backend_SDL_VK INTERFACE Vulkan::Vulkan SDL::SDL) +target_link_libraries(rmlui_backend_SDL_VK INTERFACE Vulkan::Vulkan SDL2::SDL2) +if(UNIX) + # The Vulkan renderer implementation uses dlopen/dlclose + # This is required in some UNIX and UNIX-like operating systems to load shared object files at runtime + target_link_libraries(rmlui_backend_SDL_VK INTERFACE ${CMAKE_DL_LIBS}) +endif() add_library(rmlui_backend_SDL_SDLrenderer INTERFACE) target_sources(rmlui_backend_SDL_SDLrenderer INTERFACE @@ -97,7 +107,7 @@ target_sources(rmlui_backend_SDL_SDLrenderer INTERFACE ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.h ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_SDL.h ) -target_link_libraries(rmlui_backend_SDL_SDLrenderer INTERFACE SDL::SDL SDL::Image) +target_link_libraries(rmlui_backend_SDL_SDLrenderer INTERFACE SDL2::SDL2 SDL2_image::SDL2_image) add_library(rmlui_backend_SFML_GL2 INTERFACE) target_sources(rmlui_backend_SFML_GL2 INTERFACE @@ -137,6 +147,11 @@ target_sources(rmlui_backend_GLFW_GL3 INTERFACE ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Include_GL3.h ) target_link_libraries(rmlui_backend_GLFW_GL3 INTERFACE OpenGL::GL glfw) +if(UNIX) + # The OpenGL 3 renderer implementation uses dlopen/dlclose + # This is required in some UNIX and UNIX-like operating systems to load shared object files at runtime + target_link_libraries(rmlui_backend_GLFW_GL3 INTERFACE ${CMAKE_DL_LIBS}) +endif() add_library(rmlui_backend_GLFW_VK INTERFACE) target_sources(rmlui_backend_GLFW_VK INTERFACE @@ -148,3 +163,8 @@ target_sources(rmlui_backend_GLFW_VK INTERFACE ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_VK.h ) target_link_libraries(rmlui_backend_GLFW_VK INTERFACE Vulkan::Vulkan glfw) +if(UNIX) + # The Vulkan renderer implementation uses dlopen/dlclose + # This is required in some UNIX and UNIX-like operating systems to load shared object files at runtime + target_link_libraries(rmlui_backend_GLFW_VK INTERFACE ${CMAKE_DL_LIBS}) +endif() diff --git a/CMake/BackendsDependencies.cmake b/CMake/BackendsDependencies.cmake index ed19406f3..d1f891da5 100644 --- a/CMake/BackendsDependencies.cmake +++ b/CMake/BackendsDependencies.cmake @@ -1,46 +1,40 @@ +#[[ + Set up of external dependencies required by the sample backends + + All dependencies are searched as soft dependencies so that they won't error out if the library + is declared by other means +#]] + include("${PROJECT_SOURCE_DIR}/CMake/Utils.cmake") # --- Window/input APIs --- # SDL if(RMLUI_SAMPLES_BACKEND MATCHES "^SDL") - # All dependencies are searched as soft dependencies so that they won't error out if the library - # is declared by other means - if(VCPKG_TOOLCHAIN) - # vcpkg uses a different name for their SDL find module and target than the official CMake one - find_package("SDL2") - - # If the target has been successfully imported - if(TARGET SDL2::SDL2) - # Report SDL as found - set(SDL_FOUND TRUE) - - # Add the target to SDL_LIBRARIES - # This way no other pieces of code will need to be modified for the CMake project to work with vcpkg's SDL - list(APPEND SDL_LIBRARIES SDL2::SDL2) - endif() - else() - find_package("SDL" "2") - endif() + # Although the official CMake find module is called FindSDL.cmake, the official config module + # provided by the SDL package for its version 2 is called SDL2Config.cmake + # Following this trend, the official SDL config files change their name according to their major version number + find_package("SDL2" REQUIRED) + + #[[ + RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE: + Current code operates using a hybrid mode by detecting either the variable or the target due to the possibility + of package managers such as Conan and vcpkg of setting up SDL in their own way but always following the + target naming conventions of the official SDL config files + #]] - # RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE: - # In CMake 3.19 the IMPORTED target SDL::SDL is available when using the FindSDL find module. - # More info: https://cmake.org/cmake/help/latest/module/FindSDL.html - # Current code operates using a hybrid mode by detecting either the variable or the target due to the possibility - # of package managers such as Conan and vcpkg of setting up SDL in their own way but always following the - # target naming conventions of the official CMake find modules - if(NOT TARGET SDL::SDL AND NOT SDL_FOUND) - report_not_found_dependency("SDL" SDL::SDL) + if(NOT TARGET SDL2::SDL2 AND NOT SDL2_FOUND) + report_not_found_dependency("SDL2" SDL2::SDL2) endif() - # Set up the detected SDL as the SDL::SDL INTERFACE target if it hasn't already been created + # Set up the detected SDL as the SDL2::SDL2 INTERFACE target if it hasn't already been created # This is done for consistent referencing across the CMake code regardless of the CMake version used - if(NOT TARGET SDL::SDL) - add_library(SDL::SDL INTERFACE IMPORTED) + if(NOT TARGET SDL2::SDL2) + add_library(SDL2::SDL2 INTERFACE IMPORTED) - # Any CMake target linking against SDL::SDL will link against the SDL libraries and have + # Any CMake target linking against SDL2::SDL2 will link against the SDL libraries and have # their include directories added to their target properties - target_link_libraries(SDL::SDL INTERFACE ${SDL_LIBRARIES}) - target_include_directories(SDL::SDL INTERFACE ${SDL_INCLUDE_DIRS}) + target_link_libraries(SDL2::SDL2 INTERFACE ${SDL2_LIBRARIES}) + target_include_directories(SDL2::SDL2 INTERFACE ${SDL2_INCLUDE_DIRS}) endif() # SDL_GL2 backend requires GLEW @@ -52,8 +46,8 @@ if(RMLUI_SAMPLES_BACKEND MATCHES "^SDL") endif() # Check version requirement for the SDL renderer - if(RMLUI_SAMPLES_BACKEND STREQUAL "SDL_SDLrenderer" AND SDL_VERSION VERSION_LESS "2.0.20") - message(FATAL_ERROR "SDL native renderer backend (${RMLUI_SAMPLES_BACKEND}) requires SDL 2.0.20 (found ${SDL_VERSION}).") + if(RMLUI_SAMPLES_BACKEND STREQUAL "SDL_SDLrenderer" AND SDL2_VERSION VERSION_LESS "2.0.20") + message(FATAL_ERROR "SDL native renderer backend (${RMLUI_SAMPLES_BACKEND}) requires SDL 2.0.20 (found ${SDL2_VERSION}).") endif() # List of SDL backends that require SDL_image to work with samples @@ -74,26 +68,10 @@ if(RMLUI_SAMPLES_BACKEND MATCHES "^SDL") # Require SDL_image if needed if(RMLUI_SDLIMAGE_REQUIRED) - find_package("SDL_image" "2") - - # RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE: - # FindSDL_image doesn't provide an imported target to check against - # Using old method of using a variable to check - if(NOT SDL_IMAGE_FOUND AND NOT TARGET SDL::Image) - report_not_found_dependency("SDL_image" SDL::Image) - endif() + find_package("SDL2_image") - # RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE: - # No official target name has been decided for SDL_image yet, but we pretend there's one - # to make the code more future-proof - # For us, its name will be SDL::Image - if(NOT TARGET SDL::Image) - add_library(SDL::Image INTERFACE IMPORTED) - - # Any CMake target linking against SDL::Image will link against the SDL_image libraries - # and have their include directories added to their target properties - target_link_libraries(SDL::Image INTERFACE ${SDL_IMAGE_LIBRARIES}) - target_include_directories(SDL::Image INTERFACE ${SDL_IMAGE_INCLUDE_DIRS}) + if(NOT TARGET SDL2_image::SDL2_image) + report_not_found_dependency("SDL2_image" SDL2_image::SDL2_image) endif() endif() endif() @@ -134,8 +112,10 @@ if(RMLUI_SAMPLES_BACKEND MATCHES "^SFML") # Run find package with component names both capitalized and lower-cased find_package("SFML" "2" COMPONENTS ${RMLUI_SFML_REQUIRED_COMPONENTS}) - list(TRANSFORM RMLUI_SFML_REQUIRED_COMPONENTS TOLOWER OUTPUT_VARIABLE RMLUI_SFML_REQUIRED_COMPONENTS_LOWER) - find_package("SFML" "2" COMPONENTS ${RMLUI_SFML_REQUIRED_COMPONENTS_LOWER}) + if(NOT SFML_FOUND) + list(TRANSFORM RMLUI_SFML_REQUIRED_COMPONENTS TOLOWER OUTPUT_VARIABLE RMLUI_SFML_REQUIRED_COMPONENTS_LOWER_CASE) + find_package("SFML" "2" COMPONENTS ${RMLUI_SFML_REQUIRED_COMPONENTS_LOWER_CASE}) + endif() # Since we are using find_package() in basic mode, we can check the _FOUND variable if(NOT SFML_FOUND) @@ -165,8 +145,19 @@ if(RMLUI_SAMPLES_BACKEND MATCHES "^SFML") string(TOLOWER ${sfml_component} sfml_component_lower) if(TARGET sfml-${sfml_component_lower}) + #[[ + RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE: + Because the target CMake version is 3.10, we can't alias non-global targets nor global imported targets. + + Promoting an imported target to the global scope without it being necessary can cause undesired behavior, + specially when the project is consumed as a subdirectory inside another CMake project, therefore is not + recommended. Instead of that, we pseudo-alias the target creating a second INTERFACE target with alias name. + More info: https://cmake.org/cmake/help/latest/command/add_library.html#alias-libraries + #]] + # If the target exists, alias it - add_library(SFML::${sfml_component} ALIAS sfml-${sfml_component_lower}) + add_library(SFML::${sfml_component} INTERFACE IMPORTED) + target_link_libraries(SFML::${sfml_component} INTERFACE sfml-${sfml_component_lower}) endif() endforeach() diff --git a/CMake/Modules/CI/Linux/FindSDL2_image.cmake b/CMake/Modules/CI/Linux/FindSDL2_image.cmake new file mode 100644 index 000000000..184e4e07b --- /dev/null +++ b/CMake/Modules/CI/Linux/FindSDL2_image.cmake @@ -0,0 +1,12 @@ +#[[ + Find module for SDL_image version 2 that matches the naming convention of the SDL2_imageConfig.cmake file + provided in official distributions of the SDL2_image library + + This is necessary on Ubuntu 20.04 because the libsdl2-image-dev package doesn't provide the config file. + https://packages.ubuntu.com/focal/amd64/libsdl2-image-dev/filelist +#]] + +set(SDL2_image_FOUND TRUE) + +add_library(SDL2_image::SDL2_image INTERFACE IMPORTED) +target_link_libraries(SDL2_image::SDL2_image INTERFACE "SDL2_image") diff --git a/CMake/Modules/Emscripten/FindSDL.cmake b/CMake/Modules/Emscripten/FindSDL.cmake deleted file mode 100644 index e40016d31..000000000 --- a/CMake/Modules/Emscripten/FindSDL.cmake +++ /dev/null @@ -1,67 +0,0 @@ -#[[ - Custom find module for SDL for Emscripten compilation. - - Input variables: - none - Output variables: - SDL_FOUND - SDL_VERSION - - Resulting targets: - SDL::SDL - - More info: - https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html -#]] - -include(FindPackageHandleStandardArgs) -include(FindPackageMessage) - -# If no version was specified, set default -if(NOT DEFINED SDL_FIND_VERSION) - set(SDL_FIND_VERSION "1") -endif() - -# Check if requested SDL version is valid -if((SDL_FIND_VERSION VERSION_LESS "1") OR (SDL_FIND_VERSION VERSION_GREATER_EQUAL "3")) - message(FATAL_ERROR "The requested SDL version ${SDL_FIND_VERSION} is invalid.") -endif() - -# Emscripten includes SDL support as part of it's SDK, meaning there's no need to find it -set(SDL_FOUND TRUE) -add_library(SDL::SDL INTERFACE IMPORTED) - -# Set found SDL version based on latest Emscripten SDK at the time of writing this file -if((SDL_FIND_VERSION VERSION_GREATER_EQUAL "1") AND (SDL_FIND_VERSION VERSION_LESS "2")) - # Version set based on the information on $EMSDK/upstream/emscripten/src/settings.js - set(SDL_VERSION "1.3") - - # Version number to pass to compiler - set(SDL_EMSCRIPTEN_COMPILER_SELECTED_VERSION "1") - -elseif((SDL_FIND_VERSION VERSION_GREATER_EQUAL "2") AND (SDL_FIND_VERSION VERSION_LESS "3")) - # Version set based on latest Emscripten SDK at the time of writing this file - set(SDL_VERSION "2.24.2") - - # Version number to pass to compiler - set(SDL_EMSCRIPTEN_COMPILER_SELECTED_VERSION "2") -endif() - -# Enable compilation and linking against SDL -target_compile_options(SDL::SDL INTERFACE "-sUSE_SDL=${SDL_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") -target_link_libraries(SDL::SDL INTERFACE "-sUSE_SDL=${SDL_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") - -# Get final compiler and linker flags to print them -get_target_property(SDL_COMPILE_FLAGS SDL::SDL "INTERFACE_COMPILE_OPTIONS") -get_target_property(SDL_LINK_FLAGS SDL::SDL "INTERFACE_LINK_OPTIONS") - -find_package_message( - "SDL" - "SDL ${SDL_VERSION} has been found as part of the Emscripten SDK." - "[${SDL_COMPILE_FLAGS}][${SDL_LINK_FLAGS}]" -) - -# Clean scope -unset(SDL_COMPILE_FLAGS) -unset(SDL_COMPILE_FLAGS) -unset(SDL_EMSCRIPTEN_COMPILER_SELECTED_VERSION) diff --git a/CMake/Modules/Emscripten/FindSDL2.cmake b/CMake/Modules/Emscripten/FindSDL2.cmake new file mode 100644 index 000000000..4a559a31d --- /dev/null +++ b/CMake/Modules/Emscripten/FindSDL2.cmake @@ -0,0 +1,58 @@ +#[[ + Custom find module for SDL for Emscripten compilation. + + Input variables: + none + Output variables: + SDL2_FOUND + SDL2_VERSION + + Resulting targets: + SDL2::SDL2 + + More info: + https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html +#]] + +include(FindPackageHandleStandardArgs) +include(FindPackageMessage) + +# If no version was specified, set default +if(NOT DEFINED SDL2_FIND_VERSION) + set(SDL2_FIND_VERSION "2") +endif() + +# Check if requested SDL version is valid +if((SDL2_FIND_VERSION VERSION_LESS "2") OR (SDL2_FIND_VERSION VERSION_GREATER_EQUAL "3")) + message(FATAL_ERROR "The requested SDL2 version ${SDL2_FIND_VERSION} is invalid.") +endif() + +# Emscripten includes SDL support as part of it's SDK, meaning there's no need to find it +set(SDL2_FOUND TRUE) +add_library(SDL2::SDL2 INTERFACE IMPORTED) + +# Set found SDL version based on latest Emscripten SDK at the time of writing this file +# Version set based on latest Emscripten SDK at the time of writing this file +set(SDL2_VERSION "2.24.2") + +# Version number to pass to compiler +set(SDL2_EMSCRIPTEN_COMPILER_SELECTED_VERSION "2") + +# Enable compilation and linking against SDL +target_compile_options(SDL2::SDL2 INTERFACE "-sUSE_SDL=${SDL2_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") +target_link_libraries(SDL2::SDL2 INTERFACE "-sUSE_SDL=${SDL2_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") + +# Get final compiler and linker flags to print them +get_target_property(SDL2_COMPILE_FLAGS SDL2::SDL2 "INTERFACE_COMPILE_OPTIONS") +get_target_property(SDL2_LINK_FLAGS SDL2::SDL2 "INTERFACE_LINK_OPTIONS") + +find_package_message( + "SDL2" + "SDL ${SDL2_VERSION} has been found as part of the Emscripten SDK." + "[${SDL2_COMPILE_FLAGS}][${SDL2_LINK_FLAGS}]" +) + +# Clean scope +unset(SDL2_COMPILE_FLAGS) +unset(SDL2_COMPILE_FLAGS) +unset(SDL2_EMSCRIPTEN_COMPILER_SELECTED_VERSION) diff --git a/CMake/Modules/Emscripten/FindSDL2_image.cmake b/CMake/Modules/Emscripten/FindSDL2_image.cmake new file mode 100644 index 000000000..5eba6e59d --- /dev/null +++ b/CMake/Modules/Emscripten/FindSDL2_image.cmake @@ -0,0 +1,63 @@ +#[[ + Custom find module for SDL_image for Emscripten compilation. + + Input variables: + none + Output variables: + SDL2_image_FOUND + SDL2_image_VERSION + + Resulting targets: + SDL2_image::SDL2_image + + More info: + https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html +#]] + +include(FindPackageHandleStandardArgs) +include(FindPackageMessage) + +# If no version was specified, set default +if(NOT DEFINED SDL2_image_FIND_VERSION) + set(SDL2_image_FIND_VERSION "2") +endif() + +# Check if requested SDL version is valid +if((SDL2_image_FIND_VERSION VERSION_LESS "2") OR (SDL2_image_FIND_VERSION VERSION_GREATER_EQUAL "3")) + message(FATAL_ERROR "The requested SDL2_image version ${SDL2_image_FIND_VERSION} is invalid.") +endif() + +message(WARNING + "SDL_image with Emscripten can only be used if SDL usage is also enabled. " + "The version number of both libraries must match as well." +) + +# Emscripten includes SDL support as part of it's SDK, meaning there's no need to find it +set(SDL2_image_FOUND TRUE) +add_library(SDL2_image::SDL2_image INTERFACE IMPORTED) + +# Set found SDL_image version based on latest Emscripten SDK at the time of writing this file +# Version set based on latest Emscripten SDK at the time of writing this file +set(SDL2_image_VERSION "2.24.2") + +# Version number to pass to compiler +set(SDL2_image_EMSCRIPTEN_COMPILER_SELECTED_VERSION "2") + +# Enable compilation and linking against SDL +target_compile_options(SDL2_image::SDL2_image INTERFACE "-sUSE_SDL_IMAGE=${SDL2_image_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") +target_link_libraries(SDL2_image::SDL2_image INTERFACE "-sUSE_SDL_IMAGE=${SDL2_image_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") + +# Get final compiler and linker flags to print them +get_target_property(SDL2_image_COMPILE_FLAGS SDL2_image::SDL2_image "INTERFACE_COMPILE_OPTIONS") +get_target_property(SDL2_image_LINK_FLAGS SDL2_image::SDL2_image "INTERFACE_LINK_OPTIONS") + +find_package_message( + "SDL2_image" + "SDL_image ${SDL2_image_VERSION} has been found as part of the Emscripten SDK." + "[${SDL2_image_COMPILE_FLAGS}][${SDL2_image_LINK_FLAGS}]" +) + +# Clean scope +unset(SDL2_image_COMPILE_FLAGS) +unset(SDL2_image_COMPILE_FLAGS) +unset(SDL2_image_EMSCRIPTEN_COMPILER_SELECTED_VERSION) diff --git a/CMake/Modules/Emscripten/FindSDL_image.cmake b/CMake/Modules/Emscripten/FindSDL_image.cmake deleted file mode 100644 index f8b8a7c05..000000000 --- a/CMake/Modules/Emscripten/FindSDL_image.cmake +++ /dev/null @@ -1,72 +0,0 @@ -#[[ - Custom find module for SDL_image for Emscripten compilation. - - Input variables: - none - Output variables: - SDL_image_FOUND - SDL_image_VERSION - - Resulting targets: - SDL::Image - - More info: - https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html -#]] - -include(FindPackageHandleStandardArgs) -include(FindPackageMessage) - -# If no version was specified, set default -if(NOT DEFINED SDL_image_FIND_VERSION) - set(SDL_image_FIND_VERSION "1") -endif() - -# Check if requested SDL version is valid -if((SDL_image_FIND_VERSION VERSION_LESS "1") OR (SDL_image_FIND_VERSION VERSION_GREATER_EQUAL "3")) - message(FATAL_ERROR "The requested SDL_image version ${SDL_image_FIND_VERSION} is invalid.") -endif() - -message(WARNING - "SDL_image with Emscripten can only be used if SDL usage is also enabled. " - "The version number of both libraries must match as well." -) - -# Emscripten includes SDL support as part of it's SDK, meaning there's no need to find it -set(SDL_image_FOUND TRUE) -add_library(SDL::Image INTERFACE IMPORTED) - -# Set found SDL_image version based on latest Emscripten SDK at the time of writing this file -if((SDL_image_FIND_VERSION VERSION_GREATER_EQUAL "1") AND (SDL_image_FIND_VERSION VERSION_LESS "2")) - # Version set based on the information on $EMSDK/upstream/emscripten/src/settings.js - set(SDL_image_VERSION "1.3") - - # Version number to pass to compiler - set(SDL_image_EMSCRIPTEN_COMPILER_SELECTED_VERSION "1") - -elseif((SDL_image_FIND_VERSION VERSION_GREATER_EQUAL "2") AND (SDL_image_FIND_VERSION VERSION_LESS "3")) - # Version set based on latest Emscripten SDK at the time of writing this file - set(SDL_image_VERSION "2.24.2") - - # Version number to pass to compiler - set(SDL_image_EMSCRIPTEN_COMPILER_SELECTED_VERSION "2") -endif() - -# Enable compilation and linking against SDL -target_compile_options(SDL::Image INTERFACE "-sUSE_SDL_IMAGE=${SDL_image_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") -target_link_libraries(SDL::Image INTERFACE "-sUSE_SDL_IMAGE=${SDL_image_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") - -# Get final compiler and linker flags to print them -get_target_property(SDL_image_COMPILE_FLAGS SDL::Image "INTERFACE_COMPILE_OPTIONS") -get_target_property(SDL_image_LINK_FLAGS SDL::Image "INTERFACE_LINK_OPTIONS") - -find_package_message( - "SDL_image" - "SDL_image ${SDL_image_VERSION} has been found as part of the Emscripten SDK." - "[${SDL_image_COMPILE_FLAGS}][${SDL_image_LINK_FLAGS}]" -) - -# Clean scope -unset(SDL_image_COMPILE_FLAGS) -unset(SDL_image_COMPILE_FLAGS) -unset(SDL_image_EMSCRIPTEN_COMPILER_SELECTED_VERSION) From fd3a5ab41acb9b06b164d2d680766e35d6c8a55d Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Fri, 8 Sep 2023 12:11:26 +0200 Subject: [PATCH 11/29] Clean up of older build pipeline files --- CMake/FileList.cmake | 575 ------------- CMake/Modules.old/FindLuaJIT.cmake | 16 - CMake/Modules.old/FindPkgMacros.cmake | 147 ---- CMake/Modules.old/FindSDL2.cmake | 191 ----- CMake/Modules.old/FindSDL2_image.cmake | 119 --- CMake/Modules.old/FindSFML.cmake | 209 ----- CMake/Modules.old/FindTracy.cmake | 20 - CMake/Modules.old/Findlunasvg.cmake | 32 - CMake/Platform/iOS.cmake | 190 ----- CMake/RmlUiConfig.cmake.build.in | 11 - CMake/RmlUiConfig.cmake.install.in | 7 - CMake/SampleFileList.cmake | 212 ----- CMake/builddist.py | 181 ---- CMake/gen_filelists.sh | 80 -- CMake/gen_samplelists.sh | 34 - CMakeLists_old.txt | 1048 ------------------------ Dependencies/empty.txt | 0 Dependencies/osx-depends.sh | 65 -- 18 files changed, 3137 deletions(-) delete mode 100644 CMake/FileList.cmake delete mode 100644 CMake/Modules.old/FindLuaJIT.cmake delete mode 100644 CMake/Modules.old/FindPkgMacros.cmake delete mode 100644 CMake/Modules.old/FindSDL2.cmake delete mode 100644 CMake/Modules.old/FindSDL2_image.cmake delete mode 100644 CMake/Modules.old/FindSFML.cmake delete mode 100644 CMake/Modules.old/FindTracy.cmake delete mode 100644 CMake/Modules.old/Findlunasvg.cmake delete mode 100644 CMake/Platform/iOS.cmake delete mode 100644 CMake/RmlUiConfig.cmake.build.in delete mode 100644 CMake/RmlUiConfig.cmake.install.in delete mode 100644 CMake/SampleFileList.cmake delete mode 100644 CMake/builddist.py delete mode 100644 CMake/gen_filelists.sh delete mode 100755 CMake/gen_samplelists.sh delete mode 100644 CMakeLists_old.txt delete mode 100644 Dependencies/empty.txt delete mode 100755 Dependencies/osx-depends.sh diff --git a/CMake/FileList.cmake b/CMake/FileList.cmake deleted file mode 100644 index 31873dfd5..000000000 --- a/CMake/FileList.cmake +++ /dev/null @@ -1,575 +0,0 @@ -# This file was auto-generated with gen_filelists.sh - -set(Core_HDR_FILES - ${PROJECT_SOURCE_DIR}/Source/Core/Clock.h - ${PROJECT_SOURCE_DIR}/Source/Core/ComputeProperty.h - ${PROJECT_SOURCE_DIR}/Source/Core/ContextInstancerDefault.h - ${PROJECT_SOURCE_DIR}/Source/Core/DataController.h - ${PROJECT_SOURCE_DIR}/Source/Core/DataControllerDefault.h - ${PROJECT_SOURCE_DIR}/Source/Core/DataExpression.h - ${PROJECT_SOURCE_DIR}/Source/Core/DataModel.h - ${PROJECT_SOURCE_DIR}/Source/Core/DataView.h - ${PROJECT_SOURCE_DIR}/Source/Core/DataViewDefault.h - ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorGradient.h - ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorNinePatch.h - ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiled.h - ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledBox.h - ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledBoxInstancer.h - ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledHorizontal.h - ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledHorizontalInstancer.h - ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledImage.h - ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledImageInstancer.h - ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledInstancer.h - ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledVertical.h - ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledVerticalInstancer.h - ${PROJECT_SOURCE_DIR}/Source/Core/DocumentHeader.h - ${PROJECT_SOURCE_DIR}/Source/Core/ElementAnimation.h - ${PROJECT_SOURCE_DIR}/Source/Core/ElementBackgroundBorder.h - ${PROJECT_SOURCE_DIR}/Source/Core/ElementDecoration.h - ${PROJECT_SOURCE_DIR}/Source/Core/ElementDefinition.h - ${PROJECT_SOURCE_DIR}/Source/Core/ElementHandle.h - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/ElementImage.h - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/ElementLabel.h - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/ElementTextSelection.h - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/InputType.h - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/InputTypeButton.h - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/InputTypeCheckbox.h - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/InputTypeRadio.h - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/InputTypeRange.h - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/InputTypeSubmit.h - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/InputTypeText.h - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/WidgetDropDown.h - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/WidgetSlider.h - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/WidgetTextInput.h - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/WidgetTextInputMultiLine.h - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/WidgetTextInputSingleLine.h - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/WidgetTextInputSingleLinePassword.h - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/XMLNodeHandlerSelect.h - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/XMLNodeHandlerTabSet.h - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/XMLNodeHandlerTextArea.h - ${PROJECT_SOURCE_DIR}/Source/Core/ElementStyle.h - ${PROJECT_SOURCE_DIR}/Source/Core/EventDispatcher.h - ${PROJECT_SOURCE_DIR}/Source/Core/EventInstancerDefault.h - ${PROJECT_SOURCE_DIR}/Source/Core/EventSpecification.h - ${PROJECT_SOURCE_DIR}/Source/Core/FileInterfaceDefault.h - ${PROJECT_SOURCE_DIR}/Source/Core/FontEffectBlur.h - ${PROJECT_SOURCE_DIR}/Source/Core/FontEffectGlow.h - ${PROJECT_SOURCE_DIR}/Source/Core/FontEffectOutline.h - ${PROJECT_SOURCE_DIR}/Source/Core/FontEffectShadow.h - ${PROJECT_SOURCE_DIR}/Source/Core/GeometryBackgroundBorder.h - ${PROJECT_SOURCE_DIR}/Source/Core/GeometryDatabase.h - ${PROJECT_SOURCE_DIR}/Source/Core/IdNameMap.h - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/BlockContainer.h - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/BlockFormattingContext.h - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/ContainerBox.h - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/FlexFormattingContext.h - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/FloatedBoxSpace.h - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/FormattingContext.h - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/InlineBox.h - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/InlineContainer.h - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/InlineLevelBox.h - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/InlineTypes.h - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/LayoutBox.h - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/LayoutDetails.h - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/LayoutEngine.h - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/LayoutPools.h - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/LineBox.h - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/ReplacedFormattingContext.h - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/TableFormattingContext.h - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/TableFormattingDetails.h - ${PROJECT_SOURCE_DIR}/Source/Core/Memory.h - ${PROJECT_SOURCE_DIR}/Source/Core/PluginRegistry.h - ${PROJECT_SOURCE_DIR}/Source/Core/Pool.h - ${PROJECT_SOURCE_DIR}/Source/Core/precompiled.h - ${PROJECT_SOURCE_DIR}/Source/Core/PropertiesIterator.h - ${PROJECT_SOURCE_DIR}/Source/Core/PropertyParserAnimation.h - ${PROJECT_SOURCE_DIR}/Source/Core/PropertyParserColour.h - ${PROJECT_SOURCE_DIR}/Source/Core/PropertyParserDecorator.h - ${PROJECT_SOURCE_DIR}/Source/Core/PropertyParserFontEffect.h - ${PROJECT_SOURCE_DIR}/Source/Core/PropertyParserKeyword.h - ${PROJECT_SOURCE_DIR}/Source/Core/PropertyParserNumber.h - ${PROJECT_SOURCE_DIR}/Source/Core/PropertyParserRatio.h - ${PROJECT_SOURCE_DIR}/Source/Core/PropertyParserString.h - ${PROJECT_SOURCE_DIR}/Source/Core/PropertyParserTransform.h - ${PROJECT_SOURCE_DIR}/Source/Core/PropertyShorthandDefinition.h - ${PROJECT_SOURCE_DIR}/Source/Core/ScrollController.h - ${PROJECT_SOURCE_DIR}/Source/Core/StreamFile.h - ${PROJECT_SOURCE_DIR}/Source/Core/StyleSheetFactory.h - ${PROJECT_SOURCE_DIR}/Source/Core/StyleSheetNode.h - ${PROJECT_SOURCE_DIR}/Source/Core/StyleSheetParser.h - ${PROJECT_SOURCE_DIR}/Source/Core/StyleSheetSelector.h - ${PROJECT_SOURCE_DIR}/Source/Core/Template.h - ${PROJECT_SOURCE_DIR}/Source/Core/TemplateCache.h - ${PROJECT_SOURCE_DIR}/Source/Core/TextureDatabase.h - ${PROJECT_SOURCE_DIR}/Source/Core/TextureLayout.h - ${PROJECT_SOURCE_DIR}/Source/Core/TextureLayoutRectangle.h - ${PROJECT_SOURCE_DIR}/Source/Core/TextureLayoutRow.h - ${PROJECT_SOURCE_DIR}/Source/Core/TextureLayoutTexture.h - ${PROJECT_SOURCE_DIR}/Source/Core/TextureResource.h - ${PROJECT_SOURCE_DIR}/Source/Core/TransformState.h - ${PROJECT_SOURCE_DIR}/Source/Core/TransformUtilities.h - ${PROJECT_SOURCE_DIR}/Source/Core/WidgetScroll.h - ${PROJECT_SOURCE_DIR}/Source/Core/XMLNodeHandlerBody.h - ${PROJECT_SOURCE_DIR}/Source/Core/XMLNodeHandlerDefault.h - ${PROJECT_SOURCE_DIR}/Source/Core/XMLNodeHandlerHead.h - ${PROJECT_SOURCE_DIR}/Source/Core/XMLNodeHandlerTemplate.h - ${PROJECT_SOURCE_DIR}/Source/Core/XMLParseTools.h -) - -set(MASTER_Core_PUB_HDR_FILES - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core.h -) - -set(Core_PUB_HDR_FILES - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Config/Config.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Animation.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/BaseXMLParser.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Box.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Colour.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Colour.inl - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ComputedValues.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Containers/itlib/flat_map.hpp - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Containers/itlib/flat_set.hpp - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Containers/robin_hood.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Context.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ContextInstancer.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ConvolutionFilter.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Core.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/DataModelHandle.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/DataStructHandle.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/DataTypeRegister.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/DataTypes.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/DataVariable.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Debug.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Decorator.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/DecoratorInstancer.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Dictionary.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Element.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Element.inl - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ElementDocument.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ElementInstancer.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementForm.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementFormControl.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementFormControlInput.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementFormControlSelect.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementFormControlTextArea.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementProgress.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementTabSet.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ElementScroll.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ElementText.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ElementUtilities.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Event.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/EventInstancer.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/EventListener.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/EventListenerInstancer.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Factory.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FileInterface.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FontEffect.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FontEffectInstancer.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FontEngineInterface.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FontGlyph.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FontMetrics.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Geometry.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/GeometryUtilities.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Header.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ID.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Input.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Log.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Math.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Matrix4.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Matrix4.inl - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/NumericValue.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ObserverPtr.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Platform.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Plugin.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Profiling.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/PropertiesIteratorView.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Property.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/PropertyDefinition.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/PropertyDictionary.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/PropertyIdSet.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/PropertyParser.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/PropertySpecification.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Rectangle.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/RenderInterface.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ScriptInterface.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ScrollTypes.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Spritesheet.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Stream.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StreamMemory.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StringUtilities.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StyleSheet.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StyleSheetContainer.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StyleSheetSpecification.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StyleSheetTypes.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StyleTypes.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/SystemInterface.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Texture.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Traits.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Transform.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/TransformPrimitive.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Tween.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/TypeConverter.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/TypeConverter.inl - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Types.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Unit.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/URL.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Utilities.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Variant.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Variant.inl - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vector2.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vector2.inl - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vector3.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vector3.inl - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vector4.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vector4.inl - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vertex.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/XMLNodeHandler.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/XMLParser.h -) - -set(Core_SRC_FILES - ${PROJECT_SOURCE_DIR}/Source/Core/BaseXMLParser.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Box.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Clock.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/ComputedValues.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/ComputeProperty.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Context.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/ContextInstancer.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/ContextInstancerDefault.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/ConvolutionFilter.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Core.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/DataController.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/DataControllerDefault.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/DataExpression.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/DataModel.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/DataModelHandle.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/DataTypeRegister.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/DataVariable.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/DataView.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/DataViewDefault.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Decorator.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorGradient.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorInstancer.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorNinePatch.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiled.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledBox.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledBoxInstancer.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledHorizontal.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledHorizontalInstancer.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledImage.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledImageInstancer.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledInstancer.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledVertical.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledVerticalInstancer.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/DocumentHeader.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Element.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/ElementAnimation.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/ElementBackgroundBorder.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/ElementDecoration.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/ElementDefinition.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/ElementDocument.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/ElementHandle.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/ElementInstancer.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/ElementForm.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/ElementFormControl.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/ElementFormControlInput.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/ElementFormControlSelect.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/ElementFormControlTextArea.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/ElementImage.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/ElementLabel.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/ElementProgress.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/ElementTabSet.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/ElementTextSelection.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/InputType.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/InputTypeButton.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/InputTypeCheckbox.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/InputTypeRadio.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/InputTypeRange.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/InputTypeSubmit.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/InputTypeText.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/WidgetDropDown.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/WidgetSlider.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/WidgetTextInput.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/WidgetTextInputMultiLine.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/WidgetTextInputSingleLine.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/WidgetTextInputSingleLinePassword.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/XMLNodeHandlerSelect.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/XMLNodeHandlerTabSet.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Elements/XMLNodeHandlerTextArea.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/ElementScroll.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/ElementStyle.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/ElementText.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/ElementUtilities.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Event.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/EventDispatcher.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/EventInstancer.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/EventInstancerDefault.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/EventListenerInstancer.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/EventSpecification.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Factory.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/FileInterface.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/FileInterfaceDefault.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/FontEffect.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/FontEffectBlur.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/FontEffectGlow.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/FontEffectInstancer.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/FontEffectOutline.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/FontEffectShadow.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineInterface.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Geometry.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/GeometryBackgroundBorder.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/GeometryDatabase.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/GeometryUtilities.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/BlockContainer.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/BlockFormattingContext.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/ContainerBox.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/FlexFormattingContext.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/FloatedBoxSpace.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/FormattingContext.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/InlineBox.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/InlineContainer.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/InlineLevelBox.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/LayoutBox.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/LayoutDetails.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/LayoutEngine.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/LayoutPools.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/LineBox.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/ReplacedFormattingContext.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/TableFormattingContext.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Layout/TableFormattingDetails.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Log.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Math.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Memory.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/ObserverPtr.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Plugin.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/PluginRegistry.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Profiling.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/PropertiesIteratorView.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Property.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/PropertyDefinition.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/PropertyDictionary.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/PropertyParserAnimation.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/PropertyParserColour.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/PropertyParserDecorator.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/PropertyParserFontEffect.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/PropertyParserKeyword.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/PropertyParserNumber.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/PropertyParserRatio.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/PropertyParserString.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/PropertyParserTransform.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/PropertySpecification.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/RenderInterface.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/ScrollController.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Spritesheet.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Stream.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/StreamFile.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/StreamMemory.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/StringUtilities.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/StyleSheet.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/StyleSheetContainer.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/StyleSheetFactory.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/StyleSheetNode.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/StyleSheetParser.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/StyleSheetSelector.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/StyleSheetSpecification.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/SystemInterface.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Template.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/TemplateCache.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Texture.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/TextureDatabase.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/TextureLayout.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/TextureLayoutRectangle.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/TextureLayoutRow.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/TextureLayoutTexture.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/TextureResource.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Transform.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/TransformPrimitive.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/TransformState.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/TransformUtilities.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Tween.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/TypeConverter.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/URL.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/Variant.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/WidgetScroll.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/XMLNodeHandler.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/XMLNodeHandlerBody.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/XMLNodeHandlerDefault.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/XMLNodeHandlerHead.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/XMLNodeHandlerTemplate.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/XMLParser.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/XMLParseTools.cpp -) - -set(Debugger_HDR_FILES - ${PROJECT_SOURCE_DIR}/Source/Debugger/BeaconSource.h - ${PROJECT_SOURCE_DIR}/Source/Debugger/CommonSource.h - ${PROJECT_SOURCE_DIR}/Source/Debugger/DebuggerPlugin.h - ${PROJECT_SOURCE_DIR}/Source/Debugger/DebuggerSystemInterface.h - ${PROJECT_SOURCE_DIR}/Source/Debugger/ElementContextHook.h - ${PROJECT_SOURCE_DIR}/Source/Debugger/ElementInfo.h - ${PROJECT_SOURCE_DIR}/Source/Debugger/ElementLog.h - ${PROJECT_SOURCE_DIR}/Source/Debugger/FontSource.h - ${PROJECT_SOURCE_DIR}/Source/Debugger/Geometry.h - ${PROJECT_SOURCE_DIR}/Source/Debugger/InfoSource.h - ${PROJECT_SOURCE_DIR}/Source/Debugger/LogSource.h - ${PROJECT_SOURCE_DIR}/Source/Debugger/MenuSource.h -) - -set(MASTER_Debugger_PUB_HDR_FILES - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Debugger.h -) - -set(Debugger_PUB_HDR_FILES - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Debugger/Debugger.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Debugger/Header.h -) - -set(Debugger_SRC_FILES - ${PROJECT_SOURCE_DIR}/Source/Debugger/Debugger.cpp - ${PROJECT_SOURCE_DIR}/Source/Debugger/DebuggerPlugin.cpp - ${PROJECT_SOURCE_DIR}/Source/Debugger/DebuggerSystemInterface.cpp - ${PROJECT_SOURCE_DIR}/Source/Debugger/ElementContextHook.cpp - ${PROJECT_SOURCE_DIR}/Source/Debugger/ElementInfo.cpp - ${PROJECT_SOURCE_DIR}/Source/Debugger/ElementLog.cpp - ${PROJECT_SOURCE_DIR}/Source/Debugger/Geometry.cpp -) - -if(NOT NO_FONT_INTERFACE_DEFAULT) - set(Core_HDR_FILES - ${Core_HDR_FILES} - ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontEngineInterfaceDefault.h - ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontFace.h - ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontFaceHandleDefault.h - ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontFaceLayer.h - ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontFamily.h - ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontProvider.h - ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontTypes.h - ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FreeTypeInterface.h - ) - - set(Core_SRC_FILES - ${Core_SRC_FILES} - ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontEngineInterfaceDefault.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontFace.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontFaceHandleDefault.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontFaceLayer.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontFamily.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontProvider.cpp - ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FreeTypeInterface.cpp - ) -endif() - -set(Lua_HDR_FILES - ${PROJECT_SOURCE_DIR}/Source/Lua/Colourb.h - ${PROJECT_SOURCE_DIR}/Source/Lua/Colourf.h - ${PROJECT_SOURCE_DIR}/Source/Lua/Context.h - ${PROJECT_SOURCE_DIR}/Source/Lua/ContextDocumentsProxy.h - ${PROJECT_SOURCE_DIR}/Source/Lua/Document.h - ${PROJECT_SOURCE_DIR}/Source/Lua/Element.h - ${PROJECT_SOURCE_DIR}/Source/Lua/ElementAttributesProxy.h - ${PROJECT_SOURCE_DIR}/Source/Lua/ElementChildNodesProxy.h - ${PROJECT_SOURCE_DIR}/Source/Lua/ElementInstancer.h - ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/As.h - ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementForm.h - ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementFormControl.h - ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementFormControlInput.h - ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementFormControlSelect.h - ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementFormControlTextArea.h - ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementTabSet.h - ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/SelectOptionsProxy.h - ${PROJECT_SOURCE_DIR}/Source/Lua/ElementStyleProxy.h - ${PROJECT_SOURCE_DIR}/Source/Lua/ElementText.h - ${PROJECT_SOURCE_DIR}/Source/Lua/Event.h - ${PROJECT_SOURCE_DIR}/Source/Lua/EventParametersProxy.h - ${PROJECT_SOURCE_DIR}/Source/Lua/GlobalLuaFunctions.h - ${PROJECT_SOURCE_DIR}/Source/Lua/Log.h - ${PROJECT_SOURCE_DIR}/Source/Lua/LuaDataModel.h - ${PROJECT_SOURCE_DIR}/Source/Lua/LuaDocument.h - ${PROJECT_SOURCE_DIR}/Source/Lua/LuaDocumentElementInstancer.h - ${PROJECT_SOURCE_DIR}/Source/Lua/LuaElementInstancer.h - ${PROJECT_SOURCE_DIR}/Source/Lua/LuaEventListener.h - ${PROJECT_SOURCE_DIR}/Source/Lua/LuaEventListenerInstancer.h - ${PROJECT_SOURCE_DIR}/Source/Lua/LuaPlugin.h - ${PROJECT_SOURCE_DIR}/Source/Lua/Pairs.h - ${PROJECT_SOURCE_DIR}/Source/Lua/RmlUi.h - ${PROJECT_SOURCE_DIR}/Source/Lua/RmlUiContextsProxy.h - ${PROJECT_SOURCE_DIR}/Source/Lua/Vector2f.h - ${PROJECT_SOURCE_DIR}/Source/Lua/Vector2i.h -) - -set(Lua_PUB_HDR_FILES - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/Header.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/IncludeLua.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/Interpreter.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/Lua.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/LuaType.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/Utilities.h -) - -set(Lua_SRC_FILES - ${PROJECT_SOURCE_DIR}/Source/Lua/Colourb.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/Colourf.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/Context.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/ContextDocumentsProxy.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/Document.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/Element.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/ElementAttributesProxy.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/ElementChildNodesProxy.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/ElementInstancer.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementForm.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementFormControl.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementFormControlInput.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementFormControlSelect.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementFormControlTextArea.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementTabSet.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/SelectOptionsProxy.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/ElementStyleProxy.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/ElementText.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/Event.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/EventParametersProxy.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/GlobalLuaFunctions.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/Interpreter.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/Log.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/Lua.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/LuaDataModel.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/LuaDocument.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/LuaDocumentElementInstancer.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/LuaElementInstancer.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/LuaEventListener.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/LuaEventListenerInstancer.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/LuaPlugin.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/LuaType.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/RmlUi.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/RmlUiContextsProxy.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/Utilities.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/Vector2f.cpp - ${PROJECT_SOURCE_DIR}/Source/Lua/Vector2i.cpp -) - -set(Lottie_HDR_FILES - ${PROJECT_SOURCE_DIR}/Source/Lottie/LottiePlugin.h -) - -set(Lottie_PUB_HDR_FILES - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Lottie/ElementLottie.h -) - -set(Lottie_SRC_FILES - ${PROJECT_SOURCE_DIR}/Source/Lottie/ElementLottie.cpp - ${PROJECT_SOURCE_DIR}/Source/Lottie/LottiePlugin.cpp -) - -set(SVG_HDR_FILES - ${PROJECT_SOURCE_DIR}/Source/SVG/SVGPlugin.h -) - -set(SVG_PUB_HDR_FILES - ${PROJECT_SOURCE_DIR}/Include/RmlUi/SVG/ElementSVG.h -) - -set(SVG_SRC_FILES - ${PROJECT_SOURCE_DIR}/Source/SVG/ElementSVG.cpp - ${PROJECT_SOURCE_DIR}/Source/SVG/SVGPlugin.cpp -) - diff --git a/CMake/Modules.old/FindLuaJIT.cmake b/CMake/Modules.old/FindLuaJIT.cmake deleted file mode 100644 index 199518773..000000000 --- a/CMake/Modules.old/FindLuaJIT.cmake +++ /dev/null @@ -1,16 +0,0 @@ -# Try to find the lua library -# LUAJIT_FOUND - system has lua -# LUAJIT_INCLUDE_DIR - the lua include directory -# LUAJIT_LIBRARY - the lua library - -FIND_PATH(LUAJIT_INCLUDE_DIR NAMES luajit.h PATH_SUFFIXES luajit luajit-2.0 luajit-2.1) -SET(_LUAJIT_STATIC_LIBS libluajit-5.1.a libluajit.a liblua51.a) -SET(_LUAJIT_SHARED_LIBS luajit-5.1 luajit lua51) -IF(USE_STATIC_LIBS) - FIND_LIBRARY(LUAJIT_LIBRARY NAMES ${_LUAJIT_STATIC_LIBS} ${_LUAJIT_SHARED_LIBS}) -ELSE() - FIND_LIBRARY(LUAJIT_LIBRARY NAMES ${_LUAJIT_SHARED_LIBS} ${_LUAJIT_STATIC_LIBS}) -ENDIF() -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaJIT DEFAULT_MSG LUAJIT_LIBRARY LUAJIT_INCLUDE_DIR) -MARK_AS_ADVANCED(LUAJIT_LIBRARY LUAJIT_INCLUDE_DIR) diff --git a/CMake/Modules.old/FindPkgMacros.cmake b/CMake/Modules.old/FindPkgMacros.cmake deleted file mode 100644 index 2eda3b88d..000000000 --- a/CMake/Modules.old/FindPkgMacros.cmake +++ /dev/null @@ -1,147 +0,0 @@ -################################################################## -# Provides some common functionality for the FindPackage modules -################################################################## - -# Begin processing of package -macro(findpkg_begin PREFIX) - if (NOT ${PREFIX}_FIND_QUIETLY) - message(STATUS "Looking for ${PREFIX}...") - endif () -endmacro(findpkg_begin) - -# Display a status message unless FIND_QUIETLY is set -macro(pkg_message PREFIX) - if (NOT ${PREFIX}_FIND_QUIETLY) - message(STATUS ${ARGN}) - endif () -endmacro(pkg_message) - -# Get environment variable, define it as ENV_$var and make sure backslashes are converted to forward slashes -macro(getenv_path VAR) - set(ENV_${VAR} $ENV{${VAR}}) - # replace won't work if var is blank - if (ENV_${VAR}) - string( REGEX REPLACE "\\\\" "/" ENV_${VAR} ${ENV_${VAR}} ) - endif () -endmacro(getenv_path) - -# Construct search paths for includes and libraries from a PREFIX_PATH -macro(create_search_paths PREFIX) - foreach(dir ${${PREFIX}_PREFIX_PATH}) - set(${PREFIX}_INC_SEARCH_PATH ${${PREFIX}_INC_SEARCH_PATH} - ${dir}/include ${dir}/Include ${dir}/include/${PREFIX} ${dir}/Headers) - set(${PREFIX}_LIB_SEARCH_PATH ${${PREFIX}_LIB_SEARCH_PATH} - ${dir}/lib ${dir}/Lib ${dir}/lib/${PREFIX} ${dir}/Libs) - set(${PREFIX}_BIN_SEARCH_PATH ${${PREFIX}_BIN_SEARCH_PATH} - ${dir}/bin) - endforeach(dir) - set(${PREFIX}_FRAMEWORK_SEARCH_PATH ${${PREFIX}_PREFIX_PATH}) -endmacro(create_search_paths) - -# clear cache variables if a certain variable changed -macro(clear_if_changed TESTVAR) - # test against internal check variable - # HACK: Apparently, adding a variable to the cache cleans up the list - # a bit. We need to also remove any empty strings from the list, but - # at the same time ensure that we are actually dealing with a list. - list(APPEND ${TESTVAR} "") - list(REMOVE_ITEM ${TESTVAR} "") - if (NOT "${${TESTVAR}}" STREQUAL "${${TESTVAR}_INT_CHECK}") - message(STATUS "${TESTVAR} changed.") - foreach(var ${ARGN}) - set(${var} "NOTFOUND" CACHE STRING "x" FORCE) - endforeach(var) - endif () - set(${TESTVAR}_INT_CHECK ${${TESTVAR}} CACHE INTERNAL "x" FORCE) -endmacro(clear_if_changed) - -# Try to get some hints from pkg-config, if available -macro(use_pkgconfig PREFIX PKGNAME) - find_package(PkgConfig) - if (PKG_CONFIG_FOUND) - pkg_check_modules(${PREFIX} ${PKGNAME}) - endif () -endmacro (use_pkgconfig) - -# Couple a set of release AND debug libraries (or frameworks) -macro(make_library_set PREFIX) - if (${PREFIX}_FWK) - set(${PREFIX} ${${PREFIX}_FWK}) - elseif (${PREFIX}_REL AND ${PREFIX}_DBG) - set(${PREFIX} optimized ${${PREFIX}_REL} debug ${${PREFIX}_DBG}) - elseif (${PREFIX}_REL) - set(${PREFIX} ${${PREFIX}_REL}) - elseif (${PREFIX}_DBG) - set(${PREFIX} ${${PREFIX}_DBG}) - endif () -endmacro(make_library_set) - -# Generate debug names from given release names -macro(get_debug_names PREFIX) - foreach(i ${${PREFIX}}) - set(${PREFIX}_DBG ${${PREFIX}_DBG} ${i}d ${i}D ${i}_d ${i}_D ${i}_debug ${i}) - endforeach(i) -endmacro(get_debug_names) - -# Add the parent dir from DIR to VAR -macro(add_parent_dir VAR DIR) - get_filename_component(${DIR}_TEMP "${${DIR}}/.." ABSOLUTE) - set(${VAR} ${${VAR}} ${${DIR}_TEMP}) -endmacro(add_parent_dir) - -# Do the final processing for the package find. -macro(findpkg_finish PREFIX) - # skip if already processed during this run - if (NOT ${PREFIX}_FOUND) - if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY) - set(${PREFIX}_FOUND TRUE) - set(${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR}) - set(${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY}) - if (NOT ${PREFIX}_FIND_QUIETLY) - message(STATUS "Found ${PREFIX}: ${${PREFIX}_LIBRARIES}") - endif () - else () - if (NOT ${PREFIX}_FIND_QUIETLY) - message(STATUS "Could not locate ${PREFIX}") - endif () - if (${PREFIX}_FIND_REQUIRED) - message(FATAL_ERROR "Required library ${PREFIX} not found! Install the library (including dev packages) and try again. If the library is already installed, set the missing variables manually in cmake.") - endif () - endif () - - mark_as_advanced(${PREFIX}_INCLUDE_DIR ${PREFIX}_LIBRARY ${PREFIX}_LIBRARY_REL ${PREFIX}_LIBRARY_DBG ${PREFIX}_LIBRARY_FWK) - endif () -endmacro(findpkg_finish) - - -# Slightly customised framework finder -MACRO(findpkg_framework fwk) - IF(APPLE) - SET(${fwk}_FRAMEWORK_PATH - ${${fwk}_FRAMEWORK_SEARCH_PATH} - ${CMAKE_FRAMEWORK_PATH} - ~/Library/Frameworks - /Library/Frameworks - /System/Library/Frameworks - /Network/Library/Frameworks - /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks/ - ${CMAKE_CURRENT_SOURCE_DIR}/lib/Release - ${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug - ${OGRE_PREFIX_PATH}/lib/Release - ${OGRE_PREFIX_PATH}/lib/Debug - ${OGRE_PREFIX_BUILD}/lib/Release - ${OGRE_PREFIX_BUILD}/lib/Debug - ) - FOREACH(dir ${${fwk}_FRAMEWORK_PATH}) - SET(fwkpath ${dir}/${fwk}.framework) - IF(EXISTS ${fwkpath}) - SET(${fwk}_FRAMEWORK_INCLUDES ${${fwk}_FRAMEWORK_INCLUDES} - ${fwkpath}/Headers ${fwkpath}/PrivateHeaders) - SET(${fwk}_FRAMEWORK_PATH ${dir}) - if (NOT ${fwk}_LIBRARY_FWK) - SET(${fwk}_LIBRARY_FWK "-framework ${fwk}") - endif () - ENDIF(EXISTS ${fwkpath}) - ENDFOREACH(dir) - ENDIF(APPLE) -ENDMACRO(findpkg_framework) \ No newline at end of file diff --git a/CMake/Modules.old/FindSDL2.cmake b/CMake/Modules.old/FindSDL2.cmake deleted file mode 100644 index 3f8aeeb96..000000000 --- a/CMake/Modules.old/FindSDL2.cmake +++ /dev/null @@ -1,191 +0,0 @@ -# Locate SDL2 library -# This module defines -# SDL2_LIBRARY, the name of the library to link against -# SDL2_FOUND, if false, do not try to link to SDL2 -# SDL2_INCLUDE_DIR, where to find SDL.h -# -# Source: https://code.google.com/p/freerct/source/browse/trunk/CMake/FindSDL2.cmake -# -# This module responds to the the flag: -# SDL2_BUILDING_LIBRARY -# If this is defined, then no SDL2main will be linked in because -# only applications need main(). -# Otherwise, it is assumed you are building an application and this -# module will attempt to locate and set the the proper link flags -# as part of the returned SDL2_LIBRARY variable. -# -# Don't forget to include SDLmain.h and SDLmain.m your project for the -# OS X framework based version. (Other versions link to -lSDL2main which -# this module will try to find on your behalf.) Also for OS X, this -# module will automatically add the -framework Cocoa on your behalf. -# -# -# Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your configuration -# and no SDL2_LIBRARY, it means CMake did not find your SDL2 library -# (SDL2.dll, libsdl2.so, SDL2.framework, etc). -# Set SDL2_LIBRARY_TEMP to point to your SDL2 library, and configure again. -# Similarly, if you see an empty SDL2MAIN_LIBRARY, you should set this value -# as appropriate. These values are used to generate the final SDL2_LIBRARY -# variable, but when these values are unset, SDL2_LIBRARY does not get created. -# -# -# $SDL2DIR is an environment variable that would -# correspond to the ./configure --prefix=$SDL2DIR -# used in building SDL2. -# l.e.galup 9-20-02 -# -# Modified by Eric Wing. -# Added code to assist with automated building by using environmental variables -# and providing a more controlled/consistent search behavior. -# Added new modifications to recognize OS X frameworks and -# additional Unix paths (FreeBSD, etc). -# Also corrected the header search path to follow "proper" SDL guidelines. -# Added a search for SDL2main which is needed by some platforms. -# Added a search for threads which is needed by some platforms. -# Added needed compile switches for MinGW. -# -# On OSX, this will prefer the Framework version (if found) over others. -# People will have to manually change the cache values of -# SDL2_LIBRARY to override this selection or set the CMake environment -# CMAKE_INCLUDE_PATH to modify the search paths. -# -# Note that the header path has changed from SDL2/SDL.h to just SDL.h -# This needed to change because "proper" SDL convention -# is #include "SDL.h", not . This is done for portability -# reasons because not all systems place things in SDL2/ (see FreeBSD). - -#============================================================================= -# Copyright 2003-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -# Look for the library in config mode first. -find_package(SDL2 CONFIG) -if(SDL2_FOUND AND TARGET SDL2::SDL2) - message(STATUS "Found SDL2 in config mode, version ${SDL2_VERSION}.") - set(SDL2_LIBRARY "SDL2::SDL2") - return() -else() - message(STATUS "Looking for SDL2 in module mode.") -endif() - -SET(SDL2_SEARCH_PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt -) - -FIND_PATH(SDL2_INCLUDE_DIR SDL.h - HINTS - $ENV{SDL2DIR} - PATH_SUFFIXES include/SDL2 include - PATHS ${SDL2_SEARCH_PATHS} -) - -FIND_LIBRARY(SDL2_LIBRARY_TEMP - NAMES SDL2 - HINTS - $ENV{SDL2DIR} - PATH_SUFFIXES lib64 lib - PATHS ${SDL2_SEARCH_PATHS} -) - -IF(NOT SDL2_BUILDING_LIBRARY) - IF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework") - # Non-OS X framework versions expect you to also dynamically link to - # SDL2main. This is mainly for Windows and OS X. Other (Unix) platforms - # seem to provide SDL2main for compatibility even though they don't - # necessarily need it. - FIND_LIBRARY(SDL2MAIN_LIBRARY - NAMES SDL2main - HINTS - $ENV{SDL2DIR} - PATH_SUFFIXES lib64 lib - PATHS ${SDL2_SEARCH_PATHS} - ) - ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework") -ENDIF(NOT SDL2_BUILDING_LIBRARY) - -# SDL2 may require threads on your system. -# The Apple build may not need an explicit flag because one of the -# frameworks may already provide it. -# But for non-OSX systems, I will use the CMake Threads package. -IF(NOT APPLE) - FIND_PACKAGE(Threads) -ENDIF(NOT APPLE) - -# MinGW needs an additional library, mwindows -# It's total link flags should look like -lmingw32 -lSDL2main -lSDL2 -lmwindows -# (Actually on second look, I think it only needs one of the m* libraries.) -IF(MINGW) - SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW") -ENDIF(MINGW) - -IF(SDL2_LIBRARY_TEMP) - # For SDL2main - IF(NOT SDL2_BUILDING_LIBRARY) - IF(SDL2MAIN_LIBRARY) - SET(SDL2_LIBRARY_TEMP ${SDL2MAIN_LIBRARY} ${SDL2_LIBRARY_TEMP}) - ENDIF(SDL2MAIN_LIBRARY) - ENDIF(NOT SDL2_BUILDING_LIBRARY) - - # For OS X, SDL2 uses Cocoa as a backend so it must link to Cocoa. - # CMake doesn't display the -framework Cocoa string in the UI even - # though it actually is there if I modify a pre-used variable. - # I think it has something to do with the CACHE STRING. - # So I use a temporary variable until the end so I can set the - # "real" variable in one-shot. - IF(APPLE) - SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa") - ENDIF(APPLE) - - # For threads, as mentioned Apple doesn't need this. - # In fact, there seems to be a problem if I used the Threads package - # and try using this line, so I'm just skipping it entirely for OS X. - IF(NOT APPLE) - SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT}) - ENDIF(NOT APPLE) - - # For MinGW library - IF(MINGW) - SET(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP}) - ENDIF(MINGW) - - # Set the final string here so the GUI reflects the final state. - SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found") - # Set the temp variable to INTERNAL so it is not seen in the CMake GUI - SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "") -ENDIF(SDL2_LIBRARY_TEMP) - -if(SDL2_INCLUDE_DIR AND EXISTS "${SDL2_INCLUDE_DIR}/SDL_version.h") - file(STRINGS "${SDL2_INCLUDE_DIR}/SDL_version.h" SDL2_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_MAJOR_VERSION[ \t]+[0-9]+$") - file(STRINGS "${SDL2_INCLUDE_DIR}/SDL_version.h" SDL2_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_MINOR_VERSION[ \t]+[0-9]+$") - file(STRINGS "${SDL2_INCLUDE_DIR}/SDL_version.h" SDL2_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_PATCHLEVEL[ \t]+[0-9]+$") - string(REGEX REPLACE "^#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_MAJOR "${SDL2_VERSION_MAJOR_LINE}") - string(REGEX REPLACE "^#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_MINOR "${SDL2_VERSION_MINOR_LINE}") - string(REGEX REPLACE "^#define[ \t]+SDL_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_PATCH "${SDL2_VERSION_PATCH_LINE}") - set(SDL2_VERSION ${SDL2_VERSION_MAJOR}.${SDL2_VERSION_MINOR}.${SDL2_VERSION_PATCH}) - unset(SDL2_VERSION_MAJOR_LINE) - unset(SDL2_VERSION_MINOR_LINE) - unset(SDL2_VERSION_PATCH_LINE) - unset(SDL2_VERSION_MAJOR) - unset(SDL2_VERSION_MINOR) - unset(SDL2_VERSION_PATCH) -endif() - -INCLUDE(FindPackageHandleStandardArgs) - -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR VERSION_VAR SDL2_VERSION) diff --git a/CMake/Modules.old/FindSDL2_image.cmake b/CMake/Modules.old/FindSDL2_image.cmake deleted file mode 100644 index d1aa11632..000000000 --- a/CMake/Modules.old/FindSDL2_image.cmake +++ /dev/null @@ -1,119 +0,0 @@ -# Locate SDL2_image library -# This module defines -# SDL2_IMAGE_LIBRARY, the name of the library to link against -# SDL2_IMAGE_FOUND, if false, do not try to link to SDL2_image -# SDL2_IMAGE_INCLUDE_DIR, where to find SDL.h -# -# Source: https://code.google.com/p/freerct/source/browse/trunk/CMake/FindSDL2_ttf.cmake -# -# $SDL2_IMAGE_DIR is an environment variable that would -# correspond to the ./configure --prefix=$SDL2_IMAGE_DIR -# used in building SDL2_image. -# l.e.galup 9-20-02 -# -# Modified by Eric Wing. -# Added code to assist with automated building by using environmental variables -# and providing a more controlled/consistent search behavior. -# Added new modifications to recognize OS X frameworks and -# additional Unix paths (FreeBSD, etc). -# Also corrected the header search path to follow "proper" SDL guidelines. -# Added a search for SDL2main which is needed by some platforms. -# Added a search for threads which is needed by some platforms. -# Added needed compile switches for MinGW. -# -# On OSX, this will prefer the Framework version (if found) over others. -# People will have to manually change the cache values of -# SDL2_LIBRARY to override this selection or set the CMake environment -# CMAKE_INCLUDE_PATH to modify the search paths. -# -# Note that the header path has changed from SDL2/SDL.h to just SDL.h -# This needed to change because "proper" SDL convention -# is #include "SDL.h", not . This is done for portability -# reasons because not all systems place things in SDL2/ (see FreeBSD). - -#============================================================================= -# Copyright 2003-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -SET(SDL2_IMAGE_SEARCH_PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt -) - -FIND_PATH(SDL2_IMAGE_INCLUDE_DIR SDL_image.h - HINTS - $ENV{SDL2_IMAGE_DIR} - PATH_SUFFIXES include/SDL2 include - PATHS ${SDL2_IMAGE_SEARCH_PATHS} -) - -FIND_LIBRARY(SDL2_IMAGE_LIBRARY_TEMP - NAMES SDL2_image - HINTS - $ENV{SDL2_IMAGE_DIR} - PATH_SUFFIXES lib64 lib - PATHS ${SDL2_IMAGE_SEARCH_PATHS} -) - -# SDL2_image may require threads on your system. -# The Apple build may not need an explicit flag because one of the -# frameworks may already provide it. -# But for non-OSX systems, I will use the CMake Threads package. -# IF(NOT APPLE) - # FIND_PACKAGE(Threads) -# ENDIF(NOT APPLE) - -# MinGW needs an additional library, mwindows -# It's total link flags should look like -lmingw32 -lSDL2_image -lmwindows -# (Actually on second look, I think it only needs one of the m* libraries.) -IF(MINGW) - SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW") -ENDIF(MINGW) - -IF(SDL2_IMAGE_LIBRARY_TEMP) - # For OS X, SDL2_IMAGE uses Cocoa as a backend so it must link to Cocoa. - # CMake doesn't display the -framework Cocoa string in the UI even - # though it actually is there if I modify a pre-used variable. - # I think it has something to do with the CACHE STRING. - # So I use a temporary variable until the end so I can set the - # "real" variable in one-shot. - # IF(APPLE) - # SET(SDL2_IMAGE_LIBRARY_TEMP ${SDL2_IMAGE_LIBRARY_TEMP} "-framework Cocoa") - # ENDIF(APPLE) - - # For threads, as mentioned Apple doesn't need this. - # In fact, there seems to be a problem if I used the Threads package - # and try using this line, so I'm just skipping it entirely for OS X. - # IF(NOT APPLE) - # SET(SDL2_IMAGE_LIBRARY_TEMP ${SDL2_IMAGE_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT}) - # ENDIF(NOT APPLE) - - # For MinGW library - # IF(MINGW) - # SET(SDL2_IMAGE_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_IMAGE_LIBRARY_TEMP}) - # ENDIF(MINGW) - - # Set the final string here so the GUI reflects the final state. - SET(SDL2_IMAGE_LIBRARY ${SDL2_IMAGE_LIBRARY_TEMP} CACHE STRING "Where the SDL2_IMAGE Library can be found") - # Set the temp variable to INTERNAL so it is not seen in the CMake GUI - SET(SDL2_IMAGE_LIBRARY_TEMP "${SDL2_IMAGE_LIBRARY_TEMP}" CACHE INTERNAL "") -ENDIF(SDL2_IMAGE_LIBRARY_TEMP) - -INCLUDE(FindPackageHandleStandardArgs) - -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2_image REQUIRED_VARS SDL2_IMAGE_LIBRARY SDL2_IMAGE_INCLUDE_DIR) diff --git a/CMake/Modules.old/FindSFML.cmake b/CMake/Modules.old/FindSFML.cmake deleted file mode 100644 index 99cbff2e0..000000000 --- a/CMake/Modules.old/FindSFML.cmake +++ /dev/null @@ -1,209 +0,0 @@ -# This script locates the SFML library -# ------------------------------------ -# -# Usage -# ----- -# -# When you try to locate the SFML libraries, you must specify which modules you want to use (system, window, graphics, network, audio, main). -# If none is given, the SFML_LIBRARIES variable will be empty and you'll end up linking to nothing. -# example: -# find_package(SFML COMPONENTS graphics window system) // find the graphics, window and system modules -# -# You can enforce a specific version, either MAJOR.MINOR or only MAJOR. -# If nothing is specified, the version won't be checked (ie. any version will be accepted). -# example: -# find_package(SFML COMPONENTS ...) // no specific version required -# find_package(SFML 2 COMPONENTS ...) // any 2.x version -# find_package(SFML 2.4 COMPONENTS ...) // version 2.4 or greater -# -# By default, the dynamic libraries of SFML will be found. To find the static ones instead, -# you must set the SFML_STATIC_LIBRARIES variable to TRUE before calling find_package(SFML ...). -# In case of static linking, the SFML_STATIC macro will also be defined by this script. -# example: -# set(SFML_STATIC_LIBRARIES TRUE) -# find_package(SFML 2 COMPONENTS network system) -# -# On Mac OS X if SFML_STATIC_LIBRARIES is not set to TRUE then by default CMake will search for frameworks unless -# CMAKE_FIND_FRAMEWORK is set to "NEVER" for example. Please refer to CMake documentation for more details. -# Moreover, keep in mind that SFML frameworks are only available as release libraries unlike dylibs which -# are available for both release and debug modes. -# -# If SFML is not installed in a standard path, you can use the SFML_ROOT CMake (or environment) variable -# to tell CMake where SFML is. -# -# Output -# ------ -# -# This script defines the following variables: -# - For each specified module XXX (system, window, graphics, network, audio, main): -# - SFML_XXX_LIBRARY_DEBUG: the name of the debug library of the xxx module (set to SFML_XXX_LIBRARY_RELEASE is no debug version is found) -# - SFML_XXX_LIBRARY_RELEASE: the name of the release library of the xxx module (set to SFML_XXX_LIBRARY_DEBUG is no release version is found) -# - SFML_XXX_LIBRARY: the name of the library to link to for the xxx module (includes both debug and optimized names if necessary) -# - SFML_XXX_FOUND: true if either the debug or release library of the xxx module is found -# - SFML_LIBRARIES: the list of all libraries corresponding to the required modules -# - SFML_FOUND: true if all the required modules are found -# - SFML_INCLUDE_DIR: the path where SFML headers are located (the directory containing the SFML/Config.hpp file) -# -# example: -# find_package(SFML 2 COMPONENTS system window graphics audio REQUIRED) -# include_directories(${SFML_INCLUDE_DIR}) -# add_executable(myapp ...) -# target_link_libraries(myapp ${SFML_LIBRARIES}) - -# define the SFML_STATIC macro if static build was chosen -if(SFML_STATIC_LIBRARIES) - add_definitions(-DSFML_STATIC) -endif() - -# deduce the libraries suffix from the options -set(FIND_SFML_LIB_SUFFIX "") -if(SFML_STATIC_LIBRARIES) - set(FIND_SFML_LIB_SUFFIX "${FIND_SFML_LIB_SUFFIX}-s") -endif() - -# find the SFML include directory -find_path(SFML_INCLUDE_DIR SFML/Config.hpp - PATH_SUFFIXES include - PATHS - ${SFML_ROOT} - $ENV{SFML_ROOT} - ~/Library/Frameworks - /Library/Frameworks - /usr/local/ - /usr/ - /sw # Fink - /opt/local/ # DarwinPorts - /opt/csw/ # Blastwave - /opt/) - -# check the version number -set(SFML_VERSION_OK TRUE) -if(SFML_FIND_VERSION AND SFML_INCLUDE_DIR) - # extract the major and minor version numbers from SFML/Config.hpp - # we have to handle framework a little bit differently : - if("${SFML_INCLUDE_DIR}" MATCHES "SFML.framework") - set(SFML_CONFIG_HPP_INPUT "${SFML_INCLUDE_DIR}/Headers/Config.hpp") - else() - set(SFML_CONFIG_HPP_INPUT "${SFML_INCLUDE_DIR}/SFML/Config.hpp") - endif() - FILE(READ "${SFML_CONFIG_HPP_INPUT}" SFML_CONFIG_HPP_CONTENTS) - STRING(REGEX MATCH ".*#define SFML_VERSION_MAJOR ([0-9]+).*#define SFML_VERSION_MINOR ([0-9]+).*" SFML_CONFIG_HPP_CONTENTS "${SFML_CONFIG_HPP_CONTENTS}") - STRING(REGEX REPLACE ".*#define SFML_VERSION_MAJOR ([0-9]+).*" "\\1" SFML_VERSION_MAJOR "${SFML_CONFIG_HPP_CONTENTS}") - STRING(REGEX REPLACE ".*#define SFML_VERSION_MINOR ([0-9]+).*" "\\1" SFML_VERSION_MINOR "${SFML_CONFIG_HPP_CONTENTS}") - math(EXPR SFML_REQUESTED_VERSION "${SFML_FIND_VERSION_MAJOR} * 10 + ${SFML_FIND_VERSION_MINOR}") - - # if we could extract them, compare with the requested version number - if (SFML_VERSION_MAJOR) - # transform version numbers to an integer - math(EXPR SFML_VERSION "${SFML_VERSION_MAJOR} * 10 + ${SFML_VERSION_MINOR}") - - # compare them - if(SFML_VERSION LESS SFML_REQUESTED_VERSION) - set(SFML_VERSION_OK FALSE) - endif() - else() - # SFML version is < 2.0 - if (SFML_REQUESTED_VERSION GREATER 19) - set(SFML_VERSION_OK FALSE) - set(SFML_VERSION_MAJOR 1) - set(SFML_VERSION_MINOR x) - endif() - endif() -endif() - -# find the requested modules -set(SFML_FOUND TRUE) # will be set to false if one of the required modules is not found -set(FIND_SFML_LIB_PATHS - ${SFML_ROOT} - $ENV{SFML_ROOT} - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw - /opt/local - /opt/csw - /opt) -foreach(FIND_SFML_COMPONENT ${SFML_FIND_COMPONENTS}) - string(TOLOWER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_LOWER) - string(TOUPPER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_UPPER) - set(FIND_SFML_COMPONENT_NAME sfml-${FIND_SFML_COMPONENT_LOWER}${FIND_SFML_LIB_SUFFIX}) - - # no suffix for sfml-main, it is always a static library - if(FIND_SFML_COMPONENT_LOWER STREQUAL "main") - set(FIND_SFML_COMPONENT_NAME sfml-${FIND_SFML_COMPONENT_LOWER}) - endif() - - # debug library - find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG - NAMES ${FIND_SFML_COMPONENT_NAME}-d - PATH_SUFFIXES lib64 lib - PATHS ${FIND_SFML_LIB_PATHS}) - - # release library - find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE - NAMES ${FIND_SFML_COMPONENT_NAME} - PATH_SUFFIXES lib64 lib - PATHS ${FIND_SFML_LIB_PATHS}) - - if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG OR SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE) - # library found - set(SFML_${FIND_SFML_COMPONENT_UPPER}_FOUND TRUE) - - # if both are found, set SFML_XXX_LIBRARY to contain both - if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG AND SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE) - set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY debug ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG} - optimized ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE}) - endif() - - # if only one debug/release variant is found, set the other to be equal to the found one - if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG AND NOT SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE) - # debug and not release - set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG}) - set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG}) - endif() - if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE AND NOT SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG) - # release and not debug - set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE}) - set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE}) - endif() - else() - # library not found - set(SFML_FOUND FALSE) - set(SFML_${FIND_SFML_COMPONENT_UPPER}_FOUND FALSE) - set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY "") - set(FIND_SFML_MISSING "${FIND_SFML_MISSING} SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY") - endif() - - # mark as advanced - MARK_AS_ADVANCED(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY - SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE - SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG) - - # add to the global list of libraries - set(SFML_LIBRARIES ${SFML_LIBRARIES} "${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY}") -endforeach() - -# handle errors -if(NOT SFML_VERSION_OK) - # SFML version not ok - set(FIND_SFML_ERROR "SFML found but version too low (requested: ${SFML_FIND_VERSION}, found: ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR})") - set(SFML_FOUND FALSE) -elseif(NOT SFML_FOUND) - # include directory or library not found - set(FIND_SFML_ERROR "Could NOT find SFML (missing: ${FIND_SFML_MISSING})") -endif() -if (NOT SFML_FOUND) - if(SFML_FIND_REQUIRED) - # fatal error - message(FATAL_ERROR ${FIND_SFML_ERROR}) - elseif(NOT SFML_FIND_QUIETLY) - # error but continue - message("${FIND_SFML_ERROR}") - endif() -endif() - -# handle success -if(SFML_FOUND) - message(STATUS "Found SFML ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR} in ${SFML_INCLUDE_DIR}") -endif() diff --git a/CMake/Modules.old/FindTracy.cmake b/CMake/Modules.old/FindTracy.cmake deleted file mode 100644 index 314752a48..000000000 --- a/CMake/Modules.old/FindTracy.cmake +++ /dev/null @@ -1,20 +0,0 @@ -# - Try to find Tracy -# Once done, this will define -# -# TRACY_FOUND - system has Tracy -# TRACY_INCLUDE_DIR - the Tracy include directory - -set(TRACY_DIR "" CACHE PATH "Parent directory of Tracy library") - -find_path(TRACY_INCLUDE_DIR Tracy.hpp PATHS ${TRACY_DIR} $ENV{TRACY_DIR} PATH_SUFFIXES tracy) - -set(TRACY_FOUND "NO") -if(TRACY_INCLUDE_DIR) - message(STATUS "Found Tracy ${TRACY_INCLUDE_DIR}...") - mark_as_advanced(TRACY_DIR TRACY_INCLUDE_DIR) - set(TRACY_FOUND "YES") -elseif(Tracy_FIND_REQUIRED) - message(FATAL_ERROR "Required library Tracy not found! Install the library and try again. If the library is already installed, set the missing variables manually in cmake.") -else() - message(STATUS "Library Tracy not found...") -endif() diff --git a/CMake/Modules.old/Findlunasvg.cmake b/CMake/Modules.old/Findlunasvg.cmake deleted file mode 100644 index b8d611649..000000000 --- a/CMake/Modules.old/Findlunasvg.cmake +++ /dev/null @@ -1,32 +0,0 @@ -# Try to find LunaSVG -if (TARGET lunasvg) - # This is for when lunasvg is added via an add_subdirectory - get_target_property(LUNASVG_LIBRARY lunasvg LIBRARY_OUTPUT_NAME) - get_target_property(LUNASVG_INCLUDE_DIR lunasvg INCLUDE_DIRECTORIES) -else() - find_path(LUNASVG_INCLUDE_DIR lunasvg.h - HINTS $ENV{LUNASVG_DIR} - PATH_SUFFIXES lunasvg lunasvg/include include ) - - find_library(LUNASVG_LIBRARY_DEBUG NAMES lunasvg liblunasvg - HINTS $ENV{LUNASVG_DIR} $ENV{LUNASVG_DIR}/build - PATH_SUFFIXES debug Debug) - - find_library(LUNASVG_LIBRARY_RELEASE NAMES lunasvg liblunasvg - HINTS $ENV{LUNASVG_DIR} $ENV{LUNASVG_DIR}/build - PATH_SUFFIXES release Release) - - set(LUNASVG_LIBRARY - debug ${LUNASVG_LIBRARY_DEBUG} - optimized ${LUNASVG_LIBRARY_RELEASE} - ) - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(lunasvg DEFAULT_MSG - LUNASVG_LIBRARY LUNASVG_INCLUDE_DIR) - - mark_as_advanced(LUNASVG_INCLUDE_DIR LUNASVG_LIBRARY_DEBUG LUNASVG_LIBRARY_RELEASE ) - - set(LUNASVG_LIBRARIES ${LUNASVG_LIBRARY} ) - set(LUNASVG_INCLUDE_DIRS ${LUNASVG_INCLUDE_DIR} ) -endif() diff --git a/CMake/Platform/iOS.cmake b/CMake/Platform/iOS.cmake deleted file mode 100644 index 274a5a1c1..000000000 --- a/CMake/Platform/iOS.cmake +++ /dev/null @@ -1,190 +0,0 @@ -# This file is based off of the Platform/Darwin.cmake and Platform/UnixPaths.cmake -# files which are included with CMake 2.8.4 -# It has been altered for iOS development - -# Options: -# -# IOS_PLATFORM = OS (default) or SIMULATOR -# This decides if SDKS will be selected from the iPhoneOS.platform or iPhoneSimulator.platform folders -# OS - the default, used to build for iPhone and iPad physical devices, which have an arm arch. -# SIMULATOR - used to build for the Simulator platforms, which have an x86 arch. -# -# CMAKE_IOS_DEVELOPER_ROOT = automatic(default) or /path/to/platform/Developer folder -# By default this location is automatcially chosen based on the IOS_PLATFORM value above. -# If set manually, it will override the default location and force the user of a particular Developer Platform -# -# CMAKE_IOS_SDK_ROOT = automatic(default) or /path/to/platform/Developer/SDKs/SDK folder -# By default this location is automatcially chosen based on the CMAKE_IOS_DEVELOPER_ROOT value. -# In this case it will always be the most up-to-date SDK found in the CMAKE_IOS_DEVELOPER_ROOT path. -# If set manually, this will force the use of a specific SDK version - -# Macros: -# -# set_xcode_property (TARGET XCODE_PROPERTY XCODE_VALUE) -# A convenience macro for setting xcode specific properties on targets -# example: set_xcode_property (myioslib IPHONEOS_DEPLOYMENT_TARGET "3.1") -# -# find_host_package (PROGRAM ARGS) -# A macro used to find executable programs on the host system, not within the iOS environment. -# Thanks to the android-cmake project for providing the command - - -# Standard settings -set (CMAKE_SYSTEM_NAME Darwin) -set (CMAKE_SYSTEM_VERSION 1) -set (UNIX True) -set (APPLE True) -set (IOS True) - -# Required as of cmake 2.8.10 -set (CMAKE_OSX_DEPLOYMENT_TARGET "" CACHE STRING "Force unset of the deployment target for iOS" FORCE) - -# Determine the cmake host system version so we know where to find the iOS SDKs -find_program (CMAKE_UNAME uname /bin /usr/bin /usr/local/bin) -if (CMAKE_UNAME) - exec_program(uname ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION) - string (REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\1" DARWIN_MAJOR_VERSION "${CMAKE_HOST_SYSTEM_VERSION}") -endif (CMAKE_UNAME) - -# Skip the platform compiler checks for cross compiling -set (CMAKE_CXX_COMPILER_WORKS TRUE) -set (CMAKE_C_COMPILER_WORKS TRUE) - -# All iOS/Darwin specific settings - some may be redundant -set (CMAKE_SHARED_LIBRARY_PREFIX "lib") -set (CMAKE_SHARED_LIBRARY_SUFFIX ".dylib") -set (CMAKE_SHARED_MODULE_PREFIX "lib") -set (CMAKE_SHARED_MODULE_SUFFIX ".so") -set (CMAKE_MODULE_EXISTS 1) -set (CMAKE_DL_LIBS "") - -set (CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ") -set (CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ") -set (CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}") -set (CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}") - -# Hidden visibilty is required for cxx on iOS -set (CMAKE_C_FLAGS_INIT "") -set (CMAKE_CXX_FLAGS_INIT "-fvisibility=hidden -fvisibility-inlines-hidden") - -set (CMAKE_C_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}") -set (CMAKE_CXX_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}") - -set (CMAKE_PLATFORM_HAS_INSTALLNAME 1) -set (CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -headerpad_max_install_names") -set (CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -headerpad_max_install_names") -set (CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,") -set (CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,") -set (CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a") - -# hack: if a new cmake (which uses CMAKE_INSTALL_NAME_TOOL) runs on an old build tree -# (where install_name_tool was hardcoded) and where CMAKE_INSTALL_NAME_TOOL isn't in the cache -# and still cmake didn't fail in CMakeFindBinUtils.cmake (because it isn't rerun) -# hardcode CMAKE_INSTALL_NAME_TOOL here to install_name_tool, so it behaves as it did before, Alex -if (NOT DEFINED CMAKE_INSTALL_NAME_TOOL) - find_program(CMAKE_INSTALL_NAME_TOOL install_name_tool) -endif (NOT DEFINED CMAKE_INSTALL_NAME_TOOL) - -# Setup iOS platform unless specified manually with IOS_PLATFORM -if (NOT DEFINED IOS_PLATFORM) - set (IOS_PLATFORM "OS") -endif (NOT DEFINED IOS_PLATFORM) -set (IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform") - -# Check the platform selection and setup for developer root -if (${IOS_PLATFORM} STREQUAL "OS") - set (IOS_PLATFORM_LOCATION "iPhoneOS.platform") - - # This causes the installers to properly locate the output libraries - set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos") -elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR") - set (IOS_PLATFORM_LOCATION "iPhoneSimulator.platform") - - # This causes the installers to properly locate the output libraries - set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator") -else (${IOS_PLATFORM} STREQUAL "OS") - message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected. Please choose OS or SIMULATOR") -endif (${IOS_PLATFORM} STREQUAL "OS") - -# Setup iOS developer location unless specified manually with CMAKE_IOS_DEVELOPER_ROOT -# Note Xcode 4.3 changed the installation location, choose the most recent one available -set (XCODE_POST_43_ROOT "/Applications/Xcode.app/Contents/Developer/Platforms/${IOS_PLATFORM_LOCATION}/Developer") -set (XCODE_PRE_43_ROOT "/Developer/Platforms/${IOS_PLATFORM_LOCATION}/Developer") -if (NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT) - if (EXISTS ${XCODE_POST_43_ROOT}) - set (CMAKE_IOS_DEVELOPER_ROOT ${XCODE_POST_43_ROOT}) - elseif(EXISTS ${XCODE_PRE_43_ROOT}) - set (CMAKE_IOS_DEVELOPER_ROOT ${XCODE_PRE_43_ROOT}) - endif (EXISTS ${XCODE_POST_43_ROOT}) -endif (NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT) -set (CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_IOS_DEVELOPER_ROOT} CACHE PATH "Location of iOS Platform") - -# Find and use the most recent iOS sdk unless specified manually with CMAKE_IOS_SDK_ROOT -if (NOT DEFINED CMAKE_IOS_SDK_ROOT) - file (GLOB _CMAKE_IOS_SDKS "${CMAKE_IOS_DEVELOPER_ROOT}/SDKs/*") - if (_CMAKE_IOS_SDKS) - list (SORT _CMAKE_IOS_SDKS) - list (REVERSE _CMAKE_IOS_SDKS) - list (GET _CMAKE_IOS_SDKS 0 CMAKE_IOS_SDK_ROOT) - else (_CMAKE_IOS_SDKS) - message (FATAL_ERROR "No iOS SDK's found in default search path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.") - endif (_CMAKE_IOS_SDKS) - message (STATUS "Toolchain using default iOS SDK: ${CMAKE_IOS_SDK_ROOT}") -endif (NOT DEFINED CMAKE_IOS_SDK_ROOT) -set (CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Location of the selected iOS SDK") - -# Set the sysroot default to the most recent SDK -set (CMAKE_OSX_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support") - -# set the architecture for iOS -# NOTE: Currently both ARCHS_STANDARD_32_BIT and ARCHS_UNIVERSAL_IPHONE_OS set armv7 only, so set both manually -if (${IOS_PLATFORM} STREQUAL "OS") - set (IOS_ARCH armv6 armv7 armv7s arm64) -else (${IOS_PLATFORM} STREQUAL "OS") - set (IOS_ARCH i386 x86_64) -endif (${IOS_PLATFORM} STREQUAL "OS") - -if (NOT DEFINED CMAKE_OSX_ARCHITECTURES) - set (CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE string "Build architecture for iOS") -endif (NOT DEFINED CMAKE_OSX_ARCHITECTURES) - -# Set the find root to the iOS developer roots and to user defined paths -set (CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} CACHE string "iOS find search path root") - -# default to searching for frameworks first -set (CMAKE_FIND_FRAMEWORK FIRST) - -# set up the default search directories for frameworks -set (CMAKE_SYSTEM_FRAMEWORK_PATH - ${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks - ${CMAKE_IOS_SDK_ROOT}/System/Library/PrivateFrameworks - ${CMAKE_IOS_SDK_ROOT}/Developer/Library/Frameworks -) - -# only search the iOS sdks, not the remainder of the host filesystem -set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY) -set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) - - -# This little macro lets you set any XCode specific property -macro (set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE) - set_property (TARGET ${TARGET} PROPERTY XCODE_ATTRIBUTE_${XCODE_PROPERTY} ${XCODE_VALUE}) -endmacro (set_xcode_property) - - -# This macro lets you find executable programs on the host system -macro (find_host_package) - set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) - set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER) - set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER) - set (IOS FALSE) - - find_package(${ARGN}) - - set (IOS TRUE) - set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY) - set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) - set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -endmacro (find_host_package) - diff --git a/CMake/RmlUiConfig.cmake.build.in b/CMake/RmlUiConfig.cmake.build.in deleted file mode 100644 index 5afd2838f..000000000 --- a/CMake/RmlUiConfig.cmake.build.in +++ /dev/null @@ -1,11 +0,0 @@ -@PACKAGE_INIT@ - -set_and_check(RmlUi_INCLUDE_DIRS "@PACKAGE_INCLUDE_DIR@") -set(RmlUi_LIBRARIES @RMLUI_EXPORTED_TARGETS@) -list(GET RmlUi_LIBRARIES 0 RMLUI_FIRST_TARGET) - -if(NOT (TARGET ${RMLUI_FIRST_TARGET})) - include("${CMAKE_CURRENT_LIST_DIR}/RmlUiTargets.cmake") -endif() - -check_required_components(RmlUi) diff --git a/CMake/RmlUiConfig.cmake.install.in b/CMake/RmlUiConfig.cmake.install.in deleted file mode 100644 index 88362b270..000000000 --- a/CMake/RmlUiConfig.cmake.install.in +++ /dev/null @@ -1,7 +0,0 @@ -@PACKAGE_INIT@ - -set_and_check(RmlUi_INCLUDE_DIRS "@PACKAGE_INCLUDE_INSTALL_DIR@") -set(RmlUi_LIBRARIES @RMLUI_EXPORTED_TARGETS@) -include("${CMAKE_CURRENT_LIST_DIR}/RmlUiTargets.cmake") - -check_required_components(RmlUi) diff --git a/CMake/SampleFileList.cmake b/CMake/SampleFileList.cmake deleted file mode 100644 index 75693ada6..000000000 --- a/CMake/SampleFileList.cmake +++ /dev/null @@ -1,212 +0,0 @@ -# This file was auto-generated with gen_samplelists.sh - -set(shell_HDR_FILES - ${PROJECT_SOURCE_DIR}/Samples/shell/include/PlatformExtensions.h - ${PROJECT_SOURCE_DIR}/Samples/shell/include/RendererExtensions.h - ${PROJECT_SOURCE_DIR}/Samples/shell/include/Shell.h - ${PROJECT_SOURCE_DIR}/Samples/shell/include/ShellFileInterface.h -) - -set(shell_SRC_FILES - ${PROJECT_SOURCE_DIR}/Samples/shell/src/PlatformExtensions.cpp - ${PROJECT_SOURCE_DIR}/Samples/shell/src/RendererExtensions.cpp - ${PROJECT_SOURCE_DIR}/Samples/shell/src/Shell.cpp - ${PROJECT_SOURCE_DIR}/Samples/shell/src/ShellFileInterface.cpp -) - -set(animation_HDR_FILES -) - -set(animation_SRC_FILES - ${PROJECT_SOURCE_DIR}/Samples/basic/animation/src/main.cpp -) - -set(benchmark_HDR_FILES -) - -set(benchmark_SRC_FILES - ${PROJECT_SOURCE_DIR}/Samples/basic/benchmark/src/main.cpp -) - -set(bitmapfont_HDR_FILES - ${PROJECT_SOURCE_DIR}/Samples/basic/bitmapfont/src/FontEngineBitmap.h - ${PROJECT_SOURCE_DIR}/Samples/basic/bitmapfont/src/FontEngineInterfaceBitmap.h -) - -set(bitmapfont_SRC_FILES - ${PROJECT_SOURCE_DIR}/Samples/basic/bitmapfont/src/FontEngineBitmap.cpp - ${PROJECT_SOURCE_DIR}/Samples/basic/bitmapfont/src/FontEngineInterfaceBitmap.cpp - ${PROJECT_SOURCE_DIR}/Samples/basic/bitmapfont/src/main.cpp -) - -set(customlog_HDR_FILES - ${PROJECT_SOURCE_DIR}/Samples/basic/customlog/src/SystemInterface.h -) - -set(customlog_SRC_FILES - ${PROJECT_SOURCE_DIR}/Samples/basic/customlog/src/main.cpp - ${PROJECT_SOURCE_DIR}/Samples/basic/customlog/src/SystemInterface.cpp -) - -set(databinding_HDR_FILES -) - -set(databinding_SRC_FILES - ${PROJECT_SOURCE_DIR}/Samples/basic/databinding/src/main.cpp -) - -set(demo_HDR_FILES -) - -set(demo_SRC_FILES - ${PROJECT_SOURCE_DIR}/Samples/basic/demo/src/main.cpp -) - -set(drag_HDR_FILES - ${PROJECT_SOURCE_DIR}/Samples/basic/drag/src/DragListener.h - ${PROJECT_SOURCE_DIR}/Samples/basic/drag/src/Inventory.h -) - -set(drag_SRC_FILES - ${PROJECT_SOURCE_DIR}/Samples/basic/drag/src/DragListener.cpp - ${PROJECT_SOURCE_DIR}/Samples/basic/drag/src/Inventory.cpp - ${PROJECT_SOURCE_DIR}/Samples/basic/drag/src/main.cpp -) - -set(loaddocument_HDR_FILES -) - -set(loaddocument_SRC_FILES - ${PROJECT_SOURCE_DIR}/Samples/basic/loaddocument/src/main.cpp -) - -set(treeview_HDR_FILES - ${PROJECT_SOURCE_DIR}/Samples/basic/treeview/src/FileBrowser.h -) - -set(treeview_SRC_FILES - ${PROJECT_SOURCE_DIR}/Samples/basic/treeview/src/FileBrowser.cpp - ${PROJECT_SOURCE_DIR}/Samples/basic/treeview/src/main.cpp -) - -set(transform_HDR_FILES -) - -set(transform_SRC_FILES - ${PROJECT_SOURCE_DIR}/Samples/basic/transform/src/main.cpp -) - -set(lottie_HDR_FILES -) - -set(lottie_SRC_FILES - ${PROJECT_SOURCE_DIR}/Samples/basic/lottie/src/main.cpp -) - -set(svg_HDR_FILES -) - -set(svg_SRC_FILES - ${PROJECT_SOURCE_DIR}/Samples/basic/svg/src/main.cpp -) - -set(tutorial_template_HDR_FILES -) - -set(tutorial_template_SRC_FILES - ${PROJECT_SOURCE_DIR}/Samples/tutorial/template/src/main.cpp -) - -set(tutorial_drag_HDR_FILES - ${PROJECT_SOURCE_DIR}/Samples/tutorial/drag/src/Inventory.h -) - -set(tutorial_drag_SRC_FILES - ${PROJECT_SOURCE_DIR}/Samples/tutorial/drag/src/Inventory.cpp - ${PROJECT_SOURCE_DIR}/Samples/tutorial/drag/src/main.cpp -) - -set(invaders_HDR_FILES - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/DecoratorDefender.h - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/DecoratorInstancerDefender.h - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/DecoratorInstancerStarfield.h - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/DecoratorStarfield.h - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/Defender.h - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/ElementGame.h - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/EventHandler.h - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/EventHandlerHighScore.h - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/EventHandlerOptions.h - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/EventHandlerStartGame.h - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/EventListener.h - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/EventListenerInstancer.h - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/EventManager.h - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/Game.h - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/GameDetails.h - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/HighScores.h - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/Invader.h - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/Mothership.h - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/Shield.h - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/Sprite.h -) - -set(invaders_SRC_FILES - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/DecoratorDefender.cpp - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/DecoratorInstancerDefender.cpp - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/DecoratorInstancerStarfield.cpp - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/DecoratorStarfield.cpp - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/Defender.cpp - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/ElementGame.cpp - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/EventHandler.cpp - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/EventHandlerHighScore.cpp - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/EventHandlerOptions.cpp - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/EventHandlerStartGame.cpp - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/EventListener.cpp - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/EventListenerInstancer.cpp - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/EventManager.cpp - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/Game.cpp - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/GameDetails.cpp - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/HighScores.cpp - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/Invader.cpp - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/main.cpp - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/Mothership.cpp - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/Shield.cpp - ${PROJECT_SOURCE_DIR}/Samples/invaders/src/Sprite.cpp -) - -set(luainvaders_HDR_FILES - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/DecoratorDefender.h - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/DecoratorInstancerDefender.h - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/DecoratorInstancerStarfield.h - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/DecoratorStarfield.h - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/Defender.h - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/ElementGame.h - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/ElementGameInstancer.h - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/Game.h - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/GameDetails.h - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/HighScores.h - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/Invader.h - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/LuaInterface.h - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/Mothership.h - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/Shield.h - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/Sprite.h -) - -set(luainvaders_SRC_FILES - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/DecoratorDefender.cpp - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/DecoratorInstancerDefender.cpp - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/DecoratorInstancerStarfield.cpp - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/DecoratorStarfield.cpp - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/Defender.cpp - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/ElementGame.cpp - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/ElementGameInstancer.cpp - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/Game.cpp - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/GameDetails.cpp - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/HighScores.cpp - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/Invader.cpp - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/LuaInterface.cpp - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/main.cpp - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/Mothership.cpp - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/Shield.cpp - ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/Sprite.cpp -) - diff --git a/CMake/builddist.py b/CMake/builddist.py deleted file mode 100644 index 414acc4d4..000000000 --- a/CMake/builddist.py +++ /dev/null @@ -1,181 +0,0 @@ -#!/usr/bin/python -import subprocess -import os -import sys -import getopt -import traceback -import shutil -import re - -def Usage(args): - print(sys.argv[0] + ' [-h] [-s] [-b] [-a] [-v version]') - print('') - print(' -h\t: This help screen') - print(' -s\t: Include full source code and build files') - print(' -b\t: Include sample binaries') - print(' -a\t: Create archive using 7z') - print(' -v\t: Specify RmlUi version') - print('') - sys.exit() - -def CheckVSVars(): - if 'VCINSTALLDIR' in os.environ: - return - - if not 'VS90COMNTOOLS' in os.environ: - print("Unable to find VS9 install - check your VS90COMNTOOLS environment variable") - sys.exit() - - path = os.environ['VS90COMNTOOLS'] - subprocess.call('"' + path + 'vsvars32.bat" > NUL && ' + ' '.join(sys.argv)) - sys.exit() - -def ProcessOptions(args): - - options = {'RMLUI_VERSION': 'custom', 'FULL_SOURCE': False, 'ARCHIVE_NAME': 'RmlUi-sdk', 'SAMPLE_BINARIES': False, 'ARCHIVE': False} - - try: - optlist, args = getopt.getopt(args, 'v:hsba') - except getopt.GetoptError as e: - print('\nError: ' + str(e) + '\n') - Usage(args) - - for opt in optlist: - if opt[0] == '-h': - Usage(args) - if opt[0] == '-v': - options['RMLUI_VERSION'] = opt[1] - if opt[0] == '-s': - options['FULL_SOURCE'] = True - options['ARCHIVE_NAME'] = 'RmlUi-source' - if opt[0] == '-b': - options['SAMPLE_BINARIES'] = True - if opt[0] == '-a': - options['ARCHIVE'] = True - - return options - -def Build(project, configs, defines = {}): - - old_cl = '' - if 'CL' in os.environ: - old_cl = os.environ['CL'] - else: - os.environ['CL'] = '' - - for name, value in defines.items(): - os.environ['CL'] = os.environ['CL'] + ' /D' + name + '=' + value - - for config in configs: - cmd = '"' + os.environ['VCINSTALLDIR'] + '\\vcpackages\\vcbuild.exe" /rebuild ' + project + '.vcproj "' + config + '|Win32"' - ret = subprocess.call(cmd) - if ret != 0: - print("Failed to build " + project) - sys.exit() - - os.environ['CL'] = old_cl - -def DelTree(path): - if not os.path.exists(path): - return - - print('Deleting ' + path + '...') - for root, dirs, files in os.walk(path, topdown=False): - for name in files: - os.remove(os.path.join(root, name)) - for name in dirs: - os.rmdir(os.path.join(root, name)) - -def CopyFiles(source_path, destination_path, file_list = [], exclude_directories = [], exclude_files = [], preserve_paths = True): - working_directory = os.getcwd() - source_directory = os.path.abspath(os.path.join(working_directory, os.path.normpath(source_path))) - destination_directory = os.path.abspath(os.path.join(working_directory, os.path.normpath(destination_path))) - print("Copying " + source_directory + " to " + destination_directory + " ...") - - if not os.path.exists(source_directory): - print("Warning: Source directory " + source_directory + " doesn't exist.") - return False - - for root, directories, files in os.walk(source_directory, topdown=True): - directories[:] = [d for d in directories if d not in exclude_directories] - - for file in files: - # Skip files not in the include list. - if len(file_list) > 0: - included = False - for include in file_list: - if re.search(include, file): - included = True - break; - - if not included: - continue - - # Determine our subdirectory. - subdir = root.replace(source_directory, "") - if subdir[:1] == os.path.normcase('/'): - subdir = subdir[1:] - - # Skip paths in the exclude list - excluded = False - for exclude in exclude_files: - if re.search(exclude, file): - excluded = True - break - - if excluded: - continue - - # Build up paths - source_file = os.path.join(root, file) - destination_subdir = destination_directory - if preserve_paths: - destination_subdir = os.path.join(destination_directory, subdir) - - if not os.path.exists(destination_subdir): - os.makedirs(destination_subdir) - destination_file = os.path.join(destination_subdir, file) - - # Copy files - try: - shutil.copy(source_file, destination_file) - except: - print("Failed copying " + source_file + " to " + destination_file) - traceback.print_exc() - - return True - -def Archive(archive_name, path): - cwd = os.getcwd() - os.chdir(path + '/..') - file_name = archive_name + '.zip' - if os.path.exists(file_name): - os.unlink(file_name) - os.system('7z a ' + file_name + ' ' + path[path.rfind('/')+1:]) - os.chdir(cwd) - -def main(): - options = ProcessOptions(sys.argv[1:]) - - #CheckVSVars() - #Build('RmlCore', ['Debug', 'Release'], {'RMLUI_VERSION': '\\"' + options['RMLUI_VERSION'] + '\\"'}) - #Build('RmlControls', ['Debug', 'Release']) - #Build('RmlDebugger', ['Debug', 'Release']) - - DelTree('../Distribution/RmlUi') - CopyFiles('../Include', '../Distribution/RmlUi/Include') - CopyFiles('../Build', '../Distribution/RmlUi/Build', ['\.dll$', '^Rml.*\.lib$'], ['CMakeFiles']) - CopyFiles('../CMake', '../Distribution/RmlUi/CMake', ['\.cmake$', '\.in$', '\.plist$', '\.py$', '\.sh$']) - CopyFiles('../Samples', '../Distribution/RmlUi/Samples', ['\.h$', '\.cpp$', '\.rml$', '\.rcss$', '\.tga$', '\.py$', '\.otf$', '\.ttf$', '\.txt$']) - if options['FULL_SOURCE']: - CopyFiles('../Build', '../Distribution/RmlUi/Build', ['\.vcxproj$', '\.sln$', '\.vsprops$', '\.py$'], ['CMakeFiles']) - CopyFiles('../Source', '../Distribution/RmlUi/Source', ['\.cpp$', '\.h$', '\.inl$']) - if options['SAMPLE_BINARIES']: - CopyFiles('../Build', '../Distribution/RmlUi/Build', ['\.exe$'], ['CMakeFiles']) - shutil.copyfile('../LICENSE', '../Distribution/RmlUi/LICENSE') - shutil.copyfile('../readme.md', '../Distribution/RmlUi/readme.md') - if options['ARCHIVE']: - Archive(options['ARCHIVE_NAME'] + '-' + options['RMLUI_VERSION'], '../Distribution/RmlUi'); - -if __name__ == '__main__': - main() \ No newline at end of file diff --git a/CMake/gen_filelists.sh b/CMake/gen_filelists.sh deleted file mode 100644 index 6f5014a3a..000000000 --- a/CMake/gen_filelists.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env bash - -basedir=".." -file=CMake/FileList.cmake -src='set(lib_SRC_FILES' -hdr='set(lib_HDR_FILES' -masterpubhdr='set(MASTER_lib_PUB_HDR_FILES' -pubhdr='set(lib_PUB_HDR_FILES' -srcdir='${PROJECT_SOURCE_DIR}' -fontdefaultbegin='if(NOT NO_FONT_INTERFACE_DEFAULT)' -fontdefaultend='endif()' -srcpath=Source -hdrpath=Include/RmlUi -fontdefaultpath=FontEngineDefault - -printfiles() { - # Print headers - echo ${hdr/lib/$1} >>$file - find $srcpath/$1 -maxdepth 3 -path */$fontdefaultpath -prune -o \( -iname "*.h" -o -iname "*.hpp" \) -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file - echo -e ')\n' >>$file - # Print master header for library - echo ${masterpubhdr/lib/$1} >>$file - echo ' '$srcdir/Include/RmlUi/$1.h >>$file - echo -e ')\n' >>$file - # Print public headers sub directory - echo ${pubhdr/lib/$1} >>$file - if [[ "$1" == "Core" ]]; then echo ' '$srcdir/Include/RmlUi/Config/Config.h >>$file; fi - find $hdrpath/$1 -maxdepth 3 -path */$fontdefaultpath -prune -o \( -iname "*.h" -o -iname "*.inl" -o -iname "*.hpp" \) -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file - echo -e ')\n' >>$file - # Print source files - echo ${src/lib/$1} >>$file - find $srcpath/$1 -maxdepth 3 -path */$fontdefaultpath -prune -o -iname "*.cpp" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file - echo -e ')\n' >>$file -} - -printfontdefaultfiles() { - # Print headers - echo $fontdefaultbegin >>$file - echo ' '${hdr/lib/$1} >>$file - echo ' ${'$1'_HDR_FILES}' >>$file - find $srcpath/$1/$fontdefaultpath -iname "*.h" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file - echo -e ' )\n' >>$file - # Print source files - echo ' '${src/lib/$1} >>$file - echo ' ${'$1'_SRC_FILES}' >>$file - find $srcpath/$1/$fontdefaultpath -iname "*.cpp" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file - echo -e ' )' >>$file - echo -e $fontdefaultend'\n' >>$file -} - -printpluginfiles() { - # Print headers - echo ${hdr/lib/$1} >>$file - find $srcpath/$1 -iname "*.h" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file - echo -e ')\n' >>$file - # Print public headers - echo ${pubhdr/lib/$1} >>$file - find $hdrpath/$1 -iname "*.h" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file 2>/dev/null - echo -e ')\n' >>$file - # Print source files - echo ${src/lib/$1} >>$file - find $srcpath/$1 -iname "*.cpp" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file - echo -e ')\n' >>$file -} - -pushd $basedir -echo -e "# This file was auto-generated with gen_filelists.sh\n" >$file -for lib in "Core" "Debugger"; do - printfiles $lib -done - -printfontdefaultfiles "Core" - -printpluginfiles "Lua" - -printpluginfiles "Lottie" - -printpluginfiles "SVG" - -popd diff --git a/CMake/gen_samplelists.sh b/CMake/gen_samplelists.sh deleted file mode 100755 index 002365a5d..000000000 --- a/CMake/gen_samplelists.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env bash - -basedir=".." -file=CMake/SampleFileList.cmake -src='set(sample_SRC_FILES' -hdr='set(sample_HDR_FILES' -srcdir='${PROJECT_SOURCE_DIR}' -srcpath=Samples -samples=( 'shell' - 'basic/animation' 'basic/benchmark' 'basic/bitmapfont' 'basic/customlog' 'basic/databinding' 'basic/demo' 'basic/drag' 'basic/loaddocument' 'basic/treeview' 'basic/transform' - 'basic/lottie' 'basic/svg' - 'tutorial/template' 'tutorial/drag' - 'invaders' 'luainvaders' -) - -printfiles() { - # Print headers - name=${1//basic\//} #substitute basic/ for nothing - name=${name//tutorial\//tutorial_} #substitute 'tutorial/' for 'tutorial_' - echo ${hdr/sample/$name} >>$file - find $srcpath/$1/src -maxdepth 1 -iname "*.h" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file - find $srcpath/$1/include -maxdepth 1 -iname "*.h" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file 2>/dev/null - echo -e ')\n' >>$file - # Print source files - echo ${src/sample/$name} >>$file - find $srcpath/$1/src -maxdepth 1 -iname "*.cpp" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file - echo -e ')\n' >>$file -} - -pushd $basedir -echo -e "# This file was auto-generated with gen_samplelists.sh\n" >$file -for sample in ${samples[@]}; do - printfiles $sample -done diff --git a/CMakeLists_old.txt b/CMakeLists_old.txt deleted file mode 100644 index f4020f43a..000000000 --- a/CMakeLists_old.txt +++ /dev/null @@ -1,1048 +0,0 @@ -#=================================== -# Build script for RmlUi =========== -#=================================== - -cmake_minimum_required(VERSION 3.1) - -if(APPLE) - # This has to be before most other options so CMake properly handles the - # compiler variables, it MUST bebefore the project() definition - if(IOS_PLATFORM) - set(CMAKE_TOOLCHAIN_FILE CMake/Platform/iOS.cmake) - endif(IOS_PLATFORM) - - option(BUILD_UNIVERSAL_BINARIES "Build universal binaries for all architectures supported" ON) - if (NOT CMAKE_OSX_ARCHITECTURES AND BUILD_UNIVERSAL_BINARIES) - if(IOS) - # set the architecture for iOS - if (${IOS_PLATFORM} STREQUAL "OS") - set (IOS_ARCH armv6 armv7 armv7s arm64) - set (CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE STRING "Build architecture for iOS") - else (${IOS_PLATFORM} STREQUAL "OS") - set (IOS_ARCH x86_64) - set (CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE STRING "Build architecture for iOS Simulator") - endif (${IOS_PLATFORM} STREQUAL "OS") - - else(IOS) - # set the architectures for OS X - set (OSXI_ARCH x86_64) - set (CMAKE_OSX_ARCHITECTURES ${OSXI_ARCH} CACHE STRING "Build architecture for OS X universal binaries") - endif(IOS) - endif (NOT CMAKE_OSX_ARCHITECTURES AND BUILD_UNIVERSAL_BINARIES) -endif(APPLE) - -if(COMMAND cmake_policy) - cmake_policy(SET CMP0015 NEW) -endif(COMMAND cmake_policy) - -# Enable the use of MACOSX_RPATH by default for CMake v3.0+; this effectively -# allows plug 'n' play functionality, so to speak -- the resulting shared -# library files can simply be copied over into the end-user's application -# bundle or framework bundle. No mucking around with install_name_tool. -# -# See also: -# cmake --help-policy cmp0042 -# http://www.kitware.com/blog/home/post/510 -if(POLICY CMP0042) - cmake_policy(SET CMP0042 NEW) -endif(POLICY CMP0042) -if (POLICY CMP0072) - cmake_policy (SET CMP0072 NEW) -endif(POLICY CMP0072) -if(POLICY CMP0074) - cmake_policy(SET CMP0074 NEW) -endif(POLICY CMP0074) - -project(RmlUi LANGUAGES C CXX VERSION 6.0) - -set(RMLUI_VERSION_RELEASE false) - -if(RMLUI_VERSION_RELEASE) - set(RMLUI_VERSION_SUFFIX "") -else() - set(RMLUI_VERSION_SUFFIX "-dev") -endif() - -set(RMLUI_VERSION_SHORT ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}${RMLUI_VERSION_SUFFIX}) - -list(APPEND CORE_PRIVATE_DEFS RMLUI_VERSION="${RMLUI_VERSION_SHORT}") - -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) - option(BUILD_TESTING "" OFF) - include(CTest) - - if(BUILD_TESTING) - set(RMLUI_TESTS_ENABLED ON) - set(VISUAL_TESTS_RML_DIRECTORIES "" CACHE PATH "Specify additional directories containing *.rml test documents for VisualTests. Separate multiple directories by comma.") - set(VISUAL_TESTS_COMPARE_DIRECTORY "" CACHE PATH "Set the input directory for screenshot comparison performed by VisualTests.") - set(VISUAL_TESTS_CAPTURE_DIRECTORY "" CACHE PATH "Set the output directory for screenshots generated by VisualTests.") - endif() -endif() - -# paths -include(GNUInstallDirs) - -# Search in the 'cmake' directory for additional CMake modules. -list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake;${PROJECT_SOURCE_DIR}/CMake/Modules) - -#=================================== -# Environment tests ================ -#=================================== - -include(TestForANSIForScope) -include(TestForANSIStreamHeaders) -include(TestForSTDNamespace) - -#=================================== -# Provide hints as to where depends= -# might be found = -#=================================== - -if(NOT DEFINED ENV{FREETYPE_DIR}) - set(ENV{FREETYPE_DIR} "${PROJECT_SOURCE_DIR}/Dependencies") -endif() - -if(NOT DEFINED ENV{LUA_DIR}) - set(ENV{LUA_DIR} "${PROJECT_SOURCE_DIR}/Dependencies") -endif() - -if(NOT DEFINED ENV{SDL2DIR}) - set(ENV{SDL2DIR} "${PROJECT_SOURCE_DIR}/Dependencies") -endif() - -if(NOT DEFINED ENV{SDL2_IMAGE_DIR}) - set(ENV{SDL2_IMAGE_DIR} "${PROJECT_SOURCE_DIR}/Dependencies") -endif() - -if(NOT DEFINED ENV{SFML_ROOT}) - set(ENV{SFML_ROOT} "${PROJECT_SOURCE_DIR}/Dependencies") -endif() - -if(NOT DEFINED ENV{TRACY_DIR}) - set(ENV{TRACY_DIR} "${PROJECT_SOURCE_DIR}/Dependencies") -endif() - -if(NOT DEFINED ENV{RLOTTIE_DIR}) - set(ENV{RLOTTIE_DIR} "${PROJECT_SOURCE_DIR}/Dependencies/rlottie") -endif() - -if(NOT DEFINED ENV{LUNASVG_DIR}) - set(ENV{LUNASVG_DIR} "${PROJECT_SOURCE_DIR}/Dependencies/lunasvg") -endif() - -#=================================== -# Plaform specific global hacks ==== -#=================================== - -if(APPLE) - # Disables naked builtins from AssertMacros.h which - # This prevents naming collisions such as those from the check() - # function macro with LuaType::check - add_definitions(-D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0) -endif(APPLE) - -#=================================== -# Build options ==================== -#=================================== - -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release CACHE STRING - "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." - FORCE) -endif() - -if(NOT IOS) - option(BUILD_SHARED_LIBS "Build shared (dynamic) libraries" ON) -endif(NOT IOS) - -option(BUILD_LUA_BINDINGS "Build Lua bindings" OFF) - -if (BUILD_LUA_BINDINGS) - option(BUILD_LUA_BINDINGS_FOR_LUAJIT "Build Lua bindings using luajit" OFF) -endif() - -if(APPLE) - option(BUILD_FRAMEWORK "Build Framework bundle for OSX" OFF) -endif() - -option(BUILD_SAMPLES "Build samples" OFF) - -set(SAMPLES_BACKEND "auto" CACHE STRING "Backend platform and renderer used for the samples.") -set_property(CACHE SAMPLES_BACKEND PROPERTY STRINGS auto Win32_GL2 Win32_VK X11_GL2 SDL_GL2 SDL_GL3 SDL_VK SDL_SDLrenderer SFML_GL2 GLFW_GL2 GLFW_GL3 GLFW_VK) - -if(SAMPLES_BACKEND STREQUAL "auto") - if(EMSCRIPTEN) - set(SAMPLES_BACKEND SDL_GL3) - elseif(WIN32) - set(SAMPLES_BACKEND Win32_GL2) - elseif(APPLE) - set(SAMPLES_BACKEND SDL_SDLrenderer) - else() - set(SAMPLES_BACKEND X11_GL2) - endif() -endif() - -option(MATRIX_ROW_MAJOR "Use row-major matrices. Column-major matrices are used by default." OFF) - -if(APPLE) - if(IOS) - if(BUILD_SHARED_LIBS) - message(FATAL_ERROR "BUILD_SHARED_LIBS must be OFF for iOS builds. iOS does not support shared libraries.") - endif(BUILD_SHARED_LIBS) - endif(IOS) - - if(BUILD_FRAMEWORK) - if(NOT "${CMAKE_GENERATOR}" STREQUAL "Xcode") - message(FATAL_ERROR "You should use Xcode generator with BUILD_FRAMEWORK enabled") - endif() - if(NOT BUILD_SHARED_LIBS) - message(FATAL_ERROR "BUILD_SHARED_LIBS must be ON with BUILD_FRAMEWORK enabled") - endif() - endif() -else(APPLE) - if(BUILD_FRAMEWORK) - message(FATAL_ERROR "BUILD_FRAMEWORK is only supported on Mac OS X with the Xcode generator") - endif() -endif(APPLE) - -option(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) -if(NO_FONT_INTERFACE_DEFAULT) - list(APPEND CORE_PRIVATE_DEFS RMLUI_NO_FONT_INTERFACE_DEFAULT) -endif() - -if(WIN32 AND BUILD_SHARED_LIBS AND BUILD_TESTING) - message(FATAL_ERROR "-- The RmlUi testing framework cannot be built when using shared libraries on Windows. Please disable either BUILD_SHARED_LIBS or BUILD_TESTING.") -endif() - -if(EMSCRIPTEN AND BUILD_SHARED_LIBS) - message(FATAL_ERROR "-- Dynamic libraries not supported when using Emscripten. Please disable BUILD_SHARED_LIBS.") -endif() - -if(NOT BUILD_SHARED_LIBS) - list(APPEND CORE_PUBLIC_DEFS -DRMLUI_STATIC_LIB) - message("-- Building static libraries. Make sure to #define RMLUI_STATIC_LIB before including RmlUi in your project.") -endif() - -option(NO_THIRDPARTY_CONTAINERS "Only use standard library containers." OFF) -if( NO_THIRDPARTY_CONTAINERS ) - list(APPEND CORE_PUBLIC_DEFS -DRMLUI_NO_THIRDPARTY_CONTAINERS) - message("-- No third-party containers will be used: Make sure to #define RMLUI_NO_THIRDPARTY_CONTAINERS before including RmlUi in your project.") -endif() - -option(CUSTOM_CONFIGURATION "Customize RmlUi configuration files for overriding the default configuration and types." OFF) - -set(CUSTOM_CONFIGURATION_FILE "" CACHE STRING "Custom configuration file to be included in place of .") -if( CUSTOM_CONFIGURATION AND CUSTOM_CONFIGURATION_FILE ) - list(APPEND CORE_PUBLIC_DEFS -DRMLUI_CUSTOM_CONFIGURATION_FILE="${CUSTOM_CONFIGURATION_FILE}") - message("-- Including ${CUSTOM_CONFIGURATION_FILE} instead of ") -endif () - -set(CUSTOM_INCLUDE_DIRS "" CACHE STRING "Extra include directories (use with CUSTOM_CONFIGURATION_FILE).") -if( CUSTOM_CONFIGURATION AND CUSTOM_INCLUDE_DIRS ) - include_directories(${CUSTOM_INCLUDE_DIRS}) -endif () - -set(CUSTOM_LINK_LIBRARIES "" CACHE STRING "Extra link libraries (use with CUSTOM_CONFIGURATION_FILE).") - -if( CUSTOM_CONFIGURATION ) - mark_as_advanced( CLEAR CUSTOM_CONFIGURATION_FILE CUSTOM_INCLUDE_DIRS CUSTOM_LINK_LIBRARIES ) -else() - mark_as_advanced( FORCE CUSTOM_CONFIGURATION_FILE CUSTOM_INCLUDE_DIRS CUSTOM_LINK_LIBRARIES ) - - if( CUSTOM_CONFIGURATION_FILE OR CUSTOM_INCLUDE_DIRS OR CUSTOM_LINK_LIBRARIES ) - message("-- CUSTOM_CONFIGURATION disabled, but custom configuration variables are set. They will have no effect.") - endif() -endif() - -option(ENABLE_TRACY_PROFILING "Enable profiling with Tracy. Source files can be placed in Dependencies/tracy." OFF) -if( ENABLE_TRACY_PROFILING ) - find_package(Tracy REQUIRED) - - include_directories(${TRACY_INCLUDE_DIR}) - - if( CMAKE_CONFIGURATION_TYPES ) - list(APPEND CMAKE_CONFIGURATION_TYPES Tracy) - list(REMOVE_DUPLICATES CMAKE_CONFIGURATION_TYPES) - set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING - "Add the configurations that we need" - FORCE) - set(CMAKE_C_FLAGS_TRACY "${CMAKE_CXX_FLAGS_RELEASE} -DRMLUI_ENABLE_PROFILING") - set(CMAKE_CXX_FLAGS_TRACY "${CMAKE_CXX_FLAGS_RELEASE} -DRMLUI_ENABLE_PROFILING") - set(CMAKE_EXE_LINKER_FLAGS_TRACY "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") - set(CMAKE_SHARED_LINKER_FLAGS_TRACY "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") - message("-- Tracy profiling enabled in configuration 'Tracy'.") - else() - message("-- Tracy profiling enabled.") - list(APPEND CORE_PUBLIC_DEFS -DRMLUI_ENABLE_PROFILING) - endif() -elseif( CMAKE_CONFIGURATION_TYPES ) - list(REMOVE_ITEM CMAKE_CONFIGURATION_TYPES Tracy) -endif() - -option(ENABLE_LOTTIE_PLUGIN "Enable plugin for Lottie animations. Requires the rlottie library." OFF) -option(ENABLE_SVG_PLUGIN "Enable plugin for SVG images. Requires the lunasvg library." OFF) - -option(DISABLE_RTTI_AND_EXCEPTIONS "Build with rtti and exceptions disabled." OFF) -if(DISABLE_RTTI_AND_EXCEPTIONS) - list(APPEND CORE_PUBLIC_DEFS -DRMLUI_USE_CUSTOM_RTTI) - message("-- C++ RTTI and exceptions will be disabled: Make sure to #define RMLUI_USE_CUSTOM_RTTI before including RmlUi in your project.") -endif() - -option(ENABLE_PRECOMPILED_HEADERS "Enable precompiled headers" ON) -set(PRECOMPILED_HEADERS_ENABLED OFF) -if (ENABLE_PRECOMPILED_HEADERS AND (CMAKE_VERSION VERSION_LESS 3.16.0)) - message("-- Could not enable precompiled headers. Need CMake version 3.16.0 or greater.") -elseif (ENABLE_PRECOMPILED_HEADERS) - set(PRECOMPILED_HEADERS_ENABLED ON) -endif() - -option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors." OFF) -mark_as_advanced(WARNINGS_AS_ERRORS) - -macro(add_common_target_options NAME) - # C++ language version - if(CMAKE_VERSION VERSION_LESS 3.8.0) - set_target_properties(${NAME} PROPERTIES - CXX_STANDARD 14 - CXX_STANDARD_REQUIRED YES - ) - else() - target_compile_features(${NAME} PUBLIC cxx_std_14) - endif() - set_target_properties(${NAME} PROPERTIES CXX_EXTENSIONS OFF) - - # Compiler warnings - if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") - target_compile_options(${NAME} PRIVATE -Wall -pedantic -Wextra) - - if(WARNINGS_AS_ERRORS) - target_compile_options(${NAME} PRIVATE -Werror) - endif() - elseif(MSVC) - target_compile_options(${NAME} PRIVATE /MP /W4 /w44062 /permissive-) - target_compile_definitions(${NAME} PRIVATE _CRT_SECURE_NO_WARNINGS) - - if(WARNINGS_AS_ERRORS) - target_compile_options(${NAME} PRIVATE /WX) - endif() - endif() -endmacro() - -#=================================== -# Setup paths ====================== -#=================================== - -include_directories( - ${PROJECT_SOURCE_DIR}/Include -) - -# Include list of source files -include(FileList) - -#=================================== -# Find dependencies ================ -#=================================== - -# FreeType -if(NOT NO_FONT_INTERFACE_DEFAULT) - if(EMSCRIPTEN) - set(EMSCRIPTEN_FLAGS "${EMSCRIPTEN_FLAGS} -sUSE_FREETYPE=1") - else() - find_package(Freetype REQUIRED) - if(MSVC AND FREETYPE_VERSION_STRING STREQUAL "2.11.0") - message(WARNING "You are using FreeType version 2.11.0 which introduced an issue that causes a crash on startup on some of the samples. Please avoid this version specifically.") - endif() - - list(APPEND CORE_LINK_LIBS ${FREETYPE_LIBRARIES}) - list(APPEND CORE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS}) - endif() -endif() - -# Lua -if(BUILD_LUA_BINDINGS) - if(BUILD_LUA_BINDINGS_FOR_LUAJIT) - find_package(LuaJIT REQUIRED) - list(APPEND LUA_BINDINGS_INCLUDE_DIRS ${LUAJIT_INCLUDE_DIR}) - list(APPEND LUA_BINDINGS_LINK_LIBS ${LUAJIT_LIBRARY}) - else() - find_package(Lua REQUIRED) - list(APPEND LUA_BINDINGS_INCLUDE_DIRS ${LUA_INCLUDE_DIR}) - list(APPEND LUA_BINDINGS_LINK_LIBS ${LUA_LIBRARIES}) - endif() -endif() - -# rlottie -if( ENABLE_LOTTIE_PLUGIN AND TARGET rlottie::rlottie ) - list(APPEND CORE_LINK_LIBS rlottie::rlottie) - list(APPEND CORE_INCLUDE_DIRS rlottie::rlottie) -elseif( ENABLE_LOTTIE_PLUGIN ) - # Try to find the rlottie library. - if(NOT DEFINED rlottie_DIR) - set(rlottie_DIR $ENV{RLOTTIE_DIR}) - endif() - - list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/rlottie/build) - find_package(rlottie CONFIG) - find_path(rlottie_INCLUDE_DIR rlottie.h HINTS ${rlottie_DIR} $ENV{rlottie_DIR} PATH_SUFFIXES inc rlottie/inc ) - - if(rlottie_FOUND AND rlottie_INCLUDE_DIR) - message("-- Can Lottie plugin be added to RmlCore - yes - rlottie library found") - - list(APPEND CORE_LINK_LIBS rlottie::rlottie) - list(APPEND CORE_INCLUDE_DIRS ${rlottie_INCLUDE_DIR}) - list(APPEND CORE_PRIVATE_DEFS RMLUI_ENABLE_LOTTIE_PLUGIN) - - list(APPEND Core_HDR_FILES ${Lottie_HDR_FILES}) - list(APPEND Core_PUB_HDR_FILES ${Lottie_PUB_HDR_FILES}) - list(APPEND Core_SRC_FILES ${Lottie_SRC_FILES}) - else() - if(rlottie_FOUND) - message(FATAL_ERROR "-- Can Lottie plugin be added to RmlCore - no - rlottie library found - rlottie include directory not found") - elseif(rlottie_INCLUDE_DIR) - message(FATAL_ERROR "-- Can Lottie plugin be added to RmlCore - no - rlottie library not found - rlottie include directory found at ${rlottie_INCLUDE_DIR}") - else() - message(FATAL_ERROR "-- Can Lottie plugin be added to RmlCore - no - rlottie not found") - endif() - endif() -endif() - -# lunasvg -if( ENABLE_SVG_PLUGIN ) - if(NOT DEFINED LUNASVG_DIR) - set(LUNASVG_DIR $ENV{LUNASVG_DIR}) - endif() - - message("-- Can SVG plugin be enabled - looking for lunasvg library") - - find_package(lunasvg REQUIRED) - - list(APPEND CORE_LINK_LIBS ${LUNASVG_LIBRARIES}) - list(APPEND CORE_INCLUDE_DIRS ${LUNASVG_INCLUDE_DIR}) - list(APPEND CORE_PRIVATE_DEFS RMLUI_ENABLE_SVG_PLUGIN) - - list(APPEND Core_HDR_FILES ${SVG_HDR_FILES}) - list(APPEND Core_PUB_HDR_FILES ${SVG_PUB_HDR_FILES}) - list(APPEND Core_SRC_FILES ${SVG_SRC_FILES}) - - message("-- Can SVG plugin be enabled - yes - lunasvg library found") -endif() - - -if(NOT BUILD_FRAMEWORK) -#=================================== -# Build libraries ================== -#=================================== - -set(LIBRARIES Core Debugger) - -foreach(library ${LIBRARIES}) - set(NAME Rml${library}) - - add_library(${NAME} - ${${library}_HDR_FILES} - ${${library}_PUB_HDR_FILES} - ${MASTER_${library}_PUB_HDR_FILES} - ${${library}_SRC_FILES} - ) - add_library(RmlUi::${library} ALIAS ${NAME}) - - set_target_properties(${NAME} PROPERTIES - VERSION ${PROJECT_VERSION} - SOVERSION ${PROJECT_VERSION_MAJOR} - ) - - add_common_target_options(${NAME}) - - install(TARGETS ${NAME} - EXPORT RmlUiTargets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ) - - set(RMLUI_EXPORTED_TARGETS ${RMLUI_EXPORTED_TARGETS} ${NAME}) -endforeach(library) - -if( CUSTOM_CONFIGURATION ) - foreach(library ${CUSTOM_LINK_LIBRARIES}) - install(TARGETS ${library} - EXPORT RmlUiTargets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ) - set(RMLUI_EXPORTED_TARGETS ${RMLUI_EXPORTED_TARGETS} ${library}) - endforeach(library ${CUSTOM_LINK_LIBRARIES}) -endif() - -if( MATRIX_ROW_MAJOR ) - list(APPEND CORE_PUBLIC_DEFS -DRMLUI_MATRIX_ROW_MAJOR) -endif () -if( CUSTOM_CONFIGURATION AND CUSTOM_LINK_LIBRARIES ) - target_link_libraries(RmlCore PUBLIC ${CUSTOM_LINK_LIBRARIES}) -endif () - -if (PRECOMPILED_HEADERS_ENABLED) - target_precompile_headers(RmlCore PRIVATE ${PROJECT_SOURCE_DIR}/Source/Core/precompiled.h) -endif() - - -else(NOT BUILD_FRAMEWORK) - #=================================== - # Build combined Framework ========= - #=================================== - - set(NAME RmlUi) - - set(MASTER_PUB_HDR_FILES - ${MASTER_Core_PUB_HDR_FILES} - ${MASTER_Debugger_PUB_HDR_FILES} - ) - - add_library(${NAME} - ${Core_HDR_FILES} - ${MASTER_Core_PUB_HDR_FILES} - ${Core_PUB_HDR_FILES} - ${Core_SRC_FILES} - ${Debugger_HDR_FILES} - ${MASTER_Debugger_PUB_HDR_FILES} - ${Debugger_PUB_HDR_FILES} - ${Debugger_SRC_FILES} - ) - - set_target_properties(${NAME} PROPERTIES - VERSION ${PROJECT_VERSION} - SOVERSION ${PROJECT_VERSION_MAJOR} - ) - - set_property(SOURCE ${MASTER_PUB_HDR_FILES} - PROPERTY MACOSX_PACKAGE_LOCATION Headers - ) - set_property(SOURCE ${Core_PUB_HDR_FILES} - PROPERTY MACOSX_PACKAGE_LOCATION Headers/Core - ) - set_property(SOURCE ${Debugger_PUB_HDR_FILES} - PROPERTY MACOSX_PACKAGE_LOCATION Headers/Debugger - ) - set_target_properties(${NAME} PROPERTIES - FRAMEWORK TRUE - FRAMEWORK_VERSION ${PROJECT_VERSION} - MACOSX_FRAMEWORK_IDENTIFIER com.rmlui.${NAME} - MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${RMLUI_VERSION_SHORT} - MACOSX_FRAMEWORK_BUNDLE_VERSION ${PROJECT_VERSION} - XCODE_ATTRIBUTE_INSTALL_PATH "@rpath" - PUBLIC_HEADER ${MASTER_PUB_HDR_FILES} - ) - - install(TARGETS ${NAME} - EXPORT RmlUiTargets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - FRAMEWORK DESTINATION Library/Frameworks - ) - - set(RMLUI_EXPORTED_TARGETS ${RMLUI_EXPORTED_TARGETS} ${NAME}) -endif(NOT BUILD_FRAMEWORK) - - -# Build Lua bindings -if(BUILD_LUA_BINDINGS) - set(NAME RmlLua) - - add_library(${NAME} ${Lua_SRC_FILES} - ${Lua_HDR_FILES} - ${Lua_PUB_HDR_FILES} - ) - - set_target_properties(${NAME} PROPERTIES - VERSION ${PROJECT_VERSION} - SOVERSION ${PROJECT_VERSION_MAJOR} - ) - - add_common_target_options(${NAME}) - - install(TARGETS ${NAME} - EXPORT RmlUiTargets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ) - - set(RMLUI_EXPORTED_TARGETS ${RMLUI_EXPORTED_TARGETS} ${NAME}) -endif() - -if(DISABLE_RTTI_AND_EXCEPTIONS) - if( CMAKE_COMPILER_IS_GNUCXX ) - add_definitions( -fno-rtti -fno-exceptions ) - elseif( MSVC ) - add_definitions( -D_HAS_EXCEPTIONS=0 /GR- ) - if(CMAKE_CXX_FLAGS MATCHES "/EHsc ") - string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - message(STATUS "CMAKE_CXX_FLAGS matches /EHsc before end of string replaced...") - endif() - - if(CMAKE_CXX_FLAGS MATCHES "/EHsc$") - string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - message(STATUS "CMAKE_CXX_FLAGS matches /EHsc at end of string replaced...") - endif() - else() - message(STATUS "Could not create build configuration without rtti and exceptions...") - endif() -endif() - - -#=================================== -# Link libraries =================== -#=================================== - -if(NOT BUILD_FRAMEWORK) - target_include_directories(RmlCore PRIVATE ${CORE_INCLUDE_DIRS}) - target_include_directories(RmlCore INTERFACE $ $) - target_link_libraries(RmlCore PRIVATE ${CORE_LINK_LIBS}) - target_link_libraries(RmlDebugger RmlCore) - target_compile_definitions(RmlCore PRIVATE ${CORE_PRIVATE_DEFS}) - target_compile_definitions(RmlCore PUBLIC ${CORE_PUBLIC_DEFS}) -else() - target_include_directories(RmlUi PRIVATE ${CORE_INCLUDE_DIRS}) - target_link_libraries(RmlUi PRIVATE ${CORE_LINK_LIBS}) - target_compile_definitions(RmlUi PRIVATE ${CORE_PRIVATE_DEFS}) - target_compile_definitions(RmlUi PUBLIC ${CORE_PUBLIC_DEFS}) -endif() - -if(BUILD_LUA_BINDINGS) - if(NOT BUILD_FRAMEWORK) - target_link_libraries(RmlLua RmlCore ${LUA_BINDINGS_LINK_LIBS}) - target_include_directories(RmlLua PUBLIC ${LUA_BINDINGS_INCLUDE_DIRS}) - else() - target_link_libraries(RmlUi ${LUA_BINDINGS_LINK_LIBS}) - target_include_directories(RmlUi PUBLIC ${LUA_BINDINGS_INCLUDE_DIRS}) - endif() -endif() - - -#=================================== -# Build samples ==================== -#=================================== - -# Build and link the samples -macro(bl_sample NAME) - if (WIN32) - add_executable(${NAME} WIN32 ${${NAME}_SRC_FILES} ${${NAME}_HDR_FILES} ) - elseif(APPLE) - add_executable(${NAME} MACOSX_BUNDLE ${${NAME}_SRC_FILES} ${${NAME}_HDR_FILES} ) - - # The first rpath is to the proper location where the framework/library SHOULD be, the second is to the location actually seen - # in the build environment - if(BUILD_FRAMEWORK) - set_target_properties(${NAME} PROPERTIES LINK_FLAGS "-rpath @executable_path/../Frameworks") - else() - set_target_properties(${NAME} PROPERTIES LINK_FLAGS "-rpath @executable_path/../lib") - endif() - else() - add_executable(${NAME} ${${NAME}_SRC_FILES} ${${NAME}_HDR_FILES} ) - endif() - - add_common_target_options(${NAME}) - - target_link_libraries(${NAME} ${ARGN}) -endmacro() - -# Build shell -if(BUILD_SAMPLES OR BUILD_TESTING) - message("-- Adding shell with '${SAMPLES_BACKEND}' backend.") - - include(SampleFileList) - include(BackendFileList) - - if(NOT BUILD_FRAMEWORK) - set(sample_LIBRARIES - shell - RmlCore - RmlDebugger - ) - else() - set(sample_LIBRARIES - shell - RmlUi - ) - endif() - - set(SAMPLES_DIR opt/RmlUi/Samples CACHE PATH "Path to samples directory.") - if(WIN32) - mark_as_advanced(SAMPLES_DIR) - endif() - - - set(BACKEND_SRC_FILES "${${SAMPLES_BACKEND}_SRC_FILES}") - set(BACKEND_HDR_FILES "${${SAMPLES_BACKEND}_HDR_FILES}") - - if("${BACKEND_SRC_FILES}" STREQUAL "" OR "${BACKEND_HDR_FILES}" STREQUAL "") - message(FATAL_ERROR "Unknown samples backend '${SAMPLES_BACKEND}'.") - endif() - - list(APPEND shell_SRC_FILES ${BACKEND_SRC_FILES}) - list(APPEND shell_HDR_FILES ${BACKEND_HDR_FILES} ${BACKEND_COMMON_HDR_FILES}) - - add_library(shell STATIC ${shell_SRC_FILES} ${shell_HDR_FILES}) - - target_include_directories(shell PUBLIC - ${PROJECT_SOURCE_DIR}/Backends - ${PROJECT_SOURCE_DIR}/Samples/shell/include - ) - - add_common_target_options(shell) - target_link_libraries(shell PUBLIC RmlCore RmlDebugger) - - # Add OS dependencies. - if (WIN32) - target_link_libraries(shell PRIVATE shlwapi imm32) - elseif(APPLE) - target_link_libraries(shell PRIVATE "-framework Cocoa") - elseif(UNIX AND NOT APPLE AND NOT EMSCRIPTEN) - find_package(X11) - if (X11_FOUND) - message("-- Found X11 library.") - target_link_libraries(shell PRIVATE ${X11_LIBRARIES}) - # Platform_X11 uses Xkb if possible instead of XGetKeyboardMapping for performance. - if(X11_Xkb_FOUND) - FIND_PACKAGE_MESSAGE(X11 "Found X11 KBlib: ${X11_X11_LIB}" "[${X11_X11_LIB}][${X11_XkbINCLUDE_DIR}]") - target_compile_definitions(shell PRIVATE HAS_X11XKBLIB) - endif() - endif() - endif() - - # Add platform dependencies. - if(SAMPLES_BACKEND MATCHES "^X11") - if(NOT X11_FOUND) - message(FATAL_ERROR "X11 not found or not supported on this platform, select a different sample backend.") - endif() - endif() - - if(SAMPLES_BACKEND MATCHES "^SDL") - message("-- Looking for SDL2 library for samples backend.") - if(EMSCRIPTEN) - set(EMSCRIPTEN_FLAGS "${EMSCRIPTEN_FLAGS} -sUSE_SDL=2 -sUSE_SDL_IMAGE=2 -sSDL2_IMAGE_FORMATS='[tga]'") - else() - find_package(SDL2 REQUIRED) - - if(NOT SDL2_FOUND) - message(FATAL_ERROR "SDL2 not found") - endif() - - if(SAMPLES_BACKEND STREQUAL "SDL_GL2") - find_package(GLEW REQUIRED) - if(NOT GLEW_FOUND) - message(FATAL_ERROR "GLEW not found") - endif() - endif() - - # Check version requirement for the SDL renderer. - if(SAMPLES_BACKEND STREQUAL "SDL_SDLrenderer" AND "${SDL2_VERSION}" VERSION_LESS "2.0.20") - message(FATAL_ERROR "SDL2 native renderer backend (${SAMPLES_BACKEND}) requires SDL 2.0.20 (found ${SDL2_VERSION}).") - endif() - - if(SAMPLES_BACKEND STREQUAL "SDL_GL2" OR SAMPLES_BACKEND STREQUAL "SDL_GL3" OR SAMPLES_BACKEND STREQUAL "SDL_SDLrenderer") - find_package(SDL2_image REQUIRED) - if(NOT SDL2_IMAGE_FOUND) - message(FATAL_ERROR "SDL2_image not found") - endif() - endif() - - target_include_directories(shell PRIVATE ${SDL2_INCLUDE_DIR} ${SDL2_IMAGE_INCLUDE_DIR} ${GLEW_INCLUDE_DIR}) - target_link_libraries(shell PRIVATE ${SDL2_LIBRARY} ${SDL2_IMAGE_LIBRARY} ${GLEW_LIBRARIES}) - endif() - endif() - - if(SAMPLES_BACKEND MATCHES "^SFML") - message("-- Looking for SFML 2.x library for samples backend.") - if (WIN32) - find_package(SFML 2 REQUIRED COMPONENTS graphics window system main) - else() - find_package(SFML 2 REQUIRED COMPONENTS graphics window system) - endif() - target_include_directories(shell PRIVATE ${SFML_INCLUDE_DIR}) - target_link_libraries(shell PRIVATE ${SFML_LIBRARIES}) - endif() - - if(SAMPLES_BACKEND MATCHES "^GLFW") - message("-- Looking for GLFW3 library for samples backend.") - find_package(glfw3 3.3 CONFIG REQUIRED) - target_link_libraries(shell PRIVATE glfw) - message("-- Found GLFW version ${glfw3_VERSION}.") - endif() - - # Add renderer dependencies. - if(SAMPLES_BACKEND MATCHES "GL2$") - message("-- Adding OpenGL 2 renderer backend.") - find_package(OpenGL REQUIRED) - target_include_directories(shell PRIVATE ${OPENGL_INCLUDE_DIR}) - target_link_libraries(shell PRIVATE ${OPENGL_LIBRARIES}) - target_compile_definitions(shell PRIVATE RMLUI_RENDERER_GL2) - if(APPLE) - target_compile_definitions(shell PRIVATE GL_SILENCE_DEPRECATION) - endif() - endif() - - if(SAMPLES_BACKEND MATCHES "VK$") - message("-- Using Vulkan renderer backend.") - - option(RMLUI_VK_DEBUG "Enable debugging mode for Vulkan renderer." OFF) - mark_as_advanced(RMLUI_VK_DEBUG) - if(RMLUI_VK_DEBUG) - target_compile_definitions(shell PRIVATE RMLUI_VK_DEBUG) - endif() - - target_link_libraries(shell PRIVATE ${CMAKE_DL_LIBS}) - endif() - - if(SAMPLES_BACKEND MATCHES "GL3$") - message("-- Adding OpenGL 3 renderer backend.") - if(EMSCRIPTEN) - set(EMSCRIPTEN_EXE_FLAGS "${EMSCRIPTEN_EXE_FLAGS} -sMAX_WEBGL_VERSION=2") - else() - find_package(OpenGL REQUIRED) - target_include_directories(shell PRIVATE ${OPENGL_INCLUDE_DIR}) - target_link_libraries(shell PRIVATE ${OPENGL_LIBRARIES} ${CMAKE_DL_LIBS}) - target_compile_definitions(shell PRIVATE RMLUI_RENDERER_GL3) - if(APPLE) - target_compile_definitions(shell PRIVATE GL_SILENCE_DEPRECATION) - endif() - endif() - endif() -endif() - - -if(BUILD_SAMPLES) - set(samples treeview customlog drag loaddocument transform bitmapfont animation benchmark demo databinding) - set(tutorials template drag) - - if(ENABLE_LOTTIE_PLUGIN) - list(APPEND samples "lottie") - endif() - if(ENABLE_SVG_PLUGIN) - list(APPEND samples "svg") - endif() - - # Build and install the basic samples - foreach(sample ${samples}) - bl_sample(${sample} ${sample_LIBRARIES}) - - # The samples always set this as their current working directory - install(DIRECTORY DESTINATION ${SAMPLES_DIR}/basic/${sample}) - install(TARGETS ${sample} - RUNTIME DESTINATION ${SAMPLES_DIR}/${sample} - BUNDLE DESTINATION ${SAMPLES_DIR}) - endforeach() - - # Build and install the tutorials - foreach(tutorial ${tutorials}) - set(tutorial_fullname tutorial_${tutorial}) - bl_sample(${tutorial_fullname} ${sample_LIBRARIES}) - - # The tutorials always set this as their current working directory - install(DIRECTORY DESTINATION ${SAMPLES_DIR}/tutorial/${tutorial}) - install(TARGETS ${tutorial_fullname} - RUNTIME DESTINATION ${SAMPLES_DIR}/${tutorial} - BUNDLE DESTINATION ${SAMPLES_DIR}) - endforeach() - - # Build and install invaders sample - bl_sample(invaders ${sample_LIBRARIES}) - install(DIRECTORY DESTINATION ${SAMPLES_DIR}/invaders) - install(TARGETS invaders - RUNTIME DESTINATION ${SAMPLES_DIR}/invaders - BUNDLE DESTINATION ${SAMPLES_DIR}) - - if(BUILD_LUA_BINDINGS) - bl_sample(luainvaders RmlLua ${sample_LIBRARIES} ${LUA_BINDINGS_LINK_LIBS}) - install(DIRECTORY DESTINATION ${SAMPLES_DIR}/luainvaders) - install(TARGETS luainvaders - RUNTIME DESTINATION ${SAMPLES_DIR}/luainvaders - BUNDLE DESTINATION ${SAMPLES_DIR}) - endif() - - # Add assets to emscripten binaries - if(EMSCRIPTEN) - message("-- Preloading emscipten sample assets") - - set(COMMON_ASSET_FOLDER "Samples/assets/") - set(EMSCRIPTEN_EXE_FLAGS "${EMSCRIPTEN_EXE_FLAGS} --preload-file ${CMAKE_CURRENT_SOURCE_DIR}/${COMMON_ASSET_FOLDER}@/${COMMON_ASSET_FOLDER}") - - foreach(sample ${samples}) - set(SAMPLE_DATA_FOLDER "Samples/basic/${sample}/data/") - set(ABS_SAMPLE_DATA_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/${SAMPLE_DATA_FOLDER}") - if(EXISTS ${ABS_SAMPLE_DATA_FOLDER}) - target_link_libraries(${sample} "--preload-file ${ABS_SAMPLE_DATA_FOLDER}@/${SAMPLE_DATA_FOLDER}") - endif() - endforeach() - - foreach(tutorial ${tutorials}) - set(TUTORIAL_DATA_FOLDER "Samples/tutorial/${tutorial}/data/") - set(ABS_TUTORIAL_DATA_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/${TUTORIAL_DATA_FOLDER}") - if(EXISTS ${ABS_TUTORIAL_DATA_FOLDER}) - target_link_libraries("tutorial_${tutorial}" "--preload-file ${ABS_TUTORIAL_DATA_FOLDER}@/${TUTORIAL_DATA_FOLDER}") - endif() - endforeach() - - set(INVADER_DATA_FOLDER "Samples/invaders/data/") - target_link_libraries(invaders "-sALLOW_MEMORY_GROWTH --preload-file ${CMAKE_CURRENT_SOURCE_DIR}/${INVADER_DATA_FOLDER}@/${INVADER_DATA_FOLDER}") - endif() -endif() - -#=================================== -# Source grouping for IDEs ========= -#=================================== - -source_group("Core\\Layout" REGULAR_EXPRESSION "/Core/Layout/") -source_group("Core\\Elements" REGULAR_EXPRESSION "/Core/Elements/") -source_group("Core\\FontEngineDefault" REGULAR_EXPRESSION "/Core/FontEngineDefault/") - -#=================================== -# Add global options =============== -#=================================== - -if(EMSCRIPTEN) - # Enables Asyncify which we only need since the backend doesn't control the main loop. This enables us to yield to the browser during the backend call to - # Backend::ProcessEvents(). Asyncify results in larger and slower code, users are instead encouraged to use 'emscripten_set_main_loop()' and family. - set(EMSCRIPTEN_EXE_FLAGS "${EMSCRIPTEN_EXE_FLAGS} -sASYNCIFY") - - message(STATUS "Compiling for Emscripten.\n\t- Flags:${EMSCRIPTEN_FLAGS}\n\t- ExeFlags:${EMSCRIPTEN_EXE_FLAGS}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EMSCRIPTEN_FLAGS}") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EMSCRIPTEN_FLAGS}") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EMSCRIPTEN_FLAGS} ${EMSCRIPTEN_EXE_FLAGS}") - set(CMAKE_EXECUTABLE_SUFFIX .html) -endif() - -#=================================== -# Add tests ======================== -#=================================== - -if(RMLUI_TESTS_ENABLED) - add_subdirectory(Tests) -endif() - -#=================================== -# Installation ===================== -#=================================== - -if(BUILD_LUA_BINDINGS) - install(DIRECTORY ${PROJECT_SOURCE_DIR}/Include/RmlUi - DESTINATION include - ) -else() - install(DIRECTORY ${PROJECT_SOURCE_DIR}/Include/RmlUi - DESTINATION include - PATTERN "Lua" EXCLUDE - ) -endif() - -if(BUILD_SAMPLES) - install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/assets - DESTINATION ${SAMPLES_DIR} - ) - - install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/tutorial/template/data - DESTINATION ${SAMPLES_DIR}/tutorial/template - ) - install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/tutorial/drag/data - DESTINATION ${SAMPLES_DIR}/tutorial/drag - ) - install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/animation/data - DESTINATION ${SAMPLES_DIR}/basic/animation - ) - install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/benchmark/data - DESTINATION ${SAMPLES_DIR}/basic/benchmark - ) - install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/bitmapfont/data - DESTINATION ${SAMPLES_DIR}/basic/bitmapfont - ) - install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/databinding/data - DESTINATION ${SAMPLES_DIR}/basic/databinding - ) - install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/demo/data - DESTINATION ${SAMPLES_DIR}/basic/demo - ) - install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/transform/data - DESTINATION ${SAMPLES_DIR}/basic/transform - ) - install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/treeview/data - DESTINATION ${SAMPLES_DIR}/basic/treeview - ) - install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/drag/data - DESTINATION ${SAMPLES_DIR}/basic/drag - ) - install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/invaders/data - DESTINATION ${SAMPLES_DIR}/invaders - ) - - if(TARGET lottie) - install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/lottie/data - DESTINATION ${SAMPLES_DIR}/basic/lottie - ) - endif() - if(TARGET svg) - install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/basic/svg/data - DESTINATION ${SAMPLES_DIR}/basic/svg - ) - endif() - - if(BUILD_LUA_BINDINGS) - install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/luainvaders/data - DESTINATION ${SAMPLES_DIR}/luainvaders - ) - install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/luainvaders/lua - DESTINATION ${SAMPLES_DIR}/luainvaders - ) - endif() -endif() - -#=================================== -# Generate Config.cmake files ====== -#=================================== - -# Try to include helper module -include(CMakePackageConfigHelpers OPTIONAL RESULT_VARIABLE PkgHelpers_AVAILABLE) - -# guard against older versions of cmake which do not provide it -if(${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME}) -if(PkgHelpers_AVAILABLE) - set (INCLUDE_INSTALL_DIR "include") - set (LIB_INSTALL_DIR "lib") - set (INCLUDE_DIR "${PROJECT_SOURCE_DIR}/Include") - - # generate configuration for install tree - configure_package_config_file(${PROJECT_SOURCE_DIR}/CMake/RmlUiConfig.cmake.install.in - ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfig.cmake - INSTALL_DESTINATION ${LIB_INSTALL_DIR}/RmlUi/cmake - PATH_VARS INCLUDE_INSTALL_DIR LIB_INSTALL_DIR) - write_basic_package_version_file( - ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfigVersion.cmake - VERSION ${PROJECT_VERSION} - COMPATIBILITY SameMajorVersion ) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfig.cmake - ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfigVersion.cmake - DESTINATION ${LIB_INSTALL_DIR}/RmlUi/cmake ) - install(EXPORT RmlUiTargets - DESTINATION ${LIB_INSTALL_DIR}/RmlUi/cmake) - - # generate configuration for build tree - configure_package_config_file(${PROJECT_SOURCE_DIR}/CMake/RmlUiConfig.cmake.build.in - ${CMAKE_CURRENT_BINARY_DIR}/RmlUiConfig.cmake - INSTALL_DESTINATION ${CMAKE_CURRENT_BINARY_DIR} - PATH_VARS INCLUDE_DIR CMAKE_CURRENT_BINARY_DIR) - if(NOT ${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME}) - export(TARGETS ${RMLUI_EXPORTED_TARGETS} - FILE "${CMAKE_CURRENT_BINARY_DIR}/RmlUiTargets.cmake") - endif() - write_basic_package_version_file( - ${CMAKE_CURRENT_BINARY_DIR}/RmlUiConfigVersion.cmake - VERSION ${PROJECT_VERSION} - COMPATIBILITY SameMajorVersion ) - set(RmlUi_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE PATH "The directory containing a CMake configuration file for RmlUi.") -else() - message("If you wish to use find_package(RmlUi) in your own project to find RmlUi library" - " please update cmake to version which provides CMakePackageConfighelpers module" - " or write generators for RmlUiConfig.cmake by yourself.") -endif() -endif() diff --git a/Dependencies/empty.txt b/Dependencies/empty.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/Dependencies/osx-depends.sh b/Dependencies/osx-depends.sh deleted file mode 100755 index 62a7b7620..000000000 --- a/Dependencies/osx-depends.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env sh - -BUILD_FREETYPE2=YES -BUILD_LUA=YES -BUILD_PLATFORM=osx - - -#Get depends root directory - -pushd `dirname $0` > /dev/null -SCRIPT_PATH=`pwd` -popd > /dev/null - -DEPS_DIR=${SCRIPT_PATH} - -BUILD_OUTPUTDIR=${DEPS_DIR}/${BUILD_PLATFORM} - -if [ ! -d "${BUILD_OUTPUTDIR}" ]; then - mkdir "${BUILD_OUTPUTDIR}" -fi -if [ ! -d "${BUILD_OUTPUTDIR}/lib" ]; then - mkdir "${BUILD_OUTPUTDIR}/lib" -fi -if [ ! -d "${BUILD_OUTPUTDIR}/include" ]; then - mkdir "${BUILD_OUTPUTDIR}/include" -fi - -create_ios_outdir_lipo() -{ - for lib_i386 in `find $LOCAL_OUTDIR/i386 -name "lib*.a"`; do - lib_arm7=`echo $lib_i386 | sed "s/i386/arm7/g"` - lib_arm7s=`echo $lib_i386 | sed "s/i386/arm7s/g"` - lib=`echo $lib_i386 | sed "s/i386//g"` - xcrun -sdk iphoneos lipo -arch armv7s $lib_arm7s -arch armv7 $lib_arm7 -create -output $lib - done -} - -build_freetype() -{ - - cd "${DEPS_DIR}" - if [ ! -d "freetype2" ]; then - git clone --recursive git://git.sv.nongnu.org/freetype/freetype2.git freetype2 - fi - - cd freetype2 - - cmake CMakeLists.txt -DBUILD_SHARED_LIBS:BOOL=false - make - - cmake CMakeLists.txt -DBUILD_SHARED_LIBS:BOOL=true - make - - if [ ! -d "${BUILD_OUTPUTDIR}/include/freetype2" ]; then - mkdir "${BUILD_OUTPUTDIR}/include/freetype2" - fi - cp -Rp include/* "${BUILD_OUTPUTDIR}/include/freetype2/" - cp libfreetype.a "${BUILD_OUTPUTDIR}/lib/" - cp libfreetype.dylib "${BUILD_OUTPUTDIR}/lib/" - - cd "${DEPS_DIR}" -} - - -build_freetype From 27a12a159e06593fe1b6ee113f710807563757c5 Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Fri, 8 Sep 2023 12:24:57 +0200 Subject: [PATCH 12/29] Add comments to some CMake files --- CMake/Backends.cmake | 2 ++ CMake/BackendsDependencies.cmake | 4 +++- CMake/Dependencies.cmake | 4 ++++ CMake/SamplesShellDependencies.cmake | 4 ++++ CMake/Utils.cmake | 18 +++++++++++------- 5 files changed, 24 insertions(+), 8 deletions(-) diff --git a/CMake/Backends.cmake b/CMake/Backends.cmake index 009f092ed..3ca601fd4 100644 --- a/CMake/Backends.cmake +++ b/CMake/Backends.cmake @@ -3,6 +3,8 @@ Everytime a new backend gets added or its target name is modified, please update the list of available backends found in OptionsLists.cmake + + This file is not meant to be used by consumers of the library, only by the RmlUi CMake project #]] list(APPEND RMLUI_BACKEND_COMMON_HDR_FILES diff --git a/CMake/BackendsDependencies.cmake b/CMake/BackendsDependencies.cmake index d1f891da5..340e48103 100644 --- a/CMake/BackendsDependencies.cmake +++ b/CMake/BackendsDependencies.cmake @@ -1,8 +1,10 @@ #[[ - Set up of external dependencies required by the sample backends + Set up of external dependencies required by the backends provided by the project to build the samples All dependencies are searched as soft dependencies so that they won't error out if the library is declared by other means + + This file is not meant to be used by consumers of the library, only by the RmlUi CMake project #]] include("${PROJECT_SOURCE_DIR}/CMake/Utils.cmake") diff --git a/CMake/Dependencies.cmake b/CMake/Dependencies.cmake index c1adc1faa..6aae6cced 100644 --- a/CMake/Dependencies.cmake +++ b/CMake/Dependencies.cmake @@ -1,3 +1,7 @@ +#[[ + Set up of external dependencies required to build RmlUi itself +#]] + include("${PROJECT_SOURCE_DIR}/CMake/Utils.cmake") # Freetype diff --git a/CMake/SamplesShellDependencies.cmake b/CMake/SamplesShellDependencies.cmake index 1086ce8dd..569c4d8cc 100644 --- a/CMake/SamplesShellDependencies.cmake +++ b/CMake/SamplesShellDependencies.cmake @@ -1,3 +1,7 @@ +#[[ + Set up of external dependencies required by the shell utility library used by the samples +#]] + include("${PROJECT_SOURCE_DIR}/CMake/Utils.cmake") # RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE: diff --git a/CMake/Utils.cmake b/CMake/Utils.cmake index 4b3a79e05..79e025856 100644 --- a/CMake/Utils.cmake +++ b/CMake/Utils.cmake @@ -1,8 +1,12 @@ #[[ -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 + Various CMake utilities +#]] + +#[[ + 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 @@ -14,9 +18,9 @@ function(report_not_found_dependency friendly_name target_name) endfunction() #[[ -Function to print a message to the console indicating a library from a native platform SDK hasn't been found -Arguments: - - library_name: Name of the library + Function to print a message to the console indicating a library from a native platform SDK hasn't been found + Arguments: + - library_name: Name of the library ]] function(report_not_found_native_library library_name) # Set SDK notice string From 94131f2b41864b6874a0fbfba2595be6e36928da Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Sat, 9 Sep 2023 13:29:59 +0200 Subject: [PATCH 13/29] Add rules to CONTRIBUTING.md and apply them --- CMake/Backends.cmake | 188 +++++++-------- CMake/BackendsDependencies.cmake | 21 +- CMake/Dependencies.cmake | 6 +- CMake/Modules/CI/Linux/FindSDL2_image.cmake | 2 +- CMake/Modules/Emscripten/FindFreetype.cmake | 2 +- CMake/Modules/Emscripten/FindOpenGL.cmake | 4 +- CMake/Modules/Emscripten/FindSDL2.cmake | 2 +- CMake/Modules/Emscripten/FindSDL2_image.cmake | 2 +- CMake/Modules/Emscripten/Findglfw3.cmake | 2 +- CMake/OptionsLists.cmake | 2 +- CMake/SamplesShellDependencies.cmake | 2 +- CMake/Utils.cmake | 2 +- CMakeLists.txt | 12 +- CONTRIBUTING.md | 10 +- Source/Core/CMakeLists.txt | 226 +++++++++--------- Source/Core/Elements/CMakeLists.txt | 101 ++++---- Source/Core/FontEngineDefault/CMakeLists.txt | 41 ++-- Source/Core/Layout/CMakeLists.txt | 81 +++---- Source/Debugger/CMakeLists.txt | 17 +- Source/Lottie/CMakeLists.txt | 19 +- Source/Lua/CMakeLists.txt | 16 +- Source/SVG/CMakeLists.txt | 2 +- 22 files changed, 345 insertions(+), 415 deletions(-) diff --git a/CMake/Backends.cmake b/CMake/Backends.cmake index 3ca601fd4..594445873 100644 --- a/CMake/Backends.cmake +++ b/CMake/Backends.cmake @@ -5,46 +5,44 @@ the list of available backends found in OptionsLists.cmake This file is not meant to be used by consumers of the library, only by the RmlUi CMake project -#]] +]] -list(APPEND RMLUI_BACKEND_COMMON_HDR_FILES - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend.h +add_library(rmlui_backend_common_headers INTERFACE) +target_sources(rmlui_backend_common_headers INTERFACE + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend.h" ) add_library(rmlui_backend_Win32_GL2 INTERFACE) target_sources(rmlui_backend_Win32_GL2 INTERFACE - ${RMLUI_BACKEND_COMMON_HDR_FILES} - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_Win32.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_Win32_GL2.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_Win32.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Include_Windows.h + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_Win32.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_Win32_GL2.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_Win32.h" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.h" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Include_Windows.h" ) -target_link_libraries(rmlui_backend_Win32_GL2 INTERFACE OpenGL::GL) +target_link_libraries(rmlui_backend_Win32_GL2 INTERFACE rmlui_backend_common_headers OpenGL::GL) add_library(rmlui_backend_Win32_VK INTERFACE) -target_sources(rmlui_backend_Win32_VK INTERFACE - ${RMLUI_BACKEND_COMMON_HDR_FILES} - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_Win32.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_VK.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_Win32_VK.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_Win32.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_VK.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Vulkan/ShadersCompiledSPV.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Vulkan/vk_mem_alloc.h +target_sources(rmlui_backend_Win32_VK INTERFACE + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_Win32.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_VK.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_Win32_VK.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_Win32.h" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_VK.h" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Vulkan/ShadersCompiledSPV.h" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Vulkan/vk_mem_alloc.h" ) -target_link_libraries(rmlui_backend_Win32_VK INTERFACE Vulkan::Vulkan) +target_link_libraries(rmlui_backend_Win32_VK INTERFACE rmlui_backend_common_headers Vulkan::Vulkan) add_library(rmlui_backend_X11_GL2 INTERFACE) -target_sources(rmlui_backend_X11_GL2 INTERFACE - ${RMLUI_BACKEND_COMMON_HDR_FILES} - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_X11.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_X11_GL2.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_X11.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Include_Xlib.h +target_sources(rmlui_backend_X11_GL2 INTERFACE + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_X11.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_X11_GL2.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_X11.h" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.h" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Include_Xlib.h" ) # RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE: @@ -52,30 +50,28 @@ target_sources(rmlui_backend_X11_GL2 INTERFACE # be substituted by "X11:X11" in addition to any of the other imported that might # be required. More info: # https://cmake.org/cmake/help/latest/module/FindX11.html -target_link_libraries(rmlui_backend_X11_GL2 INTERFACE OpenGL::GL ${X11_LIBRARIES}) +target_link_libraries(rmlui_backend_X11_GL2 INTERFACE rmlui_backend_common_headers OpenGL::GL ${X11_LIBRARIES}) add_library(rmlui_backend_SDL_GL2 INTERFACE) -target_sources(rmlui_backend_SDL_GL2 INTERFACE - ${RMLUI_BACKEND_COMMON_HDR_FILES} - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_SDL_GL2.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.h +target_sources(rmlui_backend_SDL_GL2 INTERFACE + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_SDL_GL2.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.h" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.h" ) -target_link_libraries(rmlui_backend_SDL_GL2 INTERFACE OpenGL::GL SDL2::SDL2 GLEW::GLEW SDL2_image::SDL2_image) +target_link_libraries(rmlui_backend_SDL_GL2 INTERFACE rmlui_backend_common_headers OpenGL::GL SDL2::SDL2 GLEW::GLEW SDL2_image::SDL2_image) add_library(rmlui_backend_SDL_GL3 INTERFACE) -target_sources(rmlui_backend_SDL_GL3 INTERFACE - ${RMLUI_BACKEND_COMMON_HDR_FILES} - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL3.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_SDL_GL3.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL3.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Include_GL3.h +target_sources(rmlui_backend_SDL_GL3 INTERFACE + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL3.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_SDL_GL3.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.h" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL3.h" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Include_GL3.h" ) -target_link_libraries(rmlui_backend_SDL_GL3 INTERFACE OpenGL::GL SDL2::SDL2 SDL2_image::SDL2_image) +target_link_libraries(rmlui_backend_SDL_GL3 INTERFACE rmlui_backend_common_headers OpenGL::GL SDL2::SDL2 SDL2_image::SDL2_image) if(UNIX) # The OpenGL 3 renderer implementation uses dlopen/dlclose # This is required in some UNIX and UNIX-like operating systems to load shared object files at runtime @@ -83,17 +79,16 @@ if(UNIX) endif() add_library(rmlui_backend_SDL_VK INTERFACE) -target_sources(rmlui_backend_SDL_VK INTERFACE - ${RMLUI_BACKEND_COMMON_HDR_FILES} - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_VK.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_SDL_VK.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_VK.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Vulkan/ShadersCompiledSPV.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Vulkan/vk_mem_alloc.h +target_sources(rmlui_backend_SDL_VK INTERFACE + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_VK.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_SDL_VK.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.h" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_VK.h" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Vulkan/ShadersCompiledSPV.h" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Vulkan/vk_mem_alloc.h" ) -target_link_libraries(rmlui_backend_SDL_VK INTERFACE Vulkan::Vulkan SDL2::SDL2) +target_link_libraries(rmlui_backend_SDL_VK INTERFACE rmlui_backend_common_headers Vulkan::Vulkan SDL2::SDL2) if(UNIX) # The Vulkan renderer implementation uses dlopen/dlclose # This is required in some UNIX and UNIX-like operating systems to load shared object files at runtime @@ -101,54 +96,50 @@ if(UNIX) endif() add_library(rmlui_backend_SDL_SDLrenderer INTERFACE) -target_sources(rmlui_backend_SDL_SDLrenderer INTERFACE - ${RMLUI_BACKEND_COMMON_HDR_FILES} - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_SDL.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_SDL_SDLrenderer.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_SDL.h +target_sources(rmlui_backend_SDL_SDLrenderer INTERFACE + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_SDL.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_SDL_SDLrenderer.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.h" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_SDL.h" ) -target_link_libraries(rmlui_backend_SDL_SDLrenderer INTERFACE SDL2::SDL2 SDL2_image::SDL2_image) +target_link_libraries(rmlui_backend_SDL_SDLrenderer INTERFACE rmlui_backend_common_headers SDL2::SDL2 SDL2_image::SDL2_image) add_library(rmlui_backend_SFML_GL2 INTERFACE) -target_sources(rmlui_backend_SFML_GL2 INTERFACE - ${RMLUI_BACKEND_COMMON_HDR_FILES} - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SFML.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_SFML_GL2.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SFML.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.h +target_sources(rmlui_backend_SFML_GL2 INTERFACE + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SFML.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_SFML_GL2.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SFML.h" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.h" ) -target_link_libraries(rmlui_backend_SFML_GL2 INTERFACE OpenGL::GL - rmlui_SFML_old_wrapper SFML::Graphics SFML::Window SFML::System +target_link_libraries(rmlui_backend_SFML_GL2 INTERFACE + rmlui_backend_common_headers OpenGL::GL rmlui_SFML_old_wrapper SFML::Graphics SFML::Window SFML::System ) if(WIN32) target_link_libraries(rmlui_backend_SFML_GL2 INTERFACE SFML::Main) endif() add_library(rmlui_backend_GLFW_GL2 INTERFACE) -target_sources(rmlui_backend_GLFW_GL2 INTERFACE - ${RMLUI_BACKEND_COMMON_HDR_FILES} - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_GLFW.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_GLFW_GL2.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_GLFW.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.h +target_sources(rmlui_backend_GLFW_GL2 INTERFACE + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_GLFW.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_GLFW_GL2.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_GLFW.h" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.h" ) -target_link_libraries(rmlui_backend_GLFW_GL2 INTERFACE OpenGL::GL glfw) +target_link_libraries(rmlui_backend_GLFW_GL2 INTERFACE rmlui_backend_common_headers OpenGL::GL glfw) add_library(rmlui_backend_GLFW_GL3 INTERFACE) -target_sources(rmlui_backend_GLFW_GL3 INTERFACE - ${RMLUI_BACKEND_COMMON_HDR_FILES} - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_GLFW.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL3.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_GLFW_GL3.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_GLFW.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL3.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Include_GL3.h +target_sources(rmlui_backend_GLFW_GL3 INTERFACE + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_GLFW.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL3.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_GLFW_GL3.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_GLFW.h" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL3.h" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Include_GL3.h" ) -target_link_libraries(rmlui_backend_GLFW_GL3 INTERFACE OpenGL::GL glfw) +target_link_libraries(rmlui_backend_GLFW_GL3 INTERFACE rmlui_backend_common_headers OpenGL::GL glfw) if(UNIX) # The OpenGL 3 renderer implementation uses dlopen/dlclose # This is required in some UNIX and UNIX-like operating systems to load shared object files at runtime @@ -156,15 +147,14 @@ if(UNIX) endif() add_library(rmlui_backend_GLFW_VK INTERFACE) -target_sources(rmlui_backend_GLFW_VK INTERFACE - ${RMLUI_BACKEND_COMMON_HDR_FILES} - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_GLFW.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_VK.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_GLFW_VK.cpp - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_GLFW.h - ${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_VK.h +target_sources(rmlui_backend_GLFW_VK INTERFACE + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_GLFW.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_VK.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Backend_GLFW_VK.cpp" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_GLFW.h" + "${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_VK.h" ) -target_link_libraries(rmlui_backend_GLFW_VK INTERFACE Vulkan::Vulkan glfw) +target_link_libraries(rmlui_backend_GLFW_VK INTERFACE rmlui_backend_common_headers Vulkan::Vulkan glfw) if(UNIX) # The Vulkan renderer implementation uses dlopen/dlclose # This is required in some UNIX and UNIX-like operating systems to load shared object files at runtime diff --git a/CMake/BackendsDependencies.cmake b/CMake/BackendsDependencies.cmake index 340e48103..1cf7843ec 100644 --- a/CMake/BackendsDependencies.cmake +++ b/CMake/BackendsDependencies.cmake @@ -5,7 +5,7 @@ is declared by other means This file is not meant to be used by consumers of the library, only by the RmlUi CMake project -#]] +]] include("${PROJECT_SOURCE_DIR}/CMake/Utils.cmake") @@ -18,11 +18,10 @@ if(RMLUI_SAMPLES_BACKEND MATCHES "^SDL") find_package("SDL2" REQUIRED) #[[ - RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE: Current code operates using a hybrid mode by detecting either the variable or the target due to the possibility of package managers such as Conan and vcpkg of setting up SDL in their own way but always following the target naming conventions of the official SDL config files - #]] + ]] if(NOT TARGET SDL2::SDL2 AND NOT SDL2_FOUND) report_not_found_dependency("SDL2" SDL2::SDL2) @@ -56,8 +55,8 @@ if(RMLUI_SAMPLES_BACKEND MATCHES "^SDL") list(APPEND RMLUI_SDL_BACKENDS_WITH_SDLIMAGE "SDL_GL2" "SDL_GL3" "SDL_SDLrenderer") # Determine if the selected SDL backend requires SDL_image - list(FIND RMLUI_SDL_BACKENDS_WITH_SDLIMAGE ${RMLUI_SAMPLES_BACKEND} index) - if(index EQUAL "-1") + list(FIND RMLUI_SDL_BACKENDS_WITH_SDLIMAGE ${RMLUI_SAMPLES_BACKEND} rmlui_sdl_image_found_item_index) + if(rmlui_sdl_image_found_item_index EQUAL "-1") # If the backend hasn't been found in the list, SDL_image isn't required set(RMLUI_SDLIMAGE_REQUIRED FALSE) else() @@ -65,7 +64,7 @@ if(RMLUI_SAMPLES_BACKEND MATCHES "^SDL") set(RMLUI_SDLIMAGE_REQUIRED TRUE) endif() # Clear scope - unset(index) + unset(rmlui_sdl_image_found_item_index) unset(RMLUI_SDL_BACKENDS_WITH_SDLIMAGE) # Require SDL_image if needed @@ -104,7 +103,7 @@ if(RMLUI_SAMPLES_BACKEND MATCHES "^SFML") In SFML <= 2.4 the old official find module is still in use which uses the old variable-based approach. - #]] + ]] # List of required components in capital case list(APPEND RMLUI_SFML_REQUIRED_COMPONENTS "Graphics" "Window" "System") @@ -129,7 +128,7 @@ if(RMLUI_SAMPLES_BACKEND MATCHES "^SFML") need to be set up. Because we always require the window module, we can use it to determine which iteration of the config. - #]] + ]] # If any of the mandatory SFML 2.7 targets isn't present, asume SFML < 2.7 has been found and set up wrappers if(NOT TARGET SFML::Window) @@ -139,7 +138,7 @@ if(RMLUI_SAMPLES_BACKEND MATCHES "^SFML") module-specific CMake targets but with different names using a config file. Therefore, we need to alias the target names to match those declared by SFML 2.7 and used by RmlUi. - #]] + ]] # For each SFML component the project requires foreach(sfml_component ${RMLUI_SFML_REQUIRED_COMPONENTS}) @@ -155,7 +154,7 @@ if(RMLUI_SAMPLES_BACKEND MATCHES "^SFML") specially when the project is consumed as a subdirectory inside another CMake project, therefore is not recommended. Instead of that, we pseudo-alias the target creating a second INTERFACE target with alias name. More info: https://cmake.org/cmake/help/latest/command/add_library.html#alias-libraries - #]] + ]] # If the target exists, alias it add_library(SFML::${sfml_component} INTERFACE IMPORTED) @@ -170,7 +169,7 @@ if(RMLUI_SAMPLES_BACKEND MATCHES "^SFML") #[[ If sfml-window doesn't exist, then SFML version is <= 2.4 and the old-variable approach used in their old official find module needs to be wrapped. - #]] + ]] # Create our own custom INTERFACE target add_library(rmlui_SFML_old_wrapper INTERFACE) diff --git a/CMake/Dependencies.cmake b/CMake/Dependencies.cmake index 6aae6cced..65dd9a46b 100644 --- a/CMake/Dependencies.cmake +++ b/CMake/Dependencies.cmake @@ -1,6 +1,6 @@ #[[ Set up of external dependencies required to build RmlUi itself -#]] +]] include("${PROJECT_SOURCE_DIR}/CMake/Utils.cmake") @@ -17,11 +17,11 @@ if(RMLUI_FONT_INTERFACE STREQUAL "freetype") # 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")) + 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") + if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") message(WARNING "Using Freetype 2.11.0 or greater with MSVC can cause issues.") endif() endif() diff --git a/CMake/Modules/CI/Linux/FindSDL2_image.cmake b/CMake/Modules/CI/Linux/FindSDL2_image.cmake index 184e4e07b..c8374a7a0 100644 --- a/CMake/Modules/CI/Linux/FindSDL2_image.cmake +++ b/CMake/Modules/CI/Linux/FindSDL2_image.cmake @@ -4,7 +4,7 @@ This is necessary on Ubuntu 20.04 because the libsdl2-image-dev package doesn't provide the config file. https://packages.ubuntu.com/focal/amd64/libsdl2-image-dev/filelist -#]] +]] set(SDL2_image_FOUND TRUE) diff --git a/CMake/Modules/Emscripten/FindFreetype.cmake b/CMake/Modules/Emscripten/FindFreetype.cmake index 5ca6615d3..73fda5750 100644 --- a/CMake/Modules/Emscripten/FindFreetype.cmake +++ b/CMake/Modules/Emscripten/FindFreetype.cmake @@ -12,7 +12,7 @@ More info: https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html -#]] +]] include(FindPackageHandleStandardArgs) include(FindPackageMessage) diff --git a/CMake/Modules/Emscripten/FindOpenGL.cmake b/CMake/Modules/Emscripten/FindOpenGL.cmake index 52dd2cc6f..41881a4cd 100644 --- a/CMake/Modules/Emscripten/FindOpenGL.cmake +++ b/CMake/Modules/Emscripten/FindOpenGL.cmake @@ -13,7 +13,7 @@ More info: https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html -#]] +]] include(FindPackageHandleStandardArgs) include(FindPackageMessage) @@ -44,7 +44,7 @@ endif() #[[ The Emscripten SDK already makes OpenGL available by default without any additional configuration. However, additional settings might be needed in some cases. -#]] +]] # Handle OpenGL 1 edge case # More info: https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html#emulation-of-older-desktop-opengl-api-features diff --git a/CMake/Modules/Emscripten/FindSDL2.cmake b/CMake/Modules/Emscripten/FindSDL2.cmake index 4a559a31d..4ff0640c9 100644 --- a/CMake/Modules/Emscripten/FindSDL2.cmake +++ b/CMake/Modules/Emscripten/FindSDL2.cmake @@ -12,7 +12,7 @@ More info: https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html -#]] +]] include(FindPackageHandleStandardArgs) include(FindPackageMessage) diff --git a/CMake/Modules/Emscripten/FindSDL2_image.cmake b/CMake/Modules/Emscripten/FindSDL2_image.cmake index 5eba6e59d..9d3a33f47 100644 --- a/CMake/Modules/Emscripten/FindSDL2_image.cmake +++ b/CMake/Modules/Emscripten/FindSDL2_image.cmake @@ -12,7 +12,7 @@ More info: https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html -#]] +]] include(FindPackageHandleStandardArgs) include(FindPackageMessage) diff --git a/CMake/Modules/Emscripten/Findglfw3.cmake b/CMake/Modules/Emscripten/Findglfw3.cmake index 062202abe..1dc949c34 100644 --- a/CMake/Modules/Emscripten/Findglfw3.cmake +++ b/CMake/Modules/Emscripten/Findglfw3.cmake @@ -12,7 +12,7 @@ More info: https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html -#]] +]] include(FindPackageHandleStandardArgs) include(FindPackageMessage) diff --git a/CMake/OptionsLists.cmake b/CMake/OptionsLists.cmake index 548e5e7f6..e2ed65c92 100644 --- a/CMake/OptionsLists.cmake +++ b/CMake/OptionsLists.cmake @@ -1,6 +1,6 @@ #[[ Lists of options available to configure some aspects of the project -#]] +]] # List of available backends list(APPEND RMLUI_SAMPLES_AVAILABLE_BACKENDS diff --git a/CMake/SamplesShellDependencies.cmake b/CMake/SamplesShellDependencies.cmake index 569c4d8cc..49e7cc232 100644 --- a/CMake/SamplesShellDependencies.cmake +++ b/CMake/SamplesShellDependencies.cmake @@ -1,6 +1,6 @@ #[[ Set up of external dependencies required by the shell utility library used by the samples -#]] +]] include("${PROJECT_SOURCE_DIR}/CMake/Utils.cmake") diff --git a/CMake/Utils.cmake b/CMake/Utils.cmake index 79e025856..fee4ded06 100644 --- a/CMake/Utils.cmake +++ b/CMake/Utils.cmake @@ -1,6 +1,6 @@ #[[ Various CMake utilities -#]] +]] #[[ Function to print a message to the console indicating a dependency hasn't been found diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e5808873..0fa943321 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,20 +32,20 @@ set_property(CACHE RMLUI_SAMPLES_BACKEND PROPERTY STRINGS ${RMLUI_SAMPLES_AVAILA set_property(CACHE RMLUI_FONT_INTERFACE PROPERTY STRINGS ${RMLUI_AVAILABLE_FONT_INTERFACES}) # Check if the specified sample backend is available -list(FIND RMLUI_SAMPLES_AVAILABLE_BACKENDS ${RMLUI_SAMPLES_BACKEND} backend_index) -if(backend_index EQUAL "-1") +list(FIND RMLUI_SAMPLES_AVAILABLE_BACKENDS ${RMLUI_SAMPLES_BACKEND} rmlui_backend_index) +if(rmlui_backend_index EQUAL "-1") # If the backend identifier isn't found in the list, return error message(FATAL_ERROR "The RmlUi backend ID specified in RMLUI_SAMPLES_BACKEND is not valid.") endif() -unset(backend_index) +unset(rmlui_backend_index) # Check if the specified font interface is available -list(FIND RMLUI_AVAILABLE_FONT_INTERFACES ${RMLUI_FONT_INTERFACE} fontinterface_index) -if(fontinterface_index EQUAL "-1") +list(FIND RMLUI_AVAILABLE_FONT_INTERFACES ${RMLUI_FONT_INTERFACE} rmlui_fontinterface_index) +if(rmlui_fontinterface_index EQUAL "-1") # If the backend identifier isn't found in the list, return error message(FATAL_ERROR "The RmlUi font interface ID specified in RMLUI_FONT_INTERFACE is not valid.") endif() -unset(fontinterface_index) +unset(rmlui_fontinterface_index) # Add custom CMake modules path for external dependencies list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake/Modules") diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8913b8e61..a58a27796 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,8 +22,14 @@ practice that quickly increases the complexity of the build script. Instead: - **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. +- **Treat CMake code as production code and comment extensively:** Properly commenting code improves readability and therefore speeds up code revisions and further modifications and improvements of existing code. When deemed necessary, context clues and additional information about certain decisions might also be given in the form of block comments delimited using [bracket comments](https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#bracket-comment). + +- **Prefix all created variables and targets:** Because the project aims to support consuming RmlUi as a CMake subdirectory, care should be taken when using and accessing variables and setting up and linking against targets. CMake subdirectories inherit read and write access to all variables accessible from their parent scope/directory, meaning naming overlap of variables and targets may occur and lead to unexpected behavior. For this reason, the name of all created variables must begin with either `RMLUI_` (meaningful variables) or `rmlui_` (temporary variables) and the name of all created targets related to the project must begin with either `rmlui_` (internal CMake targets and aliases) or `RmlUi::` (targets and aliases intended to be referenced externally when consumed as a CMake subdirectory or installed and exported when built standalone). Consumers looking to consume RmlUi as a subdirectory in their CMake project should be aware of the fact that the project reserves the right to use these prefixes to prevent name collisions. + +- **Try keeping the scope clean:** For temporary variables that are necessary for a very limited amount of lines of code, remove them afterwards using `unset()`. + - **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. + If not quoted and depending on the scenario, CMake and some of its functions might read what the developer intended to be an unquoted string literal as a variable name. Strings containing [references to variables](https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#variable-references) whose values might contain whitespaces, such as variables that contain variable paths, also benefit from this as it protects the CMake project from unexpected behavior due to these whitespaces. It also helps with readability. However, when calling `add_library()` with paths that are known not to have whitespaces, quoting the source file paths isn't necessary because it doesn't read CMake variables and reads every literal string without a whitespace as a new source file. - **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`. @@ -40,7 +46,7 @@ practice that quickly increases the complexity of the build script. Instead: 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**. +* **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 either [`CMAKE_CURRENT_SOURCE_DIR`](https://cmake.org/cmake/help/latest/variable/CMAKE_CURRENT_SOURCE_DIR.html) or [`PROJECT_SOURCE_DIR`](https://cmake.org/cmake/help/latest/variable/PROJECT_SOURCE_DIR.html) when relevant 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 (Visual Studio) 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 repository. diff --git a/Source/Core/CMakeLists.txt b/Source/Core/CMakeLists.txt index 00b28c636..d16520aee 100644 --- a/Source/Core/CMakeLists.txt +++ b/Source/Core/CMakeLists.txt @@ -4,17 +4,6 @@ # # 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 @@ -231,113 +220,113 @@ target_include_directories(rmlui_core PUBLIC "${PROJECT_SOURCE_DIR}/Include") # Setting them as PRIVATE so that it's addition doesn't propagate, it won't affect availability since # the entire include directory has already been declared as public target_sources(rmlui_core PRIVATE - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Config/Config.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Animation.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/BaseXMLParser.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Box.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Colour.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Colour.inl - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ComputedValues.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Containers/itlib/flat_map.hpp - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Containers/itlib/flat_set.hpp - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Containers/LICENSE.txt - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Containers/robin_hood.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Context.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ContextInstancer.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ConvolutionFilter.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Core.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/DataModelHandle.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/DataStructHandle.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/DataTypeRegister.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/DataTypes.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/DataVariable.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Debug.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Decorator.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/DecoratorInstancer.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Dictionary.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Element.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Element.inl - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ElementDocument.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ElementInstancer.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Input.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Log.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Math.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Matrix4.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Matrix4.inl - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/NumericValue.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ObserverPtr.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Platform.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Plugin.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Profiling.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/PropertiesIteratorView.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Property.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/PropertyDefinition.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/PropertyDictionary.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/PropertyIdSet.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/PropertyParser.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/PropertySpecification.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Rectangle.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ElementScroll.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ElementText.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ElementUtilities.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Event.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/EventInstancer.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/EventListener.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/EventListenerInstancer.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Factory.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FileInterface.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FontEffect.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FontEffectInstancer.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FontEngineInterface.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FontGlyph.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FontMetrics.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Geometry.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/GeometryUtilities.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Header.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ScriptInterface.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ScrollTypes.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Spritesheet.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Stream.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StreamMemory.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StringUtilities.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StyleSheet.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StyleSheetContainer.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StyleSheetSpecification.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StyleSheetTypes.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StyleTypes.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/SystemInterface.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Texture.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Traits.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Transform.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/TransformPrimitive.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Tween.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/TypeConverter.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/TypeConverter.inl - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Types.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Unit.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/URL.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Utilities.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Variant.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Variant.inl - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vector2.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vector2.inl - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vector3.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vector3.inl - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vector4.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vector4.inl - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vertex.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/XMLNodeHandler.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/XMLParser.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementForm.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementFormControl.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementFormControlInput.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementFormControlSelect.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementFormControlTextArea.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementProgress.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementTabSet.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ID.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/RenderInterface.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core.h + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Config/Config.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Animation.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/BaseXMLParser.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Box.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Colour.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Colour.inl" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ComputedValues.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Containers/itlib/flat_map.hpp" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Containers/itlib/flat_set.hpp" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Containers/LICENSE.txt" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Containers/robin_hood.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Context.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ContextInstancer.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ConvolutionFilter.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Core.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/DataModelHandle.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/DataStructHandle.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/DataTypeRegister.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/DataTypes.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/DataVariable.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Debug.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Decorator.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/DecoratorInstancer.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Dictionary.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Element.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Element.inl" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ElementDocument.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ElementInstancer.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Input.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Log.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Math.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Matrix4.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Matrix4.inl" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/NumericValue.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ObserverPtr.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Platform.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Plugin.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Profiling.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/PropertiesIteratorView.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Property.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/PropertyDefinition.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/PropertyDictionary.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/PropertyIdSet.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/PropertyParser.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/PropertySpecification.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Rectangle.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ElementScroll.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ElementText.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ElementUtilities.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Event.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/EventInstancer.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/EventListener.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/EventListenerInstancer.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Factory.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FileInterface.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FontEffect.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FontEffectInstancer.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FontEngineInterface.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FontGlyph.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FontMetrics.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Geometry.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/GeometryUtilities.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Header.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ScriptInterface.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ScrollTypes.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Spritesheet.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Stream.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StreamMemory.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StringUtilities.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StyleSheet.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StyleSheetContainer.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StyleSheetSpecification.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StyleSheetTypes.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/StyleTypes.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/SystemInterface.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Texture.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Traits.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Transform.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/TransformPrimitive.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Tween.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/TypeConverter.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/TypeConverter.inl" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Types.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Unit.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/URL.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Utilities.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Variant.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Variant.inl" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vector2.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vector2.inl" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vector3.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vector3.inl" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vector4.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vector4.inl" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Vertex.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/XMLNodeHandler.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/XMLParser.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementForm.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementFormControl.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementFormControlInput.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementFormControlSelect.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementFormControlTextArea.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementProgress.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementTabSet.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ID.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/RenderInterface.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Core.h" ) # Add alias for the library so that a namespaced name can be used in the rest @@ -374,6 +363,7 @@ elseif(rmlui_core_TYPE STREQUAL "SHARED_LIBRARY") # Platform and compiler handling is already done by code via pre-processor macros target_compile_definitions(rmlui_core PRIVATE "RMLUI_CORE_EXPORTS") endif() +unset(rmlui_core_TYPE) # Negotiate usage of the default font engine # When any new font engine is added, it must be added here with an else if statement before the else case diff --git a/Source/Core/Elements/CMakeLists.txt b/Source/Core/Elements/CMakeLists.txt index d24cca47a..558a4d37e 100644 --- a/Source/Core/Elements/CMakeLists.txt +++ b/Source/Core/Elements/CMakeLists.txt @@ -2,17 +2,6 @@ # # 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) # Set C++14 as requirement @@ -23,49 +12,49 @@ target_compile_features(rmlui_core_elements INTERFACE "cxx_std_14") # Relative paths can be used once the minimum CMake version is greater or # equal than CMake 3.13 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 + "${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 index 4d6ff4fba..6f6df53e6 100644 --- a/Source/Core/FontEngineDefault/CMakeLists.txt +++ b/Source/Core/FontEngineDefault/CMakeLists.txt @@ -2,17 +2,6 @@ # # 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) # Set C++14 as requirement @@ -23,21 +12,21 @@ target_compile_features(rmlui_core_fontenginedefault INTERFACE "cxx_std_14") # 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 + "${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 diff --git a/Source/Core/Layout/CMakeLists.txt b/Source/Core/Layout/CMakeLists.txt index 3283318ca..2684cd53e 100644 --- a/Source/Core/Layout/CMakeLists.txt +++ b/Source/Core/Layout/CMakeLists.txt @@ -2,17 +2,6 @@ # # 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) # Set C++14 as requirement @@ -23,39 +12,39 @@ target_compile_features(rmlui_core_layout INTERFACE "cxx_std_14") # 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 + "${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 index a99e15820..8b87d6bd5 100644 --- a/Source/Debugger/CMakeLists.txt +++ b/Source/Debugger/CMakeLists.txt @@ -4,17 +4,6 @@ # # 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 @@ -47,9 +36,9 @@ target_include_directories(rmlui_debugger PUBLIC "${PROJECT_SOURCE_DIR}/Include" # Setting them as PRIVATE so that it's addition doesn't propagate, it won't affect availability since # the entire include directory has already been declared as public target_sources(rmlui_debugger PRIVATE - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Debugger/Debugger.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Debugger/Header.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Debugger.h + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Debugger/Debugger.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Debugger/Header.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Debugger.h" ) # Link against RmlUi diff --git a/Source/Lottie/CMakeLists.txt b/Source/Lottie/CMakeLists.txt index bb7d7220e..cfd902133 100644 --- a/Source/Lottie/CMakeLists.txt +++ b/Source/Lottie/CMakeLists.txt @@ -2,17 +2,6 @@ # # 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) # Set C++14 as requirement @@ -23,14 +12,14 @@ target_compile_features(rmlui_lottie INTERFACE "cxx_std_14") # 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 + "${CMAKE_CURRENT_SOURCE_DIR}/ElementLottie.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/LottiePlugin.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/LottiePlugin.h" ) # Add public headers as files in the project (it's not necessary but convenient for IDE integration) target_sources(rmlui_lottie INTERFACE - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Lottie/ElementLottie.h + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Lottie/ElementLottie.h" ) # Link library against rlottie diff --git a/Source/Lua/CMakeLists.txt b/Source/Lua/CMakeLists.txt index c940579f9..25a5b43c2 100644 --- a/Source/Lua/CMakeLists.txt +++ b/Source/Lua/CMakeLists.txt @@ -2,12 +2,12 @@ # Add public headers as files in the project (it's not necessary but convenient for IDE integration) target_sources(rmlui_lua INTERFACE - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/Header.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/IncludeLua.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/Interpreter.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/Lua.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/LuaType.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/LuaType.inl - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/Utilities.h - ${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua.h + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/Header.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/IncludeLua.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/Interpreter.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/Lua.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/LuaType.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/LuaType.inl" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua/Utilities.h" + "${PROJECT_SOURCE_DIR}/Include/RmlUi/Lua.h" ) diff --git a/Source/SVG/CMakeLists.txt b/Source/SVG/CMakeLists.txt index 0afc4203f..37a0eba75 100644 --- a/Source/SVG/CMakeLists.txt +++ b/Source/SVG/CMakeLists.txt @@ -2,5 +2,5 @@ # Add public headers as files in the project (it's not necessary but convenient for IDE integration) target_sources(rmlui_svg INTERFACE - ${PROJECT_SOURCE_DIR}/Include/RmlUi/SVG/ElementSVG.h + "${PROJECT_SOURCE_DIR}/Include/RmlUi/SVG/ElementSVG.h" ) From c77605af1a03632ddc15e98fcc57017daa0c3a7f Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Sat, 9 Sep 2023 14:57:45 +0200 Subject: [PATCH 14/29] Various changes - Wrap addition of the Lottie subdirectory - Change name of the compiler definition for the Freetype font engine --- Source/CMakeLists.txt | 4 +++- Source/Core/CMakeLists.txt | 2 +- Source/Core/Core.cpp | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index b27fb9699..1c1bf72e1 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -4,7 +4,9 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") # Add plugin directories -add_subdirectory("Lottie") +if(RMLUI_ENABLE_LOTTIE_PLUGIN) + add_subdirectory("Lottie") +endif() # Add main RmlUi directory add_subdirectory("Core") diff --git a/Source/Core/CMakeLists.txt b/Source/Core/CMakeLists.txt index d16520aee..5e54ec4b3 100644 --- a/Source/Core/CMakeLists.txt +++ b/Source/Core/CMakeLists.txt @@ -376,7 +376,7 @@ if(RMLUI_FONT_INTERFACE STREQUAL "freetype") target_link_libraries(rmlui_core PRIVATE rmlui_core_fontenginedefault) else() # Pass information to code via compile definition - target_compile_definitions(rmlui_core PRIVATE "RMLUI_NO_FONT_INTERFACE_DEFAULT") + target_compile_definitions(rmlui_core PRIVATE "RMLUI_FONT_INTERFACE_FREETYPE") endif() # Negotiate usage of the Lottie plugin diff --git a/Source/Core/Core.cpp b/Source/Core/Core.cpp index c58e0f900..9d8d0d16b 100644 --- a/Source/Core/Core.cpp +++ b/Source/Core/Core.cpp @@ -46,7 +46,7 @@ #include "TemplateCache.h" #include "TextureDatabase.h" -#ifndef RMLUI_NO_FONT_INTERFACE_DEFAULT +#ifndef RMLUI_FONT_INTERFACE_FREETYPE #include "FontEngineDefault/FontEngineInterfaceDefault.h" #endif @@ -122,7 +122,7 @@ bool Initialise() if (!font_interface) { -#ifndef RMLUI_NO_FONT_INTERFACE_DEFAULT +#ifndef RMLUI_FONT_INTERFACE_FREETYPE default_font_interface = MakeUnique(); font_interface = default_font_interface.get(); #else From a65abdc9bb2cb33c9faebb77ad90fbb28b13dcc8 Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Sun, 10 Sep 2023 14:47:46 +0200 Subject: [PATCH 15/29] Prevent target collision on Emscripten modules --- CMake/Modules/Emscripten/FindFreetype.cmake | 78 ++++++++------- CMake/Modules/Emscripten/FindOpenGL.cmake | 96 ++++++++++--------- CMake/Modules/Emscripten/FindSDL2.cmake | 70 ++++++++------ CMake/Modules/Emscripten/FindSDL2_image.cmake | 78 ++++++++------- CMake/Modules/Emscripten/Findglfw3.cmake | 70 ++++++++------ 5 files changed, 216 insertions(+), 176 deletions(-) diff --git a/CMake/Modules/Emscripten/FindFreetype.cmake b/CMake/Modules/Emscripten/FindFreetype.cmake index 73fda5750..5f975078a 100644 --- a/CMake/Modules/Emscripten/FindFreetype.cmake +++ b/CMake/Modules/Emscripten/FindFreetype.cmake @@ -17,39 +17,47 @@ include(FindPackageHandleStandardArgs) include(FindPackageMessage) -# If no version was specified, set default -if(NOT DEFINED Freetype_FIND_VERSION) - set(Freetype_FIND_VERSION "2") +if(NOT TARGET Freetype::Freetype) + # If no version was specified, set default + if(NOT DEFINED Freetype_FIND_VERSION) + set(Freetype_FIND_VERSION "2") + endif() + + # Check if requested Freetype version is valid + # Emscripten SDK only provides Freetype 2.x + if((Freetype_FIND_VERSION VERSION_LESS "2") OR (Freetype_FIND_VERSION VERSION_GREATER_EQUAL "3")) + message(FATAL_ERROR "The requested Freetype version ${Freetype_FIND_VERSION} is invalid.") + endif() + + # Emscripten includes Freetype support as part of it's SDK, meaning there's no need to find it + set(Freetype_FOUND TRUE) + add_library(Freetype::Freetype INTERFACE IMPORTED) + + # Set found Freetype version + # Version set based on latest Emscripten SDK at the time of writing this file + set(FREETYPE_VERSION_STRING "2.6") + + # Enable compilation and linking against Freetype + target_compile_options(Freetype::Freetype INTERFACE "-sUSE_FREETYPE=1") + target_link_libraries(Freetype::Freetype INTERFACE "-sUSE_FREETYPE=1") + + # Get final compiler and linker flags to print them + get_target_property(Freetype_COMPILE_FLAGS Freetype::Freetype "INTERFACE_COMPILE_OPTIONS") + get_target_property(Freetype_LINK_FLAGS Freetype::Freetype "INTERFACE_LINK_OPTIONS") + + find_package_message( + "Freetype" + "Freetype ${FREETYPE_VERSION_STRING} has been found as part of the Emscripten SDK." + "[${Freetype_COMPILE_FLAGS}][${Freetype_LINK_FLAGS}]" + ) + + # Clean scope + unset(Freetype_COMPILE_FLAGS) + unset(Freetype_LINK_FLAGS) +else() + # Since the target already exists, we declare it as found + set(Freetype_FOUND TRUE) + if(NOT DEFINED Freetype_VERSION) + set(Freetype_VERSION "UNKNOWN") + endif() endif() - -# Check if requested Freetype version is valid -# Emscripten SDK only provides Freetype 2.x -if((Freetype_FIND_VERSION VERSION_LESS "2") OR (Freetype_FIND_VERSION VERSION_GREATER_EQUAL "3")) - message(FATAL_ERROR "The requested Freetype version ${Freetype_FIND_VERSION} is invalid.") -endif() - -# Emscripten includes Freetype support as part of it's SDK, meaning there's no need to find it -set(Freetype_FOUND TRUE) -add_library(Freetype::Freetype INTERFACE IMPORTED) - -# Set found Freetype version -# Version set based on latest Emscripten SDK at the time of writing this file -set(FREETYPE_VERSION_STRING "2.6") - -# Enable compilation and linking against Freetype -target_compile_options(Freetype::Freetype INTERFACE "-sUSE_FREETYPE=1") -target_link_libraries(Freetype::Freetype INTERFACE "-sUSE_FREETYPE=1") - -# Get final compiler and linker flags to print them -get_target_property(Freetype_COMPILE_FLAGS Freetype::Freetype "INTERFACE_COMPILE_OPTIONS") -get_target_property(Freetype_LINK_FLAGS Freetype::Freetype "INTERFACE_LINK_OPTIONS") - -find_package_message( - "Freetype" - "Freetype ${FREETYPE_VERSION_STRING} has been found as part of the Emscripten SDK." - "[${Freetype_COMPILE_FLAGS}][${Freetype_LINK_FLAGS}]" -) - -# Clean scope -unset(Freetype_COMPILE_FLAGS) -unset(Freetype_LINK_FLAGS) diff --git a/CMake/Modules/Emscripten/FindOpenGL.cmake b/CMake/Modules/Emscripten/FindOpenGL.cmake index 41881a4cd..c984d57b6 100644 --- a/CMake/Modules/Emscripten/FindOpenGL.cmake +++ b/CMake/Modules/Emscripten/FindOpenGL.cmake @@ -18,56 +18,64 @@ include(FindPackageHandleStandardArgs) include(FindPackageMessage) -# If no version was specified, set default -if(NOT DEFINED OpenGL_FIND_VERSION) - set(OpenGL_FIND_VERSION "3") -endif() +if(NOT TARGET OpenGL::GL) + # If no version was specified, set default + if(NOT DEFINED OpenGL_FIND_VERSION) + set(OpenGL_FIND_VERSION "3") + endif() -# Check if requested OpenGL version is valid -if((OpenGL_FIND_VERSION VERSION_LESS "1") OR (OpenGL_FIND_VERSION VERSION_GREATER_EQUAL "4")) - message(FATAL_ERROR "The requested OpenGL version ${OpenGL_FIND_VERSION} is invalid.") -endif() + # Check if requested OpenGL version is valid + if((OpenGL_FIND_VERSION VERSION_LESS "1") OR (OpenGL_FIND_VERSION VERSION_GREATER_EQUAL "4")) + message(FATAL_ERROR "The requested OpenGL version ${OpenGL_FIND_VERSION} is invalid.") + endif() -# Emscripten includes OpenGL ES support as part of it's SDK, meaning there's no need to find it -set(OpenGL_FOUND TRUE) -add_library(OpenGL::GL INTERFACE IMPORTED) + # Emscripten includes OpenGL ES support as part of it's SDK, meaning there's no need to find it + set(OpenGL_FOUND TRUE) + add_library(OpenGL::GL INTERFACE IMPORTED) -# Set found OpenGL version -if((OpenGL_FIND_VERSION VERSION_GREATER_EQUAL "1") AND (OpenGL_FIND_VERSION VERSION_LESS "2")) - set(OpenGL_VERSION "1") -elseif((OpenGL_FIND_VERSION VERSION_GREATER_EQUAL "2") AND (OpenGL_FIND_VERSION VERSION_LESS "3")) - set(OpenGL_VERSION "2") -elseif((OpenGL_FIND_VERSION VERSION_GREATER_EQUAL "3") AND (OpenGL_FIND_VERSION VERSION_LESS "4")) - set(OpenGL_VERSION "3") -endif() + # Set found OpenGL version + if((OpenGL_FIND_VERSION VERSION_GREATER_EQUAL "1") AND (OpenGL_FIND_VERSION VERSION_LESS "2")) + set(OpenGL_VERSION "1") + elseif((OpenGL_FIND_VERSION VERSION_GREATER_EQUAL "2") AND (OpenGL_FIND_VERSION VERSION_LESS "3")) + set(OpenGL_VERSION "2") + elseif((OpenGL_FIND_VERSION VERSION_GREATER_EQUAL "3") AND (OpenGL_FIND_VERSION VERSION_LESS "4")) + set(OpenGL_VERSION "3") + endif() -#[[ - The Emscripten SDK already makes OpenGL available by default without any additional configuration. - However, additional settings might be needed in some cases. -]] + #[[ + The Emscripten SDK already makes OpenGL available by default without any additional configuration. + However, additional settings might be needed in some cases. + ]] -# Handle OpenGL 1 edge case -# More info: https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html#emulation-of-older-desktop-opengl-api-features -if(OpenGL_VERSION VERSION_EQUAL "1") - target_link_libraries(OpenGL::GL INTERFACE "-sLEGACY_GL_EMULATION") -endif() + # Handle OpenGL 1 edge case + # More info: https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html#emulation-of-older-desktop-opengl-api-features + if(OpenGL_VERSION VERSION_EQUAL "1") + target_link_libraries(OpenGL::GL INTERFACE "-sLEGACY_GL_EMULATION") + endif() -# Handle OpenGL ES software emulation -# More info: https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html#opengl-es-2-0-3-0-emulation -if(OpenGL_ENABLE_EMULATION AND OpenGL_VERSION VERSION_GREATER_EQUAL "2") - target_link_libraries(OpenGL::GL INTERFACE "-sFULL_ES${OpenGL_VERSION}") -endif() + # Handle OpenGL ES software emulation + # More info: https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html#opengl-es-2-0-3-0-emulation + if(OpenGL_ENABLE_EMULATION AND OpenGL_VERSION VERSION_GREATER_EQUAL "2") + target_link_libraries(OpenGL::GL INTERFACE "-sFULL_ES${OpenGL_VERSION}") + endif() -# Get final compiler and linker flags to print them -get_target_property(OpenGL_COMPILE_FLAGS OpenGL::GL "INTERFACE_COMPILE_OPTIONS") -get_target_property(OpenGL_LINK_FLAGS OpenGL::GL "INTERFACE_LINK_OPTIONS") + # Get final compiler and linker flags to print them + get_target_property(OpenGL_COMPILE_FLAGS OpenGL::GL "INTERFACE_COMPILE_OPTIONS") + get_target_property(OpenGL_LINK_FLAGS OpenGL::GL "INTERFACE_LINK_OPTIONS") -find_package_message( - "OpenGL" - "OpenGL ${OpenGL_VERSION} has been found as part of the Emscripten SDK." - "[${OpenGL_COMPILE_FLAGS}][${OpenGL_LINK_FLAGS}]" -) + find_package_message( + "OpenGL" + "OpenGL ${OpenGL_VERSION} has been found as part of the Emscripten SDK." + "[${OpenGL_COMPILE_FLAGS}][${OpenGL_LINK_FLAGS}]" + ) -# Clean scope -unset(OpenGL_COMPILE_FLAGS) -unset(OpenGL_LINK_FLAGS) + # Clean scope + unset(OpenGL_COMPILE_FLAGS) + unset(OpenGL_LINK_FLAGS) +else() + # Since the target already exists, we declare it as found + set(OpenGL_FOUND TRUE) + if(NOT DEFINED OpenGL_VERSION) + set(OpenGL_VERSION "UNKNOWN") + endif() +endif() diff --git a/CMake/Modules/Emscripten/FindSDL2.cmake b/CMake/Modules/Emscripten/FindSDL2.cmake index 4ff0640c9..8b7bd5d8a 100644 --- a/CMake/Modules/Emscripten/FindSDL2.cmake +++ b/CMake/Modules/Emscripten/FindSDL2.cmake @@ -17,42 +17,50 @@ include(FindPackageHandleStandardArgs) include(FindPackageMessage) -# If no version was specified, set default -if(NOT DEFINED SDL2_FIND_VERSION) - set(SDL2_FIND_VERSION "2") -endif() +if(NOT TARGET SDL2::SDL2) + # If no version was specified, set default + if(NOT DEFINED SDL2_FIND_VERSION) + set(SDL2_FIND_VERSION "2") + endif() -# Check if requested SDL version is valid -if((SDL2_FIND_VERSION VERSION_LESS "2") OR (SDL2_FIND_VERSION VERSION_GREATER_EQUAL "3")) - message(FATAL_ERROR "The requested SDL2 version ${SDL2_FIND_VERSION} is invalid.") -endif() + # Check if requested SDL version is valid + if((SDL2_FIND_VERSION VERSION_LESS "2") OR (SDL2_FIND_VERSION VERSION_GREATER_EQUAL "3")) + message(FATAL_ERROR "The requested SDL2 version ${SDL2_FIND_VERSION} is invalid.") + endif() -# Emscripten includes SDL support as part of it's SDK, meaning there's no need to find it -set(SDL2_FOUND TRUE) -add_library(SDL2::SDL2 INTERFACE IMPORTED) + # Emscripten includes SDL support as part of it's SDK, meaning there's no need to find it + set(SDL2_FOUND TRUE) + add_library(SDL2::SDL2 INTERFACE IMPORTED) -# Set found SDL version based on latest Emscripten SDK at the time of writing this file -# Version set based on latest Emscripten SDK at the time of writing this file -set(SDL2_VERSION "2.24.2") + # Set found SDL version based on latest Emscripten SDK at the time of writing this file + # Version set based on latest Emscripten SDK at the time of writing this file + set(SDL2_VERSION "2.24.2") -# Version number to pass to compiler -set(SDL2_EMSCRIPTEN_COMPILER_SELECTED_VERSION "2") + # Version number to pass to compiler + set(SDL2_EMSCRIPTEN_COMPILER_SELECTED_VERSION "2") -# Enable compilation and linking against SDL -target_compile_options(SDL2::SDL2 INTERFACE "-sUSE_SDL=${SDL2_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") -target_link_libraries(SDL2::SDL2 INTERFACE "-sUSE_SDL=${SDL2_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") + # Enable compilation and linking against SDL + target_compile_options(SDL2::SDL2 INTERFACE "-sUSE_SDL=${SDL2_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") + target_link_libraries(SDL2::SDL2 INTERFACE "-sUSE_SDL=${SDL2_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") -# Get final compiler and linker flags to print them -get_target_property(SDL2_COMPILE_FLAGS SDL2::SDL2 "INTERFACE_COMPILE_OPTIONS") -get_target_property(SDL2_LINK_FLAGS SDL2::SDL2 "INTERFACE_LINK_OPTIONS") + # Get final compiler and linker flags to print them + get_target_property(SDL2_COMPILE_FLAGS SDL2::SDL2 "INTERFACE_COMPILE_OPTIONS") + get_target_property(SDL2_LINK_FLAGS SDL2::SDL2 "INTERFACE_LINK_OPTIONS") -find_package_message( - "SDL2" - "SDL ${SDL2_VERSION} has been found as part of the Emscripten SDK." - "[${SDL2_COMPILE_FLAGS}][${SDL2_LINK_FLAGS}]" -) + find_package_message( + "SDL2" + "SDL ${SDL2_VERSION} has been found as part of the Emscripten SDK." + "[${SDL2_COMPILE_FLAGS}][${SDL2_LINK_FLAGS}]" + ) -# Clean scope -unset(SDL2_COMPILE_FLAGS) -unset(SDL2_COMPILE_FLAGS) -unset(SDL2_EMSCRIPTEN_COMPILER_SELECTED_VERSION) + # Clean scope + unset(SDL2_COMPILE_FLAGS) + unset(SDL2_COMPILE_FLAGS) + unset(SDL2_EMSCRIPTEN_COMPILER_SELECTED_VERSION) +else() + # Since the target already exists, we declare it as found + set(SDL2_FOUND TRUE) + if(NOT DEFINED SDL2_VERSION) + set(SDL2_VERSION "UNKNOWN") + endif() +endif() diff --git a/CMake/Modules/Emscripten/FindSDL2_image.cmake b/CMake/Modules/Emscripten/FindSDL2_image.cmake index 9d3a33f47..3ccf68175 100644 --- a/CMake/Modules/Emscripten/FindSDL2_image.cmake +++ b/CMake/Modules/Emscripten/FindSDL2_image.cmake @@ -17,47 +17,55 @@ include(FindPackageHandleStandardArgs) include(FindPackageMessage) -# If no version was specified, set default -if(NOT DEFINED SDL2_image_FIND_VERSION) - set(SDL2_image_FIND_VERSION "2") -endif() +if(NOT TARGET SDL2_image::SDL2_image) + # If no version was specified, set default + if(NOT DEFINED SDL2_image_FIND_VERSION) + set(SDL2_image_FIND_VERSION "2") + endif() -# Check if requested SDL version is valid -if((SDL2_image_FIND_VERSION VERSION_LESS "2") OR (SDL2_image_FIND_VERSION VERSION_GREATER_EQUAL "3")) - message(FATAL_ERROR "The requested SDL2_image version ${SDL2_image_FIND_VERSION} is invalid.") -endif() + # Check if requested SDL version is valid + if((SDL2_image_FIND_VERSION VERSION_LESS "2") OR (SDL2_image_FIND_VERSION VERSION_GREATER_EQUAL "3")) + message(FATAL_ERROR "The requested SDL2_image version ${SDL2_image_FIND_VERSION} is invalid.") + endif() -message(WARNING - "SDL_image with Emscripten can only be used if SDL usage is also enabled. " - "The version number of both libraries must match as well." -) + message(WARNING + "SDL_image with Emscripten can only be used if SDL usage is also enabled. " + "The version number of both libraries must match as well." + ) -# Emscripten includes SDL support as part of it's SDK, meaning there's no need to find it -set(SDL2_image_FOUND TRUE) -add_library(SDL2_image::SDL2_image INTERFACE IMPORTED) + # Emscripten includes SDL support as part of it's SDK, meaning there's no need to find it + set(SDL2_image_FOUND TRUE) + add_library(SDL2_image::SDL2_image INTERFACE IMPORTED) -# Set found SDL_image version based on latest Emscripten SDK at the time of writing this file -# Version set based on latest Emscripten SDK at the time of writing this file -set(SDL2_image_VERSION "2.24.2") + # Set found SDL_image version based on latest Emscripten SDK at the time of writing this file + # Version set based on latest Emscripten SDK at the time of writing this file + set(SDL2_image_VERSION "2.24.2") -# Version number to pass to compiler -set(SDL2_image_EMSCRIPTEN_COMPILER_SELECTED_VERSION "2") + # Version number to pass to compiler + set(SDL2_image_EMSCRIPTEN_COMPILER_SELECTED_VERSION "2") -# Enable compilation and linking against SDL -target_compile_options(SDL2_image::SDL2_image INTERFACE "-sUSE_SDL_IMAGE=${SDL2_image_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") -target_link_libraries(SDL2_image::SDL2_image INTERFACE "-sUSE_SDL_IMAGE=${SDL2_image_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") + # Enable compilation and linking against SDL + target_compile_options(SDL2_image::SDL2_image INTERFACE "-sUSE_SDL_IMAGE=${SDL2_image_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") + target_link_libraries(SDL2_image::SDL2_image INTERFACE "-sUSE_SDL_IMAGE=${SDL2_image_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") -# Get final compiler and linker flags to print them -get_target_property(SDL2_image_COMPILE_FLAGS SDL2_image::SDL2_image "INTERFACE_COMPILE_OPTIONS") -get_target_property(SDL2_image_LINK_FLAGS SDL2_image::SDL2_image "INTERFACE_LINK_OPTIONS") + # Get final compiler and linker flags to print them + get_target_property(SDL2_image_COMPILE_FLAGS SDL2_image::SDL2_image "INTERFACE_COMPILE_OPTIONS") + get_target_property(SDL2_image_LINK_FLAGS SDL2_image::SDL2_image "INTERFACE_LINK_OPTIONS") -find_package_message( - "SDL2_image" - "SDL_image ${SDL2_image_VERSION} has been found as part of the Emscripten SDK." - "[${SDL2_image_COMPILE_FLAGS}][${SDL2_image_LINK_FLAGS}]" -) + find_package_message( + "SDL2_image" + "SDL_image ${SDL2_image_VERSION} has been found as part of the Emscripten SDK." + "[${SDL2_image_COMPILE_FLAGS}][${SDL2_image_LINK_FLAGS}]" + ) -# Clean scope -unset(SDL2_image_COMPILE_FLAGS) -unset(SDL2_image_COMPILE_FLAGS) -unset(SDL2_image_EMSCRIPTEN_COMPILER_SELECTED_VERSION) + # Clean scope + unset(SDL2_image_COMPILE_FLAGS) + unset(SDL2_image_COMPILE_FLAGS) + unset(SDL2_image_EMSCRIPTEN_COMPILER_SELECTED_VERSION) +else() + # Since the target already exists, we declare it as found + set(SDL2_image_FOUND TRUE) + if(NOT DEFINED SDL2_image_VERSION) + set(SDL2_image_VERSION "UNKNOWN") + endif() +endif() diff --git a/CMake/Modules/Emscripten/Findglfw3.cmake b/CMake/Modules/Emscripten/Findglfw3.cmake index 1dc949c34..a42c25f12 100644 --- a/CMake/Modules/Emscripten/Findglfw3.cmake +++ b/CMake/Modules/Emscripten/Findglfw3.cmake @@ -17,42 +17,50 @@ include(FindPackageHandleStandardArgs) include(FindPackageMessage) -# If no version was specified, set default -if(NOT DEFINED glfw3_FIND_VERSION) - set(glfw3_FIND_VERSION "1") -endif() +if(NOT TARGET glfw) + # If no version was specified, set default + if(NOT DEFINED glfw3_FIND_VERSION) + set(glfw3_FIND_VERSION "1") + endif() -# Check if requested GLFW version is valid -if((glfw3_FIND_VERSION VERSION_LESS "3") OR (glfw3_FIND_VERSION VERSION_GREATER_EQUAL "4")) - message(FATAL_ERROR "The requested GLFW version ${glfw3_FIND_VERSION} is invalid.") -endif() + # Check if requested GLFW version is valid + if((glfw3_FIND_VERSION VERSION_LESS "3") OR (glfw3_FIND_VERSION VERSION_GREATER_EQUAL "4")) + message(FATAL_ERROR "The requested GLFW version ${glfw3_FIND_VERSION} is invalid.") + endif() -# Emscripten includes GLFW support as part of it's SDK, meaning there's no need to find it -set(glfw3_FOUND TRUE) -add_library(glfw INTERFACE IMPORTED) + # Emscripten includes GLFW support as part of it's SDK, meaning there's no need to find it + set(glfw3_FOUND TRUE) + add_library(glfw INTERFACE IMPORTED) -# Set found GLFW version based on latest Emscripten SDK at the time of writing this file -# Version set based on latest Emscripten SDK at the time of writing this file -set(glfw3_VERSION "3") + # Set found GLFW version based on latest Emscripten SDK at the time of writing this file + # Version set based on latest Emscripten SDK at the time of writing this file + set(glfw3_VERSION "3") -# Version number to pass to compiler -set(glfw3_EMSCRIPTEN_COMPILER_SELECTED_VERSION ${glfw3_VERSION}) + # Version number to pass to compiler + set(glfw3_EMSCRIPTEN_COMPILER_SELECTED_VERSION ${glfw3_VERSION}) -# Enable compilation and linking against GLFW -target_compile_options(glfw INTERFACE "-sUSE_GLFW=${glfw3_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") -target_link_libraries(glfw INTERFACE "-sUSE_GLFW=${glfw3_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") + # Enable compilation and linking against GLFW + target_compile_options(glfw INTERFACE "-sUSE_GLFW=${glfw3_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") + target_link_libraries(glfw INTERFACE "-sUSE_GLFW=${glfw3_EMSCRIPTEN_COMPILER_SELECTED_VERSION}") -# Get final compiler and linker flags to print them -get_target_property(glfw3_COMPILE_FLAGS glfw "INTERFACE_COMPILE_OPTIONS") -get_target_property(glfw3_LINK_FLAGS glfw "INTERFACE_LINK_OPTIONS") + # Get final compiler and linker flags to print them + get_target_property(glfw3_COMPILE_FLAGS glfw "INTERFACE_COMPILE_OPTIONS") + get_target_property(glfw3_LINK_FLAGS glfw "INTERFACE_LINK_OPTIONS") -find_package_message( - "glfw3" - "GLFW ${glfw3_VERSION} has been found as part of the Emscripten SDK." - "[${glfw3_COMPILE_FLAGS}][${glfw3_LINK_FLAGS}]" -) + find_package_message( + "glfw3" + "GLFW ${glfw3_VERSION} has been found as part of the Emscripten SDK." + "[${glfw3_COMPILE_FLAGS}][${glfw3_LINK_FLAGS}]" + ) -# Clean scope -unset(glfw3_COMPILE_FLAGS) -unset(glfw3_COMPILE_FLAGS) -unset(glfw3_EMSCRIPTEN_COMPILER_SELECTED_VERSION) \ No newline at end of file + # Clean scope + unset(glfw3_COMPILE_FLAGS) + unset(glfw3_COMPILE_FLAGS) + unset(glfw3_EMSCRIPTEN_COMPILER_SELECTED_VERSION) +else() + # Since the target already exists, we declare it as found + set(glfw3_FOUND TRUE) + if(NOT DEFINED glfw3_VERSION) + set(glfw3_VERSION "UNKNOWN") + endif() +endif() From 62f28e7bb50180e7040f09d3f3e1c5dbc70954ea Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Mon, 11 Sep 2023 10:56:53 +0200 Subject: [PATCH 16/29] Remove SDK notice due to not found native libs --- CMake/SamplesShellDependencies.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMake/SamplesShellDependencies.cmake b/CMake/SamplesShellDependencies.cmake index 49e7cc232..92e2dcd81 100644 --- a/CMake/SamplesShellDependencies.cmake +++ b/CMake/SamplesShellDependencies.cmake @@ -15,8 +15,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows") # Required to use the functions from the shlwapi.h header find_library(Shlwapi NAMES "Shlwapi" "Shlwapi.lib" "Shlwapi.dll") if(NOT Shlwapi) - report_not_found_native_library("Shlwapi") + # report_not_found_native_library("Shlwapi") + # Many platform libraries are still available to linkers even if CMake cannot find them # Ignore the fact that the Shlwapi wasn't found and try to link against it anyway set(Shlwapi "Shlwapi") endif() @@ -30,8 +31,9 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") # Required to use the functions from the Cocoa framework find_library(Cocoa NAMES "Cocoa" "Cocoa.framework") if(NOT Cocoa) - report_not_found_native_library("Cocoa") + # report_not_found_native_library("Cocoa") + # Many platform libraries are still available to linkers even if CMake cannot find them # Ignore the fact that the Cocoa wasn't found and try to link against it anyway set(Cocoa "Cocoa") endif() From fa672572965a02fc8372e657a8b667375992e7b9 Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Mon, 11 Sep 2023 11:53:17 +0200 Subject: [PATCH 17/29] Respect chosen runtime output directory --- Samples/CMakeLists.txt | 5 ++++- Source/CMakeLists.txt | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Samples/CMakeLists.txt b/Samples/CMakeLists.txt index f439baebe..523afb2d5 100644 --- a/Samples/CMakeLists.txt +++ b/Samples/CMakeLists.txt @@ -29,7 +29,10 @@ include("${PROJECT_SOURCE_DIR}/CMake/SamplesShellDependencies.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") +# The set() call is guarded against pre-definitions in order to respect consumer choice +if(NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") +endif() # Add shell library for the samples add_subdirectory("shell") diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 1c1bf72e1..8ff086592 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -1,7 +1,10 @@ # Change the runtime output directory of all target declared in this scope # This is needed so that in the event of building the project as a shared # library, all DLLs required by samples will be properly found in Windows -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") +# The set() call is guarded against pre-definitions in order to respect consumer choice +if(NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") +endif() # Add plugin directories if(RMLUI_ENABLE_LOTTIE_PLUGIN) From 26da46f88e80432604f2e87ed664022e53ad6521 Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Mon, 11 Sep 2023 12:11:13 +0200 Subject: [PATCH 18/29] Find SDL2 as soft dependency --- CMake/BackendsDependencies.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMake/BackendsDependencies.cmake b/CMake/BackendsDependencies.cmake index 1cf7843ec..0ab8a8b49 100644 --- a/CMake/BackendsDependencies.cmake +++ b/CMake/BackendsDependencies.cmake @@ -15,7 +15,7 @@ if(RMLUI_SAMPLES_BACKEND MATCHES "^SDL") # Although the official CMake find module is called FindSDL.cmake, the official config module # provided by the SDL package for its version 2 is called SDL2Config.cmake # Following this trend, the official SDL config files change their name according to their major version number - find_package("SDL2" REQUIRED) + find_package("SDL2") #[[ Current code operates using a hybrid mode by detecting either the variable or the target due to the possibility From ea46ed4032f692ae7d694a4e4ef4fba4c0fb726a Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Mon, 11 Sep 2023 12:38:32 +0200 Subject: [PATCH 19/29] Accommodate automatic selection of samples backend --- Samples/CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Samples/CMakeLists.txt b/Samples/CMakeLists.txt index 523afb2d5..432abcf28 100644 --- a/Samples/CMakeLists.txt +++ b/Samples/CMakeLists.txt @@ -7,7 +7,14 @@ if(RMLUI_FONT_INTERFACE STREQUAL "none") ) endif() -# Declare dependencies for sample backend +# Handle automatic selection of the backend if chosen +if(RMLUI_SAMPLES_BACKEND STREQUAL "auto") + # include("${PROJECT_SOURCE_DIR}/CMake/BackendsAutoSelection.cmake") + + message(STATUS "Automatic sample backend selection enabled. Chosen backend: ${RMLUI_SAMPLES_BACKEND}") +endif() + +# Declare dependencies for sample backends include("${PROJECT_SOURCE_DIR}/CMake/BackendsDependencies.cmake") # Add information about the available backends specified in CMake/Backends.cmake From 6b13b513ee3a00ece4201762a23c999df33ce023 Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Mon, 11 Sep 2023 13:35:33 +0200 Subject: [PATCH 20/29] Clean up Tests directory --- Tests/CMakeLists.txt | 110 ------------------------------------------- Tests/readme.md | 2 +- 2 files changed, 1 insertion(+), 111 deletions(-) delete mode 100644 Tests/CMakeLists.txt diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt deleted file mode 100644 index bc17d4aaa..000000000 --- a/Tests/CMakeLists.txt +++ /dev/null @@ -1,110 +0,0 @@ -#=================================== -# RmlUi tests definitions ========== -#=================================== -target_compile_definitions(RmlCore PUBLIC RMLUI_TESTS_ENABLED) - - -#=================================== -# Include dependencies ============= -#=================================== -function(include_dependency NAME) - set(DEPENDENCY_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/${NAME}) - set(DEPENDENCY_TARGET ${NAME}::${NAME}) - - add_library(${DEPENDENCY_TARGET} IMPORTED INTERFACE) - set_property(TARGET ${DEPENDENCY_TARGET} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${DEPENDENCY_INCLUDE_DIR}") -endfunction() - -include_dependency("doctest") -# Include doctest's discovery module -include(${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/doctest/cmake/doctest.cmake) - -include_dependency("nanobench") -include_dependency("lodepng") -include_dependency("trompeloeil") - -#=================================== -# Common source files ============== -#=================================== - -file(GLOB TestsCommon_HDR_FILES ${CMAKE_CURRENT_SOURCE_DIR}/Source/Common/*.h ) -file(GLOB TestsCommon_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/Source/Common/*.cpp ) - -#=================================== -# Unit Tests ======================= -#=================================== - -file(GLOB UnitTests_HDR_FILES ${CMAKE_CURRENT_SOURCE_DIR}/Source/UnitTests/*.h ) -file(GLOB UnitTests_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/Source/UnitTests/*.cpp ) - -add_executable(UnitTests ${UnitTests_HDR_FILES} ${UnitTests_SRC_FILES}) -target_link_libraries(UnitTests RmlCore RmlDebugger doctest::doctest trompeloeil::trompeloeil ${sample_LIBRARIES}) -add_common_target_options(UnitTests) - -if(MSVC) - target_compile_definitions(UnitTests PUBLIC DOCTEST_CONFIG_USE_STD_HEADERS) -endif() - -doctest_discover_tests(UnitTests) - - - -#=================================== -# Visual Tests ===================== -#=================================== - -file(GLOB VisualTests_HDR_FILES ${CMAKE_CURRENT_SOURCE_DIR}/Source/VisualTests/*.h ) -file(GLOB VisualTests_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/Source/VisualTests/*.cpp ) - -if(WIN32) - add_executable(VisualTests WIN32 ${VisualTests_HDR_FILES} ${VisualTests_SRC_FILES}) -else() - add_executable(VisualTests ${VisualTests_HDR_FILES} ${VisualTests_SRC_FILES}) -endif() - -target_link_libraries(VisualTests RmlCore RmlDebugger lodepng::lodepng ${sample_LIBRARIES}) -add_common_target_options(VisualTests) - -if(VISUAL_TESTS_RML_DIRECTORIES) - target_compile_definitions(VisualTests PRIVATE RMLUI_VISUAL_TESTS_RML_DIRECTORIES="${VISUAL_TESTS_RML_DIRECTORIES}") -endif() -if(VISUAL_TESTS_COMPARE_DIRECTORY) - target_compile_definitions(VisualTests PRIVATE RMLUI_VISUAL_TESTS_COMPARE_DIRECTORY="${VISUAL_TESTS_COMPARE_DIRECTORY}") -endif() -if(VISUAL_TESTS_CAPTURE_DIRECTORY) - target_compile_definitions(VisualTests PRIVATE RMLUI_VISUAL_TESTS_CAPTURE_DIRECTORY="${VISUAL_TESTS_CAPTURE_DIRECTORY}") -endif() - -if(MSVC) - target_compile_definitions(VisualTests PUBLIC DOCTEST_CONFIG_USE_STD_HEADERS) -endif() - - - -#=================================== -# Benchmarks ======================= -#=================================== - -file(GLOB Benchmarks_HDR_FILES ${CMAKE_CURRENT_SOURCE_DIR}/Source/Benchmarks/*.h ) -file(GLOB Benchmarks_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/Source/Benchmarks/*.cpp ) - -add_executable(Benchmarks ${Benchmarks_HDR_FILES} ${Benchmarks_SRC_FILES} ${TestsCommon_HDR_FILES} ${TestsCommon_SRC_FILES}) -target_link_libraries(Benchmarks RmlCore RmlDebugger doctest::doctest nanobench::nanobench ${sample_LIBRARIES}) -add_common_target_options(Benchmarks) - -if(MSVC) - target_compile_definitions(Benchmarks PUBLIC DOCTEST_CONFIG_USE_STD_HEADERS) -endif() - - - -#=================================== -# Emscripten assets ================ -#=================================== - -if(EMSCRIPTEN) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -sLLD_REPORT_UNDEFINED --preload-file ${CMAKE_CURRENT_SOURCE_DIR}/Data/@/Tests/Data/") - - # Benchmarks additionally use the benchmark sample data. - target_link_libraries(Benchmarks "--preload-file ${CMAKE_CURRENT_SOURCE_DIR}/../Samples/basic/benchmark/data/@/Samples/basic/benchmark/data/") -endif() diff --git a/Tests/readme.md b/Tests/readme.md index 71511a77d..5c0aff4db 100644 --- a/Tests/readme.md +++ b/Tests/readme.md @@ -31,7 +31,7 @@ This directory contains additional libraries used by the test suite. By default, the visual tests will output screenshots and diff images into this directory, and read previous screenshots from this directory. -Use the CMake options `VISUAL_TESTS_OUTPUT_DIRECTORY` and `VISUAL_TESTS_INPUT_DIRECTORY` to specify other directories. +Use the CMake options `RMLUI_VISUAL_TESTS_OUTPUT_DIRECTORY` and `RMLUI_VISUAL_TESTS_INPUT_DIRECTORY` to specify other directories. #### `Source` From 72861917ec4b102f48178888622a0c83cf4483db Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Mon, 11 Sep 2023 23:03:39 +0200 Subject: [PATCH 21/29] Use GLVND as preferred OpenGL ABI on Linux --- CMake/BackendsDependencies.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMake/BackendsDependencies.cmake b/CMake/BackendsDependencies.cmake index 0ab8a8b49..1300f8d2d 100644 --- a/CMake/BackendsDependencies.cmake +++ b/CMake/BackendsDependencies.cmake @@ -193,6 +193,11 @@ endif() # --- Rendering APIs --- # OpenGL + +# Set preferred OpenGL ABI on Linux for target OpenGL::GL +# More info: https://cmake.org/cmake/help/latest/module/FindOpenGL.html#linux-specific +set(OpenGL_GL_PREFERENCE "GLVND") + # RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE: # OpenGL handling changes in CMake 3.11, requiring to set CMake policy CMP0072 # More info: https://cmake.org/cmake/help/latest/policy/CMP0072.html From 17fc5d0ef7a8ab4d10707faf2983c6e6f2c9bb1f Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Sat, 2 Dec 2023 17:46:12 +0100 Subject: [PATCH 22/29] Correct logic for the Freetype pre-proc definition Previous changes only involved the name of the definition, but not its logic on the source files that referenced it nor code on the CMake files --- Source/Core/CMakeLists.txt | 4 ++-- Source/Core/Core.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Core/CMakeLists.txt b/Source/Core/CMakeLists.txt index 5e54ec4b3..7a296c45d 100644 --- a/Source/Core/CMakeLists.txt +++ b/Source/Core/CMakeLists.txt @@ -374,8 +374,8 @@ if(RMLUI_FONT_INTERFACE STREQUAL "freetype") # the build system if the default font interface is disabled add_subdirectory("FontEngineDefault") target_link_libraries(rmlui_core PRIVATE rmlui_core_fontenginedefault) -else() - # Pass information to code via compile definition + + # Pass information to code via pre-processor definition target_compile_definitions(rmlui_core PRIVATE "RMLUI_FONT_INTERFACE_FREETYPE") endif() diff --git a/Source/Core/Core.cpp b/Source/Core/Core.cpp index 9d8d0d16b..217b46deb 100644 --- a/Source/Core/Core.cpp +++ b/Source/Core/Core.cpp @@ -46,7 +46,7 @@ #include "TemplateCache.h" #include "TextureDatabase.h" -#ifndef RMLUI_FONT_INTERFACE_FREETYPE +#ifdef RMLUI_FONT_INTERFACE_FREETYPE #include "FontEngineDefault/FontEngineInterfaceDefault.h" #endif @@ -122,7 +122,7 @@ bool Initialise() if (!font_interface) { -#ifndef RMLUI_FONT_INTERFACE_FREETYPE +#ifdef RMLUI_FONT_INTERFACE_FREETYPE default_font_interface = MakeUnique(); font_interface = default_font_interface.get(); #else From a07be672eff6d1a8ad9312f96ba15d7a1f4e3c27 Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Sat, 2 Dec 2023 17:53:50 +0100 Subject: [PATCH 23/29] Change options names according to new convention --- .github/workflows/build.yml | 10 +++++----- CMake/Dependencies.cmake | 2 +- CMakeLists.txt | 8 ++++---- Samples/basic/CMakeLists.txt | 4 ++-- Source/CMakeLists.txt | 2 +- Source/Core/CMakeLists.txt | 2 +- Source/Core/Core.cpp | 8 ++++---- Source/Lottie/CMakeLists.txt | 2 +- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 02edf6776..2fd403b7b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,7 +23,7 @@ jobs: cmake_options: -DRMLUI_SAMPLES_BACKEND=SDL_VK - cmake_options: -DRMLUI_BUILD_TESTING=ON -DRMLUI_ENABLE_PRECOMPILED_HEADERS=OFF enable_testing: true - - cmake_options: -DRMLUI_ENABLE_LOTTIE_PLUGIN=ON -DRMLUI_SAMPLES_BACKEND=X11_GL2 + - cmake_options: -DRMLUI_LOTTIE_PLUGIN=ON -DRMLUI_SAMPLES_BACKEND=X11_GL2 - cmake_options: -DRMLUI_DISABLE_RTTI_AND_EXCEPTIONS=ON -DRMLUI_SAMPLES_BACKEND=SDL_GL2 - cmake_options: -DRMLUI_NO_THIRDPARTY_CONTAINERS=ON -DRMLUI_SAMPLES_BACKEND=SFML_GL2 - cmake_options: -DRMLUI_SAMPLES_BACKEND=SDL_VK -DRMLUI_VK_DEBUG=ON -DRMLUI_ENABLE_PRECOMPILED_HEADERS=OFF -DCMAKE_BUILD_TYPE=Debug @@ -42,7 +42,7 @@ jobs: - name: Configure CMake working-directory: ${{github.workspace}}/Build run: >- - cmake $GITHUB_WORKSPACE -G Ninja -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DRMLUI_BUILD_LUA_BINDINGS=ON -DRMLUI_BUILD_SAMPLES=ON -DWARNINGS_AS_ERRORS=ON + cmake $GITHUB_WORKSPACE -G Ninja -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DRMLUI_BUILD_LUA_BINDINGS=ON -DRMLUI_SAMPLES=ON -DWARNINGS_AS_ERRORS=ON -DCMAKE_MODULE_PATH=$GITHUB_WORKSPACE/CMake/Modules/CI/Linux ${{ matrix.cmake_options }} @@ -81,7 +81,7 @@ jobs: - name: Configure CMake working-directory: ${{github.workspace}}/Build run: >- - cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DRMLUI_BUILD_LUA_BINDINGS=ON -DRMLUI_BUILD_SAMPLES=ON -DWARNINGS_AS_ERRORS=ON + cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DRMLUI_BUILD_LUA_BINDINGS=ON -DRMLUI_SAMPLES=ON -DWARNINGS_AS_ERRORS=ON ${{ matrix.cmake_options }} - name: Build @@ -123,7 +123,7 @@ jobs: - name: Configure CMake working-directory: ${{github.workspace}}/Build run: >- - cmake $env:GITHUB_WORKSPACE -A x64 -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=$env:BUILD_TYPE -DRMLUI_BUILD_LUA_BINDINGS=ON -DRMLUI_BUILD_SAMPLES=ON -DWARNINGS_AS_ERRORS=ON + cmake $env:GITHUB_WORKSPACE -A x64 -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=$env:BUILD_TYPE -DRMLUI_BUILD_LUA_BINDINGS=ON -DRMLUI_SAMPLES=ON -DWARNINGS_AS_ERRORS=ON -DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" ${{ matrix.cmake_options }} - name: Build @@ -155,7 +155,7 @@ jobs: - name: Configure CMake run: |- source ~/emsdk/emsdk_env.sh - cmake -S . -B Build -DCMAKE_BUILD_TYPE=Debug -DRMLUI_BUILD_SAMPLES=ON -DRMLUI_SAMPLES_BACKEND=SDL_GL3 \ + cmake -S . -B Build -DCMAKE_BUILD_TYPE=Debug -DRMLUI_SAMPLES=ON -DRMLUI_SAMPLES_BACKEND=SDL_GL3 \ -DBUILD_SHARED_LIBS=OFF -DWARNINGS_AS_ERRORS=ON -DRMLUI_EMSCRIPTEN_EXE_FLAGS="-O1" \ -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake \ -DCMAKE_MODULE_PATH=$GITHUB_WORKSPACE/CMake/Modules/Emscripten diff --git a/CMake/Dependencies.cmake b/CMake/Dependencies.cmake index 65dd9a46b..8c95cf3c2 100644 --- a/CMake/Dependencies.cmake +++ b/CMake/Dependencies.cmake @@ -28,7 +28,7 @@ if(RMLUI_FONT_INTERFACE STREQUAL "freetype") endif() # rlottie -if(RMLUI_ENABLE_LOTTIE_PLUGIN) +if(RMLUI_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") diff --git a/CMakeLists.txt b/CMakeLists.txt index 0fa943321..3b24880a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,9 +18,9 @@ set(CMAKE_CXX_EXTENSIONS OFF) # CMake GUI can group variables based on their prefix to make more clear # which options are specific to this project set(RMLUI_FONT_INTERFACE "freetype" CACHE STRING "Font interface to build RmlUi with. If set to \"none\", RmlUi won't be built with any of the included font interfaces and some samples might be disabled.") -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) -option(RMLUI_BUILD_SAMPLES "Build samples of the library." OFF) +option(RMLUI_LOTTIE_PLUGIN "Enable plugin for Lottie animations. Requires the rlottie library." OFF) +option(RMLUI_SVG_PLUGIN "Enable plugin for SVG images. Requires the lunasvg library." OFF) +option(RMLUI_SAMPLES "Build samples of the library." OFF) set(RMLUI_SAMPLES_BACKEND "GLFW_GL3" CACHE STRING "Backend to use when building the RmlUi samples. Choose one from ./CMake/Backends.cmake.") option(BUILD_SHARED_LIBS "CMake standard option. Choose whether to build RmlUi and RmlUi's debugger as shared libraries." ON) @@ -58,6 +58,6 @@ include("CMake/Dependencies.cmake") add_subdirectory("Source") # Add samples to the build project if enabled -if(RMLUI_BUILD_SAMPLES) +if(RMLUI_SAMPLES) add_subdirectory("Samples") endif() diff --git a/Samples/basic/CMakeLists.txt b/Samples/basic/CMakeLists.txt index 4ae83deb4..5ca5d73a0 100644 --- a/Samples/basic/CMakeLists.txt +++ b/Samples/basic/CMakeLists.txt @@ -4,8 +4,8 @@ add_subdirectory("demo") add_subdirectory("bitmapfont") # Negotiate inclusion of Lottie sample -if(RMLUI_ENABLE_LOTTIE_PLUGIN) +if(RMLUI_LOTTIE_PLUGIN) add_subdirectory("lottie") else() - message(NOTICE "Lottie sample disabled due to RMLUI_ENABLE_LOTTIE_PLUGIN=OFF") + message(NOTICE "Lottie sample disabled due to RMLUI_LOTTIE_PLUGIN=OFF") endif() diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 8ff086592..65172da8b 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -7,7 +7,7 @@ if(NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY) endif() # Add plugin directories -if(RMLUI_ENABLE_LOTTIE_PLUGIN) +if(RMLUI_LOTTIE_PLUGIN) add_subdirectory("Lottie") endif() diff --git a/Source/Core/CMakeLists.txt b/Source/Core/CMakeLists.txt index 7a296c45d..c2046dfc9 100644 --- a/Source/Core/CMakeLists.txt +++ b/Source/Core/CMakeLists.txt @@ -380,7 +380,7 @@ if(RMLUI_FONT_INTERFACE STREQUAL "freetype") endif() # Negotiate usage of the Lottie plugin -if(RMLUI_ENABLE_LOTTIE_PLUGIN) +if(RMLUI_LOTTIE_PLUGIN) # Link against the Lottie plugin target_link_libraries(rmlui_core PRIVATE rmlui_lottie) endif() diff --git a/Source/Core/Core.cpp b/Source/Core/Core.cpp index 217b46deb..d1d7ee3ce 100644 --- a/Source/Core/Core.cpp +++ b/Source/Core/Core.cpp @@ -50,11 +50,11 @@ #include "FontEngineDefault/FontEngineInterfaceDefault.h" #endif -#ifdef RMLUI_ENABLE_LOTTIE_PLUGIN +#ifdef RMLUI_LOTTIE_PLUGIN #include "../Lottie/LottiePlugin.h" #endif -#ifdef RMLUI_ENABLE_SVG_PLUGIN +#ifdef RMLUI_SVG_PLUGIN #include "../SVG/SVGPlugin.h" #endif @@ -140,10 +140,10 @@ bool Initialise() Factory::Initialise(); // Initialise plugins integrated with Core. -#ifdef RMLUI_ENABLE_LOTTIE_PLUGIN +#ifdef RMLUI_LOTTIE_PLUGIN Lottie::Initialise(); #endif -#ifdef RMLUI_ENABLE_SVG_PLUGIN +#ifdef RMLUI_SVG_PLUGIN SVG::Initialise(); #endif diff --git a/Source/Lottie/CMakeLists.txt b/Source/Lottie/CMakeLists.txt index cfd902133..5d7ca9652 100644 --- a/Source/Lottie/CMakeLists.txt +++ b/Source/Lottie/CMakeLists.txt @@ -26,4 +26,4 @@ target_sources(rmlui_lottie INTERFACE target_link_libraries(rmlui_lottie INTERFACE rlottie::rlottie) # Notify source files about the usage of the plugin -target_compile_definitions(rmlui_lottie INTERFACE "RMLUI_ENABLE_LOTTIE_PLUGIN") +target_compile_definitions(rmlui_lottie INTERFACE "RMLUI_LOTTIE_PLUGIN") From be27445360268bada784cce19ae79ffc13dbe09f Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Sat, 2 Dec 2023 18:01:15 +0100 Subject: [PATCH 24/29] Correct SFML handling - Remove all mention of SFML::Main - Remove handling code for SFML <= 2.4 - Make find_package() calls for SFML quiet --- CMake/Backends.cmake | 3 -- CMake/BackendsDependencies.cmake | 90 ++++++++++++-------------------- 2 files changed, 34 insertions(+), 59 deletions(-) diff --git a/CMake/Backends.cmake b/CMake/Backends.cmake index 594445873..8118621e9 100644 --- a/CMake/Backends.cmake +++ b/CMake/Backends.cmake @@ -116,9 +116,6 @@ target_sources(rmlui_backend_SFML_GL2 INTERFACE target_link_libraries(rmlui_backend_SFML_GL2 INTERFACE rmlui_backend_common_headers OpenGL::GL rmlui_SFML_old_wrapper SFML::Graphics SFML::Window SFML::System ) -if(WIN32) - target_link_libraries(rmlui_backend_SFML_GL2 INTERFACE SFML::Main) -endif() add_library(rmlui_backend_GLFW_GL2 INTERFACE) target_sources(rmlui_backend_GLFW_GL2 INTERFACE diff --git a/CMake/BackendsDependencies.cmake b/CMake/BackendsDependencies.cmake index 1300f8d2d..d686d3eef 100644 --- a/CMake/BackendsDependencies.cmake +++ b/CMake/BackendsDependencies.cmake @@ -107,15 +107,12 @@ if(RMLUI_SAMPLES_BACKEND MATCHES "^SFML") # List of required components in capital case list(APPEND RMLUI_SFML_REQUIRED_COMPONENTS "Graphics" "Window" "System") - if(WIN32) - list(APPEND RMLUI_SFML_REQUIRED_COMPONENTS "Main") - endif() # Run find package with component names both capitalized and lower-cased - find_package("SFML" "2" COMPONENTS ${RMLUI_SFML_REQUIRED_COMPONENTS}) + find_package("SFML" "2" COMPONENTS ${RMLUI_SFML_REQUIRED_COMPONENTS} QUIET) if(NOT SFML_FOUND) list(TRANSFORM RMLUI_SFML_REQUIRED_COMPONENTS TOLOWER OUTPUT_VARIABLE RMLUI_SFML_REQUIRED_COMPONENTS_LOWER_CASE) - find_package("SFML" "2" COMPONENTS ${RMLUI_SFML_REQUIRED_COMPONENTS_LOWER_CASE}) + find_package("SFML" "2" COMPONENTS ${RMLUI_SFML_REQUIRED_COMPONENTS_LOWER_CASE} QUIET) endif() # Since we are using find_package() in basic mode, we can check the _FOUND variable @@ -130,59 +127,40 @@ if(RMLUI_SAMPLES_BACKEND MATCHES "^SFML") Because we always require the window module, we can use it to determine which iteration of the config. ]] - # If any of the mandatory SFML 2.7 targets isn't present, asume SFML < 2.7 has been found and set up wrappers + # If any of the mandatory SFML 2.7 targets isn't present, assume SFML < 2.7 has been found and set up wrappers if(NOT TARGET SFML::Window) - if(TARGET sfml-window) - #[[ - If sfml-window exists, then that means the version is either SFML 2.5 or 2.6 which set up - module-specific CMake targets but with different names using a config file. - - Therefore, we need to alias the target names to match those declared by SFML 2.7 and used by RmlUi. - ]] - - # For each SFML component the project requires - foreach(sfml_component ${RMLUI_SFML_REQUIRED_COMPONENTS}) - # Make the component name lowercase - string(TOLOWER ${sfml_component} sfml_component_lower) - - if(TARGET sfml-${sfml_component_lower}) - #[[ - RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE: - Because the target CMake version is 3.10, we can't alias non-global targets nor global imported targets. - - Promoting an imported target to the global scope without it being necessary can cause undesired behavior, - specially when the project is consumed as a subdirectory inside another CMake project, therefore is not - recommended. Instead of that, we pseudo-alias the target creating a second INTERFACE target with alias name. - More info: https://cmake.org/cmake/help/latest/command/add_library.html#alias-libraries - ]] - - # If the target exists, alias it - add_library(SFML::${sfml_component} INTERFACE IMPORTED) - target_link_libraries(SFML::${sfml_component} INTERFACE sfml-${sfml_component_lower}) - endif() - endforeach() - - # Because module-specific targets already exist, there's no need for the wrapper for the older find module - # Set up wrapper target as dumb target - add_library(rmlui_SFML_old_wrapper INTERFACE) - else() - #[[ - If sfml-window doesn't exist, then SFML version is <= 2.4 and the old-variable approach used in their - old official find module needs to be wrapped. - ]] - - # Create our own custom INTERFACE target - add_library(rmlui_SFML_old_wrapper INTERFACE) - - # Set up the custom target with all the libraries - target_link_libraries(rmlui_SFML_old_wrapper INTERFACE ${SFML_LIBRARIES}) - target_include_directories(rmlui_SFML_old_wrapper INTERFACE ${SFML_INCLUDE_DIR}) - - # Create dumb targets to replace the modern component-specific targets - foreach(sfml_component ${RMLUI_SFML_REQUIRED_COMPONENTS}) + #[[ + If sfml-window exists, then that means the version is either SFML 2.5 or 2.6 which set up + module-specific CMake targets but with different names using a config file. + + Therefore, we need to alias the target names to match those declared by SFML 2.7 and used by RmlUi. + ]] + + # For each SFML component the project requires + foreach(sfml_component ${RMLUI_SFML_REQUIRED_COMPONENTS}) + # Make the component name lowercase + string(TOLOWER ${sfml_component} sfml_component_lower) + + if(TARGET sfml-${sfml_component_lower}) + #[[ + RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE: + Because the target CMake version is 3.10, we can't alias non-global targets nor global imported targets. + + Promoting an imported target to the global scope without it being necessary can cause undesired behavior, + specially when the project is consumed as a subdirectory inside another CMake project, therefore is not + recommended. Instead of that, we pseudo-alias the target creating a second INTERFACE target with alias name. + More info: https://cmake.org/cmake/help/latest/command/add_library.html#alias-libraries + ]] + + # If the target exists, alias it add_library(SFML::${sfml_component} INTERFACE IMPORTED) - endforeach() - endif() + target_link_libraries(SFML::${sfml_component} INTERFACE sfml-${sfml_component_lower}) + endif() + endforeach() + + # Because module-specific targets already exist, there's no need for the wrapper for the older find module + # Set up wrapper target as dumb target + add_library(rmlui_SFML_old_wrapper INTERFACE) endif() endif() From 52f459e9c35db071dda5ca96d8fea7cbbd3636a3 Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Sat, 2 Dec 2023 18:05:06 +0100 Subject: [PATCH 25/29] Change conditions for the Freetype MSVC warning --- CMake/Dependencies.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMake/Dependencies.cmake b/CMake/Dependencies.cmake index 8c95cf3c2..c2b19f613 100644 --- a/CMake/Dependencies.cmake +++ b/CMake/Dependencies.cmake @@ -17,8 +17,8 @@ if(RMLUI_FONT_INTERFACE STREQUAL "freetype") # 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.") + if((FREETYPE_VERSION_STRING VERSION_EQUAL "2.11.0") AND (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")) + message(WARNING "Using Freetype 2.11.0 with MSVC can cause issues. This issue is solved in Freetype 2.11.1.") endif() else() if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") From 8e037f4001163b222f6fc2f1b3d7088a9e90e62b Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Sat, 2 Dec 2023 18:10:17 +0100 Subject: [PATCH 26/29] Change sample CMake target names --- Samples/basic/benchmark/CMakeLists.txt | 4 ++-- Samples/basic/bitmapfont/CMakeLists.txt | 4 ++-- Samples/basic/demo/CMakeLists.txt | 4 ++-- Samples/basic/lottie/CMakeLists.txt | 4 ++-- Samples/shell/CMakeLists.txt | 16 ++++++++++------ 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Samples/basic/benchmark/CMakeLists.txt b/Samples/basic/benchmark/CMakeLists.txt index a5157b2bf..1abed8e28 100644 --- a/Samples/basic/benchmark/CMakeLists.txt +++ b/Samples/basic/benchmark/CMakeLists.txt @@ -1,9 +1,9 @@ if(NOT (RMLUI_FONT_INTERFACE STREQUAL "none")) # Declare executable - add_executable(rmlui_samples_benchmark WIN32 + add_executable(rmlui_sample_benchmark WIN32 src/main.cpp ) # Link shell library - target_link_libraries(rmlui_samples_benchmark PRIVATE rmlui_samples_shell) + target_link_libraries(rmlui_sample_benchmark PRIVATE rmlui_sample_shell) endif() diff --git a/Samples/basic/bitmapfont/CMakeLists.txt b/Samples/basic/bitmapfont/CMakeLists.txt index 2288f42cc..fb81f6638 100644 --- a/Samples/basic/bitmapfont/CMakeLists.txt +++ b/Samples/basic/bitmapfont/CMakeLists.txt @@ -1,5 +1,5 @@ # Declare executable -add_executable(rmlui_samples_bitmapfont WIN32 +add_executable(rmlui_sample_bitmapfont WIN32 src/FontEngineBitmap.cpp src/FontEngineBitmap.h src/FontEngineInterfaceBitmap.cpp @@ -8,4 +8,4 @@ add_executable(rmlui_samples_bitmapfont WIN32 ) # Link shell library -target_link_libraries(rmlui_samples_bitmapfont PRIVATE rmlui_samples_shell) +target_link_libraries(rmlui_sample_bitmapfont PRIVATE rmlui_sample_shell) diff --git a/Samples/basic/demo/CMakeLists.txt b/Samples/basic/demo/CMakeLists.txt index 19da91333..917b7acb3 100644 --- a/Samples/basic/demo/CMakeLists.txt +++ b/Samples/basic/demo/CMakeLists.txt @@ -1,9 +1,9 @@ if(NOT (RMLUI_FONT_INTERFACE STREQUAL "none")) # Declare executable - add_executable(rmlui_samples_demo WIN32 + add_executable(rmlui_sample_demo WIN32 src/main.cpp ) # Link shell library - target_link_libraries(rmlui_samples_demo PRIVATE rmlui_samples_shell) + target_link_libraries(rmlui_sample_demo PRIVATE rmlui_sample_shell) endif() diff --git a/Samples/basic/lottie/CMakeLists.txt b/Samples/basic/lottie/CMakeLists.txt index 01212013b..df33a949f 100644 --- a/Samples/basic/lottie/CMakeLists.txt +++ b/Samples/basic/lottie/CMakeLists.txt @@ -1,7 +1,7 @@ # Declare executable -add_executable(rmlui_samples_lottie WIN32 +add_executable(rmlui_sample_lottie WIN32 src/main.cpp ) # Link shell library -target_link_libraries(rmlui_samples_lottie PRIVATE rmlui_samples_shell) +target_link_libraries(rmlui_sample_lottie PRIVATE rmlui_sample_shell) diff --git a/Samples/shell/CMakeLists.txt b/Samples/shell/CMakeLists.txt index 2e91e4ebd..be53b88a4 100644 --- a/Samples/shell/CMakeLists.txt +++ b/Samples/shell/CMakeLists.txt @@ -1,6 +1,10 @@ +#[[ + Note: rmlui_sample_shell is NOT a sample. It's a utility static library with code common to most if not all RmlUi samples. +]] + # Quoting the source file paths isn't necessary because add_library() doesn't read # CMake variables, just strings -add_library(rmlui_samples_shell STATIC +add_library(rmlui_sample_shell STATIC src/PlatformExtensions.cpp src/RendererExtensions.cpp src/Shell.cpp @@ -8,20 +12,20 @@ add_library(rmlui_samples_shell STATIC ) # Add backend -target_link_libraries(rmlui_samples_shell PRIVATE rmlui_backend_${RMLUI_SAMPLES_BACKEND}) +target_link_libraries(rmlui_sample_shell PRIVATE rmlui_backend_${RMLUI_SAMPLES_BACKEND}) # Add include directories -target_include_directories(rmlui_samples_shell PUBLIC "include" "${PROJECT_SOURCE_DIR}/Backends") +target_include_directories(rmlui_sample_shell PUBLIC "include" "${PROJECT_SOURCE_DIR}/Backends") # Link against required libraries from Windows if(CMAKE_SYSTEM_NAME STREQUAL "Windows") # Required to use the functions from the shlwapi.h header - target_link_libraries(rmlui_samples_shell PRIVATE Windows::Shell::LightweightUtility) + target_link_libraries(rmlui_sample_shell PRIVATE Windows::Shell::LightweightUtility) # Link against required libraries from macOS elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") # Required to use the functions from the Cocoa framework - target_link_libraries(rmlui_samples_shell PRIVATE macOS::Cocoa) + target_link_libraries(rmlui_sample_shell PRIVATE macOS::Cocoa) endif() # Link against RmlUi and its debugger -target_link_libraries(rmlui_samples_shell PUBLIC RmlUi::RmlUi RmlUi::Debugger) +target_link_libraries(rmlui_sample_shell PUBLIC RmlUi::RmlUi RmlUi::Debugger) From 4f254800057ce8d039a04ac8b2788736ae3c6533 Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Sat, 2 Dec 2023 18:17:16 +0100 Subject: [PATCH 27/29] Change handling of samples that require Freetype --- Samples/basic/CMakeLists.txt | 18 +++++++++++------- Samples/basic/benchmark/CMakeLists.txt | 14 ++++++-------- Samples/basic/demo/CMakeLists.txt | 14 ++++++-------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Samples/basic/CMakeLists.txt b/Samples/basic/CMakeLists.txt index 5ca5d73a0..b26abba5a 100644 --- a/Samples/basic/CMakeLists.txt +++ b/Samples/basic/CMakeLists.txt @@ -1,11 +1,15 @@ # Add CMake subdirectories of basic samples -add_subdirectory("benchmark") -add_subdirectory("demo") add_subdirectory("bitmapfont") -# Negotiate inclusion of Lottie sample -if(RMLUI_LOTTIE_PLUGIN) - add_subdirectory("lottie") -else() - message(NOTICE "Lottie sample disabled due to RMLUI_LOTTIE_PLUGIN=OFF") +# If a font interface has been selected, add CMake subdirectories of samples that require it +if(NOT (RMLUI_FONT_INTERFACE STREQUAL "none")) + add_subdirectory("benchmark") + add_subdirectory("demo") + + # Negotiate inclusion of Lottie sample + if(RMLUI_LOTTIE_PLUGIN) + add_subdirectory("lottie") + else() + message(NOTICE "Lottie sample disabled due to RMLUI_LOTTIE_PLUGIN=OFF") + endif() endif() diff --git a/Samples/basic/benchmark/CMakeLists.txt b/Samples/basic/benchmark/CMakeLists.txt index 1abed8e28..3d9e8905e 100644 --- a/Samples/basic/benchmark/CMakeLists.txt +++ b/Samples/basic/benchmark/CMakeLists.txt @@ -1,9 +1,7 @@ -if(NOT (RMLUI_FONT_INTERFACE STREQUAL "none")) - # Declare executable - add_executable(rmlui_sample_benchmark WIN32 - src/main.cpp - ) +# Declare executable +add_executable(rmlui_sample_benchmark WIN32 + src/main.cpp +) - # Link shell library - target_link_libraries(rmlui_sample_benchmark PRIVATE rmlui_sample_shell) -endif() +# Link shell library +target_link_libraries(rmlui_sample_benchmark PRIVATE rmlui_sample_shell) diff --git a/Samples/basic/demo/CMakeLists.txt b/Samples/basic/demo/CMakeLists.txt index 917b7acb3..1a8efb57b 100644 --- a/Samples/basic/demo/CMakeLists.txt +++ b/Samples/basic/demo/CMakeLists.txt @@ -1,9 +1,7 @@ -if(NOT (RMLUI_FONT_INTERFACE STREQUAL "none")) - # Declare executable - add_executable(rmlui_sample_demo WIN32 - src/main.cpp - ) +# Declare executable +add_executable(rmlui_sample_demo WIN32 + src/main.cpp +) - # Link shell library - target_link_libraries(rmlui_sample_demo PRIVATE rmlui_sample_shell) -endif() +# Link shell library +target_link_libraries(rmlui_sample_demo PRIVATE rmlui_sample_shell) From fb1eabd927ffa3149273f19e9b4c5895f51fda52 Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Sat, 2 Dec 2023 18:24:29 +0100 Subject: [PATCH 28/29] Move SDL_image find module for Ubuntu up a folder --- .github/workflows/build.yml | 2 +- CMake/Modules/{CI => }/Linux/FindSDL2_image.cmake | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename CMake/Modules/{CI => }/Linux/FindSDL2_image.cmake (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2fd403b7b..f1f5e2470 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,7 +43,7 @@ jobs: working-directory: ${{github.workspace}}/Build run: >- cmake $GITHUB_WORKSPACE -G Ninja -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DRMLUI_BUILD_LUA_BINDINGS=ON -DRMLUI_SAMPLES=ON -DWARNINGS_AS_ERRORS=ON - -DCMAKE_MODULE_PATH=$GITHUB_WORKSPACE/CMake/Modules/CI/Linux + -DCMAKE_MODULE_PATH=$GITHUB_WORKSPACE/CMake/Modules/Linux ${{ matrix.cmake_options }} - name: Build diff --git a/CMake/Modules/CI/Linux/FindSDL2_image.cmake b/CMake/Modules/Linux/FindSDL2_image.cmake similarity index 100% rename from CMake/Modules/CI/Linux/FindSDL2_image.cmake rename to CMake/Modules/Linux/FindSDL2_image.cmake From 6760b65b417a828c6976308db9655f9745c6a47f Mon Sep 17 00:00:00 2001 From: hobyst <48522412+hobyst@users.noreply.github.com> Date: Mon, 4 Dec 2023 15:03:03 +0100 Subject: [PATCH 29/29] Remove mention of SFML <= 2.4 in comment --- CMake/BackendsDependencies.cmake | 3 --- 1 file changed, 3 deletions(-) diff --git a/CMake/BackendsDependencies.cmake b/CMake/BackendsDependencies.cmake index d686d3eef..8860fbfcc 100644 --- a/CMake/BackendsDependencies.cmake +++ b/CMake/BackendsDependencies.cmake @@ -100,9 +100,6 @@ if(RMLUI_SAMPLES_BACKEND MATCHES "^SFML") In SFML 2.5 the first iteration of the SFMLConfig.cmake file was introduced, which uses a target-oriented approach to exposing the different modules of SFML but it doesn't use the same names as the config file from SFML 2.7. - - In SFML <= 2.4 the old official find module is still in use which uses the old variable-based - approach. ]] # List of required components in capital case