Voxelands Forum

The official Voxelands discussion forum

You are not logged in.

#1 2015-04-09 19:51:44

TurtleCat
Not Dead, Just Sleeping
Registered: 2014-11-16
Posts: 19

Building on Windows

In order to build Voxelands on Windows, you will need the following:

* Microsoft Visual Studio   - https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx
* CMake                     - http://www.cmake.org/download/
* Irrlicht 1.8.1            - http://irrlicht.sourceforge.net/downloads/
* FreeType                  - http://gnuwin32.sourceforge.net/packages/freetype.htm (binaries zip)
* GetText                   - http://gnuwin32.sourceforge.net/packages/gettext.htm (binaries, dependencies and developer files zips)
* ZLib Headers and DLL      - http://www.winimage.com/zLibDll/index.html (zlib125 AND zlib125dll)
* LibOgg and LibVorbis      - https://www.xiph.org/downloads/
* OpenAL                    - http://openal-soft.org/#download (binaries zip)
* Voxelands Source          - http://gitlab.com/voxelands/voxelands

Start out by creating a directory for Voxelands, and lay it out as follows with the above downloaded files. Rename libogg-1.3.x to libogg. This is so that the relevant headers are found when building libvorbis. I tend to rename all of them and remove version numbers just to make my life easier; that's entirely your choice, however. You will also need to create the voxelands-install directory yourself.

Go ahead and merge all three of the GetText folders into one.

+---vl-dev
|   +---freetype
|   +---gettext
|   +---irrlicht
|   +---libogg
|   +---libvorbis
|   +---openal
|   +---voxelands
|   +---voxelands-install
|   +---zlib
|   \---zlib125dll

You're now ready to start the build process. Before we can go ahead and start to build the game itself, we first need to build libogg and  libvorbis. We'll be starting with libogg, so navigate to liboogg\win32\VS2010 and open the libogg_dynamic.sln file with Visual Studio. If like me, you are using a more recent version of Visual Studio, you will likely be prompted to upgrade the VC++ compiler and libraries upon opening this file; just click OK and move on.

Before we can build, we need to make a few changes. In Project->Properties, expand Configuration Properties and select General. In the options pane to the right will be one option labelled Platform Toolset. You will need to change this to Visual Studio 2013 - Windows XP (v120_xp). Click OK, then go to Build->Configuration Manager and set the active solution to Release, NOT Debug. If you leave it as Debug, it will cause the project to depend on msvcr120d.dll which is a Microsoft debugging DLL and CANNOT be redistributed. Click Close. Now we are ready, so go to Build->Build libogg. You should now find the following:

+---VS2010
|   \---Win32
|       \---Release
|           |   bitwise.obj
|           |   framing.obj
|           |   libogg.dll
|           |   libogg.exp
|           |   libogg.lib
|           |   libogg_dynamic.log

Excellent. We can now move on again, so close the current solution, and then navigate to libvorbis\win32\VS2010. Open up vorbis_dynamic.sln and as you did before, you will be prompted to upgrade the compiler and libraries if you are using a newer version of Visual Studio.

In your Solution Explorer (on the right by default), right-click libvorbis and choose Properties; just like before, go to Configuration Properties and then set Platform Toolset to Visual Studio 2013 - Windows XP (v120_xp). Do the same thing for libvorbisfile. Again, Build->Configuration Manager and set active solution to Release. Now, go to Build->Batch Build and check the box next to each of the
following:

libvorbis       Release Win32
libvorbisfile   Release Win32

Then click Build. If all goes well, there will be no errors and your directory structure will look like this:

\---VS2010
|   \---Win32
|       \---Release
|               libvorbis.dll
|               libvorbis.exp
|               libvorbis.lib
|               libvorbisfile.dll
|               libvorbisfile.exp
|               libvorbisfile.lib

If you get errors about not being able to find various headers, such as ogg.h, then you have NOT renamed the libogg-1.3.x directory as libogg. Go back and do this, then rebuild.

Now it is time to move on to building the game itself.

Run the CMake GUI. Click Browse Source and navigate to the voxelands folder (NOT voxelands\src) and select that. Then select the same directory for the location to build the binaries. Once this is done, click Configure. You will then be asked to specify the generator. Select the relevant version of Visual Studio; in my case, using Visual Studio 2013, that is the option "Visual Studio 12 2013", yours may be different. After a moment, a bunch of variables will appear and you will receive an error message. You can safely ignore that for the
time being.

You need to set the variables so that they are as follows:

