Amalgamated juce


#1

ok, as promised, I’ve checked in some stuff to do the entire-library-in-a-cpp-file thing, and have updated the juce demo to use this build method. Feedback, please!


#2

just checking…

here is a start build/linux/premake.lua

project.name = "Amalgamator"
project.bindir = "build"
project.libdir = "build"

project.configs = { "Debug", "Release" }

package = newpackage()
package.name = "Amalgamator"
package.target = "amalgamator"
package.kind = "exe"
package.language = "c++"

package.objdir = "build/intermediate"
package.config["Debug"].objdir   = "build/intermediate/Debug"
package.config["Release"].objdir = "build/intermediate/Release"

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

package.config["Release"].defines   = { "LINUX=1", "NDEBUG=1" };

package.includepaths = { 
    "/usr/include",
    "/usr/include/freetype2"
}

package.libpaths = { 
    "/usr/X11R6/lib/"
}

package.config["Debug"].links = { 
    "freetype", "pthread", "rt", "X11", "GL", "GLU", "Xinerama", "asound"
}

package.config["Release"].links = { 
    "freetype", "pthread", "rt", "X11", "GL", "GLU", "Xinerama", "asound"
}

package.linkflags = { "static-runtime" }

package.files = { matchfiles (
    "../../*.h",
    "../../*.cpp"
    )
}

anyway… compiling time improved by 1000% !!! ten seconds to compile the whole library now !!!


#3

i’ve tried it on my jucetice library (something like juce, based upon it) by issuing:

but i notice that only .h files are parsed, since jucetice.h only include .h files… how can i deal with include recursively also every implementation file (cpp, c, cxx file not mentioned in any file) ?

also, i’ve tried calling it like this to build the library parsing the containing directory:

[code] bash# amalgamator jucetice/

The C++ Amalgamator! Copyright 2008 by Julian Storer - www.rawmaterialsoftware.com

The template file doesn’t exist!
[/code]


#4

Here’s what I get when trying to build rev 447:

------ Rebuild All started: Project: Amalgamator, Configuration: Debug Win32 ------ Deleting intermediate and output files for project 'Amalgamator', configuration 'Debug|Win32' Compiling... juce_AmalgamatorMain.cpp juce_LibrarySource.cpp c:\program files\microsoft visual studio 8\vc\include\intrin.h(912) : error C2733: second C linkage of overloaded function '_interlockedbittestandset' not allowed c:\program files\microsoft visual studio 8\vc\include\intrin.h(912) : see declaration of '_interlockedbittestandset' c:\program files\microsoft visual studio 8\vc\include\intrin.h(913) : error C2733: second C linkage of overloaded function '_interlockedbittestandreset' not allowed c:\program files\microsoft visual studio 8\vc\include\intrin.h(913) : see declaration of '_interlockedbittestandreset' Generating Code... Build log was saved at "file://c:\juce\trunk\extras\amalgamator\vc8\Debug\BuildLog.htm" Amalgamator - 2 error(s), 0 warning(s) ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

I’m pretty sure I’ve seen this before, but I can’t remember the fix.


#5

You need to call the amalgamator.exe passing it the juce root, e.g. on my machine it’s “c:\code\juce”. It’ll look in the src/ folder for the two template files it needs.

warmonger: I’ve no idea what’s going on there… some kind of crazy mix of MS SDK headers?


#6

i called:

but still it complaints about the template file that doesn’t exist

i need to provide juce_amalgamated_template.h and juce_amalgamated_template.cpp inside the src directory ?

can these files be passed to the command line (so we can actually run the amalgamator on other source directories that are not juce) ?


#7

Okay, I managed to get it working. Apparently the project was opening in VC2005, which hasn’t worked with Juce projects on my system for a while. It’s definitely some MS SDK conflict. VC2008 worked fine, but I had to #define JUCE_QUICKTIME 0 first.

edit:
Having used it a bit, I’ve noticed that Intellisense seems to receive similar performance gains when updating (which happens way too often), so I’m pretty much sold. I’ll be using juce_amalgamated for all my future projects, unless some major problems pop up. So far so good though.


