Skip to content
Snippets Groups Projects
Commit f54edbd2 authored by Tim Redick's avatar Tim Redick :robot:
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
.catkin_tools
.catkin_workspace
.vscode
build*
devel*
logs
\ No newline at end of file
/opt/ros/melodic/share/catkin/cmake/toplevel.cmake
\ No newline at end of file
cmake_minimum_required(VERSION 2.8.3)
project(gl3w_ros)
add_compile_options(-std=c++11)
#######################
## Find Dependencies ##
#######################
# find conan packages
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/v0.13/conan.cmake"
"${CMAKE_BINARY_DIR}/conan.cmake")
endif()
include(${CMAKE_BINARY_DIR}/conan.cmake)
conan_cmake_run(CONANFILE conanfile.txt
BUILD missing)
set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR} ${CMAKE_MODULE_PATH})
find_package(catkin REQUIRED COMPONENTS
roscpp)
find_package(gl3w REQUIRED)
find_package(glfw REQUIRED)
#############
## Package ##
#############
catkin_package(
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME}
CATKIN_DEPENDS roscpp)
###########
## Build ##
###########
add_library(${PROJECT_NAME})
target_sources(${PROJECT_NAME} PRIVATE
src/gl3w_ros.cpp)
target_include_directories(${PROJECT_NAME} PUBLIC
include)
target_link_libraries(${PROJECT_NAME} PRIVATE
gl3w::gl3w
glfw::glfw)
add_executable(${PROJECT_NAME}_node)
target_sources(${PROJECT_NAME}_node PRIVATE
src/gl3w_ros_node.cpp)
target_link_libraries(${PROJECT_NAME}_node PRIVATE
${PROJECT_NAME}
${catkin_LIBRARIES})
include_directories(${catkin_INCLUDE_DIRS})
#############
## Install ##
#############
# Mark executables and/or libraries for installation
# install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_node
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )
# # Mark cpp header files for installation
# install(DIRECTORY include/${PROJECT_NAME}/
# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
# FILES_MATCHING PATTERN "*.hpp"
# )
[requires]
gl3w/0.2@tuebel/testing
glfw/3.2.1@bincrafters/stable
[generators]
cmake_find_package
[options]
*:shared=True
\ No newline at end of file
#pragma once
namespace gl3w_ros
{
class Gl3wRos
{
public:
/*!
\returns EXIT_SUCCESS if gl3w has been found and a context could be created
*/
int test();
};
} // namespace gl3w_ros
\ No newline at end of file
<?xml version="1.0"?>
<package format="2">
<name>gl3w_ros</name>
<version>0.0.0</version>
<description>The gl3w_ros package</description>
<!-- One maintainer tag required, multiple allowed, one person per tag -->
<!-- Example: -->
<!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
<maintainer email="tim@todo.todo">tim</maintainer>
<!-- One license tag required, multiple allowed, one license per tag -->
<!-- Commonly used license strings: -->
<!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
<license>TODO</license>
<!-- Url tags are optional, but multiple are allowed, one per tag -->
<!-- Optional attribute type can be: website, bugtracker, or repository -->
<!-- Example: -->
<!-- <url type="website">http://wiki.ros.org/gl3w_ros</url> -->
<!-- Author tags are optional, multiple are allowed, one per tag -->
<!-- Authors do not have to be maintainers, but could be -->
<!-- Example: -->
<!-- <author email="jane.doe@example.com">Jane Doe</author> -->
<!-- The *depend tags are used to specify dependencies -->
<!-- Dependencies can be catkin packages or system dependencies -->
<!-- Examples: -->
<!-- Use depend as a shortcut for packages that are both build and exec dependencies -->
<!-- <depend>roscpp</depend> -->
<!-- Note that this is equivalent to the following: -->
<!-- <build_depend>roscpp</build_depend> -->
<!-- <exec_depend>roscpp</exec_depend> -->
<!-- Use build_depend for packages you need at compile time: -->
<!-- <build_depend>message_generation</build_depend> -->
<!-- Use build_export_depend for packages you need in order to build against this package: -->
<!-- <build_export_depend>message_generation</build_export_depend> -->
<!-- Use buildtool_depend for build tool packages: -->
<!-- <buildtool_depend>catkin</buildtool_depend> -->
<!-- Use exec_depend for packages you need at runtime: -->
<!-- <exec_depend>message_runtime</exec_depend> -->
<!-- Use test_depend for packages you need only for testing: -->
<!-- <test_depend>gtest</test_depend> -->
<!-- Use doc_depend for packages you need only for building documentation: -->
<!-- <doc_depend>doxygen</doc_depend> -->
<buildtool_depend>catkin</buildtool_depend>
<build_depend>roscpp</build_depend>
<build_export_depend>roscpp</build_export_depend>
<exec_depend>roscpp</exec_depend>
<!-- The export tag contains other, unspecified, tags -->
<export>
<!-- Other tools can request additional information be placed here -->
</export>
</package>
#include <gl3w_ros/gl3w_ros.hpp>
#include <GL/gl3w.h>
#include <GLFW/glfw3.h>
#include <iostream>
namespace gl3w_ros
{
int Gl3wRos::test()
{
int glfw_res = glfwInit();
if (glfw_res == GLFW_FALSE)
{
std::cout << "failed to init glfw"
<< "\n";
return EXIT_FAILURE;
}
else
{
std::cout << "succeeded to init glfw"
<< "\n";
}
// compability requirements
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
auto window = glfwCreateWindow(640, 480, "test_package", NULL, NULL);
if (!window)
{
std::cout << "failed to create glfw context\n";
return EXIT_FAILURE;
}
else
{
std::cout << "succeeded to create glfw context\n";
}
glfwMakeContextCurrent(window);
int success = gl3wInit();
if (gl3wInit())
{
std::cout << "failed to init gl3w " << success << "\n";
glfwDestroyWindow(window);
glfwTerminate();
return EXIT_FAILURE;
}
if (!gl3wIsSupported(4, 2))
{
std::cout << "succeeded to init gl3w\n";
glfwDestroyWindow(window);
glfwTerminate();
return EXIT_SUCCESS;
}
}
} // namespace gl3w_ros
\ No newline at end of file
#include <gl3w_ros/gl3w_ros.hpp>
#include <ros/ros.h>
/*!
Simple application that only prints if gl3w has been loaded
*/
int main(int argc, char **argv)
{
ros::init(argc, argv, "gl3w_ros_node");
ros::NodeHandle node_handle;
gl3w_ros::Gl3wRos gl_ros;
int success = gl_ros.test();
if(success == EXIT_SUCCESS){
ROS_INFO("Succeeded to load OpenGL");
}else{
ROS_ERROR("Failed to load OpenGL");
}
return success;
}
cmake_minimum_required(VERSION 2.8.3)
project(use_gl3w_ros)
add_compile_options(-std=c++11)
#######################
## Find Dependencies ##
#######################
find_package(catkin REQUIRED COMPONENTS
gl3w_ros)
#############
## Package ##
#############
catkin_package(
INCLUDE_DIRS include
LIBRARIES use_gl3w_ros
CATKIN_DEPENDS gl3w_ros)
###########
## Build ##
###########
include_directories(
include
${catkin_INCLUDE_DIRS})
add_library(${PROJECT_NAME}
src/use_gl3w_ros.cpp)
target_link_libraries(${PROJECT_NAME} PUBLIC
${CONAN_LIBS}
${catkin_LIBRARIES})
add_executable(${PROJECT_NAME}_node src/use_gl3w_ros_node.cpp)
target_link_libraries(${PROJECT_NAME}_node PRIVATE
${PROJECT_NAME})
#############
## Install ##
#############
# Mark executables and/or libraries for installation
install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_node
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
# Mark cpp header files for installation
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.hpp"
)
#pragma once
#include <gl3w_ros/gl3w_ros.hpp>
namespace use_gl3w_ros
{
class UseGl3wRos
{
public:
/*!
\returns EXIT_SUCCESS if gl3w has been found and a context could be created
*/
int test();
private:
gl3w_ros::Gl3wRos gl_ros;
};
} // namespace use_gl3w_ros
\ No newline at end of file
<?xml version="1.0"?>
<package format="2">
<name>use_gl3w_ros</name>
<version>0.0.0</version>
<description>The use_gl3w_ros package</description>
<!-- One maintainer tag required, multiple allowed, one person per tag -->
<!-- Example: -->
<!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
<maintainer email="tim@todo.todo">tim</maintainer>
<!-- One license tag required, multiple allowed, one license per tag -->
<!-- Commonly used license strings: -->
<!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
<license>TODO</license>
<!-- Url tags are optional, but multiple are allowed, one per tag -->
<!-- Optional attribute type can be: website, bugtracker, or repository -->
<!-- Example: -->
<!-- <url type="website">http://wiki.ros.org/gl3w_ros</url> -->
<!-- Author tags are optional, multiple are allowed, one per tag -->
<!-- Authors do not have to be maintainers, but could be -->
<!-- Example: -->
<!-- <author email="jane.doe@example.com">Jane Doe</author> -->
<!-- The *depend tags are used to specify dependencies -->
<!-- Dependencies can be catkin packages or system dependencies -->
<!-- Examples: -->
<!-- Use depend as a shortcut for packages that are both build and exec dependencies -->
<!-- <depend>roscpp</depend> -->
<!-- Note that this is equivalent to the following: -->
<!-- <build_depend>roscpp</build_depend> -->
<!-- <exec_depend>roscpp</exec_depend> -->
<!-- Use build_depend for packages you need at compile time: -->
<!-- <build_depend>message_generation</build_depend> -->
<!-- Use build_export_depend for packages you need in order to build against this package: -->
<!-- <build_export_depend>message_generation</build_export_depend> -->
<!-- Use buildtool_depend for build tool packages: -->
<!-- <buildtool_depend>catkin</buildtool_depend> -->
<!-- Use exec_depend for packages you need at runtime: -->
<!-- <exec_depend>message_runtime</exec_depend> -->
<!-- Use test_depend for packages you need only for testing: -->
<!-- <test_depend>gtest</test_depend> -->
<!-- Use doc_depend for packages you need only for building documentation: -->
<!-- <doc_depend>doxygen</doc_depend> -->
<buildtool_depend>catkin</buildtool_depend>
<depend>gl3w_ros</depend>
<!-- The export tag contains other, unspecified, tags -->
<export>
<!-- Other tools can request additional information be placed here -->
</export>
</package>
#include <use_gl3w_ros/use_gl3w_ros.hpp>
namespace use_gl3w_ros
{
int UseGl3wRos::test()
{
return gl_ros.test();
}
} // namespace gl3w_ros
\ No newline at end of file
#include <use_gl3w_ros/use_gl3w_ros.hpp>
#include <ros/ros.h>
/*!
Simple application that only prints if gl3w has been loaded
*/
int main(int argc, char **argv)
{
ros::init(argc, argv, "gl3w_ros_node");
ros::NodeHandle node_handle;
use_gl3w_ros::UseGl3wRos gl_ros;
int success = gl_ros.test();
if(success == EXIT_SUCCESS){
ROS_INFO("Succeeded to load OpenGL");
}else{
ROS_ERROR("Failed to load OpenGL");
}
return success;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment