[Bf-committers] Re: Compiling under Windows with MinGW (Correction)

Ray Fonk sh484090 at 12move.nl
Sat Oct 23 19:27:16 CEST 2004


Sorry guys,

Included the wrong file which had some annoying typos in it.
Here's the right one...

RayF

_____________________________________________________________________

12move ADSL nu de eerste maand voor maar € 8,95! GRATIS modem, 
GEEN aansluitkosten en GEEN datalimiet! Ga nu naar http://adsl.12move.nl




-------------- next part --------------
BUILDING BLENDER ON MINGW

Following tested on Win98SE using mingw, msys 1.0.10 and GCC 3.4.
bf-blender directory assumed to be the root of the source tree,


Proposed code changes
---------------------

1) Patch bf-blender/blender/source/tools/guess/guessconfig by adding the following 
lines after line 83: 

    if [ "$OS" = "mingw" ]; then
        OS="windows"
        CPU=""
        OS_VERSION=""
    fi

This ensures that OS='windows' on mingw.
Note: With this solution make cannot distinguish between cygwin and mingw build platforms.
Don't know at this point whether this would be needed, but note for future reference.

2) In bf-blender/blender/source/blender/makesdna/intern/Makefile: change as follows

$(DIR)/$(DEBUG_DIR)DNA.c: $(DIR)/$(DEBUG_DIR)makesdna
    ifeq ($(OS),windows)
      ifeq ($(FREE_WINDOWS),true)
<TAB>$(DIR)/$(DEBUG_DIR)makesdna $(DIR)/$(DEBUG_DIR)DNA.c
      else
<TAB>$(SRCHOME)/tools/cygwin/cl_wrapper.pl - $(DIR)/$(DEBUG_DIR)makesdna \
	   $(DIR)/$(DEBUG_DIR)DNA.c
      endif
    else
<TAB>$(DIR)/$(DEBUG_DIR)makesdna $(DIR)/$(DEBUG_DIR)DNA.c
    endif

Reason: The cl_wrapper.pl perl script generates a VC++ style compiler call 
which we don't need on FREE_WINDOWS. 
NOTE: Needs to be verified for other platforms (cygwin).

3) Remove trailing slashes at end of CPPFLAGS include directives:
In bf-blender/blender/source/blender/blenlib/intern/Makefile: 
    CPPFLAGS += -I../../include/
In bf-blender/blender/source/blender/blenloader/intern/Makefile: 
    CPPFLAGS += -I../../render/extern/include/

Reason: GCC 3.4 doesn't seem to like the trailing slash and fails to find 
include files. This change also makes these lines conform all other -I lines.

4) In bf-blender/blender/source/blender/creator/buildinfo.c: inclusion of winbuildinfo.h

This one is tricky: currently the buildinfo.h file is only generated by the 
SConstruct file under windows. See bf-blender/blender/SConstruct lines 1040 ff:

	if user_options_dict['USE_BUILDINFO'] == 1:
		if sys.platform=='win32':
			build_info_file = open("source/creator/winbuildinfo.h", 'w')
			build_info_file.write("char *build_date=\"%s\";\n"%build_date)
			build_info_file.write("char *build_time=\"%s\";\n"%build_time)
			build_info_file.write("char *build_platform=\"win32\";\n")
			build_info_file.write("char *build_type=\"%s\";\n"%build_type)
			build_info_file.close()
			env.Append (CPPDEFINES = ['NAN_BUILDINFO', 'BUILD_DATE'])
		else:
			env.Append (CPPDEFINES = ['BUILD_TIME=\'"%s"\''%(build_time),
							'BUILD_DATE=\'"%s"\''%(build_date),
							'BUILD_TYPE=\'"dynamic"\'',
							'NAN_BUILDINFO',
							'BUILD_PLATFORM=\'"%s"\''%(sys.platform)])


Jesterking added this back in March (rev 1.24), probably for good reason, but unfortunately 
the CVS log doesn't say why the original version (i.e. the else: clause) didn't work. 
If possible, I would vote to always use the else: clause so that buildinfo.c can simply be
as follows:

char * build_date=BUILD_DATE;
char * build_time=BUILD_TIME;
char * build_platform=BUILD_PLATFORM;
char * build_type=BUILD_TYPE;

I would suggest jesterking has a look if this is possible.
As a minimum, I think SCons and make should be doing the same thing...


(2) and (4) need to bee checked by cygwin and SCons teams respectively.
If they don't break anything, the above changes should be robust.


Building blender
----------------
After applying above changes, steps are simple:

A) Create clean source tree in bf-blender/blender 
and install library tree in bf-blender/lib/windows.

B) Add "user-def.mk" file to bf-blender/blender with following line:

    export FREE_WINDOWS=true

C) cd to bf-blender/blender and run make

and one should be in good shape.


More information about the Bf-committers mailing list