]> git.saurik.com Git - wxWidgets.git/blobdiff - build/bakefiles/common.bkl
fixed custom build step for VC++ project files
[wxWidgets.git] / build / bakefiles / common.bkl
index deb3ed321cef2528af5211c49342d35fb1f21dd7..0c429596ef9f993a78f6d31d5497f451ff3034be 100644 (file)
@@ -3,8 +3,6 @@
 
 <makefile>
     
-    <set var="BUILDING_LIB" overwrite="0">0</set>
-
     <!-- bakefile modules we need: -->
     <using module="datafiles"/>
 
     <set var="WXVER_MAJOR">$(wxwin.getVersionMajor())</set>
     <set var="WXVER_MINOR">$(wxwin.getVersionMinor())</set>
     <set var="WXVER_RELEASE">$(wxwin.getVersionRelease())</set>
-    <set var="WX_VERSION">$(WXVER_MAJOR).$(WXVER_MINOR).$(WXVER_RELEASE)</set>
+    <set var="WX_VERSION" make_var="1">
+        $(WXVER_MAJOR).$(WXVER_MINOR).$(WXVER_RELEASE)
+    </set>
+
+    <set var="WX_STABLE_BRANCH">$(int(int(WXVER_MINOR) % 2 == 0))</set>
 
-    <set var="WXSOVERSION">0.0.0</set>
+    <set var="WXSOVERSION">
+        <if cond="WX_STABLE_BRANCH=='1'">0.0.0</if>
+        <if cond="WX_STABLE_BRANCH=='0'">$(WXVER_RELEASE).0.0</if>
+    </set>
     <set var="WXMACVERSION">$(WX_VERSION)</set>
+    <set var="WXWIN32DLLVERSION">
+        <if cond="WX_STABLE_BRANCH=='1'">$(WXVER_MAJOR)$(WXVER_MINOR)</if>
+        <if cond="WX_STABLE_BRANCH=='0'">$(WXVER_MAJOR)$(WXVER_MINOR)$(WXVER_RELEASE)</if>
+    </set>
     
     
     <!-- ================================================================== -->
         <if cond="USE_GUI=='0'">base</if>
         <if cond="USE_GUI=='1'">$(TOOLKIT_LOWERCASE)$(TOOLKIT_VERSION)</if>
     </set>
+    
+    <set var="WXBASEPORT">
+        <if cond="TOOLKIT=='MAC'">_carbon</if>
+    </set>
 
     <set var="COMPILERORGCC">
         <if cond="isdefined('COMPILER')">$(COMPILER)</if>
     <set var="WXCOMPILER">
         <if cond="PLATFORM_WIN32=='1'">_$(COMPILERORGCC)</if>
     </set>
-    
+
+    <set var="VENDORTAG">
+        <if cond="PLATFORM_WIN32=='1' and OFFICIAL_BUILD=='1'"></if>
+        <if cond="PLATFORM_WIN32=='1' and OFFICIAL_BUILD=='0'">_$(VENDOR)</if>
+    </set>
+
     <set var="WXDEBUGFLAG">
-        <if cond="BUILD=='debug'">d</if>
+        <if cond="BUILD=='debug' and DEBUG_FLAG=='default'">d</if>
+        <if cond="DEBUG_FLAG=='1'">d</if>
     </set>
     <set var="WXUNICODEFLAG">
         <if cond="UNICODE=='1'">u</if>
     </set>
 
     <if cond="FORMAT=='autoconf'">
-        <set var="WXNAMEPREFIX">wx</set>
+        <set var="WXNAMEPREFIX">wx_base$(WXBASEPORT)</set>
         <set var="WXNAMEPREFIXGUI">wx_$(PORTNAME)$(WXUNIVNAME)</set>
         <set var="WXVERSIONTAG">-$(WXVER_MAJOR).$(WXVER_MINOR)</set>
     </if>
     <if cond="FORMAT!='autoconf'">