BUILD_CLIENT            -   Checked
BUILD_SERVER            -   Unchecked (your build will fail if this is checked)
CMAKE_INSTALL_PREFIX    -   vl-dev\voxelands-install
ENABLE_AUDIO            -   Checked if you want audio
ENABLE_GETTEXT          -   Checked
GETTEXT_DLL             -   vl-build\gettext\bin\libgettextlib.dll
GETTEXT_ICONV_DLL       -   vl-build\gettext\bin\libiconv2.dll
GETTEXT_INCLUDE_DIR     -   vl-build\gettext\include
GETTEXT_LIBRARY         -   vl-build\gettext\lib\libintl.lib
GETTEXT_MSGFMT          -   vl-build\gettext\bin\msgfmt.exe
IRRLICHT_SOURCE_DIR     -   vl-build\irrlicht
OGG_INCLUDE_DIR         -   vl-build\libogg\include
OGG_LIBRARY             -   vl-build\libogg\win32\VS2010\Win32\Release\libogg.lib
OPENAL_INCLUDE_DIR      -   vl-build\openal\include\AL
OPENAL_LIBRARY          -   vl-build\openal\libs\Win32\OpenAL32.lib
RUN_IN_PLACE            -   Checked
VORBISFILE_LIBRARY      -   vl-build\libvorbis\win32\VS2010\Win32\Release\libvorbisfile.lib
VORBIS_INCLUDE_DIR      -   vl-build\libvorbis\include
VORBIS_LIBRARY          -   vl-build\libvorbis\win32\VS2010\Win32\Release\libvorbis.lib

That's the first step complete. Click on Configure again; you'll get another error and some more variables to specify:

FREETYPE2_INCLUDE_DIR_freetype2     -   vl-build\freetype\include\freetype2
FREETYPE2_INCLUDE_DIR_ft2build      -   vl-build\freetype\include
FREETYPE_LIBRARY                    -   vl-build\freetype\lib\freetype.lib

Click Configure again. You'll be presented with the last set. You can leave the jthread and sqlite ones alone; we are only interested in the zlib variables here:

ZLIB_DLL            -   vl-build\zlib125dll\dll32\zlibwapi.dll
ZLIB_INCLUDE_DIR    -   vl-build\zlib
ZLIB_LIBRARIES      -   vl-build\zlib125dll\dll32\zlibwapi.lib

Hit Configure one last time. You should now have no errors in CMake. Go ahead and click Generate. Once that is done, go into vl-build\voxelands and open up voxelands.sln in Visual Studio. You will see in your Solution Explorer on the right that there are several projects here. Just as you did with the libogg and libvorbis ones, you need to go into Properties and set the Platform Toolset
to Visual Studio 2013 - Windows XP (v120_xp). Then, Build->Configuration Manager and again set the active solution configuration to Release, NOT Debug. You are now ready to build.

First build the ALL_BUILD project. This will take a while to complete. If this succeeds without errors, move on and build INSTALL project. This should not take very long at all. Once this succeeds, you should have files in your voxelands-install directory. At the moment, however, extra DLLs are required (I believe further tweaks to the CMake files are needed). The DLLs you will have to include in the bin folder are, in addition to those already placed there:

* freetype6.dll
* libvorbisfile.dll
* libvorbis.dll
* libogg.dll
* zlib1.dll

Congratulations, you just built Voxelands on Windows. Have a cup of tea. :)

Last edited by TurtleCat (2015-04-10 09:02:51)

Offline

#2 2015-04-09 21:25:52

melkior
Member
From: Sacramento, CA
Registered: 2015-04-08
Posts: 52
Website

Re: Building on Windows

Thanks for writing this up, I can see I made an error in the OpenAl area when I was trying last night, I assumed the OPENAL_LIBRARY should point at vl-build\openal\libs\Win32\  rather than the file  -   vl-build\openal\libs\Win32\OpenAL32.lib

Ill take this for a spin tonight and see how it works for me, much appreciated!

Offline

#3 2015-04-10 03:11:19

melkior
Member
From: Sacramento, CA
Registered: 2015-04-08
Posts: 52
Website

Re: Building on Windows

Okay so .. this got me past the OpenAL errors (thank you)

However I notice in your instructions you note:

You can leave the jthread and sqlite ones alone; we are only interested in the zlib variables here:

But Cmake cannot find the jthread stuff, and when I try to build in VS it gives errors it can not find the jthreadconfig.h file.

Fatal error C1083: Cannot open include file: 'jthreadconfig.h': No such file or directory
2>  content_mapnode_farm.cpp
2>E:\voxelandsdev\voxelands\src\jthread\jmutex.h(32): fatal error C1083: Cannot open include file: 'jthreadconfig.h': No such file or directory

