]> git.saurik.com Git - wxWidgets.git/commitdiff
added <xrc-file> tag to wxpresets
authorVáclav Slavík <vslavik@fastmail.fm>
Mon, 23 Jun 2008 20:31:16 +0000 (20:31 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Mon, 23 Jun 2008 20:31:16 +0000 (20:31 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54338 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

build/bakefiles/wxpresets/presets/wx.bkl
build/bakefiles/wxpresets/presets/wx_xrc.bkl [new file with mode: 0644]

index bb2a8d8d3f3bacdff0c72464c1c376ee3031ffd4..bb48de3a1809d1406346b113e48c318c9568f347 100644 (file)
         </if>
     </define-global-tag>
 
+
+    <include file="wx_xrc.bkl"/>
+
 </makefile>
diff --git a/build/bakefiles/wxpresets/presets/wx_xrc.bkl b/build/bakefiles/wxpresets/presets/wx_xrc.bkl
new file mode 100644 (file)
index 0000000..5d0f9e7
--- /dev/null
@@ -0,0 +1,72 @@
+<?xml version="1.0" ?>
+<!-- $Id$ -->
+
+<!--
+
+Bakefile XRC support; included by wx.bkl, do not include directly.
+
+Usage:
+
+<exe id="myapp" template="wxgui,simple">
+    ...
+    <sources>...</sources>
+    ...
+    <xrc-file>myapp.xrc</xrc-file>
+    <xrc-file>file2.xrc</xrc-file>
+</exe>
+
+Then in application code, you have to call initialization for every XRC
+file:
+
+    InitXMLResource_myapp();
+    InitXMLResource_file2();
+
+-->
+
+<makefile>
+
+    <!-- XRC section -->
+    <option name="WXRC" category="path">
+        <description>Path to find the wxrc executable.</description>
+        <default-value>wxrc</default-value>
+    </option>
+
+
+    <define-tag name="xrc-file" rules="exe,dll,lib">
+        <set var="_xrc_file">$(value)</set>
+        <set var="_xrc_cpp">$(value.replace('.xrc', '_xrc.cpp'))</set>
+        <set var="_xrc_base">$(value[value.rfind('/')+1:value.rfind('.')])</set>
+        <set var="_wxrc_options">-c -n InitXMLResource_$(_xrc_base)</set>
+
+        <sources>$(_xrc_cpp)</sources>
+        <if cond="FORMAT not in ['msvc6prj','msvs2003prj','msvs2005prj']">
+            <clean-files>$(_xrc_cpp)</clean-files>
+            <add-target target="$(_xrc_cpp)" type="action"/>
+            <modify-target target="$(_xrc_cpp)">
+                <set var="_xrc">$(_xrc_file)</set>
+                <depends-on-file>$(SRCDIR)/$(_xrc)</depends-on-file>
+                <command>
+                    $(WXRC) $(_wxrc_options) -o $(_xrc_cpp) $(_xrc)
+                </command>
+            </modify-target>
+        </if>
+        <if cond="FORMAT in ['msvc6prj','msvs2003prj','msvs2005prj']">
+            <sources>$(_xrc_file)</sources>
+            <!--
+                A hack to add XRC compilation step to MSVC projects.
+
+                NB: it's important to use backslashes and not slashes here.
+             -->
+             <set var="_custom_build_files" append="1">$(_xrc_file.replace('/','\\'))</set>
+            <set var="_custom_build_$(_xrc_file.replace('/','_').replace('.','_'))">
+Compiling XRC resources: $(_xrc_file)...
+InputPath=$(_xrc_file)
+
+"$(_xrc_cpp.replace('/','\\'))" : "$(DOLLAR)(INTDIR)"
+$(TAB)$(WXRC) $(_wxrc_options) -o $(_xrc_cpp) $(_xrc_file)
+            </set>
+        </if>
+
+    </define-tag>
+
+</makefile>