Setting up CMake

This commit is contained in:
ganome 2025-01-30 22:21:42 -07:00
parent cfa53d4fc3
commit fcca15772c
Signed by untrusted user who does not match committer: Ganome
GPG Key ID: 944DE53336D81B83
6 changed files with 261118 additions and 5 deletions

9
CMakeLists.txt Normal file
View File

@ -0,0 +1,9 @@
cmake_minimum_requred(VERSION 3.30)
project(hardwareDB VERSION 0.0.1)
add_executable(hardwareDB src/main.cpp)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(${PROJECT} ${CMAKE_CURRENT_SOURCE_DIR}/include/sqlite3)

BIN
hardware.db Normal file

Binary file not shown.

41
hardware.sql Normal file
View File

@ -0,0 +1,41 @@
CREATE TABLE cpu (
id INTEGER PRIMARY KEY,
manufacturer TEXT DEFAULT "unknown manufacturer",
model TEXT NOT NULL UNIQUE,
releasedyear TEXT DEFAULT 2025,
bits TEXT DEFAULT "64 bit",
igpu BOOL DEFAULT FALSE,
igpusize TEXT DEFAULT "Unknown integrated Graphics",
cores TEXT DEFAULT "Unknown cores",
threads TEXT "Unknown threads",
l1cache TEXT DEFAULT "unknown l1cache",
l2cache TEXT DEFAULT "unknown l2cache",
l3cache TEXT DEFAULT "unknown l3cache",
pcielanes TEXT DEFAULT "unknown PCIE lanes",
mainclock TEXT DEFAULT "unknown main clock speed",
boostclock TEXT DEFAULT "unknown boost clock speed",
architecture TEXT DEFAULT "x86_64",
microcode TEXT DEFAULT "honeycomb UNKNOWN microcode",
kerneldriver TEXT DEFAULT "unknown kernel driver",
comment TEXT DEFAULT "no comment"
);
CREATE TABLE gpu (
id INTEGER PRIMARY KEY,
model TEXT NOT NULL UNIQUE,
mainclock TEXT DEFAULT "unknown main clock speed",
boostclock TEXT DEFAULT "unkown boost clock speed",
ram TEXT NOT NULL,
shadercores TEXT DEFAULT "unknown shader cores or N/A (AMD)"
);
INSERT INTO cpu(manufacturer, model, releasedyear, igpu, igpusize, cores, threads, l1cache, l2cache, l3cache, pcielanes, mainclock, boostclock, microcode, comment)
VALUES( 'AMD', '7800x3d', 2024, true, '512 Mb', 8, 16, '64Kb per core', '1Mb per core', '96Mb (shared)', 'Gen 5 @ 24 lanes', '4.2 Ghz', '5.0 Ghz', '0x0a601209 as of 30 Jan, 2025', 'Must update MB firmware before posting this CPU');
-- SELECT * from cpu WHERE model='7800x3d'; -- will return all fields which match that "model" - since model is UNIQUE; it will be 1 result
-- UPDATE cpu SET manufacturer = 'new manufacturer' WHERE model='CPUMODEL' -- This will update the manufacturer for that model - VERY IMPORTANT to have WHERE = or it will UPDATE THE ENTIRE TABLE!!!
-- DELETE FROM cpu WHERE model='CPUMODEL' - this will delte an entry in the table "cpu" that matches model - VERY IMPORT to have a WHERE here or it wipes the whole table!
-- INSERT INTO cpu(model, mainclock) VALUES ('CPUMODEL', '3.0 Ghz'); -- This will create the model (REQUIRED) and mainclock fields set.
-- ALTER TABLE cpu ADD COLUMN vendor TEXT; -- this would add a field to the CPU table called vendor
-- DROP TABLE cpu -- this would delete the table cpu

View File

@ -43,7 +43,6 @@ class Mobo: public Hardware {
class CPU: public Hardware { class CPU: public Hardware {
public: public:
std::map<std::string, std::string> HardwareSpecs = { std::map<std::string, std::string> HardwareSpecs = {
{"manufacturer", "The Gnomes part 2"}, {"manufacturer", "The Gnomes part 2"},
{"model", "Honey Bomb"}, {"model", "Honey Bomb"},

261044
sqlite3.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,22 +1,42 @@
#include <iostream> #include <iostream>
#include <stdio.h>
#include <sqlite/command.hpp>
#include <sqlite/result.hpp>
#include <string> #include <string>
#include "lists/hardware.h" #include "lists/hardware.h"
#include "lists/cpu.h" #include "lists/cpu.h"
#include "include/setcpu.h" #include "include/setcpu.h"
#include "include/sethardware.h" #include "include/sethardware.h"
#include <sqlite3.h>
// Begin testing of SQLite3
int createDB();
int createTable();
static int createDB(const char* s);
static int createTable(const char* s);
int main() { int main() {
// using namespace std; const char* dbfile = "hardware.db";
int counter= 0; sqlite3* hardwareDB;
createDB(dbfile);
// createTable(dbfile);
/* //Create the CPU classes from the cpulist file
int counter= 0;
auto cpus = genCPUclasses(); auto cpus = genCPUclasses();
for (CPU& cpu: cpus) { for (CPU& cpu: cpus) {
// cpus[counter].HardwareSpecs["model"] = "value"; // cpus[counter].HardwareSpecs["model"] = "value";
std::cout << cpu.HardwareSpecs["model"] << " loaded at index: " << counter << std::endl; std::cout << cpu.HardwareSpecs["model"] << " loaded at index: " << counter << std::endl;
counter++; counter++;
} }
*/
//Testing the new dictionaries //Testing the new dictionaries
// cout << "Lets try the setCPU function!\n"; // cout << "Lets try the setCPU function!\n";
// std::cout << "A7800x3d main clock speed is: " << A7800x3d->HardwareSpecs["mainclock"] << std::endl; // std::cout << "A7800x3d main clock speed is: " << A7800x3d->HardwareSpecs["mainclock"] << std::endl;