Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: precompiled headers? #64

Closed
ghost opened this issue Jul 29, 2015 · 5 comments
Closed

Feature request: precompiled headers? #64

ghost opened this issue Jul 29, 2015 · 5 comments
Labels

Comments

@ghost
Copy link

ghost commented Jul 29, 2015

Hi, Doug!

Wouldn't be great to compile code at runtime using precompiled headers?

Due to nature of openFrameworks (which pulls lots and lots of headers from variety of libraries) right now my ofAppLive project takes about 5 seconds to recompile a source file at runtime with RCC++, and it's the same time needed for standard recompiling. But if I use Cotire CMake module that precompiles headers automatically for me, the compile time is reduced to less than a second!

What do you think, will it be possible to use this technique with RCC++?

Thanks!

@dougbinks
Copy link
Collaborator

Precompiled headers can be used with runtime compiled C++ already by specifying the required compile option using RuntimeObjectSystem::SetAdditionalCompileOptions(). I think you'll need to set up your project manually to use them, or figure out the options Cotire is using so you can use those.

Let me know if you need any help with this, and I'll leave the feature request open until we can verify that you can get this to work without any changes to RCC++.

@ghost
Copy link
Author

ghost commented Jul 31, 2015

@dougbinks ok, I got it working and now it compiles almost as fast as with Cotire, but I've noticed one strange thing: why ObjectInterfacePerModuleSource.cpp compiles with my source file on each runtime change? Is it required at all? If yes, why not precompile it to object file?

@ghost
Copy link
Author

ghost commented Jul 31, 2015

Here's how compile command looks like (notice ofApp.cpp and ObjectInterfacePerModuleSource.cpp):

clang++  -g -fPIC -fvisibility=hidden -shared -Os -I"../RuntimeCompiledCPlusPlus/Aurora/RuntimeObjectSystem" -I"../RuntimeCompiledCPlusPlus/Aurora/RuntimeCompiler" -I"/usr/include/AL" -I"/usr/include/cairo" -I"/usr/include/gtk-3.0" -I"/usr/include/atk-1.0" -I"/usr/include/glib-2.0" -I"/usr/include/harfbuzz" -I"/usr/include/pixman-1" -I"/usr/include/libpng12" -I"/usr/include/pango-1.0" -I"/usr/include/freetype2" -I"/usr/include/gio-unix-2.0" -I"/usr/include/gstreamer-1.0" -I"/usr/include/gdk-pixbuf-2.0" -I"/usr/include/at-spi2-atk/2.0" -I"/usr/lib/x86_64-linux-gnu/glib-2.0/include" -I"../../of/src/openframeworks" -I"../../of/src/openframeworks/3d" -I"../../of/src/openframeworks/app" -I"../../of/src/openframeworks/communication" -I"../../of/src/openframeworks/events" -I"../../of/src/openframeworks/gl" -I"../../of/src/openframeworks/graphics" -I"../../of/src/openframeworks/math" -I"../../of/src/openframeworks/sound" -I"../../of/src/openframeworks/types" -I"../../of/src/openframeworks/utils" -I"../../of/src/openframeworks/video" -I"../../of/src/freeimage" -I"../../of/src/freeimage/OpenEXR" -I"../../of/src/freeimage/OpenEXR/Half" -I"../../of/src/freeimage/OpenEXR/Iex" -I"../../of/src/freeimage/OpenEXR/IlmImf" -I"../../of/src/freeimage/OpenEXR/IlmThread" -I"../../of/src/freeimage/OpenEXR/Imath" -I"../../of/src/glew" -I"../../of/src/glew/include" -I"../../of/src/glfw" -I"../../of/src/glfw/include" -I"../../of/src/glfw/include/GLFW" -I"../../of/src/kissfft" -I"../../of/src/kissfft/tools" -I"../../of/src/libtess2" -I"../../of/src/libtess2/Include" -I"../../of/src/libtess2/Source" -I"../../of/src/poco" -I"../../of/src/poco/Crypto/include" -I"../../of/src/poco/Foundation/include" -I"../../of/src/poco/Net/include" -I"../../of/src/poco/NetSSL_OpenSSL/include" -I"../../of/src/poco/Util/include" -I"../../of/src/poco/XML/include" -I"../../of/src/poco/Zip/include" -I"../../of/src/rtaudio" -I"../../of/src/rtaudio/include" -I"../../of/src/utf8cpp" -I"../../of/src/utf8cpp/include" -I"../RuntimeCompiledCPlusPlus/Aurora" -I".." -L"../../of/lib-linux/release" -F"../../of/lib-linux/release" -o /tmp/RCCppTempDylib0ZYZh9 -include /mnt/space/Projects/ofLiveApp/build/cotire/ofApp_CXX_prefix.hxx "../src/ofApp.cpp" "../RuntimeCompiledCPlusPlus/Aurora/RuntimeObjectSystem/ObjectInterfacePerModuleSource.cpp"  -DRCCPP -DOF_USING_GTK -DOF_USING_MPG123 -DOF_SOUND_PLAYER_OPENAL -DOF_SOUNDSTREAM_RTAUDIO -DOF_VIDEO_PLAYER_GSTREAMER -DOF_VIDEO_CAPTURE_GSTREAMER -Wno-switch -Wno-c++11-narrowing -Wno-ignored-attributes -Wno-deprecated-register -std=gnu++11 -lPocoFoundation -lassimp -lfreeimage -lglew -lglfw -lkissfft -lopenFrameworks -lPocoCrypto -lPocoJSON -lPocoNet -lPocoNetSSL -lPocoUtil -lPocoXML -lrtaudio -ltess2 -lboost_filesystem -lboost_system -lrt -ldl -lXi -lSM -lICE -lX11 -lXext -lXrandr -lXcursor -lXxf86vm -lXinerama -ludev -lgtk-3 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lgobject-2.0 -lglib-2.0 -lglib-2.0 -lgthread-2.0 -lgmodule-2.0 -lz -lasound -lopenal -lcairo -lGLU -lGL -lSM -lICE -lX11 -lXext -lssl -lcrypto -lsndfile -lfreetype -lgstreamer-1.0 -lfontconfig -lpthread -lgstapp-1.0 -lgstbase-1.0 -lgstvideo-1.0

@dougbinks
Copy link
Collaborator

Glad that you got this working - I'll close this issue as precompiled headers work for you.

The file ObjectInterfacePerModuleSource.cpp is indeed required, and currently the Posix compiler doesn't retain intermediates, as this is the default with gcc and clang. I should look into whether doing so would be a performance improvement, so I've opened a new feature request as #65.

@elliotwoods
Copy link

oops. wrong thread sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants