Premake for windows


Is it possible to create premake file for Windows build? There is premake file for only linux.

I tried to copy premake files from linux folder to windows folder, but I couldn’t decide what to do to the following lines:

package.includepaths = {
"/usr/include/freetype2" //do I need this library on Windows? What should I do for this line?

package.config[“Debug”].defines = { “LINUX=1”, “DEBUG=1”, “_DEBUG=1” };
package.config[“Debug”].buildoptions = { “-D_DEBUG -ggdb -Wall” }

package.config[“Release”].defines = { “LINUX=1”, “NDEBUG=1” };
package.config[“Release”].buildoptions = { “-O2 -Wall -fvisibility=hidden” }

Should I replace LINUX=1 with LINUX=0 or WINDOWS=1? What should I replace it with?


You seem to want to make life very hard for yourself! I’ve no idea if it’s possible, but it’s definitely not as easy as starting up visual studio and hitting F5…


I want to use Juce with Eclipse. I can build Juce on Visual studio and then use the library with Eclipse, but I want my applications to be compiled with 100% GCC.

premake is not able to create Eclipse make files, but Eclipse can use MinGW’s make files. At the worst case, I can build Juce using MinGW-make from the command prompt window after then being able to make premake create make files for MinGW.


I looked at the source codes of Juce, and replaced “LINUX=1” with “_WIN32=1”, “intermediate_linux” with “intermediate_windows”, “/usr/include” with “C:\MinGW\include”, “/usr/include/freetype2” with “C:\Program Files\GnuWin32\include\freetype2” in juce_premake.lua
(I installed freetype library into C:\Program Files\GnuWin32)

After than copying juce.lua into juce\build\win32 folder, I used
premake --file juce_premake.lua --cc gcc --os windows --target gnu
command on the command prompt window (path system variable was set to have premake and mingw32-make inside path variable).

After then runnung mingw32-make on the folder juce\build\win32, MinGW compiled all the files except for juce_win32_WebBrowserComponent.cpp

The MinGW output related to juce_win32_WebBrowserComponent.cpp is below,

platform_specific_code/juce_win32_WebBrowserComponent.cpp:39:21: warning: comuti
l.h: No such file or directory
platform_specific_code/juce_win32_WebBrowserComponent.cpp:159: warning: class j uce::WebBrowserComponentInternal::EventHandler' has virtual functions but non-vi rtual destructor platform_specific_code/juce_win32_WebBrowserComponent.cpp: In member functionv
oid juce::WebBrowserComponentInternal::goToURL(const juce::String&, const juce::
StringArray*, const juce::MemoryBlock*)’:
platform_specific_code/juce_win32_WebBrowserComponent.cpp:108: error: _variant_ t' was not declared in this scope platform_specific_code/juce_win32_WebBrowserComponent.cpp:108: error: expected
;’ before "flags"
platform_specific_code/juce_win32_WebBrowserComponent.cpp:111: error: headersVa r' was not declared in this scope platform_specific_code/juce_win32_WebBrowserComponent.cpp:111: warning: unused v ariable 'headersVar' platform_specific_code/juce_win32_WebBrowserComponent.cpp:133: error:postDataV
ar’ was not declared in this scope
platform_specific_code/juce_win32_WebBrowserComponent.cpp:133: warning: unused v
ariable ‘postDataVar’
juce_Component.h:2049: error: juce::Component::ComponentFlags juce::Component:: <anonymous union>::flags' is private platform_specific_code/juce_win32_WebBrowserComponent.cpp:139: error: within thi s context platform_specific_code/juce_win32_WebBrowserComponent.cpp:139: error:frame’ wa
s not declared in this scope
platform_specific_code/juce_win32_WebBrowserComponent.cpp:140: error: postDataV ar' was not declared in this scope platform_specific_code/juce_win32_WebBrowserComponent.cpp:140: error:headersVa
r’ was not declared in this scope
platform_specific_code/juce_win32_WebBrowserComponent.cpp:108: warning: unused v
ariable '_variant_t’
platform_specific_code/juce_win32_WebBrowserComponent.cpp:139: warning: unused v
ariable 'frame’
platform_specific_code/juce_win32_WebBrowserComponent.cpp:140: warning: unused v
ariable 'postDataVar’
platform_specific_code/juce_win32_WebBrowserComponent.cpp:140: warning: unused v
ariable 'headersVar’
make[1]: *** […/…/bin/intermediate_windows/Debug/juce_win32_WebBrowserComponen
t.o] Error 1
make: *** [JUCE] Error 2

How can I solve this problem?
I looked at juce_win32_WebBrowserComponent.cpp, and I saw that there are some lines related to ActiveX. Is this component based on Internet Explorer? If it is so, is it possible to make this component Mozilla Gecko based?


Ehhrmm… if Jules would provide CMake files for all the stuff, you could use Eclipse/All flavours of VC/NMake/Xcode/makefiles etc. See . It is really one awesome tool (we actually use it for all our stuff, incl. juce)


If you are familiar with CMake, can’t you prepare cmake file for Juce? Since Juce is open source, you can include cmake script into Juce repository. You can take all the include instructions from premake, and then prepare cmake build file regarding the parameters which make Juce multiplatform. It will be very useful.

GCC doesn’t compile juce_win32_WebBrowserComponent.cpp. This component is not multi platform. Is there a way to disable this component?


Absolutely, no problems to disable stuff on a platform basis. I’ll look into the cmake file.


For Windows-specific build instructions, you can look at my modifications which I wrote above. For 64 bit windows, _WIN32=1 will be _WIN64=1

32 bit and 64 bit selections for Windows and the path of the freetype library can be passed by a parameter into the cmake.


Yes, but I think cmake knows already and sets the correct defines. But I’ll check it out.


_WIN32=1 and _WIN64=1 definitions are checked in the Juce codes, so either _WIN32=1 or _WIN64=1 should be set for Windows builds (I think this is Juce specific definition).


Ah, sorry, yes that would be handled automagically.


By the way, if LINUX, _WIN32 or _WIN64 is not defined, Juce defines JUCE_MAC automatically (I looked it at juce_PlatformDefs.h file).

You can configure cmake to do it so.


Hmm… Catch 22. I’m doing a build option for amalgamated juce, but amalgamator has a dependency to the exact files it is meant to produce :?

Jules, is there some way amalgamator can be built without having to rely on juce_amalgamated.* files so that:

  1. Amalgamator is built
  2. Amalgamator builds juce_amalgamated.* files
  3. Amalgamated JUCE lib is built

Edit: Never mind, I fixed it :wink:


Does it work now? It will be very excellent to work with Juce on every IDE.


Haven’t tried on Mac and Linux yet, but yes it works on Windows (and its prepped for Mac/Linux). I’ll have to make a cmake file for the juce demo so its clear how it works (so everyone can make their own)


I think that Juce demo has not high priority as much as the Juce library has. Can you upload the cmake file to the svn server?


Sorry, only Jules can do that, I think…