1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00

Fixed ui file inclusion (wait for #embed)

This commit is contained in:
Eduardo P. Gomez 2023-09-21 04:45:39 -03:00
parent dc8c1d600a
commit 46d21bf5c2
7 changed files with 15 additions and 12 deletions

View File

@ -37,7 +37,7 @@
], ],
"defines": [], "defines": [],
"compilerPath": "/usr/bin/gcc", "compilerPath": "/usr/bin/gcc",
"cppStandard": "gnu++20", "cppStandard": "gnu++23",
"intelliSenseMode": "linux-gcc-x64", "intelliSenseMode": "linux-gcc-x64",
"cStandard": "gnu23", "cStandard": "gnu23",
"compileCommands": "${workspaceFolder}/build/compile_commands.json" "compileCommands": "${workspaceFolder}/build/compile_commands.json"

View File

@ -54,6 +54,7 @@
"stdexcept": "cpp", "stdexcept": "cpp",
"streambuf": "cpp", "streambuf": "cpp",
"cinttypes": "cpp", "cinttypes": "cpp",
"typeinfo": "cpp" "typeinfo": "cpp",
"*.ui": "cpp"
} }
} }

View File

@ -24,6 +24,10 @@ set(CPACK_DEBIAN_PACKAGE_DEPENDS "libgtk-4-1")
include(CPack) include(CPack)
install(DIRECTORY ${CMAKE_BINARY_DIR}/root/ DESTINATION /) install(DIRECTORY ${CMAKE_BINARY_DIR}/root/ DESTINATION /)
#C/C++ flags
set(CMAKE_C_STANDARD 23)
set(CMAKE_CXX_STANDARD 23)
find_package(PkgConfig) find_package(PkgConfig)
pkg_check_modules(PC_ QUIET ) pkg_check_modules(PC_ QUIET )
set(_DEFINITIONS ${PC__CFLAGS_OTHER}) set(_DEFINITIONS ${PC__CFLAGS_OTHER})
@ -37,7 +41,6 @@ find_library(_LIBRARY NAMES
set(_LIBRARIES ${_LIBRARY} ) set(_LIBRARIES ${_LIBRARY} )
set(_INCLUDE_DIRS ${_INCLUDE_DIR} ) set(_INCLUDE_DIRS ${_INCLUDE_DIR} )
set(CMAKE_CXX_STANDARD 20)
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set _FOUND to TRUE # handle the QUIETLY and REQUIRED arguments and set _FOUND to TRUE

View File

@ -9,9 +9,4 @@
* it means that every time it's called * it means that every time it's called
* the file content will be included in the code * the file content will be included in the code
*/ */
#define GetFileContent(file_path) []() -> std::string { \ #define GetFileContent(file_path) #file_path
std::ifstream file(file_path); \
std::stringstream buffer; \
buffer << file.rdbuf(); \
return buffer.str(); \
}()

View File

@ -1,7 +1,8 @@
#pragma once #pragma once
#include <preprocessor/GetFileContent.hpp>
#include <string> #include <string>
namespace MainWindow { namespace MainWindow {
const std::string ui = GetFileContent(PROJECT_SOURCE_DIR "/tools/dxdiag/layout/MainWindow.ui"); const std::string ui =
#include "MainWindow.ui"
;
} }

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> R"XXX(<?xml version="1.0" encoding="UTF-8"?>
<interface> <interface>
<requires lib="gtk" version="4.0"/> <requires lib="gtk" version="4.0"/>
<object class="GtkWindow" id="main_window"> <object class="GtkWindow" id="main_window">
@ -398,3 +398,4 @@ If you know what area is causing the problem, click on the apropriate tab above.
</property> </property>
</object> </object>
</interface> </interface>
)XXX"

View File

@ -2,6 +2,8 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <unistd.h> #include <unistd.h>
#include <iostream> #include <iostream>
#include <fstream>
#include <sstream>
#include <string> #include <string>
#include <vector> #include <vector>
#include <cstdio> #include <cstdio>