]> git.saurik.com Git - wxWidgets.git/blobdiff - build/bakefiles/wxpresets/presets/wx_win32.bkl
Merge the new wxWebView classes from the SOC2011_WEBVIEW branch.
[wxWidgets.git] / build / bakefiles / wxpresets / presets / wx_win32.bkl
index fa5fb027347c78ddddc43ac4c1cbe3bcca61cd6a..4b86018beeb66e6d98081e71b4a748250187c95a 100644 (file)
 <!--                $Id$ -->
 
 
-<!--
-
-FIXME: this template has (at least) the following bugs:
-
- * it's MSW-only, the port is assumed to be wxMSW unconditionally
-
- * multiple wx configurations (CFG variable set when building the
-   library) are not supported
-
--->
-
-<!-- makefile tag signifies the beginning of the bakefile           -->
 <makefile>
 
-    <requires version="0.1.5"/>
 
-    <!--                        OPTIONS                             -->
     <!--                                                            -->
-    <!--    These are essentially the configurations you            -->
-    <!--    want in bakefile.                                       -->
-    <!--                                                            -->
-    <!--    In MSVC these are the different build                   -->
-    <!--    configurations you can have (in the build menu),        -->
-    <!--    and in autoconf is enabled with enable-xxx=xx.          -->
-    <!--    For other compilers a separate configuration            -->
-    <!--    file is created (such as config.gcc on gcc)             -->
-    <!--    which has several options a user can modify.            -->
+    <!--                        OPTIONS                             -->
     <!--                                                            -->
-    <!--    Note that the above only happens if an option           -->
-    <!--    is not constant, i.e. if it cannot be determined        -->
-    <!--    by bakefile itself.                                     -->
-
-    <!-- this is a temporary variable until there is non general    -->
-    <!-- function in bakefiles for returning native markup for      -->
-    <!-- reading envrionment variables                              -->
-    <set var="ENV_VAR">
-        <if cond="FORMAT=='watcom'">%</if>
-        <if cond="FORMAT!='watcom'"></if>
-    </set>
-
-
-    <!-- The directory where wxWidgets is installed: -->
-    <if cond="not isdefined('WX_DIR')">
-        <set var="WX_DIR_DEFAULT" overwrite="0">$(DOLLAR)($(ENV_VAR)WXWIN)</set>
-        <option name="WX_DIR" category="path">
-            <default-value>$(WX_DIR_DEFAULT)</default-value>
-            <description>
-                The directory where wxWidgets library is installed
-            </description>
-        </option>
-    </if>
 
+    <set var="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_NORMAL">
+        <!-- 'NORMAL' here refers to the fact that the formats for which
+             FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_NORMAL==1 only need
+             additional compiler and/or linker flags (see e.g. WXMACHINE_FLAG)
+         -->
+        <if cond="FORMAT in ['msvc']">1</if>
+        <if cond="FORMAT not in ['msvc']">0</if>
+    </set>
+    <set var="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_VIA_MSVS_PLATFORMS">
+        <!-- the formats for which FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_VIA_MSVS_PLATFORMS==1 
+             need special handling: see the docs of the MSVS_PLATFORMS variable in Bakefile docs.
+         -->
+        <if cond="FORMAT in ['msvs2005prj','msvs2008prj']">1</if>
+        <if cond="FORMAT not in ['msvs2005prj','msvs2008prj']">0</if>
+    </set>
+    <set var="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES">
+        <if cond="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_NORMAL=='1'">1</if>
+        <if cond="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_VIA_MSVS_PLATFORMS=='1'">1</if>
+        <if cond="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_NORMAL=='0' and FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_VIA_MSVS_PLATFORMS=='0'">0</if>
+    </set>
+    
     <!--    This is a standard option that determines               -->
