diff --git a/CMakeLists.txt b/CMakeLists.txt index 22de931d7a1da0684529c4730f91f3313feeaa0f..2c51f8dabe128a021cc18e825e90d2d4948817de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,7 +82,8 @@ set_property(TARGET shadertoy PROPERTY CXX_STANDARD 14) # Include directories for install set_property(TARGET shadertoy APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<BUILD_INTERFACE:${INCLUDE_DIR}/shadertoy> - $<INSTALL_INTERFACE:include/shadertoy>) + $<INSTALL_INTERFACE:include/shadertoy> + $<INSTALL_INTERFACE:${Boost_INCLUDE_DIR}>) # Precompiled header optimization set_target_properties(shadertoy PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT ${INCLUDE_DIR}/stdafx.hpp) @@ -102,6 +103,8 @@ install(EXPORT shadertoy DESTINATION ${CMAKE_INSTALL_DATADIR}/shadertoy) install(FILES shadertoy-config.cmake DESTINATION ${CMAKE_INSTALL_DATADIR}/shadertoy) +install(DIRECTORY examples + DESTINATION ${CMAKE_INSTALL_DATADIR}/shadertoy) file(GLOB SHADERTOY_HEADERS ${INCLUDE_DIR}/shadertoy/*.hpp) set(SHADERTOY_HEADERS ${SHADERTOY_HEADERS} diff --git a/debian/libshadertoy-dev.install b/debian/libshadertoy-dev.install index f61215a8f82981bf96612a57a5c941e62b76717f..e54bb63880b74f283db57a608c7d6830b454c412 100644 --- a/debian/libshadertoy-dev.install +++ b/debian/libshadertoy-dev.install @@ -1,2 +1,3 @@ usr/include/* +usr/share/shadertoy/* usr/share/doc/* \ No newline at end of file diff --git a/debian/rules b/debian/rules index 98197305804fd108c105d5d55082d6c19efc0e0f..30c5417425a6c6d00ebf64203de52f8e904b9073 100755 --- a/debian/rules +++ b/debian/rules @@ -24,3 +24,5 @@ override_dh_auto_configure: dh_auto_configure -- -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) \ -DCMAKE_BUILD_TYPE=Release +override_dh_auto_clean: + rm -rf obj-$(DEB_HOST_MULTIARCH)/* diff --git a/examples/00-build/CMakeLists.txt b/examples/00-build/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b9ce5c8ee47a2e4350f6890da2af795725dbfc3 --- /dev/null +++ b/examples/00-build/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 2.8) + +project(00-build) +include(FindPkgConfig) + +# GL libraries +find_package(OpenGL REQUIRED) +find_package(GLEW REQUIRED) +pkg_search_module(glfw3 glfw3) + +# libshadertoy +find_package(shadertoy REQUIRED) + +include_directories( + ${OPENGL_INCLUDE_DIRS} + ${GLEW_INCLUDE_DIRS} + ${glfw3_INCLUDE_DIRS} + ${shadertoy_INCLUDE_DIRS}) + +add_executable(example00-build + ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp) + +target_link_libraries(example00-build + ${OPENGL_LIBRARY} + ${GLEW_LIBRARIES} + ${glfw3_LIBRARIES} + ${shadertoy_LIBRARIES}) diff --git a/examples/00-build/main.cpp b/examples/00-build/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8a3977b86a986fad0470361a9946d73373682e4e --- /dev/null +++ b/examples/00-build/main.cpp @@ -0,0 +1,55 @@ +#include <GL/glew.h> +#include <GLFW/glfw3.h> +#include <oglplus/all.hpp> + +#include <shadertoy/Shadertoy.hpp> + +int main(int argc, char *argv[]) +{ + int code = 0; + + shadertoy::ContextConfig contextConfig; + contextConfig.width = 640; + contextConfig.height = 480; + contextConfig.targetFramerate = 60.0; + + if (!glfwInit()) + { + std::cerr << "Failed to initialize glfw" << std::endl; + return 1; + } + + // Initialize window + GLFWwindow *window = glfwCreateWindow(contextConfig.width, + contextConfig.height, + "libshadertoy example 00-build", + nullptr, + nullptr); + + if (!window) + { + std::cerr << "Failed to create glfw window" << std::endl; + code = 1; + } + else + { + glfwMakeContextCurrent(window); + + // Initialize GLEW + if (glewInit() != GLEW_OK) + { + std::cerr << "Failed to initialize glew" << std::endl; + code = 1; + } + else + { + shadertoy::RenderContext context(contextConfig); + std::cout << "Created context based on config" << std::endl; + } + + glfwDestroyWindow(window); + } + + glfwTerminate(); + return code; +} \ No newline at end of file diff --git a/include/shadertoy/UniformState.hpp b/include/shadertoy/UniformState.hpp index 74861b7907d7fcb30ad1ef2925da4c39069df84c..6e9a089c0f2910bcb88e5f9a5e2156b079ce55fa 100644 --- a/include/shadertoy/UniformState.hpp +++ b/include/shadertoy/UniformState.hpp @@ -1,6 +1,12 @@ #ifndef _SHADERTOY_UNIFORM_STATE_HPP_ #define _SHADERTOY_UNIFORM_STATE_HPP_ +#include <boost/variant.hpp> +#include <boost/archive/xml_oarchive.hpp> +#include <boost/archive/xml_iarchive.hpp> +#include <boost/serialization/nvp.hpp> +#include <boost/serialization/array.hpp> + #include "shadertoy/pre.hpp" #include "shadertoy/Misc.hpp" diff --git a/include/shadertoy/pre.hpp b/include/shadertoy/pre.hpp index 4089cd0ceac0fe6999f86d2c04c47095f773a8cd..ff6d4b676e0dfc23a30269788373f4fe85224ae5 100644 --- a/include/shadertoy/pre.hpp +++ b/include/shadertoy/pre.hpp @@ -3,6 +3,9 @@ #include "shadertoy/config.hpp" +#include <oglplus/all.hpp> +#include <boost/filesystem.hpp> + namespace shadertoy { struct InputConfig; diff --git a/shadertoy-config.cmake b/shadertoy-config.cmake index dccff455b2365ede2155a3864b9206e963f37ab2..8ceeaef87285f5b6f7228c702019472960c88fff 100644 --- a/shadertoy-config.cmake +++ b/shadertoy-config.cmake @@ -2,3 +2,17 @@ get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) include(${SELF_DIR}/shadertoy.cmake) + +# Internal config +get_target_property(shadertoy_INCLUDE_DIR shadertoy INTERFACE_INCLUDE_DIRECTORIES) +set(shadertoy_LIBRARY shadertoy) + +include(FindPackageHandleStandardArgs) +# handle QUIETLY and REQUIRED +find_package_handle_standard_args(shadertoy DEFAULT_MSG + shadertoy_INCLUDE_DIR shadertoy_LIBRARY) + +mark_as_advanced(shadertoy_INCLUDE_DIR shadertoy_LIBRARY) +# Set config +set(shadertoy_LIBRARIES ${shadertoy_LIBRARY}) +set(shadertoy_INCLUDE_DIRS ${shadertoy_INCLUDE_DIR})