From 4f9c633bc9a661fbeb367e950f6789d8de6782e6 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 9 Dec 2017 18:16:28 +0100 Subject: compat: add easier translate boilerplate for non-qobject --- cmake/opentrack-boilerplate.cmake | 1 + compat/macros.hpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake index d3becd56..56117e09 100644 --- a/cmake/opentrack-boilerplate.cmake +++ b/cmake/opentrack-boilerplate.cmake @@ -166,6 +166,7 @@ function(otr_module n_) target_link_libraries(${n} opentrack-api opentrack-options opentrack-compat) endif() + target_compile_definitions("${n}" PRIVATE "-DOTR_MODULE_NAME=\"${n_}\"") string(REPLACE "-" "_" build-n ${n_}) string(TOUPPER "${build-n}" build-n) set_property(TARGET ${n} PROPERTY DEFINE_SYMBOL "BUILD_${build-n}") diff --git a/compat/macros.hpp b/compat/macros.hpp index bf134c75..05a027bd 100644 --- a/compat/macros.hpp +++ b/compat/macros.hpp @@ -1,5 +1,7 @@ #pragma once +#define otr_tr(str) (QCoreApplication::translate(OTR_MODULE_NAME, (str))) + #if defined _MSC_VER # define never_inline __declspec(noinline) #elif defined __GNUG__ -- cgit v1.2.3