-    <!--    whether the user wants to build this library as         -->
-    <!--    a dll or as a static library.                           -->
-    <if cond="not isdefined('WX_SHARED')">
-        <set var="WX_SHARED_DEFAULT" overwrite="0">0</set>
-        <option name="WX_SHARED">
-            <values>0,1</values>
-            <values-description>,DLL</values-description>
-            <default-value>$(WX_SHARED_DEFAULT)</default-value>
+    <!--    the architecture for which the lib/exe/dll later        -->
+    <!--    declared are meant.                                     -->
+    <if cond="not isdefined('TARGET_CPU') and FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_NORMAL=='1'">
+        <set var="TARGET_CPU_DEFAULT" overwrite="0">X86</set>
+        <option name="TARGET_CPU">
+            <values>X86,AMD64,IA64</values>
+            <values-description>i386-compatible,AMD 64 bit,Itanium 64 bit</values-description>
+            <default-value>$(TARGET_CPU_DEFAULT)</default-value>
             <description>
-                Use DLL build of wx library to use?
+                Architecture of the CPU for which to build the executables and libraries
             </description>
         </option>
     </if>
-
-    <!-- Configuration for building the bakefile with               -->
-    <!-- unicode strings or not (unicode or ansi).                  -->
-    <if cond="not isdefined('WX_UNICODE')">
-        <set var="WX_UNICODE_DEFAULT" overwrite="0">0</set>
-        <option name="WX_UNICODE">
-            <values>0,1</values>
-            <values-description>,Unicode</values-description>
-            <default-value>$(WX_UNICODE_DEFAULT)</default-value>
-            <description>
-                Compile Unicode build of wxWidgets?
-            </description>
-        </option>
+    <if cond="not isdefined('TARGET_CPU') and FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_VIA_MSVS_PLATFORMS=='1'">
+        <!-- defining TARGET_CPU also for the formats using the MSVS_PLATFORM variable allows to write
+             easier tests in user bakefiles; e.g.:
+             
+            <set var="MY_ARCH_DEPENDENT_VARIABLE">
+                <if cond="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES=='0'">value1</if>
+                <if cond="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES=='1' and TARGET_CPU=='X86'">value2</if>
+                <if cond="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES=='1' and TARGET_CPU=='AMD64'">value3</if>
+                <if cond="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES=='1' and TARGET_CPU=='IA64'">value4</if>
+            </set>
+        -->
+        <set var="TARGET_CPU">
+            <if cond="MSVS_PLATFORM=='win32'">X86</if>
+            <if cond="MSVS_PLATFORM=='win64'">AMD64</if>
+            <if cond="MSVS_PLATFORM=='ia64'">IA64</if>
+                <!-- MSVS_PLATFORM currently does not support ia64 but this line is still needed by bakefile 
+                     to correctly set the TARGET_CPU variable -->
+        </set>
     </if>
 
-    <if cond="not isdefined('WX_DEBUG')">
-        <set var="WX_DEBUG_DEFAULT" overwrite="0">1</set>
-        <option name="WX_DEBUG">
-            <values>0,1</values>
-            <values-description>Release,Debug</values-description>
-            <default-value>$(WX_DEBUG_DEFAULT)</default-value>
-            <description>
-                Use debug build of wxWidgets (define __WXDEBUG__)?
-            </description>
-        </option>
-    </if>
 
-    <if cond="not isdefined('WX_VERSION')">
-        <set var="WX_VERSION_DEFAULT" overwrite="0">26</set>
-        <option name="WX_VERSION">
-            <default-value>$(WX_VERSION_DEFAULT)</default-value>
-            <description>
-                Version of the wx library to build against.
-            </description>
-        </option>
-    </if>
 
     <!--                     HELPER VARIABLES                       -->
     <!--                                                            -->
@@ -134,29 +95,88 @@ FIXME: this template has (at least) the following bugs:
     <!--    These are handy ways of dealing with the                -->
     <!--    extensions in the library names of the                  -->
     <!--    wxWindows library.                                      -->
-    <set var="WXLIBPOSTFIX">
-        <if cond="WX_DEBUG=='1' and WX_UNICODE=='1'">ud</if>
-        <if cond="WX_DEBUG=='1' and WX_UNICODE=='0'">d</if>
-        <if cond="WX_DEBUG=='0' and WX_UNICODE=='1'">u</if>
-    </set>
     <set var="WX3RDPARTYLIBPOSTFIX">
         <if cond="WX_DEBUG=='1'">d</if>
     </set>
 
     <set var="WXCPU">
         <if cond="FORMAT=='msevc4prj'">_$(CPU)</if>
