From f42d61192a9400c6d0154a7c3c3cea3668324050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Mon, 18 Apr 2022 14:17:21 +0200 Subject: [PATCH] Add preview rendering skeleton --- CMakeLists.txt | 16 +++++++++++++++- plugins/CMakeLists.txt | 1 + plugins/plugin-example/CMakeLists.txt | 2 +- preview-rendering/CMakeLists.txt | 7 +++++++ preview-rendering/src/preview-rendering.c | 4 ++++ test/CMakeLists.txt | 2 +- 6 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 preview-rendering/CMakeLists.txt create mode 100644 preview-rendering/src/preview-rendering.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a7d30a..818be16 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,7 @@ +if (POLICY CMP0048) + cmake_policy(SET CMP0048 NEW) +endif (POLICY CMP0048) + project(gds-render LANGUAGES C) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) @@ -24,7 +28,7 @@ if(NOT WIN32) set(BoldWhite "${Esc}[1;37m") endif() -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.0) find_package(PkgConfig REQUIRED) pkg_search_module(GLIB REQUIRED glib-2.0) pkg_check_modules(GTK3 REQUIRED gtk+-3.0) @@ -81,6 +85,12 @@ set(FORT_ENABLE_TESTING OFF CACHE INTERNAL "") add_subdirectory(3rdparty/libfort) +if(OPENGL_PREVIEW) + message("${Green}OpenGL preview activated${ColorReset}") + add_definitions(-DGDS_RENDER_OPGENGL_PREVIEW) + add_subdirectory(preview-rendering) +endif(OPENGL_PREVIEW) + link_directories(${GLIB_LINK_DIRS} ${GTK3_LINK_DIRS} ${CAIRO_LINK_DIRS}) add_definitions(${GLIB2_CFLAGS_OTHER}) @@ -88,6 +98,10 @@ add_executable(${PROJECT_NAME} ${SOURCE} ${SOURCE_GENERATED}) add_dependencies(${PROJECT_NAME} glib-resources) add_dependencies(${PROJECT_NAME} version) add_dependencies(${PROJECT_NAME} translations) +if(OPENGL_PREVIEW) + add_dependencies(${PROJECT_NAME} opengl-preview) + target_link_libraries(${PROJECT_NAME} opengl-preview) +endif(OPENGL_PREVIEW) install (TARGETS ${PROJECT_NAME} RUNTIME diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 5064828..5e4d721 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -1,2 +1,3 @@ add_subdirectory(plugin-example) add_custom_target(plugins DEPENDS pluginexample) +cmake_minimum_required(VERSION 3.0) diff --git a/plugins/plugin-example/CMakeLists.txt b/plugins/plugin-example/CMakeLists.txt index 40637e9..f79930c 100644 --- a/plugins/plugin-example/CMakeLists.txt +++ b/plugins/plugin-example/CMakeLists.txt @@ -1,5 +1,5 @@ project(pluginexample) -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.0) find_package(PkgConfig REQUIRED) pkg_search_module(PYTHON REQUIRED python3) diff --git a/preview-rendering/CMakeLists.txt b/preview-rendering/CMakeLists.txt new file mode 100644 index 0000000..a67e8ab --- /dev/null +++ b/preview-rendering/CMakeLists.txt @@ -0,0 +1,7 @@ +project(opengl-preview) +cmake_minimum_required(VERSION 3.0) + +aux_source_directory("src" SRCS) + +add_library(${PROJECT_NAME} STATIC ${SRCS}) +target_include_directories(${PROJECT_NAME} PUBLIC "include") diff --git a/preview-rendering/src/preview-rendering.c b/preview-rendering/src/preview-rendering.c new file mode 100644 index 0000000..816849b --- /dev/null +++ b/preview-rendering/src/preview-rendering.c @@ -0,0 +1,4 @@ +int foobar(void) +{ + return 42; +} diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b4c871c..03323bf 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,4 +1,5 @@ project(gds-render-test) +cmake_minimum_required(VERSION 3.0) add_custom_target(test "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}" "-r compact" "-s" DEPENDS ${PROJECT_NAME}) @@ -22,7 +23,6 @@ if(NOT WIN32) set(BoldWhite "${Esc}[1;37m") endif() -cmake_minimum_required(VERSION 2.8) find_package(PkgConfig REQUIRED) include_directories("${CMAKE_CURRENT_SOURCE_DIR}/catch-framework")