summaryrefslogtreecommitdiff
path: root/replace-enum-strings.cmake
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2017-10-18 15:43:57 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2017-10-18 23:48:11 +0800
commit53db221259b5eea4d2244321b2fe96beb39aef7d (patch)
tree66de2e434f56e90a7371f3f59133fa5cd56603ce /replace-enum-strings.cmake
parent162575f2c69f519aae1b18ff1c501e7e4c2cdd4b (diff)
downloadharfbuzz-53db221259b5eea4d2244321b2fe96beb39aef7d.tar.gz
CMake: Support building HarfBuzz-GObject
This adds support to the CMake build files to support building HarfBuzz-GObject, which is actually a little bit complicated, as we need to: -Run glib-mkenums, which is a Python (for newer GLib/GObject) or PERL (for older, pre 2.53.4, GLib/GObject) script. This matters more for Visual Studio builds as shebang lines are not supported, so we need to test-run it with PERL or Python to determine which is the correct interpretor to use. -Next, we need to replace strings in the sources that we obtain from running glib-mkenums. So, the solution here is to use a small utility CMake script for our purposes here, to maintain maximum compatibility. -Ensure that things do work in the Visual Studio IDE builds.
Diffstat (limited to 'replace-enum-strings.cmake')
-rw-r--r--replace-enum-strings.cmake21
1 files changed, 21 insertions, 0 deletions
diff --git a/replace-enum-strings.cmake b/replace-enum-strings.cmake
new file mode 100644
index 00000000..42fdbff9
--- /dev/null
+++ b/replace-enum-strings.cmake
@@ -0,0 +1,21 @@
+# CMake script to replace items
+# in sources generated by glib-mkenums
+
+FILE(READ ${ENUM_INPUT_SRC} enum_in)
+
+STRING(REPLACE
+ "_t_get_type"
+ "_get_type"
+ enum_out_tmp
+ "${enum_in}"
+ )
+
+STRING(REPLACE
+ "_T ("
+ " ("
+ enum_out
+ "${enum_out_tmp}"
+ )
+
+FILE(WRITE ${ENUM_OUTPUT_SRC} "${enum_out}")
+FILE(REMOVE ${ENUM_INPUT_SRC}) \ No newline at end of file