+        <if cond="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES=='1' and TARGET_CPU=='AMD64'">_amd64</if>
+        <if cond="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES=='1' and TARGET_CPU=='IA64'">_ia64</if>
     </set>
-
+    
+    <set var="WXMACHINE_FLAG">
+        <!-- add the /MACHINE linker flag to formats with "normal" multiple-arch support when building in 64bit mode
+             (formats using the MSVS_PLATFORM variable don't need the /MACHINE linker flag!): -->
+        <if cond="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_NORMAL=='1' and TARGET_CPU=='AMD64'">/MACHINE:AMD64</if>
+        <if cond="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_NORMAL=='1' and TARGET_CPU=='IA64'">/MACHINE:IA64</if>
+    </set>
+    
     <set var="WXLIBPATH">
-        <if cond="WX_SHARED=='0'">$(DIRSEP)lib$(DIRSEP)$(COMPILER)$(WXCPU)_lib</if>
-        <if cond="WX_SHARED=='1'">$(DIRSEP)lib$(DIRSEP)$(COMPILER)$(WXCPU)_dll</if>
+        <if cond="WX_SHARED=='0'">$(DIRSEP)lib$(DIRSEP)$(COMPILER_PREFIX)$(WXCPU)_lib</if>
+        <if cond="WX_SHARED=='1'">$(DIRSEP)lib$(DIRSEP)$(COMPILER_PREFIX)$(WXCPU)_dll</if>
     </set>
-
-    <set var="WXPORT">
+    
+    <!-- under Unix this is an option (detected at configure-time);
+         under Windows this is not an user option! -->
+    <set var="WX_PORT">
         <if cond="FORMAT=='msevc4prj'">wince</if>
         <if cond="FORMAT!='msevc4prj'">msw</if>
     </set>
-    <set var="WXLIBINCLUDE">$(WXLIBPATH)$(DIRSEP)$(WXPORT)$(WXLIBPOSTFIX)</set>
+
+    <set var="WXLIBINCLUDE">$(WXLIBPATH)$(DIRSEP)$(WX_PORT)$(WXLIBPOSTFIX)</set>
+
+
+    <!--    All the possible mixes for the wx library names          -->
+    <set var="WXLIB_BASE_NAME">
+        <if cond="WX_MONOLITHIC=='0'">wxbase$(WX_VERSION)$(WXLIBPOSTFIX)</if>
+
+        <!--
+            the trick used to support monolithic builds is here: when the
+            <wx-lib>base</wx-lib> tag is found, and user selected
+            WX_MONOLITHIC=1, then the base library is translated to the
+            monolithic library
+        -->
+        <if cond="WX_MONOLITHIC=='1'">wx$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)</if>
+    </set>
+
+
+    <!--   Libraries whose name is prefixed with 'wxbase'            -->
+    <define-global-tag name="define-wxbase-lib-name">
+        <set var="WXLIB_$(value.upper())_NAME">
+            <if cond="WX_MONOLITHIC=='0'">
+                wxbase$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)
+            </if>
+    </set>
+    </define-global-tag>
+
+    <define-wxbase-lib-name>net</define-wxbase-lib-name>
+    <define-wxbase-lib-name>xml</define-wxbase-lib-name>
+
+
+    <!--   Libraries whose name is prefixed with 'wx' only          -->
+    <define-global-tag name="define-wxlib-name">
+        <set var="WXLIB_$(value.upper())_NAME">
+            <if cond="WX_MONOLITHIC=='0'">
+                wx$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)
+            </if>
+        </set>
+    </define-global-tag>
+
+    <define-wxlib-name>core</define-wxlib-name>
+    <define-wxlib-name>media</define-wxlib-name>
+    <define-wxlib-name>xrc</define-wxlib-name>
+    <define-wxlib-name>html</define-wxlib-name>
+    <define-wxlib-name>adv</define-wxlib-name>
+    <define-wxlib-name>qa</define-wxlib-name>
+    <define-wxlib-name>aui</define-wxlib-name>
+    <define-wxlib-name>ribbon</define-wxlib-name>
+    <define-wxlib-name>propgrid</define-wxlib-name>
+    <define-wxlib-name>stc</define-wxlib-name>
+    <define-wxlib-name>richtext</define-wxlib-name>
+
+    <!-- NOTE: The GL lib is not part of the monolithic build; treat it as a contrib! -->
+
 
 
     <!--                        WX TEMPLATE                         -->
