diff --git a/.gitignore b/.gitignore index 3690599..3834a7f 100644 --- a/.gitignore +++ b/.gitignore @@ -49,6 +49,8 @@ vendors/drogon/trantor/TrantorConfigVersion.cmake vendors/drogon/trantor/exports/ vendors/database/ postgresql-prefix/ +CPM_modules/ +_deps/ # https://www.gnu.org/software/libtool/ diff --git a/CMakeLists.txt b/CMakeLists.txt index ef40eef..b4dc6ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,10 +39,12 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON) -# add CPM for C +# add CPM Deps. for C +# Note: only packages that have a CMakeLists.txt.. include(vendors/cmake/CPM_0.38.7.cmake) #CPMAddPackage("gh:postgres/postgres#7.1.3") +#CPMAddPackage("gh:nlohmann/json@3.10.5") # This is your project statement. You should always list languages; # Listing the version is nice here since it sets lots of useful variables @@ -52,6 +54,9 @@ project( VERSION 1.0.0 ) +# Adding something we can run - Output name matches target name +add_executable(DrogonCMS src/base.c) + #=============================================================================== # Setting compilation flags for various compilers and build types: #=============================================================================== @@ -110,35 +115,45 @@ if(NOT CMAKE_BUILD_TYPE) FORCE) endif() -# Find packages go here. +# Find PkgConfig. find_package(PkgConfig REQUIRED) -find_package(PostgreSQL REQUIRED) pkg_check_modules(GTK4 REQUIRED gtk4>=4.0) message("GTK4 include dir: ${GTK4_INCLUDE_DIRS}") message("GTK4 libraries: ${GTK4_LIBRARY_DIRS}") -message("GTK4 Other CFlags: ${GTK4_CFLAGS_OTHER}") +message("GTK4 other Cflags: ${GTK4_CFLAGS_OTHER}") pkg_check_modules(ADW REQUIRED libadwaita-1>=1.3.5) message("ADW include dir: ${ADW_INCLUDE_DIRS}") message("ADW libraries: ${ADW_LIBRARY_DIRS}") -message("ADW Other CFlags: ${ADW_CFLAGS_OTHER}") +message("ADW other Cflags: ${ADW_CFLAGS_OTHER}") #pkg_check_modules(SSL REQUIRED openssl>=3.1.2) #message("SSL libraries: ${SSL_LIBRARY_DIRS}") - #pkg_check_modules(SSL REQUIRED zlib>=1.3) +# Make use of PostgreSQL if FOUND, else use SQLite3 +find_package (PostgreSQL) +if (PostgreSQL_FOUND) + message("POSTGRESQL include dir: ${PostgreSQL_INCLUDE_DIRS}") + message("POSTGRESQL libraries: ${PostgreSQL_LIBRARIES}") + include_directories(${PostgreSQL_INCLUDE_DIRS} ${PostgreSQL_SERVER_INCLUDE_DIRS}) + target_link_libraries (${PROJECT_NAME} PUBLIC ${PostgreSQL_LIBRARIES}) + +#pkg_check_modules(SQLite3 REQUIRED sqlite3>=3.43.1) +elseif (SQLITE3_FOUND) + find_package (SQLite3) + message("SQLITE3 include dir: ${SQLITE3_INCLUDE_DIRS}") + message("SQLITE3 libraries: ${SQLITE3_LIBRARIES}") + include_directories(${SQLITE3_INCLUDE_DIRS}) + target_link_libraries (${PROJECT_NAME} PUBLIC ${SQLITE3_LIBRARIES}) +endif (PostgreSQL_FOUND) # Setup CMake to use GTK+, tell the compiler where to look for headers # and to the linker where to look for libraries -include_directories(${GTK4_INCLUDE_DIRS} ${ADW_INCLUDE_DIRS} ${PostgreSQL_INCLUDE_DIRS} ${PostgreSQL_SERVER_INCLUDE_DIRS}) +include_directories(${GTK4_INCLUDE_DIRS} ${ADW_INCLUDE_DIRS}) link_directories(${GTK4_LIBRARY_DIRS} ${ADW_LIBRARY_DIRS}) add_definitions(${GTK4_CFLAGS_OTHER} ${ADW_CFLAGS_OTHER}) -# Adding something we can run - Output name matches target name -add_executable(DrogonCMS src/base.c) -#add_executable(PG_Store vendors/postgresql-db/main.cc) - # Include drogon source code locally add_subdirectory(vendors/api-server/) add_subdirectory(vendors/simple-reverse-proxy/) @@ -153,16 +168,11 @@ add_subdirectory(vendors/simple-reverse-proxy/) # Make sure you link your targets with this command. It can also link libraries and # even flags, so linking a target that does not exist will not give a configure-time error. target_include_directories(${PROJECT_NAME} PUBLIC ${GTK4_LIBRARIES} ${ADW_LIBRARIES}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${GTK4_LIBRARIES} ${ADW_LIBRARIES} PostgreSQL::PostgreSQL) +target_link_libraries(${PROJECT_NAME} PRIVATE ${GTK4_LIBRARIES} ${ADW_LIBRARIES}) # Target Compile Options target_compile_options(${PROJECT_NAME} PRIVATE ${WARNING_LEVELS_GCC} $<$:${WARNING_LEVELS_GCC_DEBUG}>) -# This part is so the Modern CMake book can verify this example builds. For your code, -# you'll probably want tests too -enable_testing() -#add_test(NAME MyExample COMMAND MyExample) - #=============================================================================== # Package generation: #=============================================================================== diff --git a/src/base.c b/src/base.c index b3d3917..8c8e9ff 100644 --- a/src/base.c +++ b/src/base.c @@ -34,7 +34,6 @@ #include #include #include -/*#include */ /* Static Variables diff --git a/src/ui/admin-dashboard.ui b/src/ui/admin-dashboard.ui index 07876fb..ae58bb3 100644 --- a/src/ui/admin-dashboard.ui +++ b/src/ui/admin-dashboard.ui @@ -1,6 +1,7 @@ - + - + - + - + - + - +