Page 1 of 2

[guide] How to build wz4 from scratch

PostPosted: Friday, 11.July 2014, 18:18
by ikam
Hi

Here a small guide to build wz4 from latest github source with third party libraries.

Requirements :

- Visual Studio (c++ dev editor and compiler) (tested and works with 2008,2010,2012,2013)
- yasm (assembleur compiler required for some wz4 code part)
- cmake (used to build assimp visual studio project)
- nvidia physx sdk (or suscribe to nvidia dev zone (third part library to simulate physics)
- assimp sdk (third part library to import 3d models)
- git (best way to always get latest wz4 sources)

Installation :

- install visual studio
- rename yasm binary to "yasm.exe" and put it in c:/windows folder
- install cmake
- install git

note : easiest way for now, is to use next predefined path (in wait of alternative methods to set path to libraries and wz4 sources code)

Get wz4 sources with git :

- create a folder C:\github
- right click empty place in folder and select "git bash" in menu
- at prompt, enter next command : git clone https://github.com/wzman/werkkzeug4CE.git
- it will download files and you obtain : C:\github\werkkzeug4CE folder with all wz4 files insides
- launch build_project.bat script to create visual studio project files

third-party libraries :

- create a folder C:\library to put all required libraries

Physx :

- extract archive content in C:\library folder to get : C:\library\PhysX-3.3.1_PC_SDK_Core

Assimp :

- extract archive content in C:\library folder to get : C:/library/assimp_3.1.1_build
- Run cmake-gui
- browse source = C:/library/assimp-3.1.1-win-binaries
- browse build = C:/library/assimp_3.1.1_build (create new empty folder)
- unckeck unused stuff : BUILD_ASSIMP_TOOLS, BUILD_SAMPLES, BUILD_TESTS, INSTALL_PDB
- click configure, and again if all is red
- click generate
- go to C:/library/assimp_3.1.1_build
- open Assimp.sln (double click) - select release - and Build
- you finally get C:/library/assimp_3.1.1_build\code\Release\ assimp.lib and assimp.dll required to compil with wz4

Wz4

- open C:\github\werkkzeug4CE\wz4\werkkzeug4\werkkzeug4.sln
- select release_dx9 and win32 or win64, and build

Optionnal :

To launch directly wz4 from visual studio editor you can put required third part dll inside wz4 folders, ex :
in C:\github\werkkzeug4CE\wz4\werkkzeug4\release_dx9_Win32, add :
- PhysX3CHECKED_x86.dll
- PhysX3CommonCHECKED_x86.dll
- PhysX3CookingCHECKED_x86.dll
from C:\library\PhysX-3.3.1_PC_SDK_Core\Bin\win32
and
- assimp.dll from C:\library\assimpBuild\code\Release


git updates

When new modifications are pushed on wz4 github project, you can update your code :

- Visual studio opened or closed
- right click in C:\github\werkkzeug4CE folder and select Git bash in menu
- enter : git pull origin master (get updates in master branch)
- Click build in visual studio, it will only recompile modifications.


Disable third part libraries

You can choose to not compil wz4 with physx or assimp libraries, it will remove physx and assimp features from wz4 if you don't want to use them and avoid to need extra dll.

- open C:\github\werkkzeug4CE\altona\main\base\types.hpp file
- search for
#define sCOMPIL_PHYSX // NVIDIA Physx library
#define sCOMPIL_ASSIMP // Open Asset import library
and put a comments at start of lines to ignore definitions, like this :
// #define sCOMPIL_PHYSX // NVIDIA Physx library
// #define sCOMPIL_ASSIMP // Open Asset import library
it will not compil both libraries here.

Patch Physx to works with other visual studio version than 2010

Note : this chapter is now obsolete, it was fixed by migrating physx 3.2.3 to 3.3.1

Physx packages (version 3.2.3), contain a bug and cause compilation errors when visual studio version is not 2010.
To get it working with your visual studio version you need to edit some files in physx folder. As theses file are binaries files you need an hexadecimal editor (like this)

concerned files are :
PhysX3ExtensionsCHECKED.lib
PxTaskCHECKED.lib
PhysXProfileSDKCHECKED.lib
in C:\library\PhysX-3.2.3_PC_SDK_Core\Lib\win32 (for 32 bits compilation version, do the same for 64 bits if you want to use it too)

open these file with your hexa editor and search for the string : MSC_VER=1600
replace 1600 with right number value according your visual studio version :

1600 = visual studio 2010
1700 = visual studio 2012
1800 = visual studio 2013

search again the same sting and replace all references. do the same for all specified files and it's done, you can now build your project.

Re: Build Wz4 from scratch

PostPosted: Friday, 11.July 2014, 20:53
by Skinnytorus
A little addition: You can skip installing and using the git client: just download any respective branch by pressing 'Download Zip' button in the lower right corner of the github web interface. :)

Re: Build Wz4 from scratch