-        <set var="WXNAMEPREFIX">wx$(WXVER_MAJOR)$(WXVER_MINOR)</set>
-        <set var="WXNAMEPREFIXGUI">wx$(PORTNAME)$(WXUNIVNAME)$(WXVER_MAJOR)$(WXVER_MINOR)</set>
+        <set var="WXNAMEPREFIX">
+            wxbase$(WXBASEPORT)$(WXVER_MAJOR)$(WXVER_MINOR)
+        </set>
+        <set var="WXNAMEPREFIXGUI">
+            wx$(PORTNAME)$(WXUNIVNAME)$(WXVER_MAJOR)$(WXVER_MINOR)</set>
         <set var="WXVERSIONTAG"></set>
     </if>
-
-    <set var="TOOLCHAIN_NAME">
-        $(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)-$(WXVER_MAJOR).$(WXVER_MINOR)
+    <set var="WXDLLNAMEPREFIX">
+        <if cond="PLATFORM_WIN32=='1'">
+            wxbase$(WXBASEPORT)$(WXWIN32DLLVERSION)
+        </if>
+        <if cond="PLATFORM_WIN32=='0'">$(WXNAMEPREFIX)</if>
+    </set>
+    <set var="WXDLLNAMEPREFIXGUI">
+        <if cond="PLATFORM_WIN32=='1'">
+            wx$(PORTNAME)$(WXUNIVNAME)$(WXWIN32DLLVERSION)
+        </if>
+        <if cond="PLATFORM_WIN32=='0'">$(WXNAMEPREFIXGUI)</if>
+    </set>
+    <set var="WXDLLVERSIONTAG">
+        <if cond="PLATFORM_WIN32=='1'"></if>
+        <if cond="PLATFORM_WIN32=='0'">$(WXVERSIONTAG)</if>
     </set>
 
     
     <set var="WXLIB_BASE">
         <if cond="MONOLITHIC=='0'">$(mk.evalExpr(wxwin.mkLibName('base')))</if>
     </set>
+    <set var="WXLIB_NET">
+        <if cond="MONOLITHIC=='0'">$(mk.evalExpr(wxwin.mkLibName('net')))</if>
+    </set>
     <set var="WXLIB_CORE">
         <if cond="MONOLITHIC=='0'">$(mk.evalExpr(wxwin.mkLibName('core')))</if>
     </set>
+    <set var="WXLIB_ADV">
+        <if cond="MONOLITHIC=='0'">$(mk.evalExpr(wxwin.mkLibName('adv')))</if>
+    </set>
     <set var="WXLIB_HTML">
         <if cond="MONOLITHIC=='0'">$(mk.evalExpr(wxwin.mkLibName('html')))</if>
     </set>
+    <set var="WXLIB_XML">
+        <if cond="MONOLITHIC=='0'">$(mk.evalExpr(wxwin.mkLibName('xml')))</if>
+    </set>
+    <set var="WXLIB_ODBC">
+        <if cond="MONOLITHIC=='0'">$(mk.evalExpr(wxwin.mkLibName('odbc')))</if>
+    </set>
+    <set var="WXLIB_DBGRID">
+        <if cond="MONOLITHIC=='0'">$(mk.evalExpr(wxwin.mkLibName('dbgrid')))</if>
+    </set>
 
     <set var="WXLIB_MONO">
         <if cond="MONOLITHIC=='1'">$(mk.evalExpr(wxwin.mkLibName('mono')))</if>
     
     
     <!-- =============================================================== -->
-    <!--                   Where to store built libraries:               -->
+    <!--             Where to store built libraries and objects:         -->
     <!-- =============================================================== -->
     
-    <set var="LIBDIRNAME">
+
+    <if cond="FORMAT!='autoconf'">
+        <set var="WXDLLFLAG">
+            <if cond="SHARED=='1'">dll</if>
+        </set>
+        <set var="CFG_NAME_PART">
+            $(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG)
+        </set>
+        <set var="OBJS" make_var="1">$(COMPILER)_$(CFG_NAME_PART)</set>
+        <set var="BUILDDIR">$(OBJS)</set>
+    </if>
+    
+    <set var="LIBDIRNAME" make_var="1">
         <if cond="FORMAT=='autoconf'">$(top_builddir)lib</if>
-        <if cond="FORMAT!='autoconf'">$(TOP_SRCDIR)lib$(DIRSEP)$(COMPILER)</if>
+        <if cond="FORMAT!='autoconf' and SHARED=='0'">
+            $(nativePaths(TOP_SRCDIR))lib$(DIRSEP)$(COMPILER)_lib$(CFG)
+        </if>
+        <if cond="FORMAT!='autoconf' and SHARED=='1'">
+            $(nativePaths(TOP_SRCDIR))lib$(DIRSEP)$(COMPILER)_dll$(CFG)
+        </if>
     </set>
     
+    <if cond="FORMAT!='autoconf'">
+        <set var="SETUPHDIR" make_var="1">
+            $(LIBDIRNAME)\$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)
+        </set>
+    </if>
+    
+
+    
     <!-- =============================================================== -->
     <!--                        Templates for libs:                      -->
     <!-- =============================================================== -->
 
-    <set var="DEBUGFLAG">
-        <if cond="BUILD=='debug'">on</if>
-        <if cond="BUILD=='release'">off</if>
+    <set var="DEBUGINFO">
+        <if cond="BUILD=='debug' and DEBUG_INFO=='default'">on</if>
+        <if cond="DEBUG_INFO=='1'">on</if>
+        <if cond="BUILD=='release' and DEBUG_INFO=='default'">off</if>
+        <if cond="DEBUG_INFO=='0'">off</if>
+    </set>
+    <set var="DEBUGRUNTIME">
+        <if cond="DEBUG_RUNTIME_LIBS=='default'">$(DEBUGINFO)</if>
+        <if cond="DEBUG_RUNTIME_LIBS=='0'">off</if>
+        <if cond="DEBUG_RUNTIME_LIBS=='1'">on</if>
     </set>
     <set var="OPTIMIZEFLAG">
-        <if cond="BUILD=='debug'">speed</if>
-        <if cond="BUILD=='release'">off</if>
+        <if cond="BUILD=='debug'">off</if>
+        <if cond="BUILD=='release'">speed</if>
+    </set>
+
+    <set var="DEBUG_DEFINE">
+        <if cond="FORMAT!='autoconf' and BUILD=='debug' and DEBUG_FLAG=='default'">__WXDEBUG__</if>
+        <if cond="FORMAT!='autoconf' and DEBUG_FLAG=='1'">__WXDEBUG__</if>
+    </set>
+    <set var="UNICODE_DEFINE">
+        <if cond="FORMAT!='autoconf' and UNICODE=='1'">wxUSE_UNICODE=1</if>
+    </set>
+    
+    <set var="UNICOWS_LIB">
+        <if cond="MSLU=='1'">unicows</if>
     </set>
+
+    <template id="common_settings">
+        <debug-info>$(DEBUGINFO)</debug-info>
+        <debug-runtime-libs>$(DEBUGRUNTIME)</debug-runtime-libs>
+        <optimize>$(OPTIMIZEFLAG)</optimize>
+        <threading>multi</threading>
+        <runtime-libs>$(RUNTIME_LIBS)</runtime-libs>
+        <if cond="FORMAT!='autoconf'">
+            <cppflags>$(EXTRACFLAGS)</cppflags>
+        </if>
+    </template>
     
     <template id="anylib">
-        <depends cond="FORMAT!='autoconf' and BUILDING_LIB=='1'">setup.h</depends>
         <dirname>$(LIBDIRNAME)</dirname>
         <install-to>$(LIBDIR)</install-to>
-        
-        <debug-info>$(DEBUGFLAG)</debug-info>
-        <optimize>$(OPTIMIZEFLAG)</optimize>
-        <threading>multi</threading>        
+    </template>
+
+    <template id="3rdparty_lib" template="common_settings,anylib">
+        <libname>$(id)$(WXDEBUGFLAG)$(HOST_SUFFIX)</libname>
+        <!--
+        we want to install 3rd party libs system-wide only with static
+        version of wxWindows; otherwise they are embedded in shared libs:
+        -->
+        <install-if>SHARED=='0'</install-if>
     </template>
 
 
     <include file="jpeg.bkl"/>
     <include file="tiff.bkl"/>
     <include file="odbc.bkl"/>