What do you have set for that?

This is what cmake has for my jthread stuff:

JTHREAD_INCLUDE_DIR    JTHREAD_INCLUDE_DIR-NOTFOUND
JTHREAD_LIBRARY           JTHREAD_LIBRARY-NOTFOUND
JTHREAD_WIN32_CRITICALSECTION  (not checked)

Offline

#4 2015-04-10 03:24:54

melkior
Member
From: Sacramento, CA
Registered: 2015-04-08
Posts: 52
Website

Re: Building on Windows

Another note; for GetText , on the same page you linked you have to get the Developer file Zip or you wont have the files you need (figured if others come to follow instrucions later they will want to know that)

EDIT: Also needed GetText dependencies for libiconv2.dll

Last edited by melkior (2015-04-10 03:30:47)

Offline

#5 2015-04-10 04:08:41

melkior
Member
From: Sacramento, CA
Registered: 2015-04-08
Posts: 52
Website

Re: Building on Windows

Okay I think I'm on to the jThread issues  .. the CMakeLists file that is included in Voxelands src is Unix only, whereas if I go grab the Win zip from the site it's Windows only ..

Current one in source control:

if( UNIX )
	set(jthread_SRCS pthread/jmutex.cpp pthread/jthread.cpp)
	set(jthread_platform_LIBS "")

	set(JTHREAD_CONFIG_WIN32THREADS "// Using pthread based threads")
	set(JTHREAD_CONFIG_JMUTEXCRITICALSECTION "")
else( UNIX )
	set(jthread_SRCS win32/jmutex.cpp win32/jthread.cpp)
	set(jthread_platform_LIBS "")

	set(JTHREAD_CONFIG_WIN32THREADS "#define JTHREAD_CONFIG_WIN32THREADS")
	set(JTHREAD_WIN32_CRITICALSECTION OFF CACHE BOOL "If set to false, use standard mutex. If set to true, use a critical section object.")
	if (JTHREAD_WIN32_CRITICALSECTION)
		set(JTHREAD_CONFIG_JMUTEXCRITICALSECTION "#define JTHREAD_CONFIG_JMUTEXCRITICALSECTION")
	else (JTHREAD_WIN32_CRITICALSECTION)
		set(JTHREAD_CONFIG_JMUTEXCRITICALSECTION "// Using standard Win32 mutex")
	endif (JTHREAD_WIN32_CRITICALSECTION)
endif( UNIX )

add_library(jthread ${jthread_SRCS})

target_link_libraries(
	jthread
	${jthread_platform_LIBS}
)


configure_file("${PROJECT_SOURCE_DIR}/jthread/jthreadconfig.h.in"
	"${PROJECT_BINARY_DIR}/jthread/jthreadconfig.h")

Version from http://research.edm.uhasselt.be/~jori/p … CS.Jthread

cmake_minimum_required(VERSION 2.6)

project(jthread)
set(VERSION 1.3.1)

set (_DEFAULT_LIBRARY_INSTALL_DIR lib)
if (EXISTS "${CMAKE_INSTALL_PREFIX}/lib32/" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
	set (_DEFAULT_LIBRARY_INSTALL_DIR lib32)
elseif (EXISTS "${CMAKE_INSTALL_PREFIX}/lib64/" AND CMAKE_SIZEOF_VOID_P EQUAL 8)
	set (_DEFAULT_LIBRARY_INSTALL_DIR lib64)
endif ()

set(LIBRARY_INSTALL_DIR "${_DEFAULT_LIBRARY_INSTALL_DIR}" CACHE PATH "Library installation directory")
if(NOT IS_ABSOLUTE "${LIBRARY_INSTALL_DIR}")
	set(LIBRARY_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIBRARY_INSTALL_DIR}")
endif()

find_package(Threads)
if (NOT CMAKE_USE_WIN32_THREADS_INIT)
	if (NOT CMAKE_USE_PTHREADS_INIT)
		message(FATAL_ERROR "Can find neither pthread support nor Win32 thread support")
	endif (NOT CMAKE_USE_PTHREADS_INIT)
endif (NOT CMAKE_USE_WIN32_THREADS_INIT)

add_subdirectory(src)

I attempted to just swap them out but this results in additional errors and adding more name/value pairs to CMake than yours has, that may be good bad or indifferent but I'm not sure which yet :-)

Offline

#6 2015-04-10 04:19:59

melkior
Member
From: Sacramento, CA
Registered: 2015-04-08
Posts: 52
Website

Re: Building on Windows

Ok fixed the jthreadconfig.h missing issue by removing the unix jthread FOLDER in voxelands src and replaced it with a windows version, then I edited the \vl-build\voxelands\src\jthread\src\CMakeLists.txt file to remove all if(UNIX) codeblocks and it works now. (note if you dont remove the unix blocks it will think its compiling for Unix still and it will throw more errors)

set (HEADERS jmutex.h jthread.h jmutexautolock.h ${PROJECT_BINARY_DIR}/src/jthreadconfig.h)

add_definitions(-DJTHREAD_COMPILING)

if (CMAKE_USE_WIN32_THREADS_INIT)
	set(SOURCES win32/jmutex.cpp win32/jthread.cpp)
	set(JTHREAD_CONFIG_WIN32THREADS "#define JTHREAD_CONFIG_WIN32THREADS")
	set(JTHREAD_WIN32_CRITICALSECTION OFF CACHE BOOL "If set to false, use standard mutex. If set to true, use a critical section object.")
	if (JTHREAD_WIN32_CRITICALSECTION)
		set(JTHREAD_CONFIG_JMUTEXCRITICALSECTION "#define JTHREAD_CONFIG_JMUTEXCRITICALSECTION")
	else (JTHREAD_WIN32_CRITICALSECTION)
		set(JTHREAD_CONFIG_JMUTEXCRITICALSECTION "// Using standard Win32 mutex")
	endif (JTHREAD_WIN32_CRITICALSECTION)
else (CMAKE_USE_WIN32_THREADS_INIT) # Use pthread
	set(SOURCES pthread/jmutex.cpp pthread/jthread.cpp)
	set(JTHREAD_CONFIG_WIN32THREADS "// Using pthread based threads")
	set(JTHREAD_CONFIG_JMUTEXCRITICALSECTION "")
endif (CMAKE_USE_WIN32_THREADS_INIT)

if (NOT UNIX)
	set(CMAKE_DEBUG_POSTFIX _d)
	set(JTHREAD_COMPILE_STATIC ON CACHE BOOL "Flag indicating if a static library should be built, or a dynamic one")
endif (NOT UNIX)


include_directories(${PROJECT_SOURCE_DIR}/src)
include_directories(${PROJECT_BINARY_DIR}/src)

install(FILES ${HEADERS} DESTINATION include/jthread)
install(TARGETS ${JTHREAD_INSTALLTARGETS} DESTINATION ${LIBRARY_INSTALL_DIR})


configure_file("${PROJECT_SOURCE_DIR}/src/jthreadconfig.h.in"
	       "${PROJECT_BINARY_DIR}/src/jthreadconfig.h")

foreach(ARG ${JTHREAD_LIBS})
	set(JTHREAD_LIBS_CMAKECONFIG "${JTHREAD_LIBS_CMAKECONFIG} \"${ARG}\"")
endforeach()

configure_file("${PROJECT_SOURCE_DIR}/cmake/JThreadConfig.cmake.in" 
	       "${PROJECT_BINARY_DIR}/cmake/JThreadConfig.cmake")
install(FILES 
	"${PROJECT_BINARY_DIR}/cmake/JThreadConfig.cmake" 
	DESTINATION ${LIBRARY_INSTALL_DIR}/cmake/JThread)

And now I have similar errors for  jmutex.h , working on that next :-)

Offline

#7 2015-04-10 09:03:20

TurtleCat
Not Dead, Just Sleeping
Registered: 2014-11-16
Posts: 19

Re: Building on Windows

melkior wrote:

Okay so .. this got me past the OpenAL errors (thank you)

However I notice in your instructions you note:

You can leave the jthread and sqlite ones alone; we are only interested in the zlib variables here:

But Cmake cannot find the jthread stuff, and when I try to build in VS it gives errors it can not find the jthreadconfig.h file.

Fatal error C1083: Cannot open include file: 'jthreadconfig.h': No such file or directory
2>  content_mapnode_farm.cpp
2>E:\voxelandsdev\voxelands\src\jthread\jmutex.h(32): fatal error C1083: Cannot open include file: 'jthreadconfig.h': No such file or directory

What do you have set for that?

This is what cmake has for my jthread stuff:

JTHREAD_INCLUDE_DIR    JTHREAD_INCLUDE_DIR-NOTFOUND
JTHREAD_LIBRARY           JTHREAD_LIBRARY-NOTFOUND
JTHREAD_WIN32_CRITICALSECTION  (not checked)

I leave them. In doing so, you'll notice at the bottom of CMake it will say something like "using project jthread, using project sqlite".

