Skip to content

Commit

Permalink
Merge pull request #6 from rxdu/feature-xmotion_support
Browse files Browse the repository at this point in the history
Feature xmotion support
  • Loading branch information
rxdu authored Nov 25, 2024
2 parents 7170da8 + e582bd1 commit 315de3f
Show file tree
Hide file tree
Showing 99 changed files with 2,454 additions and 277 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,27 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-22.04, ubuntu-24.04 ]
os: [ ubuntu-20.04, ubuntu-22.04, ubuntu-24.04 ]
steps:
- uses: actions/checkout@v4
- name: Checkout submodules
run: git submodule update --init --recursive
- name: Install Dependencies
run: sudo apt-get update && sudo apt-get install -y libgl1-mesa-dev libglfw3-dev libcairo2-dev libopencv-dev
run: |
sudo apt-get update && sudo apt-get install -y libgl1-mesa-dev \
libglfw3-dev libcairo2-dev libopencv-dev libglm-dev
- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build
- name: Configure CMake
- name: Configure CMake (Ubuntu 20.04)
if: ${{ matrix.os == 'ubuntu-20.04' }}
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENABLE_AUTO_LAYOUT=OFF -DBUILD_TESTING=ON
- name: Configure CMake (Ubuntu 22.04 or 24.04)
if: ${{ matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-24.04' }}
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_TESTING=ON
- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
Expand Down
123 changes: 70 additions & 53 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,35 +1,48 @@
cmake_minimum_required(VERSION 3.16.0)

find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
message(STATUS "Found ccache")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
endif()
if (CCACHE_PROGRAM)
message(STATUS "Found ccache")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
endif ()

project(quickviz VERSION 0.2.0)

message(STATUS "------------------------------------------------")
if (PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME)
set(BUILD_AS_MODULE OFF)
message(STATUS "Build quickviz as a standalone project")
else ()
set(BUILD_AS_MODULE ON)
message(STATUS "Build quickviz as a module")
endif ()
message(STATUS "------------------------------------------------")

## Project Options
option(ENABLE_AUTO_LAYOUT "Enable autolayout" ON)
option(IMVIEW_WITH_GLAD "Integrate glad into imview" ON)
option(BUILD_QUICKVIZ_APP "Build quickviz app" OFF)
option(BUILD_TESTING "Build tests" ON)
option(QUICKVIZ_DEV_MODE "Development mode forces building tests" OFF)
option(STATIC_CHECK "Perform static check" OFF)
option(IMVIEW_WITH_GLAD "Integrate glad into imview" ON)

## Check if code compiles on x86_64 platform
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(BUILD_ON_X86_64 TRUE)
else()
set(BUILD_ON_X86_64 FALSE)
endif()
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(BUILD_ON_X86_64 TRUE)
else ()
set(BUILD_ON_X86_64 FALSE)
endif ()

## Generate symbols for IDE indexer
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

if(STATIC_CHECK)
find_program(CPPCHECK cppcheck)
if(CPPCHECK)
message(STATUS "Found cppcheck")
set(CMAKE_CXX_CPPCHECK cppcheck;--std=c++11;--enable=all)
endif()
endif()
if (STATIC_CHECK)
find_program(CPPCHECK cppcheck)
if (CPPCHECK)
message(STATUS "Found cppcheck")
set(CMAKE_CXX_CPPCHECK cppcheck;--std=c++11;--enable=all)
endif ()
endif ()

## Additional cmake module path
# include(${CMAKE_BINARY_DIR}/conan_paths.cmake)
Expand All @@ -44,67 +57,71 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)

## Chosse build type
set(default_build_type "Release")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif ()

## Use GNUInstallDirs to install libraries into correct locations on all platforms.
include(GNUInstallDirs)

## Put all binary files into /bin and libraries into /lib
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
if (QUICKVIZ_DEV_MODE)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
else ()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
endif ()

if(QUICKVIZ_DEV_MODE)
message(STATUS "quickviz development mode enabled")
endif()

# Build tests
if(PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME AND BUILD_TESTING)
enable_testing()
include(GoogleTest)
# add_subdirectory(tests)
message(STATUS "Tests will be built")
else()
message(STATUS "Tests will not be built")
if(ENABLE_AUTO_LAYOUT)
message(STATUS "Auto layout enabled")
endif()

# Build tests
if (((NOT BUILD_AS_MODULE) AND BUILD_TESTING) OR QUICKVIZ_DEV_MODE)
set(BUILD_TESTING ON)
enable_testing()
include(GoogleTest)
message(STATUS "quickviz tests will be built")
else ()
set(BUILD_TESTING OFF)
message(STATUS "quickviz test will not be built")
endif ()

## Add source directory
add_subdirectory(src)

#add_library(quickviz INTERFACE)
#target_link_libraries(quickviz INTERFACE imcore imview cvdraw)

## Installation setup
message(STATUS "Project will be installed to ${CMAKE_INSTALL_PREFIX} with 'make install'")

# Offer the user the choice of overriding the installation directories
set(INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH "Installation directory for libraries")
set(INSTALL_BINDIR ${CMAKE_INSTALL_BINDIR} CACHE PATH "Installation directory for executables")
set(INSTALL_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH "Installation directory for header files")
if(WIN32 AND NOT CYGWIN)
set(DEF_INSTALL_CMAKEDIR CMake)
else()
set(DEF_INSTALL_CMAKEDIR share/cmake/${PROJECT_NAME})
endif()
if (WIN32 AND NOT CYGWIN)
set(DEF_INSTALL_CMAKEDIR CMake)
else ()
set(DEF_INSTALL_CMAKEDIR share/cmake/${PROJECT_NAME})
endif ()
set(INSTALL_CMAKEDIR ${DEF_INSTALL_CMAKEDIR} CACHE PATH "Installation directory for CMake files")

# print installation path to user
foreach(p LIB BIN INCLUDE CMAKE)
file(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${INSTALL_${p}DIR} _path)
message(STATUS "Installation path for ${p}: ${_path}")
unset(_path)
endforeach()

# targets to install
install(TARGETS quickviz
EXPORT quickvizTargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include)
foreach (p LIB BIN INCLUDE CMAKE)
file(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${INSTALL_${p}DIR} _path)
message(STATUS "Installation path for ${p}: ${_path}")
unset(_path)
endforeach ()

# targets to install defined in each module

# export target configuration
include(CMakePackageConfigHelpers)
Expand All @@ -120,8 +137,8 @@ install(EXPORT quickvizTargets

configure_file(cmake/quickvizConfig.cmake.in quickvizConfig.cmake @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/quickvizConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/quickvizConfigVersion.cmake"
DESTINATION lib/cmake/quickviz)
"${CMAKE_CURRENT_BINARY_DIR}/quickvizConfigVersion.cmake"
DESTINATION lib/cmake/quickviz)

# Packaging support
set(CPACK_PACKAGE_NAME "quickviz")
Expand All @@ -136,7 +153,7 @@ set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")

set(CPACK_GENERATOR "DEB")
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Ruixiang Du")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Ruixiang Du")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libgl1-mesa-dev, libglfw3-dev, libcairo2-dev")
set(CPACK_SOURCE_IGNORE_FILES .git dist .*build.* \\\\.DS_Store)
include(CPack)
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ imview library in your own project, it's recommended to read this design documen