PostPosted: Friday, 11.July 2014, 22:35
by ikam
yes you can, but I it's painfull to download every time the zip, extract, and rebuild all.
With git you only update the source code with a single command and no need to rebuild entire solution. It's really faster. yo also can switch branch as you want, without rebuild all too. I really recommand to use it, it will save your time.
here the magic command to get updates :
Code: Select all
git pull origin master

Re: How to build wz4 from scratch

PostPosted: Saturday, 12.July 2014, 00:08
by Skinnytorus
yes you can, but I it's painfull to download every time the zip, extract, and rebuild all.

You might be surprised, but that's how I've done that since I reinstalled my system. Less soft more joy! =)
I'm just kidding. Thanks for the tip! :)

Re: How to build wz4 from scratch

PostPosted: Saturday, 12.July 2014, 08:07
by ikam
Yes I like clean system too. I reinstall windows and visual studio at each boot :lol:

I migrate physx 3.2.3 to 3.3.1. You can download it on same download page in blog.
it bring physx bug fix and minor changes and it fix the lib problem with other visual studio version than 2010 (see bottom guide).

Re: [guide] How to build wz4 from scratch

PostPosted: Saturday, 12.July 2014, 10:27
by Skinnytorus
Yes I like clean system too. I reinstall windows and visual studio at each boot :lol:

It's even better to reinstall windows as a background task during each session =)

I migrate physx 3.2.3 to 3.3.1. You can download it on same download page in blog.

Do I have to delete the old physx 3.2.3 or may I just keep it in the library folder?

Re: [guide] How to build wz4 from scratch

PostPosted: Saturday, 12.July 2014, 11:09
by ikam
you can keep it if you want, but also can delete it, there is no more link reference to this lib.

Re: [guide] How to build wz4 from scratch

PostPosted: Saturday, 12.July 2014, 11:10
by Skinnytorus
OK. Got it working! Thanks.
- browse build = C:/library/assimp-3.1.1_build (create new empty folder)

For it to work out of the box, the path should be C:/library/assimp_3.1.1_build.
Otherwise VC2010 can't find the assimp lib.

Re: [guide] How to build wz4 from scratch

PostPosted: Saturday, 12.July 2014, 11:14
by ikam
yes you're right, thanks.
it's mistake when I wrotte this post.

Re: [guide] How to build wz4 from scratch

PostPosted: Saturday, 12.July 2014, 11:17
by Skinnytorus
One more thing: Before the latest update I could launch wz4 without physx dlls in its folder. Now it won't start without them. Should I modify sys envi variables or something?

Edit:
To launch directly wz4 from visual studio editor you can put required third part dll inside wz4 folders, ex :
in C:\github\werkkzeug4CE\wz4\werkkzeug4\release_dx9_Win32, add :
- PhysX3CHECKED_x86.dll
- PhysX3CommonCHECKED_x86.dll
- PhysX3CookingCHECKED_x86.dll
from C:\library\PhysX-3.3.1_PC_SDK_Core\Bin\win32
and
- assimp.dll from C:\library\assimpBuild\code\Release


You forgot to mention: c:\library\PhysX-3.3.1_PC_SDK_Core\Bin\win32\nvToolsExt32_1.dll

Re: [guide] How to build wz4 from scratch

PostPosted: Saturday, 12.July 2014, 11:27
by ikam
It's because you add to your path the physx folder. Ye syou need to update it to the new dll folder

Re: [guide] How to build wz4 from scratch

PostPosted: Saturday, 12.July 2014, 11:49
by Skinnytorus
Oh... I forgot how I did that... I don't see any similar path among the win system environment variables. Should I copy the new path there?

Re: [guide] How to build wz4 from scratch

PostPosted: Saturday, 12.July 2014, 17:24
by ikam
yes you need to add the new physx bin folder to the system path.

Re: [guide] How to build wz4 from scratch

PostPosted: Saturday, 12.July 2014, 17:32
by Skinnytorus
OK. I'll try that. Thank you.

Re: [guide] How to build wz4 from scratch

PostPosted: Monday, 28.July 2014, 11:36
by CybeREX
Hey guys, What I did wrong?
Use MV C++ express 2010
Download new physX and unpack it
download assimp
2014-07-28_14-23.jpg


After trying rebuild project I get this

LINK : fatal error LNK1104: can't open file "C:/library/assimp_3.1.1_build/code/Release/assimp.lib"

I don't get it

Assimp :

- extract archive content in C:\library folder to get : C:/library/assimp_3.1.1_build
I download and extract archive here


- Run cmake-gui
where this gui?

- browse source = C:/library/assimp-3.1.1-win-binaries
I download and extract this files too here


- browse build = C:/library/assimp_3.1.1_build (create new empty folder)
Why I need create empty folder if we unpack here asimp files before?

PS. I download and extract archives from here
http://sourceforge.net/projects/assimp/ ... ssimp-3.1/

assimp-3.1.1.zip
assimp-3.1.1-win-binaries.zip
2014-07-28_14-43_Total Commander.jpg


Edited2:

Oh Cmake it's another software that I need setup to my OS =)
http://www.cmake.org/cmake/resources/software.html