+    <include file="expat.bkl"/>
 
     
     <!-- =============================================================== -->
     <!--                  Templates for wxWindows libs:                  -->
     <!-- =============================================================== -->
 
-    <template id="wx">
+    <template id="wx" template="common_settings">
         <set var="wxid">$(wxwin.mk_wxid(id))</set>
         <define>__WX$(TOOLKIT)__</define>
         <define>$(WXUNIV_DEFINE)</define>
+        <define>$(DEBUG_DEFINE)</define>
+        <define>$(UNICODE_DEFINE)</define>
         <include>$(TOP_SRCDIR)include</include>
         <lib-path>$(LIBDIRNAME)</lib-path>        
-        <include cond="FORMAT!='autoconf'">$(LIBDIRNAME)</include>
-        <include>$(INC_TIFF)</include>
-        <include>$(INC_JPEG)</include>
-        <include>$(INC_PNG)</include>
-        <include>$(INC_ZLIB)</include>
-        <include>$(INC_ODBC)</include>
-        <include>$(INC_REGEX)</include>
+        <include cond="FORMAT!='autoconf'">$(SETUPHDIR)</include>
     </template>
 
-    <template id="wx_append">
-        <ldflags>$(EXTRALIBS)</ldflags>
+    <!-- for both GUI and wxBase libs/samples: -->
+    <template id="wx_append_base_nomono">
         <!-- link against builtin 3rd party libs, if needed: -->
         <sys-lib>$(LIB_TIFF)</sys-lib>
         <sys-lib>$(LIB_JPEG)</sys-lib>
         <sys-lib>$(LIB_ZLIB)</sys-lib>
         <sys-lib>$(LIB_ODBC)</sys-lib>
         <sys-lib>$(LIB_REGEX)</sys-lib>
