Giter Club home page Giter Club logo

tron's Introduction

tron - Qt/OpenSceneGraph based libraries and apps

Features

  • 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)

Goals

  • 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

Prerequisites

Disk Space

A full build uses about 150 GB of disk space.

Apps

  • Windows Windows

    1. Install Visual Studio 2022 Community
      1. Download and open vs_Community.exe
      2. Select "Desktop development with C++" Workload
      3. 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.
    2. Open terminal and install git, pwsh, cmake, perl, and code
    'Git.Git', '9MZ1SNWT0N5D', 'cmake', 'StrawberryPerl.StrawberryPerl', 'XP9KHM4BK9FZ7Q' | % {winget install $_ --accept-source-agreements --accept-package-agreements}
    1. Close terminal (this terminal must be restarted to access newly installed apps)
  • Linux Linux

    1. Open terminal and install pwsh, git, and code
    sudo snap install powershell --channel=lts/stable --classic; sudo apt-get install git --yes; sudo snap install code --classic
  • MacOS Mac

    1. SIP (System Integrity Protection) must be disabled to run setup script. Follow these instructions.
    2. Open terminal and install brew and PowerShell
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"; brew install --cask powershell

Setup

Windows Windows/Linux Linux/MacOS Mac

  1. 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"

Build/Run/Debug

  • Visual Studio Code (Windows Windows/Linux Linux/MacOS Mac)
    1. Open terminal and launch Visual Studio Code with repo folder
    pwsh -Command "code $HOME/repos/tron"
    1. Install Workspace Recommended extensions
      • View > Extensions > Filter Extensions... > Recommended
      • Click "Install" on each extension
    2. To launch a target, click the "play" icon the status bar (bottom)
    3. 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
    4. Select a launch target
      • hello_cmake to test CMake
      • hello_osg to test OpenSceneGraph
      • hello_qt to test Qt
    5. To launch debugger, click the "debug" icon in the status bar (bottom)
  • Visual Studio 2022 (Windows Windows)
    1. 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"
    1. Solution Explorer > Right click on project > Set as Startup Project
      • hello_cmake to test CMake
      • hello_osg to test OpenSceneGraph
      • hello_qt to test Qt
    2. Debug > Start Debugging

Clean

All output (CMake, compiler, linker, etc.) go to ./build directory. To clean up, delete ./build.

Create A CMake Project

See ~/repos/tron/src/hello/hello_cmake/CMakeLists.txt for a simple example.

  1. Create CMakeLists.txt in project directory under ~/repos/tron/src
  2. First line sets project name: project(<PROJECT_NAME>)
  3. Add project_common() to get settings that apply to all projects.
  4. Add source code to compile via add_executable
  5. Link libraries with target_link_libraries
  6. Add project directory to ~/repos/tron/CmakeLists.txt with add_subdirectory
  7. Generate build files in ./build
pwsh -Command 'cmake -S ~/repos/tron -B ~/repos/tron/build'

CMake Tips

Helpful Documentation

ALL_BUILD and ZERO_CHECK

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.

Copy files

Use configure_file to copy files. The copy happens during CMake build file generation. See src/sandbox/QTreeView for an example.

CMake Comment

CMake Comment Documentation

  • Everything after # is a comment
    • Like C++ //
  • Everthing in betwee #[[ and ]] is a comment
    • Like C++ /* ... */

Print Message/Variable

CMake's Message Documentation

message("Hello")
message(${PROJECT_NAME})

Show All CMake Variables

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()

Qt Tips

Qt tools for Visual Studio

OpenSceneGraph Tips

OpenSceneGraph GitHub Discussions

Where OpenSceneGraph Q&A happens today. This is active.

https://github.com/openscenegraph/OpenSceneGraph/discussions

OpenSceneGraph Google Group

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

OpenSceneGraph Books

Visual Studio Code

Environment

Required environment variables are embedded in vs code workspace. You do not need to modify your environment to run/debug apps within vs code.

To run CMake configure

This should happen automatically as needed (for example, when you click on Build).

To run manually: Ctrl+Shift+P > CMake: Configure

tron's People

Contributors

lenihan avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.