@@ -177,18 +197,38 @@ FIXME: this template has (at least) the following bugs:
     <!--    libraries required by the platform, the libraries       -->
     <!--    we want for our stuff, and the wxWindows libs.          -->
 
-
-
     <!-- this tag is used to include wx libraries: -->
     <define-tag name="wx-lib" rules="exe,dll,module">
-        <if cond="value=='base'">
-            <sys-lib>wxbase$(WX_VERSION)$(WXLIBPOSTFIX)</sys-lib>
+        <if cond="value=='base'"><sys-lib>$(WXLIB_BASE_NAME)</sys-lib></if>
+        <if cond="value=='core'"><sys-lib>$(WXLIB_CORE_NAME)</sys-lib></if>
+
+        <if cond="value=='net'"><sys-lib>$(WXLIB_NET_NAME)</sys-lib></if>
+        <if cond="value=='xml'"><sys-lib>$(WXLIB_XML_NAME)</sys-lib></if>
+
+        <if cond="value=='media'"><sys-lib>$(WXLIB_MEDIA_NAME)</sys-lib></if>
+        <if cond="value=='xrc'"><sys-lib>$(WXLIB_XRC_NAME)</sys-lib></if>
+        <if cond="value=='html'"><sys-lib>$(WXLIB_HTML_NAME)</sys-lib></if>
+        <if cond="value=='adv'"><sys-lib>$(WXLIB_ADV_NAME)</sys-lib></if>
+        <if cond="value=='qa'"><sys-lib>$(WXLIB_QA_NAME)</sys-lib></if>
+        <if cond="value=='aui'"><sys-lib>$(WXLIB_AUI_NAME)</sys-lib></if>
+        <if cond="value=='ribbon'"><sys-lib>$(WXLIB_RIBBON_NAME)</sys-lib></if>
+        <if cond="value=='propgrid'"><sys-lib>$(WXLIB_PROPGRID_NAME)</sys-lib></if>
+        <if cond="value=='richtext'"><sys-lib>$(WXLIB_RICHTEXT_NAME)</sys-lib></if>
+
+        <!-- The GL lib isn't part of the monolithic build, treat it as a contrib: -->
+        <if cond="value=='gl'">
+            <sys-lib>wx$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)</sys-lib>
         </if>
-        <if cond="value in ['net','xml', 'odbc']">
-            <sys-lib>wxbase$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)</sys-lib>
+
+        <if cond="value=='stc'">
+            <!-- wxSTC requires also the basic scintilla library
+                 which is built as a separate 3rd party library -->
+            <sys-lib>$(WXLIB_STC_NAME)</sys-lib>
+            <sys-lib>wxscintilla$(WX3RDPARTYLIBPOSTFIX)</sys-lib>
         </if>
-        <if cond="value not in ['base','net','xml']">
-            <sys-lib>wx$(WXPORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)</sys-lib>
+
+        <if cond="value not in WX_LIB_LIST.split()">
+            <error>Unknown wxWidgets library given in the wx-lib tag</error>
         </if>
     </define-tag>
 
@@ -209,12 +249,16 @@ FIXME: this template has (at least) the following bugs:
             <ldflags>-mthreads</ldflags>
         </if>
 
+        <define>$(substituteFromDict(WX_SHARED,{'1':'WXUSINGDLL','0':''}))</define>
+
         <define>$(WXUNICODE_DEFINE)</define>
         <define>$(WXDEBUG_DEFINE)</define>
         <define>__WXMSW__</define>
 
-        <include>$(WX_DIR)$(WXLIBINCLUDE)</include>
-        <include>$(WX_DIR)/include</include>
+        <if cond="FORMAT!='xcode2'">
+            <include>$(WX_DIR)$(WXLIBINCLUDE)</include>
+            <include>$(WX_DIR)/include</include>
+        </if>
     </template>
 
 