## Build

The code in this repository should build on any recent linux distributions with a compiler supporting C++11/14.
The code in this repository should build on any recent linux distributions with a compiler supporting C++11/14/17. Note
that the yoga library for layout management requires certain C++20 features, and you will need to disable automatic
layout feature if you are using an older compiler (such as the gcc that comes with Ubuntu 20.04 or older).

**Setup toolchain**

Expand Down
6 changes: 6 additions & 0 deletions data/glsl/fragment_shader.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#version 330 core
out vec4 FragColor;
void main()
{
FragColor = vec4(0.2, 0.5, 0.8, 1.0);
}
6 changes: 6 additions & 0 deletions data/glsl/vertex_shader.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#version 330 core
layout (location = 0) in vec3 aPos;
void main()
{
gl_Position = vec4(aPos, 1.0);
}
Binary file added docs/opengl/opengl_coordinate_frames.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/opengl/orthographic_projection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/opengl/perspective_projection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/quickviz-v0.1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ endif ()
add_subdirectory(third_party)

# applications
add_subdirectory(app)
if (ENABLE_AUTO_LAYOUT)
add_subdirectory(app)
endif ()
33 changes: 22 additions & 11 deletions src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
add_executable(quickviz main.cpp
# components
quickviz_application.cpp
# panels
panels/main_docking_panel.cpp
panels/config_panel.cpp
panels/scene_panel.cpp
panels/config_panel.cpp
panels/console_panel.cpp)
target_link_libraries(quickviz PRIVATE imview)
target_include_directories(quickviz PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
if (BUILD_QUICKVIZ_APP)
message(STATUS "Build quickviz application")
add_executable(quickviz main.cpp
# components
quickviz_application.cpp
component/log_processor.cpp
# panels
panels/menu_bar.cpp
panels/main_docking_panel.cpp
panels/scene_panel.cpp
panels/config_panel.cpp
panels/console_panel.cpp)
target_link_libraries(quickviz PRIVATE imview)
target_include_directories(quickviz PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})

install(TARGETS quickviz
EXPORT quickvizTargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include)
endif ()
Loading

0 comments on commit 315de3f

Please sign in to comment.