diff --git a/.gitignore b/.gitignore index 79aae119..fccc58be 100644 --- a/.gitignore +++ b/.gitignore @@ -21,5 +21,11 @@ vogl_build/* voglinc/ *~ *.swp +\#* +.\#* +*.a +*.bin _out*/ +__nix_qt5__ +/result diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..c8caec68 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +language: nix +script: nix-build shell.nix +sudo: true +# Sudo containers start slower, but are isolated in a VM and get 8G of RAM, instead of 4G. + +cache: + directories: + - /nix diff --git a/CMakeLists.txt b/CMakeLists.txt index db87754e..b6433518 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,4 +52,3 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") add_subdirectory(src/libbacktrace) # 10 add_subdirectory(src/libbacktrace_test) # 11 endif() - diff --git a/README.md b/README.md index f2e739f0..bf35cc34 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,6 @@ vogl ============= - -#### NOTE #### - -April 16, 2014: Vogl history has been completely and utterly trounced. The original repository had an entire chroot build system that most folks weren't interested in. A few contributors (thanks Carl & Sir Anthony) took the time to build a much smaller source only vogl repository which we've replaced the original one with. - -A separate chroot repository (which will build this source repository) is now here: - -https://bitbucket.org/raddebugger/vogl_chroot +[![Build Status](https://travis-ci.org/deepfire/vogl.svg?branch=master)](https://travis-ci.org/deepfire/vogl) ## Warning ## @@ -15,11 +8,7 @@ This project is alpha^2. If you are up for suffering through a bit of pain with ## Dependencies ## -The chroot configuration script should be a good reference for vogl dependencies. It is located here: - -https://bitbucket.org/raddebugger/vogl_chroot/src/master/bin/chroot_configure.sh?at=master - -The build dependencies for ubuntu (14.04) can be installed using the following: +The build dependencies for ubuntu (14.04) can be installed either using APT: ``` sudo apt-get install build-essential pkg-config cmake libx11-dev \ zip wget libtinyxml-dev liblzma-dev libunwind8-dev \ @@ -27,10 +16,70 @@ sudo apt-get install build-essential pkg-config cmake libx11-dev \ freeglut3-dev qt5-default libqt5x11extras5-dev git \ libsdl2-gfx-dev libsdl2-image-dev libsdl2-ttf-dev libjpeg-turbo8-dev ``` +> .. or using Nix, for which keep reading. + +### Get Source and Build ### + +There are two build methods, due to development environment setup mechanisms: Nix and chroot. + +1. The Nix-based method: + + - distribution-agnostic, but requires the Nix package manager to be installed + - fire-and-forget + - integrated with Travis CI + - allows fine dependency specification + - 100% declarative -- you get what you ask for (nothing is implied by any kind of "state") + - currently suffers from https://github.com/NixOS/nixpkgs/issues/9415 + - ..but there is a remedy (nVidia-only at the moment): https://github.com/deepfire/nix-install-vendor-gl + +2. The old, chroot-based method. + +#### Nix-based #### + +##### Linux (Mac OS X untested, but not impossible) #### + +First, you need to have Nix installed (citing http://nixos.org/nix/manual/#ch-installing-binary): + +``` +desktop@steamos:~/src/vogl$ bash <(curl https://nixos.org/nix/install) +... + +## At the end, this will instruct you to either re-login, +## or source the Nix environment setup script. Do that. +## Validation: + +desktop@steamos:~/src/vogl$ nix-env --query --installed # ..which should list just `nix`, initially. +``` +> NOTE: If security implications of this particular step worry you, please read +> the following piece by Domen Kožar: +> https://www.domenkozar.com/2015/09/27/friends-sometimes-let-friends-curl-to-shell/) -## Get Source and Build ## +Once that's behind us, the following two options become available: -#### Linux #### +1. Building and installing the package into the current user environment: + +``` +desktop@steamos:~/src/vogl$ nix-env --no-build-output --cores 0 -iE 'f: (import ./shell.nix {})' +these derivations will be built: + /nix/store/zvdz4dhprf6kbnjf5sjcc8731rnbmd1z-vogl-2016-05-13.drv +building path(s) ‘/nix/store/b88a5flgwjghw204wg5j8ahqs50l2qba-vogl-2016-05-13’ +_makeQtWrapperSetup +unpacking sources +unpacking source archive /nix/store/qm11psc7pp4nk2273msgln3x519iv1pb-vogl-cbc5f18 +... + +... +``` + +2. Entering the fully-dependency endowed build environment: +``` +nix-shell +``` + + +#### Chroot-based #### + +##### Linux #### ``` git clone https://github.com/ValveSoftware/vogl.git @@ -44,7 +93,7 @@ The binaries are placed in the vogl/vogl_build directory. For debug builds, use "-DCMAKE_BUILD_TYPE=Debug" For 32-bit builds, use "-DBUILD_X64=Off" -#### Windows #### +##### Windows #### ``` git clone https://github.com/ValveSoftware/vogl.git @@ -60,7 +109,7 @@ cmake -DQt5_DIR="C:\Qt\5.3\msvc2013_opengl\lib\cmake\Qt5" -G "Visual Studio 12 2 Note: The path to Qt5 might need to be adjusted depending on your install location. After compiling with Visual Studio, the binaries are placed in the vogl\vogl_build\Release (or Debug) directory. -### Mac OS X ### +##### Mac OS X ### Install the required build dependencies using Homebrew: @@ -95,6 +144,12 @@ https://bitbucket.org/raddebugger/vogl_chroot/src/master/bin/src/sl.cpp?at=maste We are currently working on making it much easier to launch and profile Steam apps. +Note, that `vogleditor` used to attempt to launch the target application while +preloading both 32-bit and 64-bit versions of the capture libraries, but this was +error-prone -- in certain systems that would prevent the editor-based capturing at +all. So this was disabled, and now `vogleditor` only preloads captures of a +single architecture -- one matching the particular `vogl` build, 32 or 64-bit. + ## Replay ## ``` diff --git a/default.nix b/default.nix new file mode 100644 index 00000000..492cbf64 --- /dev/null +++ b/default.nix @@ -0,0 +1,52 @@ +# -*- indent-tabs-mode: nil -*- +{ cmake, git, pkgconfig, wget, zip +, makeQtWrapper, qtbase, qtx11extras +, libdwarf, libjpeg_turbo, libunwind, lzma, tinyxml, libX11 +, SDL2, SDL2_gfx, SDL2_image, SDL2_ttf +, freeglut, mesa, mesa_glu +## +, fetchgit, stdenv +, localSource ? false +}: +let + ver = "2016-05-13"; +in +stdenv.mkDerivation { + name = "vogl-${ver}"; + version = "${ver}"; + + src = fetchgit { + url = if localSource == false then "https://github.com/deepfire/vogl.git" else ("file://" + localSource); + rev = "cbc5f1853e294b363f16c4e00b3e0c49dbf74559"; + sha256 = "17gwd73x3lnqv6ccqs48pzqwbzjhbn41c0x0l5zzirhiirb3yh0n"; + }; + + nativeBuildInputs = [ + makeQtWrapper pkgconfig + ]; + + buildInputs = [ + cmake git pkgconfig wget zip + qtbase qtx11extras + libdwarf libjpeg_turbo libunwind lzma tinyxml libX11 + SDL2 SDL2_gfx SDL2_image SDL2_ttf + freeglut mesa mesa_glu + ]; + + enableParallelBuilding = true; + + dontUseCmakeBuildDir = true; + preConfigure = '' + cmakeDir=$PWD + mkdir -p vogl/vogl_build/release64 && cd $_ + ''; + cmakeFlags = '' -DCMAKE_VERBOSE=On -DCMAKE_BUILD_TYPE=Release -DBUILD_X64=On''; + + meta = with stdenv.lib; { + description = "OpenGL capture / playback debugger."; + homepage = https://github.com/ValveSoftware/vogl; + license = licenses.bsd3; + maintainers = with maintainers; [ deepfire ]; + platforms = platforms.all; + }; +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 00000000..fbbfab4a --- /dev/null +++ b/shell.nix @@ -0,0 +1,5 @@ +{ nixpkgs ? import {} }: + +nixpkgs.pkgs.libsForQt56.callPackage + (import ./.) + { } diff --git a/src/glxspheres/CMakeLists.txt b/src/glxspheres/CMakeLists.txt index 03c07893..1e078c17 100644 --- a/src/glxspheres/CMakeLists.txt +++ b/src/glxspheres/CMakeLists.txt @@ -41,3 +41,9 @@ target_link_libraries(${PROJECT_NAME} build_options_finalize() +# +# Installation +# +install(TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib) diff --git a/src/ktxtool/CMakeLists.txt b/src/ktxtool/CMakeLists.txt index 38e148e0..682a4df2 100644 --- a/src/ktxtool/CMakeLists.txt +++ b/src/ktxtool/CMakeLists.txt @@ -36,3 +36,9 @@ target_link_libraries(${PROJECT_NAME} build_options_finalize() +# +# Installation +# +install(TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib) diff --git a/src/voglbench/CMakeLists.txt b/src/voglbench/CMakeLists.txt index e7d98a9e..fe6c58fd 100644 --- a/src/voglbench/CMakeLists.txt +++ b/src/voglbench/CMakeLists.txt @@ -41,3 +41,10 @@ target_link_libraries(${PROJECT_NAME} ) build_options_finalize() + +# +# Installation +# +install(TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib) diff --git a/src/voglcmd/CMakeLists.txt b/src/voglcmd/CMakeLists.txt index c612b05e..feb63f77 100644 --- a/src/voglcmd/CMakeLists.txt +++ b/src/voglcmd/CMakeLists.txt @@ -38,3 +38,9 @@ target_link_libraries(${PROJECT_NAME} build_options_finalize() +# +# Installation +# +install(TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib) diff --git a/src/vogleditor/CMakeLists.txt b/src/vogleditor/CMakeLists.txt index 60bf484f..df84d880 100644 --- a/src/vogleditor/CMakeLists.txt +++ b/src/vogleditor/CMakeLists.txt @@ -229,3 +229,10 @@ if (MSVC) endif() build_options_finalize() + +# +# Installation +# +install(TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib) diff --git a/src/vogleditor/vogleditor.cpp b/src/vogleditor/vogleditor.cpp index e67f4b93..7a02358e 100644 --- a/src/vogleditor/vogleditor.cpp +++ b/src/vogleditor/vogleditor.cpp @@ -471,7 +471,7 @@ VoglEditor::Prompt_Result VoglEditor::prompt_generate_trace() #endif QString cmdLine = m_pLaunchTracerDialog->get_command_line(); - QProcessEnvironment env = m_pLaunchTracerDialog->get_process_environment(); + QProcessEnvironment env = m_pLaunchTracerDialog->get_process_environment (sizeof (void *) < 8); bool bSuccess = launch_application_to_generate_trace(cmdLine, env); QFileInfo fileInfo(m_pLaunchTracerDialog->get_trace_file_path()); if (bSuccess && fileInfo.exists()) diff --git a/src/vogleditor/vogleditor_qapicalltreemodel.cpp b/src/vogleditor/vogleditor_qapicalltreemodel.cpp index 41bfdfa2..71211452 100644 --- a/src/vogleditor/vogleditor_qapicalltreemodel.cpp +++ b/src/vogleditor/vogleditor_qapicalltreemodel.cpp @@ -348,8 +348,7 @@ bool vogleditor_QApiCallTreeModel::init(vogl_trace_file_reader *pTrace_reader) { QString msg(QString("*** Information: unpaired \"") + QString(g_vogl_entrypoint_descs[entrypoint_id].m_pName) + QString("\".")); vogleditor_output_message(msg.toStdString().c_str()); - vogl_printf(msg.toStdString().c_str()); - vogl_printf("\n"); + vogl_printf("%s\n", msg.toStdString().c_str()); } } else if (isMarkerPushEntrypoint(entrypoint_id)) @@ -387,7 +386,7 @@ bool vogleditor_QApiCallTreeModel::init(vogl_trace_file_reader *pTrace_reader) { QString msg(QString("*** Information: unpaired \"") + QString(g_vogl_entrypoint_descs[entrypoint_id].m_pName) + QString("\".")); vogleditor_output_message(msg.toStdString().c_str()); - vogl_printf(msg.toStdString().c_str()); + vogl_printf("%s", msg.toStdString().c_str()); vogl_printf("\n"); } } diff --git a/src/vogleditor/vogleditor_qlaunchtracerdialog.cpp b/src/vogleditor/vogleditor_qlaunchtracerdialog.cpp index b6381b1f..356818bb 100644 --- a/src/vogleditor/vogleditor_qlaunchtracerdialog.cpp +++ b/src/vogleditor/vogleditor_qlaunchtracerdialog.cpp @@ -85,7 +85,7 @@ QString vogleditor_QLaunchTracerDialog::get_command_line() return cmdline; } -QProcessEnvironment vogleditor_QLaunchTracerDialog::get_process_environment() +QProcessEnvironment vogleditor_QLaunchTracerDialog::get_process_environment(bool just32bits) { QDir appDirectory(QCoreApplication::applicationDirPath()); @@ -119,9 +119,7 @@ QProcessEnvironment vogleditor_QLaunchTracerDialog::get_process_environment() m_process_environment.insert("VOGL_CMD_LINE", VOGL_CMD_LINE); } - QString libvogltrace32 = appDirectory.absoluteFilePath("./libvogltrace32.so"); - QString libvogltrace64 = appDirectory.absoluteFilePath("./libvogltrace64.so"); - QString LD_PRELOAD = libvogltrace32 + ":" + libvogltrace64; + QString LD_PRELOAD = appDirectory.absoluteFilePath(just32bits ? "./libvogltrace32.so" : "./libvogltrace64.so"); if (getenv("LD_PRELOAD")) { diff --git a/src/vogleditor/vogleditor_qlaunchtracerdialog.h b/src/vogleditor/vogleditor_qlaunchtracerdialog.h index e147e992..9afd9437 100644 --- a/src/vogleditor/vogleditor_qlaunchtracerdialog.h +++ b/src/vogleditor/vogleditor_qlaunchtracerdialog.h @@ -19,7 +19,7 @@ class vogleditor_QLaunchTracerDialog : public QDialog QString get_application_to_launch(); QString get_command_line(); - QProcessEnvironment get_process_environment(); + QProcessEnvironment get_process_environment(bool just32bits); QString get_trace_file_path(); private diff --git a/src/voglgen/CMakeLists.txt b/src/voglgen/CMakeLists.txt index e57d566f..9c83c60f 100644 --- a/src/voglgen/CMakeLists.txt +++ b/src/voglgen/CMakeLists.txt @@ -170,3 +170,9 @@ endif() build_options_finalize() +# +# Installation +# +install(TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib) diff --git a/src/voglreplay/CMakeLists.txt b/src/voglreplay/CMakeLists.txt index a42d1dc3..a6aceb60 100644 --- a/src/voglreplay/CMakeLists.txt +++ b/src/voglreplay/CMakeLists.txt @@ -54,3 +54,9 @@ target_link_libraries(${PROJECT_NAME} build_options_finalize() +# +# Installation +# +install(TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib) diff --git a/src/voglreplay/replay_tool_trace.cpp b/src/voglreplay/replay_tool_trace.cpp index ccc70504..7071419d 100644 --- a/src/voglreplay/replay_tool_trace.cpp +++ b/src/voglreplay/replay_tool_trace.cpp @@ -289,12 +289,11 @@ tool_trace_mode(vogl::vector *desc) vogl_message_printf("Logfile: %s", args.vogl_logfile.c_str()); vogl_printf(" (will have PID appended)\n"); - dynamic_string vogltracepath32 = getfullpath("libvogltrace32.so"); - dynamic_string vogltracepath64 = getfullpath("libvogltrace64.so"); + dynamic_string vogltracepath = getfullpath((sizeof(void *) < 8) ? "libvogltrace32.so" : "libvogltrace64.so"); // set up LD_PRELOAD string dynamic_string LD_PRELOAD = "LD_PRELOAD=\""; - LD_PRELOAD += vogltracepath32 + ":" + vogltracepath64; + LD_PRELOAD += vogltracepath; if (is_steam_file || getenv("LD_PRELOAD")) LD_PRELOAD += ":$LD_PRELOAD"; diff --git a/src/voglserver/CMakeLists.txt b/src/voglserver/CMakeLists.txt index aeed3794..276644f5 100644 --- a/src/voglserver/CMakeLists.txt +++ b/src/voglserver/CMakeLists.txt @@ -34,3 +34,9 @@ target_link_libraries(${PROJECT_NAME} build_options_finalize() +# +# Installation +# +install(TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib) diff --git a/src/vogltest/CMakeLists.txt b/src/vogltest/CMakeLists.txt index e71deed7..66ab80a0 100644 --- a/src/vogltest/CMakeLists.txt +++ b/src/vogltest/CMakeLists.txt @@ -62,3 +62,9 @@ target_link_libraries(${PROJECT_NAME} build_options_finalize() +# +# Installation +# +install(TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib) diff --git a/src/vogltrace/CMakeLists.txt b/src/vogltrace/CMakeLists.txt index d1cb5e01..c65f6180 100644 --- a/src/vogltrace/CMakeLists.txt +++ b/src/vogltrace/CMakeLists.txt @@ -116,3 +116,8 @@ endif() build_options_finalize() +# +# Installation +# +install(TARGETS vogltrace + LIBRARY DESTINATION bin)