Start Simplifying CMake code (#24177)

* Use generator expressions

* Update cmake minimum

* Move options and remove project name

* Use further generator expressions

* Try upgrading to CMake 3.25 on Ubuntu 22.04 CI

Install software-properties-common

* Standardise with DISABLE_TTF for disable defines

* Set X64 var differently due to unknown reasons

---------

Co-authored-by: Michael Steenbeek <1478678+Gymnasiast@users.noreply.github.com>
This commit is contained in:
Duncan
2025-04-11 16:09:52 +01:00
committed by GitHub
parent 87765d662d
commit d5de6c2b49
26 changed files with 177 additions and 209 deletions
+3 -1
View File
@@ -498,7 +498,9 @@ jobs:
with:
key: linux-appimage
- name: Install Clang 15
run: apt update && apt install -y clang-15
run: apt update && apt install -y clang-15 software-properties-common
- name: Install CMake 3.25
run: add-apt-repository -y ppa:ecal/cmake-3.25 && apt install -y cmake
- name: Get pre-reqs
run: . scripts/setenv -q && get-discord-rpc
- name: Build OpenRCT2
+26 -33
View File
@@ -1,5 +1,5 @@
# CMAKE project for openrct2
cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.24)
if (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)
message(FATAL_ERROR "Building in-source is not supported! Create a build dir and remove ${CMAKE_SOURCE_DIR}/CMakeCache.txt")
@@ -43,12 +43,13 @@ if (APPLE)
message("Unknown macOS architecture: ${ARCH}. Behavior may be unexpected.")
endif()
endif ()
project(openrct2 CXX)
if (APPLE)
set(CMAKE_SYSTEM_PROCESSOR "${CMAKE_OSX_ARCHITECTURES}" CACHE STRING "")
endif ()
project(openrct2 CXX)
include(cmake/platform.cmake)
include(CMakeDependentOption)
@@ -111,6 +112,9 @@ option(DISABLE_HTTP "Disable HTTP support.")
option(DISABLE_NETWORK "Disable multiplayer functionality. Mainly for testing.")
option(DISABLE_TTF "Disable support for TTF provided by freetype2.")
option(DISABLE_VERSION_CHECKER "Disable the check for newer versions.")
option(DISABLE_FLAC "Disable FLAC support.")
option(DISABLE_VORBIS "Disable OGG/VORBIS support.")
option(DISABLE_OPENGL "Disable OpenGL support.")
option(ENABLE_SCRIPTING "Enable script / plugin support." ON)
option(ENABLE_ASAN "Enable the AddressSanitizer.")
option(ENABLE_UBSAN "Enable the UndefinedBehaviourSanitizer.")
@@ -251,6 +255,8 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
set(X86_64 1)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*|amd64.*|AMD64.*")
set(X86 1)
elseif(CMAKE_OSX_ARCHITECTURES MATCHES "amd64.*|x86_64.*|AMD64.*")
set(X86_64 1)
endif()
# Check if a flag exists and add it to the list of compiler (so, not linker) options
@@ -386,33 +392,20 @@ if(NOT DISABLE_GUI)
endif()
# Defines
if (USE_MMAP)
target_compile_options(libopenrct2 PUBLIC -DUSE_MMAP)
endif ()
if (DISABLE_NETWORK)
target_compile_options(libopenrct2 PUBLIC -DDISABLE_NETWORK)
endif ()
if (DISABLE_HTTP)
target_compile_options(libopenrct2 PUBLIC -DDISABLE_HTTP)
endif ()
if (DISABLE_TTF)
target_compile_options(libopenrct2 PUBLIC -DNO_TTF)
endif ()
if (DISABLE_VERSION_CHECKER)
target_compile_options(libopenrct2 PUBLIC -DDISABLE_VERSION_CHECKER)
endif ()
if (ENABLE_SCRIPTING)
target_compile_options(libopenrct2 PUBLIC -DENABLE_SCRIPTING)
endif ()
if (ENABLE_ASAN)
target_compile_options(libopenrct2 PUBLIC -fsanitize=address)
target_link_options(libopenrct2 PUBLIC -fsanitize=address)
endif ()
if (ENABLE_UBSAN)
target_compile_options(libopenrct2 PUBLIC -fsanitize=undefined)
target_link_options(libopenrct2 PUBLIC -fsanitize=undefined)
endif ()
target_compile_definitions(libopenrct2 PUBLIC
$<$<BOOL:${USE_MMAP}>:USE_MMAP>
$<$<BOOL:${DISABLE_NETWORK}>:DISABLE_NETWORK>
$<$<BOOL:${DISABLE_HTTP}>:DISABLE_HTTP>
$<$<BOOL:${DISABLE_TTF}>:DISABLE_TTF>
$<$<BOOL:${DISABLE_VERSION_CHECKER}>:DISABLE_VERSION_CHECKER>
$<$<BOOL:${ENABLE_SCRIPTING}>:ENABLE_SCRIPTING>
)
target_compile_options(libopenrct2 PUBLIC $<$<BOOL:${ENABLE_ASAN}>:-fsanitize=address>)
target_link_options(libopenrct2 PUBLIC $<$<BOOL:${ENABLE_ASAN}>:-fsanitize=address>)
target_compile_options(libopenrct2 PUBLIC $<$<BOOL:${ENABLE_UBSAN}>:-fsanitize=undefined>)
target_link_options(libopenrct2 PUBLIC $<$<BOOL:${ENABLE_UBSAN}>:-fsanitize=undefined>)
# g2
if (NOT (MACOS_BUNDLE AND (NOT CMAKE_OSX_ARCHITECTURES MATCHES "${SYSTEM_MACOS_ARCH}")))
@@ -421,7 +414,7 @@ if (NOT (MACOS_BUNDLE AND (NOT CMAKE_OSX_ARCHITECTURES MATCHES "${SYSTEM_MACOS_A
COMMAND ./openrct2-cli sprite build ${CMAKE_BINARY_DIR}/g2.dat ${ROOT_DIR}/resources/g2/sprites.json
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
add_custom_target(g2 DEPENDS ${PROJECT_NAME} g2.dat)
add_custom_target(g2 DEPENDS openrct2 g2.dat)
else ()
message("Skipping g2.dat generation in macOS cross-compile")
endif ()
@@ -456,7 +449,7 @@ if (NOT MACOS_BUNDLE OR (MACOS_BUNDLE AND WITH_TESTS))
include(${ROOT_DIR}/cmake/download.cmake)
download_openrct2_zip(
ZIP_VERSION ${TITLE_SEQUENCE_VERSION}
DOWNLOAD_DIR \$ENV{DESTDIR}${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}/sequence/
DOWNLOAD_DIR \$ENV{DESTDIR}${CMAKE_INSTALL_FULL_DATADIR}/openrct2/sequence/
SKIP_IF_EXISTS ${CMAKE_SOURCE_DIR}/data/sequence/
ZIP_URL ${TITLE_SEQUENCE_URL}
SHA1 ${TITLE_SEQUENCE_SHA1}
@@ -470,7 +463,7 @@ if (NOT MACOS_BUNDLE OR (MACOS_BUNDLE AND WITH_TESTS))
include(${ROOT_DIR}/cmake/download.cmake)
download_openrct2_zip(
ZIP_VERSION ${OBJECTS_VERSION}
DOWNLOAD_DIR \$ENV{DESTDIR}${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}/object/
DOWNLOAD_DIR \$ENV{DESTDIR}${CMAKE_INSTALL_FULL_DATADIR}/openrct2/object/
SKIP_IF_EXISTS ${CMAKE_SOURCE_DIR}/data/object/
ZIP_URL ${OBJECTS_URL}
SHA1 ${OBJECTS_SHA1}
@@ -482,7 +475,7 @@ if (NOT MACOS_BUNDLE OR (MACOS_BUNDLE AND WITH_TESTS))
download_openrct2_zip(
ZIP_VERSION ${OPENSFX_VERSION}
SKIP_IF_EXISTS ${CMAKE_SOURCE_DIR}/data/assetpack/openrct2.sound.parkap
DOWNLOAD_DIR \$ENV{DESTDIR}${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}/
DOWNLOAD_DIR \$ENV{DESTDIR}${CMAKE_INSTALL_FULL_DATADIR}/openrct2/
ZIP_URL ${OPENSFX_URL}
SHA1 ${OPENSFX_SHA1}
)")
@@ -493,7 +486,7 @@ if (NOT MACOS_BUNDLE OR (MACOS_BUNDLE AND WITH_TESTS))
download_openrct2_zip(
ZIP_VERSION ${OPENMSX_VERSION}
SKIP_IF_EXISTS ${CMAKE_SOURCE_DIR}/data/assetpack/openrct2.music.alternative.parkap
DOWNLOAD_DIR \$ENV{DESTDIR}${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}/
DOWNLOAD_DIR \$ENV{DESTDIR}${CMAKE_INSTALL_FULL_DATADIR}/openrct2/
ZIP_URL ${OPENMSX_URL}
SHA1 ${OPENMSX_SHA1}
)")
+6 -14
View File
@@ -1,11 +1,3 @@
cmake_minimum_required(VERSION 3.10)
project(openrct2-cli CXX)
if (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)
message(FATAL_ERROR "Building in-source is not supported! Create a build dir and remove ${CMAKE_SOURCE_DIR}/CMakeCache.txt")
endif ()
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
@@ -14,11 +6,11 @@ file(GLOB_RECURSE OPENRCT2_CLI_SOURCES
"${CMAKE_CURRENT_LIST_DIR}/*.h"
"${CMAKE_CURRENT_LIST_DIR}/*.hpp")
add_executable(${PROJECT_NAME} ${OPENRCT2_CLI_SOURCES})
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_LIST_DIR}/..")
ipo_set_target_properties(${PROJECT_NAME})
add_executable(openrct2-cli ${OPENRCT2_CLI_SOURCES})
target_include_directories(openrct2-cli PRIVATE "${CMAKE_CURRENT_LIST_DIR}/..")
ipo_set_target_properties(openrct2-cli)
if (EMSCRIPTEN)
target_link_libraries(${PROJECT_NAME} ${ICU_DT_LIBRARY_RELEASE} ${ICU_DATA_LIBRARIES})
target_link_libraries(openrct2-cli ${ICU_DT_LIBRARY_RELEASE} ${ICU_DATA_LIBRARIES})
endif ()
target_link_libraries(${PROJECT_NAME} libopenrct2 Threads::Threads)
target_link_platform_libraries(${PROJECT_NAME})
target_link_libraries(openrct2-cli libopenrct2 Threads::Threads)
target_link_platform_libraries(openrct2-cli)
+37 -48
View File
@@ -1,15 +1,9 @@
# CMAKE project for openrct2-ui (UI build of OpenRCT2)
cmake_minimum_required(VERSION 3.10)
# OpenRCT2 UI (main binary)
if (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)
message(FATAL_ERROR "Building in-source is not supported! Create a build dir and remove ${CMAKE_SOURCE_DIR}/CMakeCache.txt")
endif ()
# Options
option(DISABLE_FLAC "Disable FLAC support.")
option(DISABLE_VORBIS "Disable OGG/VORBIS support.")
option(DISABLE_OPENGL "Disable OpenGL support.")
# Third party libraries
if (EMSCRIPTEN)
set(USE_FLAGS "${EMSCRIPTEN_FLAGS}")
@@ -64,61 +58,60 @@ if (APPLE)
endif ()
# Outputs
project(openrct2 CXX)
add_executable(${PROJECT_NAME} ${OPENRCT2_UI_SOURCES} ${OPENRCT2_UI_MM_SOURCES})
SET_CHECK_CXX_FLAGS(${PROJECT_NAME})
ipo_set_target_properties(${PROJECT_NAME})
add_executable(openrct2 ${OPENRCT2_UI_SOURCES} ${OPENRCT2_UI_MM_SOURCES})
SET_CHECK_CXX_FLAGS(openrct2)
ipo_set_target_properties(openrct2)
# mingw builds cannot use the PkgConfig imported targets
if (EMSCRIPTEN)
target_link_libraries(${PROJECT_NAME} "libopenrct2"
target_link_libraries(openrct2 "libopenrct2"
${SPEEXDSP_LIBRARIES}
${ICU_DATA_LIBRARIES}
${ICU_DT_LIBRARY_RELEASE})
elseif (NOT MSVC AND NOT WIN32)
target_link_libraries(${PROJECT_NAME} "libopenrct2"
target_link_libraries(openrct2 "libopenrct2"
PkgConfig::SDL2
PkgConfig::SPEEX)
else ()
target_link_libraries(${PROJECT_NAME} "libopenrct2"
target_link_libraries(openrct2 "libopenrct2"
${SDL2_LDFLAGS}
${SPEEX_LDFLAGS})
endif ()
target_link_platform_libraries(${PROJECT_NAME})
target_link_platform_libraries(openrct2)
if (NOT DISABLE_FLAC)
if (NOT MSVC AND NOT WIN32)
target_link_libraries(${PROJECT_NAME} PkgConfig::FLAC)
target_link_libraries(openrct2 PkgConfig::FLAC)
else ()
target_link_libraries(${PROJECT_NAME} ${FLAC_LDFLAGS})
target_link_libraries(openrct2 ${FLAC_LDFLAGS})
endif ()
endif ()
if (NOT DISABLE_VORBIS)
if (NOT MSVC AND NOT WIN32 AND NOT EMSCRIPTEN)
target_link_libraries(${PROJECT_NAME} PkgConfig::OGG PkgConfig::VORBISFILE)
target_link_libraries(openrct2 PkgConfig::OGG PkgConfig::VORBISFILE)
else ()
target_link_libraries(${PROJECT_NAME} ${OGG_LDFLAGS} ${VORBISFILE_LDFLAGS})
target_link_libraries(openrct2 ${OGG_LDFLAGS} ${VORBISFILE_LDFLAGS})
endif ()
endif ()
if (NOT DISABLE_OPENGL)
if (WIN32)
target_link_libraries(${PROJECT_NAME} opengl32)
target_link_libraries(openrct2 opengl32)
elseif (APPLE)
target_link_libraries(${PROJECT_NAME} ${OPENGL_LIBRARY})
target_link_libraries(openrct2 ${OPENGL_LIBRARY})
else ()
target_link_libraries(${PROJECT_NAME} ${GL_LIBRARIES})
target_link_libraries(openrct2 ${GL_LIBRARIES})
endif ()
endif ()
# Includes
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_LIST_DIR}/.."
target_include_directories(openrct2 PRIVATE "${CMAKE_CURRENT_LIST_DIR}/.."
${SPEEX_INCLUDE_DIRS}
${OGG_INCLUDE_DIRS}
${VORBIS_INCLUDE_DIRS}
${FLAC_INCLUDE_DIRS})
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${SDL2_INCLUDE_DIRS}
target_include_directories(openrct2 SYSTEM PRIVATE ${SDL2_INCLUDE_DIRS}
"${CMAKE_CURRENT_LIST_DIR}/../thirdparty")
# Compiler flags
@@ -126,10 +119,10 @@ if (WIN32)
# mingw complains about "%zu" not being a valid format specifier for printf, unless we
# tell it that it is
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__USE_MINGW_ANSI_STDIO=1")
target_link_libraries(${PROJECT_NAME} comdlg32)
target_link_libraries(openrct2 comdlg32)
if (MSVC)
target_link_libraries(${PROJECT_NAME} SDL2::SDL2-static)
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE SDL2::SDL2-static)
target_link_libraries(openrct2 SDL2::SDL2-static)
target_include_directories(openrct2 SYSTEM PRIVATE SDL2::SDL2-static)
else ()
# mingw does not provide proper CMake information like other configurations
find_path(SDL2_INCLUDE_DIRS SDL2/SDL.h)
@@ -139,7 +132,7 @@ if (WIN32)
find_library(SDL2_LDFLAGS sdl2)
endif ()
# Hardcode some of the libraries used by mingw builds
target_link_libraries(${PROJECT_NAME} imm32 winmm setupapi version)
target_link_libraries(openrct2 imm32 winmm setupapi version)
endif ()
endif ()
if (MSVC)
@@ -152,18 +145,14 @@ if (MSVC)
endif ()
# Defines
if (DISABLE_FLAC)
add_definitions(-DDISABLE_FLAC)
endif ()
if (DISABLE_VORBIS)
add_definitions(-DDISABLE_VORBIS)
endif ()
if (DISABLE_OPENGL)
add_definitions(-DDISABLE_OPENGL)
else ()
# Makes OpenGL function get queried in run-time rather than linked-in
add_definitions(-DOPENGL_NO_LINK)
endif ()
target_compile_definitions(openrct2 PUBLIC
$<$<BOOL:${DISABLE_FLAC}>:DISABLE_FLAC>
$<$<BOOL:${DISABLE_VORBIS}>:DISABLE_VORBIS>
# If OpenGL is enabled then we want to dynamically look up symbols.
# If its disabled and somehow we magically end up linking to OpenGL we don't want look up the OpenGL symbols????
$<IF:$<BOOL:${DISABLE_OPENGL}>,DISABLE_OPENGL,OPENGL_NO_LINK>
)
if (MSVC)
add_definitions(-D__DISABLE_DLL_PROXY__)
endif ()
@@ -176,17 +165,17 @@ if (ENABLE_HEADERS_CHECK AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(OPENRCT2_HEADERS_CHECK ${OPENRCT2_UI_HEADERS})
# OpenGLAPIProc.h is not meant to be included directly.
list(REMOVE_ITEM OPENRCT2_HEADERS_CHECK "${CMAKE_CURRENT_LIST_DIR}/drawing/engines/opengl/OpenGLAPIProc.h")
add_library(${PROJECT_NAME}-headers-check OBJECT ${OPENRCT2_HEADERS_CHECK})
set_target_properties(${PROJECT_NAME}-headers-check PROPERTIES LINKER_LANGUAGE CXX)
add_library(openrct2-headers-check OBJECT ${OPENRCT2_HEADERS_CHECK})
set_target_properties(openrct2-headers-check PROPERTIES LINKER_LANGUAGE CXX)
set_source_files_properties(${OPENRCT2_HEADERS_CHECK} PROPERTIES LANGUAGE CXX)
add_definitions("-x c++ -Wno-pragma-once-outside-header -Wno-unused-const-variable")
get_target_property(OPENRCT2_INCLUDE_DIRS ${PROJECT_NAME} INCLUDE_DIRECTORIES)
set_target_properties(${PROJECT_NAME}-headers-check PROPERTIES INCLUDE_DIRECTORIES "${OPENRCT2_INCLUDE_DIRS}")
get_target_property(OPENRCT2_INCLUDE_DIRS openrct2 INCLUDE_DIRECTORIES)
set_target_properties(openrct2-headers-check PROPERTIES INCLUDE_DIRECTORIES "${OPENRCT2_INCLUDE_DIRS}")
endif ()
if(MACOS_BUNDLE)
add_dependencies(${PROJECT_NAME} openrct2-cli)
add_dependencies(openrct2 openrct2-cli)
set(OUTPUT_NAME "OpenRCT2")
set(MACOS_APP_NAME "${OUTPUT_NAME}.app")
set(BUNDLE_FRAMEWORK_DIR "${MACOS_APP_NAME}/Contents/Frameworks")
@@ -194,7 +183,7 @@ if(MACOS_BUNDLE)
set(SOURCE_DATA_DIR "${ROOT_DIR}/data")
# Add distribution sources
target_sources(${PROJECT_NAME}
target_sources(openrct2
PUBLIC ${ROOT_DIR}/distribution/readme.txt
PUBLIC ${ROOT_DIR}/distribution/changelog.txt
PUBLIC ${ROOT_DIR}/contributors.md
@@ -212,7 +201,7 @@ if(MACOS_BUNDLE)
)
if (CMAKE_OSX_ARCHITECTURES MATCHES "${SYSTEM_MACOS_ARCH}")
target_sources(${PROJECT_NAME}
target_sources(openrct2
PUBLIC ${CMAKE_BINARY_DIR}/g2.dat
)
list(APPEND BUNDLE_RESOURCES ${CMAKE_BINARY_DIR}/g2.dat)
@@ -274,7 +263,7 @@ if(MACOS_BUNDLE)
file(COPY ${ASSET_PACK_DIR} DESTINATION "${BUNDLE_RESOURCE_DIR}")
# Create as a bundle
set_target_properties(${PROJECT_NAME} PROPERTIES
set_target_properties(openrct2 PROPERTIES
MACOSX_BUNDLE ON
OUTPUT_NAME ${OUTPUT_NAME}
MACOSX_BUNDLE_BUNDLE_NAME ${OUTPUT_NAME}
@@ -70,7 +70,7 @@ private:
int32_t _drawCount = 0;
#ifndef NO_TTF
#ifndef DISABLE_TTF
uint32_t _ttfGlId = 0;
#endif
@@ -983,7 +983,7 @@ void OpenGLDrawingContext::DrawGlyph(DrawPixelInfo& dpi, const ImageId image, in
void OpenGLDrawingContext::DrawTTFBitmap(
DrawPixelInfo& dpi, TextDrawInfo* info, TTFSurface* surface, int32_t x, int32_t y, uint8_t hintingThreshold)
{
#ifndef NO_TTF
#ifndef DISABLE_TTF
auto baseId = static_cast<uint32_t>(0x7FFFF) - 1024;
auto imageId = baseId + _ttfGlId;
_engine.InvalidateImage(imageId);
@@ -1071,7 +1071,7 @@ void OpenGLDrawingContext::DrawTTFBitmap(
command.bounds = { left, top, right, bottom };
command.depth = _drawCount++;
command.zoom = 1.0f;
#endif // NO_TTF
#endif // DISABLE_TTF
}
void OpenGLDrawingContext::FlushCommandBuffers()
+1 -1
View File
@@ -1023,7 +1023,7 @@ namespace OpenRCT2::Ui::Windows
void OnResizeObjective()
{
#ifndef NO_TTF
#ifndef DISABLE_TTF
if (gCurrentTTFFontSet != nullptr)
WindowSetResize(*this, { 230, 270 }, { 230, 270 });
else
+46 -54
View File
@@ -1,11 +1,3 @@
cmake_minimum_required(VERSION 3.10)
project(libopenrct2 CXX)
if (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)
message(FATAL_ERROR "Building in-source is not supported! Create a build dir and remove ${CMAKE_SOURCE_DIR}/CMakeCache.txt")
endif ()
file(GLOB_RECURSE OPENRCT2_CORE_SOURCES "${CMAKE_CURRENT_LIST_DIR}/*.cpp")
file(GLOB_RECURSE OPENRCT2_CORE_HEADERS "${CMAKE_CURRENT_LIST_DIR}/*.h"
"${CMAKE_CURRENT_LIST_DIR}/*.hpp")
@@ -27,7 +19,7 @@ if (ENABLE_SCRIPTING)
endif ()
endif ()
add_library(${PROJECT_NAME} ${OPENRCT2_CORE_SOURCES} ${OPENRCT2_CORE_MM_SOURCES} ${OPENRCT2_DUKTAPE_SOURCES})
add_library(libopenrct2 ${OPENRCT2_CORE_SOURCES} ${OPENRCT2_CORE_MM_SOURCES} ${OPENRCT2_DUKTAPE_SOURCES})
if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "13")
message(WARNING "Buggy GCC 12 detected! Disabling some warnings")
set_source_files_properties("${CMAKE_CURRENT_LIST_DIR}/localisation/FormatCodes.cpp" PROPERTIES COMPILE_FLAGS "-Wno-restrict")
@@ -36,14 +28,14 @@ if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "13")
set_source_files_properties("${CMAKE_CURRENT_LIST_DIR}/scenario/Scenario.cpp" PROPERTIES COMPILE_FLAGS "-Wno-restrict")
endif()
if (APPLE)
target_link_platform_libraries(${PROJECT_NAME})
target_link_platform_libraries(libopenrct2)
endif ()
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
SET_CHECK_CXX_FLAGS(${PROJECT_NAME})
set_target_properties(libopenrct2 PROPERTIES PREFIX "")
SET_CHECK_CXX_FLAGS(libopenrct2)
if (NOT DISABLE_NETWORK OR NOT DISABLE_HTTP)
if (WIN32)
target_link_libraries(${PROJECT_NAME} bcrypt)
target_link_libraries(libopenrct2 bcrypt)
else ()
if (APPLE AND NOT MACOS_USE_DEPENDENCIES)
# note - we are not yet compatible with openssl3, which is now default brew version
@@ -53,32 +45,32 @@ if (NOT DISABLE_NETWORK OR NOT DISABLE_HTTP)
endif ()
find_package(OpenSSL 1.0.0 REQUIRED)
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC ${OPENSSL_INCLUDE_DIR})
target_include_directories(libopenrct2 SYSTEM PUBLIC ${OPENSSL_INCLUDE_DIR})
if(STATIC)
target_link_libraries(${PROJECT_NAME} ${SSL_STATIC_LIBRARIES})
target_link_libraries(libopenrct2 ${SSL_STATIC_LIBRARIES})
else ()
target_link_libraries(${PROJECT_NAME} ${OPENSSL_LIBRARIES})
target_link_libraries(libopenrct2 ${OPENSSL_LIBRARIES})
endif()
endif()
endif ()
if (NOT DISABLE_NETWORK AND WIN32)
target_link_libraries(${PROJECT_NAME} ws2_32 crypt32 wldap32 version winmm imm32 advapi32 shell32 ole32)
target_link_libraries(libopenrct2 ws2_32 crypt32 wldap32 version winmm imm32 advapi32 shell32 ole32)
endif ()
if (NOT DISABLE_HTTP)
if (WIN32)
target_link_libraries(${PROJECT_NAME} winhttp)
target_link_libraries(libopenrct2 winhttp)
else ()
PKG_CHECK_MODULES(LIBCURL REQUIRED libcurl)
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${LIBCURL_INCLUDE_DIRS})
target_include_directories(libopenrct2 SYSTEM PRIVATE ${LIBCURL_INCLUDE_DIRS})
if (STATIC)
target_link_libraries(${PROJECT_NAME} ${LIBCURL_STATIC_LIBRARIES})
target_link_libraries(libopenrct2 ${LIBCURL_STATIC_LIBRARIES})
else ()
target_link_libraries(${PROJECT_NAME} ${LIBCURL_LIBRARIES})
target_link_libraries(libopenrct2 ${LIBCURL_LIBRARIES})
endif ()
endif ()
endif ()
@@ -94,10 +86,10 @@ if (NOT DISABLE_TTF)
PKG_CHECK_MODULES(FREETYPE REQUIRED IMPORTED_TARGET freetype2)
endif ()
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${FREETYPE_INCLUDE_DIRS})
target_include_directories(libopenrct2 SYSTEM PRIVATE ${FREETYPE_INCLUDE_DIRS})
if (UNIX AND NOT APPLE)
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${FONTCONFIG_INCLUDE_DIRS})
target_include_directories(libopenrct2 SYSTEM PRIVATE ${FONTCONFIG_INCLUDE_DIRS})
endif ()
endif ()
@@ -105,9 +97,9 @@ if (NOT DISABLE_GOOGLE_BENCHMARK)
find_package(benchmark)
if (benchmark_FOUND)
message("Found Google benchmark, enabling support")
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_DEFINITIONS USE_BENCHMARK)
target_link_libraries(${PROJECT_NAME} benchmark::benchmark)
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${benchmark_INCLUDE_DIRS})
set_target_properties(libopenrct2 PROPERTIES COMPILE_DEFINITIONS USE_BENCHMARK)
target_link_libraries(libopenrct2 benchmark::benchmark)
target_include_directories(libopenrct2 SYSTEM PRIVATE ${benchmark_INCLUDE_DIRS})
else ()
message("Google benchmark not found, disabling support")
endif ()
@@ -115,7 +107,7 @@ endif ()
# Third party libraries
if (EMSCRIPTEN)
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${ICU_INCLUDE_DIR})
target_include_directories(libopenrct2 SYSTEM PRIVATE ${ICU_INCLUDE_DIR})
set(USE_FLAGS "${EMSCRIPTEN_FLAGS}")
if (NOT DISABLE_VORBIS)
set(USE_FLAGS "${USE_FLAGS} -s USE_VORBIS=1 -s USE_OGG=1")
@@ -147,18 +139,18 @@ else ()
endif ()
if (STATIC)
target_link_libraries(${PROJECT_NAME}
target_link_libraries(libopenrct2
${PNG_STATIC_LIBRARIES}
${ZLIB_STATIC_LIBRARIES}
${LIBZIP_STATIC_LIBRARIES})
else ()
if (NOT MSVC AND NOT EMSCRIPTEN)
target_link_libraries(${PROJECT_NAME}
target_link_libraries(libopenrct2
PkgConfig::PNG
PkgConfig::ZLIB
PkgConfig::LIBZIP)
else ()
target_link_libraries(${PROJECT_NAME}
target_link_libraries(libopenrct2
${PNG_LIBRARIES}
${ZLIB_LIBRARIES}
${LIBZIP_LIBRARIES})
@@ -167,19 +159,19 @@ endif ()
if (MINGW)
# Hardcode libraries used on mingw
target_link_libraries(${PROJECT_NAME} crypto ws2_32 tasn1 unistring iconv p11-kit hogweed gmp nettle)
target_link_libraries(libopenrct2 crypto ws2_32 tasn1 unistring iconv p11-kit hogweed gmp nettle)
# Link in libssp
target_link_libraries(${PROJECT_NAME} -fstack-protector-strong)
target_link_libraries(libopenrct2 -fstack-protector-strong)
endif()
if (UNIX AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "BSD")
# Include libdl for dlopen
target_link_libraries(${PROJECT_NAME} dl)
target_link_libraries(libopenrct2 dl)
endif ()
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(${PROJECT_NAME} Threads::Threads)
target_link_libraries(libopenrct2 Threads::Threads)
# For some reason, these flags break the check for pthreads. Add them after.
if (EMSCRIPTEN)
@@ -195,53 +187,53 @@ if (NOT MINGW AND NOT MSVC AND NOT EMSCRIPTEN)
# For unicode code page conversion.
find_package(ICU 59.0 REQUIRED COMPONENTS uc)
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${ICU_INCLUDE_DIRS})
target_include_directories(libopenrct2 SYSTEM PRIVATE ${ICU_INCLUDE_DIRS})
if (STATIC)
target_link_libraries(${PROJECT_NAME} ${ICU_STATIC_LIBRARIES})
target_link_libraries(libopenrct2 ${ICU_STATIC_LIBRARIES})
else ()
target_link_libraries(${PROJECT_NAME} ${ICU_LIBRARIES})
target_link_libraries(libopenrct2 ${ICU_LIBRARIES})
endif ()
endif ()
if (NOT DISABLE_TTF)
if (STATIC)
target_link_libraries(${PROJECT_NAME} ${FREETYPE_STATIC_LIBRARIES})
target_link_libraries(libopenrct2 ${FREETYPE_STATIC_LIBRARIES})
if (UNIX AND NOT APPLE)
target_link_libraries(${PROJECT_NAME} ${FONTCONFIG_STATIC_LIBRARIES})
target_link_libraries(libopenrct2 ${FONTCONFIG_STATIC_LIBRARIES})
endif ()
else ()
if (NOT MSVC)
target_link_libraries(${PROJECT_NAME} PkgConfig::FREETYPE)
target_link_libraries(libopenrct2 PkgConfig::FREETYPE)
else ()
target_link_libraries(${PROJECT_NAME} ${FREETYPE_LIBRARIES})
target_link_libraries(libopenrct2 ${FREETYPE_LIBRARIES})
endif ()
if (UNIX AND NOT APPLE)
target_link_libraries(${PROJECT_NAME} ${FONTCONFIG_LIBRARIES})
target_link_libraries(libopenrct2 ${FONTCONFIG_LIBRARIES})
endif ()
endif ()
if (${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
target_link_libraries(${PROJECT_NAME} -L${OPENBSD_X11BASE}/lib)
target_link_libraries(libopenrct2 -L${OPENBSD_X11BASE}/lib)
endif ()
endif ()
if (HAVE_DISCORD_RPC)
if(${DISCORDRPC_FOUND})
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${DISCORDRPC_INCLUDE_DIR})
target_link_libraries(${PROJECT_NAME} ${DISCORDRPC_LIBRARY})
target_include_directories(libopenrct2 SYSTEM PRIVATE ${DISCORDRPC_INCLUDE_DIR})
target_link_libraries(libopenrct2 ${DISCORDRPC_LIBRARY})
else()
target_link_libraries(libopenrct2 discord-rpc)
endif()
endif()
# Includes
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${LIBZIP_INCLUDE_DIRS})
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${PNG_INCLUDE_DIRS}
target_include_directories(libopenrct2 SYSTEM PRIVATE ${LIBZIP_INCLUDE_DIRS})
target_include_directories(libopenrct2 SYSTEM PRIVATE ${PNG_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS})
include_directories(${PROJECT_NAME} SYSTEM ${CMAKE_CURRENT_LIST_DIR}/../thirdparty)
include_directories(libopenrct2 SYSTEM ${CMAKE_CURRENT_LIST_DIR}/../thirdparty)
# To avoid unnecessary rebuilds set the current branch and
# short sha1 only for the two files that use these
@@ -274,15 +266,15 @@ endif()
# - GCC 8 does not support -Wno-pragma-once-outside-header
# - Other compilers status unknown
if (ENABLE_HEADERS_CHECK AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_library(${PROJECT_NAME}-headers-check OBJECT ${OPENRCT2_CORE_HEADERS})
set_target_properties(${PROJECT_NAME}-headers-check PROPERTIES LINKER_LANGUAGE CXX)
add_library(libopenrct2-headers-check OBJECT ${OPENRCT2_CORE_HEADERS})
set_target_properties(libopenrct2-headers-check PROPERTIES LINKER_LANGUAGE CXX)
set_source_files_properties(${OPENRCT2_CORE_HEADERS} PROPERTIES LANGUAGE CXX)
add_definitions("-x c++ -Wno-pragma-once-outside-header -Wno-unused-const-variable")
get_target_property(LIBOPENRCT2_INCLUDE_DIRS ${PROJECT_NAME} INCLUDE_DIRECTORIES)
set_target_properties(${PROJECT_NAME}-headers-check PROPERTIES INCLUDE_DIRECTORIES "${LIBOPENRCT2_INCLUDE_DIRS}")
get_target_property(LIBOPENRCT2_INCLUDE_DIRS libopenrct2 INCLUDE_DIRECTORIES)
set_target_properties(libopenrct2-headers-check PROPERTIES INCLUDE_DIRECTORIES "${LIBOPENRCT2_INCLUDE_DIRS}")
else ()
# Dummy target to ease invocation
add_custom_target(${PROJECT_NAME}-headers-check)
add_custom_target(libopenrct2-headers-check)
endif ()
if (UNIX)
@@ -291,5 +283,5 @@ endif ()
if (CMAKE_LIBRARY_ARCHITECTURE MATCHES "arm-linux-gnueabihf")
message(STATUS "Linking to armhf libs; adding libatomic")
target_link_libraries(${PROJECT_NAME} atomic)
target_link_libraries(libopenrct2 atomic)
endif()
+8 -8
View File
@@ -504,7 +504,7 @@ static void TTFDrawStringRawSprite(DrawPixelInfo& dpi, std::string_view text, Te
}
}
#ifndef NO_TTF
#ifndef DISABLE_TTF
static void TTFDrawStringRawTTF(DrawPixelInfo& dpi, std::string_view text, TextDrawInfo* info)
{
@@ -540,7 +540,7 @@ static void TTFDrawStringRawTTF(DrawPixelInfo& dpi, std::string_view text, TextD
info->x += surface->w;
}
#endif // NO_TTF
#endif // DISABLE_TTF
static void TTFProcessFormatCode(DrawPixelInfo& dpi, const FmtString::Token& token, TextDrawInfo* info)
{
@@ -615,7 +615,7 @@ static void TTFProcessFormatCode(DrawPixelInfo& dpi, const FmtString::Token& tok
}
}
#ifndef NO_TTF
#ifndef DISABLE_TTF
static bool ShouldUseSpriteForCodepoint(char32_t codepoint)
{
switch (codepoint)
@@ -644,21 +644,21 @@ static bool ShouldUseSpriteForCodepoint(char32_t codepoint)
return false;
}
}
#endif // NO_TTF
#endif // DISABLE_TTF
static void TTFProcessStringLiteral(DrawPixelInfo& dpi, std::string_view text, TextDrawInfo* info)
{
#ifndef NO_TTF
#ifndef DISABLE_TTF
bool isTTF = info->flags & TEXT_DRAW_FLAG_TTF;
#else
bool isTTF = false;
#endif // NO_TTF
#endif // DISABLE_TTF
if (!isTTF)
{
TTFDrawStringRawSprite(dpi, text, info);
}
#ifndef NO_TTF
#ifndef DISABLE_TTF
else
{
CodepointView codepoints(text);
@@ -705,7 +705,7 @@ static void TTFProcessStringLiteral(DrawPixelInfo& dpi, std::string_view text, T
TTFDrawStringRawTTF(dpi, text.substr(ttfRunIndex.value(), len), info);
}
}
#endif // NO_TTF
#endif // DISABLE_TTF
}
static void TTFProcessStringCodepoint(DrawPixelInfo& dpi, codepoint_t codepoint, TextDrawInfo* info)
+6 -6
View File
@@ -34,9 +34,9 @@ static constexpr int32_t kSpriteFontLineHeight[FontStyleCount] = {
static uint8_t _spriteFontCharacterWidths[FontStyleCount][kSpriteFontGlyphCount];
static uint8_t _additionalSpriteFontCharacterWidth[FontStyleCount][SPR_G2_GLYPH_COUNT] = {};
#ifndef NO_TTF
#ifndef DISABLE_TTF
TTFFontSetDescriptor* gCurrentTTFFontSet;
#endif // NO_TTF
#endif // DISABLE_TTF
constexpr uint8_t CS_SPRITE_FONT_OFFSET = 32;
@@ -358,12 +358,12 @@ ImageId FontSpriteGetCodepointSprite(FontStyle fontStyle, int32_t codepoint)
int32_t FontGetLineHeight(FontStyle fontStyle)
{
auto fontSize = EnumValue(fontStyle);
#ifndef NO_TTF
#ifndef DISABLE_TTF
if (LocalisationService_UseTrueTypeFont())
{
return gCurrentTTFFontSet->size[fontSize].line_height;
}
#endif // NO_TTF
#endif // DISABLE_TTF
return kSpriteFontLineHeight[fontSize];
}
@@ -401,7 +401,7 @@ bool FontSupportsStringSprite(const utf8* text)
bool FontSupportsStringTTF(const utf8* text, FontStyle fontStyle)
{
#ifndef NO_TTF
#ifndef DISABLE_TTF
const utf8* src = text;
const TTF_Font* font = gCurrentTTFFontSet->size[EnumValue(fontStyle)].font;
if (font == nullptr)
@@ -421,7 +421,7 @@ bool FontSupportsStringTTF(const utf8* text, FontStyle fontStyle)
return true;
#else
return false;
#endif // NO_TTF
#endif // DISABLE_TTF
}
bool FontSupportsString(const utf8* text, FontStyle fontStyle)
+2 -2
View File
@@ -26,7 +26,7 @@ enum class FontStyle : uint8_t
constexpr uint8_t FontStyleCount = 3;
constexpr std::array<FontStyle, FontStyleCount> FontStyles = { FontStyle::Small, FontStyle::Medium, FontStyle::Tiny };
#ifndef NO_TTF
#ifndef DISABLE_TTF
struct InternalTTFFont;
using TTF_Font = InternalTTFFont;
@@ -49,7 +49,7 @@ struct TTFFontSetDescriptor
extern TTFFontSetDescriptor* gCurrentTTFFontSet;
#endif // NO_TTF
#endif // DISABLE_TTF
void FontSpriteInitialiseCharacters();
int32_t FontSpriteGetCodepointOffset(int32_t codepoint);
+2 -2
View File
@@ -1546,7 +1546,7 @@ static void ScrollingTextSetBitmapForSprite(
static void ScrollingTextSetBitmapForTTF(
std::string_view text, int32_t scroll, uint8_t* bitmap, const int16_t* scrollPositionOffsets, colour_t colour)
{
#ifndef NO_TTF
#ifndef DISABLE_TTF
auto fontDesc = TTFGetFontFromSpriteBase(FontStyle::Tiny);
if (fontDesc->font == nullptr)
{
@@ -1634,5 +1634,5 @@ static void ScrollingTextSetBitmapForTTF(
scroll--;
}
}
#endif // NO_TTF
#endif // DISABLE_TTF
}
+2 -2
View File
@@ -7,7 +7,7 @@
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#ifndef NO_TTF
#ifndef DISABLE_TTF
#include "../Diagnostic.h"
@@ -371,4 +371,4 @@ void TTFDispose()
{
}
#endif // NO_TTF
#endif // DISABLE_TTF
+2 -2
View File
@@ -17,7 +17,7 @@ bool TTFInitialise();
void TTFDispose();
struct TTFSurface;
#ifndef NO_TTF
#ifndef DISABLE_TTF
struct TTFSurface
{
@@ -44,4 +44,4 @@ void TTF_SetFontHinting(TTF_Font* font, int hinting);
int TTF_GetFontHinting(const TTF_Font* font);
void TTF_Quit(void);
#endif // NO_TTF
#endif // DISABLE_TTF
+1 -1
View File
@@ -13,7 +13,7 @@
* removed.
*/
#ifndef NO_TTF
#ifndef DISABLE_TTF
/*
SDL_ttf: A companion library to SDL for working with TrueType (tm) fonts
+4 -4
View File
@@ -740,7 +740,7 @@ void X8DrawingContext::DrawGlyph(DrawPixelInfo& dpi, const ImageId image, int32_
GfxDrawSpritePaletteSetSoftware(dpi, image, { x, y }, paletteMap);
}
#ifndef NO_TTF
#ifndef DISABLE_TTF
template<bool TUseHinting>
static void DrawTTFBitmapInternal(
DrawPixelInfo& dpi, uint8_t colour, TTFSurface* surface, int32_t x, int32_t y, uint8_t hintingThreshold)
@@ -810,12 +810,12 @@ static void DrawTTFBitmapInternal(
dst += dstScanSkip;
}
}
#endif // NO_TTF
#endif // DISABLE_TTF
void X8DrawingContext::DrawTTFBitmap(
DrawPixelInfo& dpi, TextDrawInfo* info, TTFSurface* surface, int32_t x, int32_t y, uint8_t hintingThreshold)
{
#ifndef NO_TTF
#ifndef DISABLE_TTF
const uint8_t fgColor = info->palette[1];
const uint8_t bgColor = info->palette[3];
@@ -835,5 +835,5 @@ void X8DrawingContext::DrawTTFBitmap(
DrawTTFBitmapInternal<true>(dpi, fgColor, surface, x, y, hintingThreshold);
else
DrawTTFBitmapInternal<false>(dpi, fgColor, surface, x, y, 0);
#endif // NO_TTF
#endif // DISABLE_TTF
}
+1 -1
View File
@@ -144,7 +144,7 @@ namespace OpenRCT2::Colour
} // namespace OpenRCT2::Colour
#ifndef NO_TTF
#ifndef DISABLE_TTF
static BlendColourMapType BlendColourMap = { 0 };
static bool BlendColourMapInitialised = false;
+1 -1
View File
@@ -264,7 +264,7 @@ namespace OpenRCT2::Colour
u8string ToString(colour_t colour);
} // namespace OpenRCT2::Colour
#ifndef NO_TTF
#ifndef DISABLE_TTF
uint8_t BlendColours(const uint8_t paletteIndex1, const uint8_t paletteIndex2);
#endif
+2 -2
View File
@@ -11,7 +11,7 @@
#include "Fonts.h"
#ifndef NO_TTF
#ifndef DISABLE_TTF
TTFontFamily const TTFFamilyChineseSimplified = {
&TTFFontSimSun,
@@ -53,4 +53,4 @@ TTFontFamily const TTFFamilySansSerif = {
&TTFFontRoboto,
};
#endif // NO_TTF
#endif // DISABLE_TTF
+3 -3
View File
@@ -13,7 +13,7 @@
constexpr std::nullptr_t kFamilyOpenRCT2Sprite = nullptr;
#ifndef NO_TTF
#ifndef DISABLE_TTF
#include <vector>
@@ -30,8 +30,8 @@ extern TTFontFamily const TTFFamilySansSerif;
#define FAMILY(x) x
#else // NO_TTF
#else // DISABLE_TTF
#define FAMILY(x) kFamilyOpenRCT2Sprite
#endif // NO_TTF
#endif // DISABLE_TTF
+8 -8
View File
@@ -21,7 +21,7 @@
using namespace OpenRCT2;
using namespace OpenRCT2::Localisation;
#ifndef NO_TTF
#ifndef DISABLE_TTF
uint8_t const HINTING_DISABLED = 0;
uint8_t const HINTING_THRESHOLD_LOW = 40;
uint8_t const HINTING_THRESHOLD_MEDIUM = 60;
@@ -123,18 +123,18 @@ TTFFontSetDescriptor TTFFontNotoNaskhArabic = { {
{ "NotoNaskhArabic-Regular.ttf", "Noto Naskh Arabic", 9, 1, -2, 9, HINTING_THRESHOLD_MEDIUM, nullptr },
} };
// clang-format on
#endif // NO_TTF
#endif // DISABLE_TTF
static void LoadSpriteFont(LocalisationService& localisationService)
{
TTFDispose();
localisationService.UseTrueTypeFont(false);
#ifndef NO_TTF
#ifndef DISABLE_TTF
gCurrentTTFFontSet = nullptr;
#endif // NO_TTF
#endif // DISABLE_TTF
}
#ifndef NO_TTF
#ifndef DISABLE_TTF
static bool LoadFont(LocalisationService& localisationService, TTFFontSetDescriptor* font)
{
TTFDispose();
@@ -167,11 +167,11 @@ static bool LoadCustomConfigFont(LocalisationService& localisationService)
bool fontInitialised = TTFInitialise();
return fontInitialised;
}
#endif // NO_TTF
#endif // DISABLE_TTF
void TryLoadFonts(LocalisationService& localisationService)
{
#ifndef NO_TTF
#ifndef DISABLE_TTF
auto currentLanguage = localisationService.GetCurrentLanguage();
TTFontFamily const* fontFamily = LanguagesDescriptors[currentLanguage].font_family;
@@ -215,6 +215,6 @@ void TryLoadFonts(LocalisationService& localisationService)
LOG_VERBOSE("Unable to initialise any of the preferred TrueType fonts -- falling back to sprite font.");
}
}
#endif // NO_TTF
#endif // DISABLE_TTF
LoadSpriteFont(localisationService);
}
+2 -2
View File
@@ -16,7 +16,7 @@ namespace OpenRCT2::Localisation
#include "../drawing/Font.h"
#ifndef NO_TTF
#ifndef DISABLE_TTF
extern TTFFontSetDescriptor TTFFontMSGothic;
extern TTFFontSetDescriptor TTFFontNotoSansMono;
extern TTFFontSetDescriptor TTFFontHiragano;
@@ -33,6 +33,6 @@ extern TTFFontSetDescriptor TTFFontMicroHei;
extern TTFFontSetDescriptor TTFFontRoboto;
extern TTFFontSetDescriptor TTFFontNotoSansCJK;
extern TTFFontSetDescriptor TTFFontNotoNaskhArabic;
#endif // NO_TTF
#endif // DISABLE_TTF
void TryLoadFonts(OpenRCT2::Localisation::LocalisationService& localisationService);
@@ -78,7 +78,7 @@
#include <thread>
#include <vector>
#ifndef NO_TTF
#ifndef DISABLE_TTF
#include "../drawing/TTF.h"
#endif
@@ -722,7 +722,7 @@ static void ConsoleCommandGet(InteractiveConsole& console, const arguments_t& ar
{
console.WriteFormatLine("host_timescale %.02f", OpenRCT2::GetContext()->GetTimeScale());
}
#ifndef NO_TTF
#ifndef DISABLE_TTF
else if (argv[0] == "enable_hinting")
{
console.WriteFormatLine("enable_hinting %d", Config::Get().fonts.EnableHinting);
@@ -1003,7 +1003,7 @@ static void ConsoleCommandSet(InteractiveConsole& console, const arguments_t& ar
console.Execute("get host_timescale");
}
#ifndef NO_TTF
#ifndef DISABLE_TTF
else if (varName == "enable_hinting" && InvalidArguments(&invalidArgs, int_valid[0]))
{
Config::Get().fonts.EnableHinting = (int_val[0] != 0);
+1 -1
View File
@@ -75,7 +75,7 @@ struct LanguageDescriptor
const utf8* english_name;
const utf8* native_name;
uint8_t fallback;
#if !defined(NO_TTF)
#if !defined(DISABLE_TTF)
TTFontFamily const* font_family;
#else
void* font_family;
+1 -1
View File
@@ -163,7 +163,7 @@ namespace OpenRCT2::Platform
return {};
}
#ifndef NO_TTF
#ifndef DISABLE_TTF
std::string GetFontPath(const TTFFontDescriptor& font)
{
auto expectedPath = std::string("/system/fonts/") + std::string(font.filename);
+4 -4
View File
@@ -28,9 +28,9 @@
// for PATH_MAX
#include <linux/limits.h>
#endif // __linux__
#ifndef NO_TTF
#ifndef DISABLE_TTF
#include <fontconfig/fontconfig.h>
#endif // NO_TTF
#endif // DISABLE_TTF
#include "../Date.h"
#include "../OpenRCT2.h"
@@ -387,7 +387,7 @@ namespace OpenRCT2::Platform
};
}
#ifndef NO_TTF
#ifndef DISABLE_TTF
std::string GetFontPath(const TTFFontDescriptor& font)
{
// set LANG to portable C.UTF-8 so font face names from fontconfig
@@ -448,7 +448,7 @@ namespace OpenRCT2::Platform
FcFini();
return path;
}
#endif // NO_TTF
#endif // DISABLE_TTF
} // namespace OpenRCT2::Platform
#endif
+2 -2
View File
@@ -103,9 +103,9 @@ namespace OpenRCT2::Platform
std::string GetEnvironmentPath(const char* name);
std::string GetHomePath();
#endif
#ifndef NO_TTF
#ifndef DISABLE_TTF
std::string GetFontPath(const TTFFontDescriptor& font);
#endif // NO_TTF
#endif // DISABLE_TTF
std::string FormatShortDate(std::time_t timestamp);
std::string FormatTime(std::time_t timestamp);