@@ -223,14 +267,14 @@ FIXME: this template has (at least) the following bugs:
          after __wx-libs-point: -->
     <define-tag name="__wx-syslibs" rules="exe,dll,module">
         <!-- wx 3rd party libs, always use them: -->
-        <sys-lib cond="FORMAT!='msevc4prj'">wxtiff$(WX3RDPARTYLIBPOSTFIX)</sys-lib> 
-        <sys-lib>wxjpeg$(WX3RDPARTYLIBPOSTFIX)</sys-lib> 
-        <sys-lib>wxpng$(WX3RDPARTYLIBPOSTFIX)</sys-lib> 
-        <sys-lib>wxzlib$(WX3RDPARTYLIBPOSTFIX)</sys-lib> 
-        <!-- For regex we won't use the WX3RDPARTYLIBPOSTIX postfix: 
+        <sys-lib cond="FORMAT!='msevc4prj'">wxtiff$(WX3RDPARTYLIBPOSTFIX)</sys-lib>
+        <sys-lib>wxjpeg$(WX3RDPARTYLIBPOSTFIX)</sys-lib>
+        <sys-lib>wxpng$(WX3RDPARTYLIBPOSTFIX)</sys-lib>
+        <sys-lib>wxzlib$(WX3RDPARTYLIBPOSTFIX)</sys-lib>
+        <!-- For regex we won't use the WX3RDPARTYLIBPOSTIX postfix:
              unliked tiff, jpeg, png, zlib, expat, when building
              in Unicode mode, the "u" suffix is appended to regex -->
-        <sys-lib cond="FORMAT!='msevc4prj'">wxregex$(WXLIBPOSTFIX)</sys-lib> 
+        <sys-lib cond="FORMAT!='msevc4prj'">wxregex$(WXLIBPOSTFIX)</sys-lib>
         <sys-lib>wxexpat$(WX3RDPARTYLIBPOSTFIX)</sys-lib>
 
         <!-- link-in system libs that wx depends on: -->
@@ -255,7 +299,6 @@ FIXME: this template has (at least) the following bugs:
             <sys-lib>rpcrt4</sys-lib>
             <sys-lib>advapi32</sys-lib>
             <sys-lib>wsock32</sys-lib>
-            <sys-lib>odbc32</sys-lib>
         </if>
 
         <!-- Libs common to both borland and MSVC               -->
@@ -266,12 +309,44 @@ FIXME: this template has (at least) the following bugs:
 
     <!-- template for wx executables/dlls: -->
     <template id="wx" template="wx-lib">
-        <lib-path>$(WX_DIR)$(WXLIBPATH)</lib-path>
+        <if cond="FORMAT!='xcode2'">
+            <lib-path>$(WX_DIR)$(WXLIBPATH)</lib-path>
+        </if>
 
+        <ldflags>$(WXMACHINE_FLAG)</ldflags>
+            
         <!-- wx libs must come before 3rd party and sys libs, this is
              the place where the hack explained above is carried on: -->
         <__wx-libs-point/>
         <__wx-syslibs/>
     </template>
 
+    <if cond="FORMAT_SUPPORTS_ACTIONS=='1' and WX_TEST_FOR_SELECTED_WXBUILD=='1'">
+
+        <!--
+            VERY IMPORTANT: before starting to build all targets of the generated makefile,
+                            we need to check if the selected wxWidgets build exists; we do
+                            that simply creating the following target; if it fails the make
+                            program will halt printing the following nice error message...
+                            (much better than the 'could not find wx/*.h file')
+        -->
+        <action id="test_for_selected_wxbuild">
+            <dependency-of>all</dependency-of>
+
+            <!-- the @ is to hide these actions from the user -->
+            <command>
+                @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \
+                    echo ----------------------------------------------------------------------------
+                @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \
+                    echo The selected wxWidgets build is not available!
+                @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \
+                    echo Please use the options prefixed with WX_ to select another wxWidgets build.
+                @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \
+                    echo ----------------------------------------------------------------------------
+                @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \
+                    exit 1
+            </command>
+        </action>
+    </if>
+
 </makefile>