Can compile with RMLUI.
This commit is contained in:
parent
3bc5e2a0db
commit
26bdf2aba2
6 changed files with 123 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
**/build/**
|
|
@ -0,0 +1,14 @@
|
|||
cmake_minimum_required(VERSION 3.18)
|
||||
project(
|
||||
gui_framework_benchmark
|
||||
DESCRIPTION "GUI Framework Benchmark"
|
||||
HOMEPAGE_URL "https://www.etheryo.fr/"
|
||||
LANGUAGES CXX C
|
||||
)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
|
||||
# Projects
|
||||
add_subdirectory(rmlui)
|
50
rmlui/CMakeLists.txt
Normal file
50
rmlui/CMakeLists.txt
Normal file
|
@ -0,0 +1,50 @@
|
|||
# Project
|
||||
project(
|
||||
rmlui_test
|
||||
VERSION 1.0.0
|
||||
DESCRIPTION "rmlui_test"
|
||||
LANGUAGES CXX C
|
||||
)
|
||||
|
||||
# Dependencies
|
||||
set(CMAKE_TLS_VERIFY FALSE) # Custom TLS/Proxy sometimes does not enable download
|
||||
include(dependencies.cmake)
|
||||
|
||||
# Source files
|
||||
set(TARGET rmlui_test)
|
||||
set(SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src")
|
||||
add_executable(${TARGET}
|
||||
${SOURCES}/main.cpp
|
||||
)
|
||||
|
||||
# Include folders
|
||||
target_include_directories(${TARGET} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
target_include_directories(${TARGET} PRIVATE "${RMLUI_INCLUDE_DIRS}")
|
||||
|
||||
# Libraries
|
||||
target_link_libraries(
|
||||
${TARGET} PRIVATE
|
||||
rmlui_debugger
|
||||
rmlui_core
|
||||
)
|
||||
|
||||
# Compilation depending on the platform
|
||||
if(MSVC)
|
||||
# Build the program as a window-only (no cmd)
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
target_link_options(${TARGET} PRIVATE "/SUBSYSTEM:WINDOWS")
|
||||
target_compile_options(${TARGET} PRIVATE /W3 /WX )
|
||||
else()
|
||||
target_compile_options(${TARGET} PRIVATE /W3 /WX /DEBUG )
|
||||
endif()
|
||||
else()
|
||||
target_compile_options(${TARGET} PRIVATE -Wall -Wextra -Wpedantic -Werror)
|
||||
endif()
|
||||
|
||||
# Output folder
|
||||
set_target_properties(${TARGET}
|
||||
PROPERTIES
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
|
||||
)
|
9
rmlui/data/hello_world.rml
Normal file
9
rmlui/data/hello_world.rml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<rml>
|
||||
<head>
|
||||
<title>Hello world</title>
|
||||
</head>
|
||||
<body data-model="animals">
|
||||
<h1>RmlUi</h1>
|
||||
<p>Hello world</p>
|
||||
</body>
|
||||
</rml>
|
38
rmlui/dependencies.cmake
Normal file
38
rmlui/dependencies.cmake
Normal file
|
@ -0,0 +1,38 @@
|
|||
cmake_minimum_required(VERSION 3.11)
|
||||
|
||||
# Freetype parameters
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
|
||||
# Freetype
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
freetype
|
||||
DOWNLOAD_EXTRACT_TIMESTAMP OFF
|
||||
GIT_REPOSITORY https://gitlab.freedesktop.org/freetype/freetype.git
|
||||
GIT_TAG VER-2-13-3
|
||||
)
|
||||
FetchContent_GetProperties(freetype)
|
||||
if (NOT freetype_POPULATED)
|
||||
set(FETCHCONTENT_QUIET NO)
|
||||
FetchContent_MakeAvailable(freetype)
|
||||
endif()
|
||||
|
||||
# RML UI parameters
|
||||
set(BUILD_SHARED_LIBS ON CACHE BOOL "" FORCE)
|
||||
set(Freetype_ROOT ${freetype_SOURCE_DIR} CACHE PATH "Path to freetype root" FORCE)
|
||||
add_library(Freetype::Freetype ALIAS freetype)
|
||||
# RML UI
|
||||
FetchContent_Declare(
|
||||
rmlui
|
||||
GIT_REPOSITORY https://github.com/mikke89/RmlUi.git
|
||||
GIT_TAG 6.1
|
||||
)
|
||||
FetchContent_GetProperties(rmlui)
|
||||
if (NOT rmlui_POPULATED)
|
||||
set(FETCHCONTENT_QUIET NO)
|
||||
FetchContent_MakeAvailable(rmlui)
|
||||
endif()
|
||||
set(RMLUI_INCLUDE_DIRS
|
||||
"${RmlUi_SOURCE_DIR}/Include"
|
||||
"${RmlUi_SOURCE_DIR}/Backends"
|
||||
"${RmlUi_SOURCE_DIR}/Samples/shell/include"
|
||||
)
|
11
rmlui/src/main.cpp
Normal file
11
rmlui/src/main.cpp
Normal file
|
@ -0,0 +1,11 @@
|
|||
#include <RmlUi/Core.h>
|
||||
#include <RmlUi/Debugger.h>
|
||||
#include <RmlUi_Backend.h>
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
printf("Using RML Version: %s\n", Rml::GetVersion().c_str());
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Reference in a new issue