melkior wrote:

Another note; for GetText , on the same page you linked you have to get the Developer file Zip or you wont have the files you need (figured if others come to follow instrucions later they will want to know that)

EDIT: Also needed GetText dependencies for libiconv2.dll

Yeah, sorry. I lost some of the progress on the text file whilst I was working and forgot about that bit, but you're right, you do need all three of those (you can also install the full package for it from GNUWin32 but ugh, I'd rather not). I've added that in now.

As for any of the jthread stuff you have been doing, you shouldn't need to do that at all. If you set the source directory and build directory so that they are both vl-dev\voxelands, the jthreadconfig.h file will be created in the correct places when you run CMake. If you're still using a separate voxelands-build directory as per the instructions in the README file, then your jthreadconfig.h file will have been created in vl-dev\voxelands-build\src\jthread; simply move it from there to vl-dev\voxelands\src\jthread and you can build.

You shouldn't be downloading a separate set of files for jthread and there is no need to play with the CMakeLists to get it to build.

Edit: If you are building the next branch and haven't updated the latest changes, you'll need to make this yourself before you can get it to build: https://gitlab.com/voxelands/voxelands/ … 78f7f6e9ca

Last edited by TurtleCat (2015-04-10 09:07:54)

Offline

#8 2015-04-10 15:19:50

melkior
Member
From: Sacramento, CA
Registered: 2015-04-08
Posts: 52
Website

Re: Building on Windows

JJH wrote:

As for any of the jthread stuff you have been doing, you shouldn't need to do that at all. If you set the source directory and build directory so that they are both vl-dev\voxelands, the jthreadconfig.h file will be created in the correct places when you run CMake. If you're still using a separate voxelands-build directory as per the instructions in the README file, then your jthreadconfig.h file will have been created in vl-dev\voxelands-build\src\jthread; simply move it from there to vl-dev\voxelands\src\jthread and you can build.

You shouldn't be downloading a separate set of files for jthread and there is no need to play with the CMakeLists to get it to build.

Edit: If you are building the next branch and haven't updated the latest changes, you'll need to make this yourself before you can get it to build: https://gitlab.com/voxelands/voxelands/ … 78f7f6e9ca


Ah - that might be the problem ; I probably have some cross wired settings between the readme and your recent instructions I'll check that this evening!  Thanks!

Offline

#9 2015-04-11 03:48:06

melkior
Member
From: Sacramento, CA
Registered: 2015-04-08
Posts: 52
Website

Re: Building on Windows

Nice, pointing those two folders to the same place resolved 99% of the errors.

Now it compiles but near the end tells me that one of the zlib files is missing or corrupt:

Error	2	error LNK1107: invalid or corrupt file: cannot read at 0x2B8	E:\voxelandsdev\zlib\dll32\zlibwapi.dll	1	1	voxelands

So I tried putting those 5 files you mentioned in the bin folder in case that was actually a pre-requisite but that hasn't solved it.

Some googling seems to suggest that its looking for it in the wrong folder; so I'm trying to figure out what I've done wrong to have it looking in the wrong folder :-)

Offline

#10 2015-04-11 03:58:10

melkior
Member
From: Sacramento, CA
Registered: 2015-04-08
Posts: 52
Website

Re: Building on Windows

Got it - I had inadvertently linked the zlibwapi.dll rather than zlibwapi.lib

Error	6	error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'	E:\voxelandsdev\voxelands\src\Irrlicht.lib(Irrlicht.dll)	voxelands

I'm running 64 bit windows and 64 bit VS 2013 community edition; trying to see if theres a setting I can change to fix that.

Offline

#11 2015-04-11 04:56:02

melkior
Member
From: Sacramento, CA
Registered: 2015-04-08
Posts: 52
Website

Re: Building on Windows

Okay - the problem with x86 vs x64 was in CMake ; when you first go to "configure" the very first time it asks your compiler, so I choose the one I have... which was  Visual Studio 12 2013 x64

What I should have choose the one that says Visual Studio 12 2013.  Once I redid it yet again with the non x64 that issue is resolved.

Otherwise everything else worked EXCEPT .. I do not have zlib1.dll in my project folder anywhere (used a file search utility)

So I copied that out of a build of Voxelands I had downloaded from the website and now it works.

Not sure why I don't have that dll though lol!

Offline

#12 2015-04-11 06:05:40

darkrose
Administrator
Registered: 2013-10-05
Posts: 743

Re: Building on Windows

yey! working is good!


Support Voxelands on Patreon: https://www.patreon.com/voxelands

Offline

Board footer

Powered by FluxBB