+        <sys-lib>$(LIB_EXPAT)</sys-lib>
+        
+        <ldlibs>$(EXTRALIBS)</ldlibs>
+
+        <!-- system libraries on windows: -->
+        <if cond="FORMAT!='autoconf'">
+            <sys-lib>$(UNICOWS_LIB)</sys-lib>
+            <if cond="COMPILER=='bcc'">
+                <sys-lib>import32</sys-lib>
+                <sys-lib>ole2w32</sys-lib>
+            </if>
+            <if cond="COMPILER!='bcc'">
+                <sys-lib>kernel32</sys-lib>
+                <sys-lib>user32</sys-lib>
+                <sys-lib>gdi32</sys-lib>
+                <sys-lib>comdlg32</sys-lib>
+                <sys-lib>winspool</sys-lib>
+                <sys-lib>winmm</sys-lib>
+                <sys-lib>shell32</sys-lib>
+                <sys-lib>comctl32</sys-lib>
+                <sys-lib>odbc32</sys-lib>
+                <sys-lib>ole32</sys-lib>
+                <sys-lib>oleaut32</sys-lib>
+                <sys-lib>uuid</sys-lib>
+                <sys-lib>rpcrt4</sys-lib>
+                <sys-lib>advapi32</sys-lib>
+                <sys-lib>wsock32</sys-lib>
+            </if>
+        </if>        
+    </template>
+
+    <define-tag name="msvc-headers" rules="dll,lib">
+        <if cond="FORMAT=='msvc6prj'">
+            <msvc-project-files>
+                $(addPrefixToList('include\', wxwin.headersOnly(value)))
+            </msvc-project-files>
+        </if>
+    </define-tag>
+    
+    <define-tag name="msvc-copy-setup-h" rules="dll,lib">
+        <if cond="FORMAT=='msvc6prj'">
+            <msvc-headers>wx/msw/setup.h</msvc-headers>
+            <set var="__custom_build_files" append="1">
+                include\wx\msw\setup.h
+            </set>
+            <set var="__custom_build_include_wx_msw_setup_h">
+Creating $(SETUPHDIR)\wx\setup.h
+InputPath=..\include\wx\msw\setup.h
+
+"$(SETUPHDIR)\wx\setup.h" : $(DOLLAR)(SOURCE) "$(DOLLAR)(INTDIR)" "$(DOLLAR)(OUTDIR)"
+$(TAB)copy "$(DOLLAR)(InputPath)" $(SETUPHDIR)\wx\setup.h
+            </set>
+        </if>
+    </define-tag>
+
+
+    <!-- for GUI libs/samples: -->
+    <template id="wx_append_nomono" template="wx_append_base_nomono">
+        <ldlibs>$(EXTRALIBS_GUI)</ldlibs>
     </template>
 
+
+    <template id="wx_append_base" template_append="wx_append_base_nomono">
+        <!-- Always link against the wxWin library in monolithic build: -->
+        <sys-lib>$(WXLIB_MONO)</sys-lib>
+    </template>
+    <template id="wx_append" template_append="wx_append_nomono">
+        <!-- Always link against the wxWin library in monolithic build: -->
+        <sys-lib>$(WXLIB_MONO)</sys-lib>
+    </template>
+    
+
+    <set var="WX_DISABLE_PRECOMP_HEADERS" overwrite="0">0</set>
+    
     <template id="wx_lib_b" template="wx,anylib">
         <set var="WXLIBNAME">$(wxwin.mkLibName(wxid))</set>
         <libname>$(WXLIBNAME)</libname>
-        <precomp-headers>on</precomp-headers>
-        <precomp-headers-file>wxprec</precomp-headers-file>
+
+        <if cond="WX_DISABLE_PRECOMP_HEADERS=='0'">
+            <if cond="FORMAT!='autoconf'">
+                <sources>$(WXTOPDIR)src/msw/dummy.cpp</sources>
+                <precomp-headers-gen>
+                    $(WXTOPDIR)src/msw/dummy.cpp
+                </precomp-headers-gen>
+            </if>
+            <precomp-headers-header>wx/wxprec.h</precomp-headers-header>
+            <precomp-headers>on</precomp-headers>
+            <precomp-headers-file>wxprec_$(id)</precomp-headers-file>
+            <precomp-headers-exclude>
+                src/common/unzip.c
+                src/common/extended.c
+                src/msw/gsocket.c
+                src/msw/gsockmsw.c
+            </precomp-headers-exclude>
+        </if>
+        
+        <if cond="FORMAT=='msvc6prj' and BUILDING_LIB=='1'">
+            <msvc-file-group>Common Sources:src/common/*</msvc-file-group>
+            <msvc-file-group>MSW Sources:src/msw/*</msvc-file-group>
+            <msvc-file-group>Generic Sources:src/generic/*</msvc-file-group>
+            <msvc-file-group>wxUniv Sources:src/univ/*</msvc-file-group>
+            <msvc-file-group>wxHTML Sources:src/html/*</msvc-file-group>
+            <msvc-file-group>Setup Headers:*/setup.h</msvc-file-group>
+            <msvc-file-group>MSW Headers:*wx/msw/*.h</msvc-file-group>
+            <msvc-file-group>Generic Headers:*wx/generic/*.h</msvc-file-group>
+            <msvc-file-group>wxUniv Headers:*wx/univ/*.h</msvc-file-group>
+            <msvc-file-group>wxHTML Headers:*wx/html/*.h</msvc-file-group>
+            <msvc-file-group>Common Headers:*wx/*.h</msvc-file-group>
+        </if>
     </template>
-    
+
     <template id="wx_dll_b" template="wx_lib_b">
         <set var="WXDLLNAME">$(wxwin.mkDllName(wxid))</set>
         <dllname>$(WXDLLNAME)</dllname>
         <mac_version>$(WXMACVERSION)</mac_version>
     </template>
 
-    <template id="wx_lib" template="wx_lib_b"/>
-    <template id="wx_dll" template="wx_dll_b" template_append="wx_append"/>
+    <template id="wx_3rdparty_dependencies">
+        <depends>wxtiff</depends>
+        <depends>wxjpeg</depends>
+        <depends>wxpng</depends>
+        <depends>wxexpat</depends>
+        <depends>wxzlib</depends>
+        <depends cond="FORMAT=='autoconf'">wxodbc</depends>
+        <depends>wxregex</depends>
+    </template>
+
+    <template id="wx_3rdparty_includes">
+        <include>$(INC_TIFF)</include>
+        <include>$(INC_JPEG)</include>
+        <include>$(INC_PNG)</include>
+        <include>$(INC_ZLIB)</include>
+        <include>$(INC_ODBC)</include>
+        <include>$(INC_REGEX)</include>
+        <include>$(INC_EXPAT)</include>
+    </template>
+    
+    <template id="wx_lib" template="wx_lib_b,wx_3rdparty_includes"/>
+    <template id="wx_base_lib" template="wx_lib_b,wx_3rdparty_includes">
+        <define>wxUSE_GUI=0</define> 
+    </template>
+
+    <template id="wx_dll"
+              template="wx_dll_b,wx_3rdparty_dependencies,wx_3rdparty_includes"
+              template_append="wx_append_nomono"/>
+    <template id="wx_base_dll"
+              template="wx_dll_b,wx_3rdparty_dependencies,wx_3rdparty_includes"
+              template_append="wx_append_base_nomono">
+        <define>wxUSE_GUI=0</define> 
+    </template>
+                           
+    <!-- =============================================================== -->
+    <!--             Templates for building wxWindows plugins:           -->
+    <!-- =============================================================== -->
+
+    <if cond="WX_STABLE_BRANCH=='1'">
+        <set var="PLUGIN_VERSION">
+            <if cond="PLATFORM_UNIX=='1'">
+                -$(WXVER_MAJOR).$(WXVER_MINOR)
+            </if>
+            <if cond="PLATFORM_UNIX=='0'">
+                $(WXVER_MAJOR)$(WXVER_MINOR)
+            </if>
+        </set>
+    </if>
+    <if cond="WX_STABLE_BRANCH=='0'">
+        <set var="PLUGIN_VERSION">
+            <if cond="PLATFORM_UNIX=='1'">
+                -$(WXVER_MAJOR).$(WXVER_MINOR).$(WXVER_RELEASE)
+            </if>
+            <if cond="PLATFORM_UNIX=='0'">
+                $(WXVER_MAJOR)$(WXVER_MINOR)$(WXVER_RELEASE)
+            </if>
+        </set>
+    </if>
+
+    <define-rule name="wx-base-plugin" extends="module">
+        <template>
+            <dllname>
+                $(id)$(addPrefixIfNotEmpty('_',WXNAMESUFFIX))$(PLUGIN_VERSION)$(WXCOMPILER)
+            </dllname>
+            <define>WXUSINGDLL</define>
+            <define>wxUSE_GUI=0</define>
+        </template>
+    </define-rule>
+    
+    <define-rule name="wx-gui-plugin" extends="module">
+        <template template="wx">
+            <dllname>
+                $(id)_$(PORTNAME)$(WXUNIVNAME)$(WXNAMESUFFIX)$(PLUGIN_VERSION)$(WXCOMPILER)
+            </dllname>
+            <define>WXUSINGDLL</define>
+        </template>
+    </define-rule>
     
     <!-- =============================================================== -->
     <!--               Support for wxWindows samples and contrib:        -->
     <!-- =============================================================== -->
 
     <!-- Link against one wxWin library. Value must be literal! -->
-    <define-tag name="wx-lib" rules="exe,dll">
+    <define-tag name="wx-lib" rules="exe,dll,module">
         <sys-lib>$(wxwin.libToLink(value))</sys-lib>
+        <if cond="FORMAT=='msvc6prj' and MONOLITHIC=='0'">
+            <depends-on-dsp>$(wxwin.makeDspDependency(value))</depends-on-dsp>
+        </if>
     </define-tag>
 
 </makefile>