- tron - Qt/OpenSceneGraph based libraries and apps
- F12 to look up symbols (both local and third party)
- Builds all third party dependencies locally
- Debug symbols including third party
- Source for third party
- Debug via one mouse click in VS Code (builds code, launches debug executable with gdb for active project)
- Cross platform: works on Linux, Mac, Windows
- Built around VS Code, but supports any IDE (including - Visual Studio on Windows)
- Builds/runs locally (after setup, can disconnect from internet and continue developing)
- Fast compilation via precompiled headers
- Fast linking via visibility/dllexport (only export symbols designated as public)
- Simple - Err on the side of simple solutions that new users will easily understand
- Fast - Want to be able to develop fast, debug fast, iterate fast, run fast
- Easy - Things should "just work" or be easy to figure out
- Crossplatform - Windows, Linux, Mac
- Multiple copies of repo
- Run locally
A full build uses about 150 GB of disk space.
-
- Install Visual Studio 2022 Community
- Download and open vs_Community.exe
- Select "Desktop development with C++" Workload
- Click "Install" button
- NOTE: To verify proper install, you should be able to run
cl
from the "Developer Command Prompt for VS 2022" without error.
- Open terminal and install
git
,pwsh
,cmake
,perl
, andcode
'Git.Git', '9MZ1SNWT0N5D', 'cmake', 'StrawberryPerl.StrawberryPerl', 'XP9KHM4BK9FZ7Q' | % {winget install $_ --accept-source-agreements --accept-package-agreements}
- Close terminal (this terminal must be restarted to access newly installed apps)
- Install Visual Studio 2022 Community
-
- Open terminal and install
pwsh
,git
, andcode
sudo snap install powershell --channel=lts/stable --classic; sudo apt-get install git --yes; sudo snap install code --classic
- Open terminal and install
-
- SIP (System Integrity Protection) must be disabled to run setup script. Follow these instructions.
- Open terminal and install
brew
andPowerShell
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"; brew install --cask powershell
- Open terminal and clone repo, run setup script (~1-2 hours)
pwsh -Command "git clone https://github.com/lenihan/tron.git $HOME/repos/tron; ~/repos/tron/scripts/setup.ps1"
- Visual Studio Code (
Windows/
Linux/
Mac)
- Open terminal and launch Visual Studio Code with repo folder
pwsh -Command "code $HOME/repos/tron"
- Install Workspace Recommended extensions
- View > Extensions > Filter Extensions... > Recommended
- Click "Install" on each extension
- To launch a target, click the "play" icon the status bar (bottom)
- Select a Kit
- Windows:
Visual Studio Community 2022 Release - amd64
- Linux:
GCC 9.4.0 x86_64-linux-gnu
- Mac:
Clang 14.0.0 x86_64-apple-darwin 21.6.0
- Windows:
- Select a launch target
hello_cmake
to test CMakehello_osg
to test OpenSceneGraphhello_qt
to test Qt
- To launch debugger, click the "debug" icon in the status bar (bottom)
- Visual Studio 2022 (
Windows)
- Open terminal and generate .sln file, launch in Visual Studio
pwsh -Command "cmake -S ~/repos/tron -B ~/repos/tron/build; ~/repos/tron/build/tron.sln"
- Solution Explorer > Right click on project > Set as Startup Project
hello_cmake
to test CMakehello_osg
to test OpenSceneGraphhello_qt
to test Qt
- Debug > Start Debugging
All output (CMake, compiler, linker, etc.) go to ./build directory. To clean up, delete ./build.
See ~/repos/tron/src/hello/hello_cmake/CMakeLists.txt
for a simple example.
- Create
CMakeLists.txt
in project directory under~/repos/tron/src
- First line sets project name:
project(<PROJECT_NAME>)
- Add
project_common()
to get settings that apply to all projects. - Add source code to compile via add_executable
- Link libraries with target_link_libraries
- Add project directory to
~/repos/tron/CmakeLists.txt
with add_subdirectory - Generate build files in ./build
pwsh -Command 'cmake -S ~/repos/tron -B ~/repos/tron/build'
CMake creates two predefined projects
- ALL_BUILD - Build all projects
- ZERO_CHECK - Check to see if any files are out of date, and re-run CMake if needed.
ALL_BUILD has a dependency on all projects. When you build ALL_BUILD, you build everything.
ZERO_CHECK looks at the timestamp on generate.stamp
files to determine if CMake needs to re-run. For example, if you add a new source file to a 'CMakeLists.txt` file, ZERO_CHECK will detect this and regenerate build files. All projects have a dependency on ZERO_CHECK to ensure all build files are up to date before building.
Use configure_file
to copy files. The copy happens during CMake build file generation. See src/sandbox/QTreeView
for an example.
- Everything after
#
is a comment- Like C++
//
- Like C++
- Everthing in betwee
#[[
and]]
is a comment- Like C++
/* ... */
- Like C++
message("Hello")
message(${PROJECT_NAME})
Add this to a CMakeLists.txt
to see all CMake variables
get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames)
foreach (_variableName ${_variableNames})
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()
- Install Qt Visual Studio Tools
- Adds debugging extensions for Qt data types
Where OpenSceneGraph Q&A happens today. This is active.
https://github.com/openscenegraph/OpenSceneGraph/discussions
Email forum with 18,000+ conversations. This is where most questions are posted/answered. No longer active, but contains lots of Questions and answers.
https://groups.google.com/g/osg-users
Required environment variables are embedded in vs code workspace. You do not need to modify your environment to run/debug apps within vs code.
This should happen automatically as needed (for example, when you click on Build).
To run manually: Ctrl+Shift+P > CMake: Configure