#8

Jules, this is fantastic. I disabled ASIO, QT and OpenGL, which I’ve always done with JUCE. My intermediate folder went from 270 MB (755 files) to 31 MB (7 files). The only strange thing is that the debug and release libs produced are of the same size (14 MB). The release lib used to be over 200 megabytes with the separate source files.

Edit:
jucelib_static_Win32_debug.lib: 15 515 908 bytes
jucelib_static_Win32.lib: 15 472 412 bytes
(so they’re different is what I want to say)

Build time is now about 10 seconds instead of the roughly 5 minutes previously. Awesome, looks very convenient for light JUCE modifications.

Haven’t tested the amalgamator tool yet.


#9

Another misterious thing:

One of my applications (only one I tested so far) went up in size:

release: 900K to 2.5M
debug: 3M to 5.5M

This could probably be because I skipped a few revisions in the svn, so I guess I have to build the regular stuff from the tip as well.

Edit:
I can confirm now (using the tip of the svn) that the amalgamated version produces about 2.5x larger executable when built (while the static libs are massively smaller than before).


#10

you can use the fantastic upx on your final exe :slight_smile:


#11

I’m not worried about the size itself. I thought the two builds should roughly be the same. Isn’t the amalgamated version is just a different build method which produces the same output?


#12

should be… but i don’t know, compiler could be handling the produced .obj differently internally.


#13

Strange - my exes seem to come out smaller or the same size. Maybe you need to tweak some optimisation settings?


#14

The only things that are different from your project file in the svn:

  • I’m using VC9
  • Output location
  • Additional include dir set to “C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include”

#15

I thought VC9 was the problem too, but when I went through the project configuration manually and made sure that everything in the compiler and linker settings were identical (except for the lib directory), I got a 10% smaller release binary with the amalgamated project.


#16

vc6 (no code of mine for now, just added the two new cpp and h files)
disable ASIO and Quicktime

enable RTTI for a new Win32 project
2 errors appear.

Compiling...
juce_amalgamated.cpp
c:\devel\amal\juce_amalgamated.cpp(65538) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(98516) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(104437) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(105934) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(111348) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(111349) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(111358) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(124470) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(229429) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(229430) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(229431) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(230559) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(230639) : error C2065: '_endthreadex' : undeclared identifier
c:\devel\amal\juce_amalgamated.cpp(230652) : error C2065: '_beginthreadex' : undeclared identifier
c:\devel\amal\juce_amalgamated.cpp(236956) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(238555) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(238557) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(238870) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(238871) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(238874) : warning C4049: compiler limit : terminating line number emission
Error executing cl.exe.

#17

Perhaps the include path is incorrect. These are WinAPI functions declared in <process.h>, your compiler needs to find it.

I had similar headaches with incorrect (old VC6 instead of VC9) SDK’s include parths.


#18

i have paths to

PSDK Include and Include/MFC
and VC6 path to Include +vstsdk include path

this always worked with all JUCE projects, what additional directories can affect the build ?


#19

Try setting the VC6 project to force using multithreaded runtime libs.

Project Settings ->> C/C++ --> Code Generation --> Runtime Library: set it to /MT


#20

it helped but now there is a different error:

--------------------Configuration: amal - Win32 Debug--------------------
Compiling...
juce_amalgamated.cpp
c:\devel\amal\juce_amalgamated.cpp(65538) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(98516) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(104437) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(105934) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(111348) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(111349) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(111358) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(124470) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(229429) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(229430) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(229431) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(230559) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(236956) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(238555) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(238557) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(238870) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(238871) : warning C4049: compiler limit : terminating line number emission
c:\devel\amal\juce_amalgamated.cpp(238874) : warning C4049: compiler limit : terminating line number emission
c:\devel\msdev\vc98\include\xlocale(464) : error C2668: 'free' : ambiguous call to overloaded function
        c:\devel\msdev\vc98\include\xlocale(463) : while compiling class-template member function '__thiscall std::ctype<unsigned short>::~std::ctype<unsigned short>(void)'
Error executing cl.exe.

amal.exe - 1 error(s), 18 warning(s)