drogonCMS-cmake into main branch that replaces make plus other things #1
137
CMakeLists.txt
Normal file
137
CMakeLists.txt
Normal file
@ -0,0 +1,137 @@
|
||||
# This is a Drogon Content Management System(CMS) built on GTK4.
|
||||
# Copyright (C) 2024-PRESENT SHARPETRONICS, LLC
|
||||
# Copyright (C) 2024-PRESENT ODINZU WENKI(CHARLES)
|
||||
|
||||
# This is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# Under Section 7 of GPL version 3, you are granted additional
|
||||
# permissions described in the GCC Runtime Library Exception, version
|
||||
# 3.1, as published by the Free Software Foundation.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# this program; see the files LICENSE and LICENSE_EXCEPTION respectively.
|
||||
# If not, see <http://www.gnu.org/licenses/>.
|
||||
#===============================================================================
|
||||
# AUTHORED DATE: 01.14.2024
|
||||
|
||||
# Almost all CMake files should start with this
|
||||
# You should always specify a range with the newest
|
||||
# and oldest tested versions of CMake. This will ensure
|
||||
# you pick up the best policies.
|
||||
cmake_minimum_required(VERSION 3.1...3.28)
|
||||
|
||||
# This is your project statement. You should always list languages;
|
||||
# Listing the version is nice here since it sets lots of useful variables
|
||||
# we removed LANGUAGES C from project to allow for automatic compiler/linker checks; we will use C and C++ libraries for this project.
|
||||
project(
|
||||
DrogonCMS
|
||||
VERSION 1.0
|
||||
LANGUAGES C CXX)
|
||||
|
||||
# Adding something we can run - Output name matches target name
|
||||
add_executable(DrogonCMS src/base.c)
|
||||
|
||||
# If you set any CMAKE_ variables, that can go here.
|
||||
# (But usually don't do this, except maybe for C++ standard)
|
||||
set(CMAKE_PROJECT_DESCRIPTION "A GTK / Drogon CMS")
|
||||
set(CMAKE_PROJECT_HOMEPAGE_URL "https://github.com/odinzu/drogoncms")
|
||||
|
||||
#===============================================================================
|
||||
# Setting compilation flags for various compilers and build types:
|
||||
#===============================================================================
|
||||
|
||||
# Print system, compiler CMake ID, version and path:
|
||||
#message(STATUS "System: ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR}")
|
||||
#message(STATUS "Compiler: ${CMAKE_Fortran_COMPILER_ID} ${CMAKE_Fortran_COMPILER_VERSION} ${CMAKE_Fortran_COMPILER}")
|
||||
#message(STATUS "Build type is: ${CMAKE_BUILD_TYPE}")
|
||||
|
||||
set(CMAKE_C_FLAGS "gtk4")
|
||||
|
||||
#===============================================================================
|
||||
# Default build type is release
|
||||
# Uncomment this to debug or use "cmake -D CMAKE_BUILD_TYPE=debug .."
|
||||
#===============================================================================
|
||||
# set(CMAKE_BUILD_TYPE debug)
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE release)
|
||||
endif()
|
||||
|
||||
# Find packages go here.
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(GTK4 REQUIRED IMPORTED_TARGET gtk4)
|
||||
pkg_check_modules(ADW REQUIRED IMPORTED_TARGET libadwaita-1)
|
||||
|
||||
# You should usually split this into folders, but this is a simple example
|
||||
|
||||
# This is a "default" library, and will match the *** variable setting.
|
||||
# Other common choices are STATIC, SHARED, and MODULE
|
||||
# Including header files here helps IDEs but is not required.
|
||||
# Output libname matches target name, with the usual extensions on your system
|
||||
#add_library(MyLibExample simple_lib.cpp simple_lib.hpp)
|
||||
|
||||
# Link each target with other targets or add options, etc.
|
||||
|
||||
# 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_link_libraries(DrogonCMS PRIVATE PkgConfig::GTK4)
|
||||
target_link_libraries(DrogonCMS PRIVATE PkgConfig::ADW)
|
||||
## [main]
|
||||
|
||||
# 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:
|
||||
#===============================================================================
|
||||
#set(CPACK_PACKAGE_CHECKSUM SHA256)
|
||||
#set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
|
||||
#set(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README.md")
|
||||
#set(CPACK_GENERATOR "TGZ")
|
||||
#set(CPACK_SOURCE_GENERATOR "TGZ")
|
||||
#include(CPack)
|
||||
|
||||
#===============================================================================
|
||||
# Add subdirectories to build:
|
||||
#===============================================================================
|
||||
add_subdirectory(src)
|
||||
|
||||
###############################################################################
|
||||
## PACKAGING ##################################################################
|
||||
###############################################################################
|
||||
|
||||
# all install commands get the same destination. this allows us to use paths
|
||||
# relative to the executable.
|
||||
#install(TARGETS example DESTINATION example_destination)
|
||||
# this is basically a repeat of the file copy instruction that copies the
|
||||
# resources in the build directory, but here we tell CMake that we want it
|
||||
# in the package
|
||||
#install(DIRECTORY resources DESTINATION example_destination)
|
||||
|
||||
#set(CPACK_PACKAGE_CHECKSUM SHA256)
|
||||
#set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
|
||||
#set(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README.md")
|
||||
#set(CPACK_GENERATOR "TGZ")
|
||||
#set(CPACK_SOURCE_GENERATOR "TGZ")
|
||||
|
||||
# now comes everything we need, to create a package
|
||||
# there are a lot more variables you can set, and some
|
||||
# you need to set for some package types, but we want to
|
||||
# be minimal here
|
||||
#set(CPACK_PACKAGE_NAME "MyExample")
|
||||
#set(CPACK_PACKAGE_VERSION "1.0.0")
|
||||
|
||||
# we don't want to split our program up into several things
|
||||
#set(CPACK_MONOLITHIC_INSTALL 1)
|
||||
|
||||
# This must be last
|
||||
#include(CPack)
|
16
Makefile.am
16
Makefile.am
@ -1,16 +0,0 @@
|
||||
# TODO: organize files more
|
||||
|
||||
# reduce warnings/errors for subdirectory objects
|
||||
AUTOMAKE_OPTIONS = subdir-objects
|
||||
|
||||
# the name of the binary file
|
||||
bin_PROGRAMS = drogon_dashboard
|
||||
|
||||
# Uses shell pkg-config CLI to find and include required libs
|
||||
AM_CFLAGS = $(shell pkg-config --cflags gtk4)
|
||||
LIBS = $(shell pkg-config --libs libadwaita-1 gtk4)
|
||||
|
||||
# various *.cpp and *.hpp files for the root project; the '\' implies a *newline*
|
||||
drogon_dashboard_SOURCES = \
|
||||
src/base.c
|
||||
|
24
README.md
24
README.md
@ -1,4 +1,4 @@
|
||||
## A Drogon Dashboard built with C, Drogon, GNU Autotools, Adwaita and Gtk4.
|
||||
## A Drogon Dashboard built with C, Drogon, CMake, Adwaita and Gtk4.
|
||||
This software creates a local/remote Drogon content management system (CMS) application.
|
||||
|
||||
### License
|
||||
@ -6,23 +6,19 @@
|
||||
|
||||
### Developer Environment Requirements
|
||||
* GCC (GNU C/C++ Compiler) 13.2.1
|
||||
* GNU Autotools
|
||||
* GNU Make 4.4.1
|
||||
* Pkg-Config 1.8.1
|
||||
* CMake >= 3.28
|
||||
* Pkg-Config >= 1.8.1
|
||||
* Gtk4 >= 4.0
|
||||
* Adwaita >= 1.3.5
|
||||
* *Optional* Cambalache >= 0.14 (Gtk4 Editor) [SEE REQUIREMENTS]
|
||||
* *Optional* Geany IDE
|
||||
* Basic CLI Experience
|
||||
|
||||
### Steps to build the Drogon Dashboard Application
|
||||
### Steps to build DrogonCMS from Source code
|
||||
|
||||
1. Run `autoreconf -vi`. **Tip:** Run this command each time you modify configure.ac
|
||||
2. Create a `build` directory and auto configure the app `cd build && ../configure`.
|
||||
3. Compile the app with `make`. **Tip:** Be certain you are in the **build** directory
|
||||
4. Run the app with `./drogon_dashboard`.
|
||||
5. *Optional:* Install the app to core system `make install`. **Tip:** Root permissions may be needed depending on where you --prefix the install directory
|
||||
6. *Optional:* `make dist` creates and packages the binaries for **distribution**.
|
||||
1. Run `cmake -DCMAKE_BUILD_TYPE=Release .`
|
||||
2. Then, to build the executable, we do `cmake --build .`
|
||||
3. Run the app with `./drogoncms`
|
||||
|
||||
## Development & Contributing
|
||||
|
||||
@ -48,7 +44,7 @@ This is what my build commands look like in Geany IDE.
|
||||
|
||||
## Authors
|
||||
|
||||
* SharpeTronics, Inc.
|
||||
* SharpeTronics, LLC
|
||||
* oDinZu WenKi
|
||||
|
||||
## Financial Support & Donations
|
||||
@ -61,6 +57,8 @@ oDinZu WenKi https://liberapay.com/oDinZu/
|
||||
* No commission fee
|
||||
* ~5% payment processing fee
|
||||
|
||||
Bitcoin Donations: [SEND INQUIRIES AT CHARLES@SHARPETRONICS.COM]
|
||||
|
||||
## Learning Resources
|
||||
* Adawaita Documentation https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/index.html
|
||||
* Cambalache https://gitlab.gnome.org/jpu/cambalache
|
||||
@ -72,6 +70,6 @@ oDinZu WenKi https://liberapay.com/oDinZu/
|
||||
* GObject Documentation https://docs.gtk.org/gobject/index.html
|
||||
* GTK 4 Demos https://gitlab.gnome.org/GNOME/gtk/-/tree/main/demos
|
||||
* GTK 4 Documentation https://docs.gtk.org/gtk4/
|
||||
* GNU Autotools Documentation https://www.gnu.org/software/automake/manual/automake.html#Autotools-Introduction
|
||||
* CMake Documentation https://cmake.org/cmake/help/book/mastering-cmake/index.html
|
||||
|
||||
Notice: We focus implementation with the C programming language and only add various features of C ++ code.
|
||||
|
33
configure.ac
33
configure.ac
@ -1,33 +0,0 @@
|
||||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ([2.71])
|
||||
AC_INIT([drogon_dashboard], [0.0.1], [odinzu@sharpetronics.com])
|
||||
|
||||
# When a package contains more than a few tests that define C preprocessor symbols, the command lines to pass -D options to the compiler can get quite long.
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_SRCDIR([src/base.c])
|
||||
|
||||
# Organize root project build-aux files
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
|
||||
# USED by automake to work with autoconf; Enables all warnings, plus foreign disables warnings/errors for mandatory files like README.md
|
||||
AM_INIT_AUTOMAKE([-Wall -Wdeprecated-declarations foreign])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
|
||||
# Checks for libraries.
|
||||
|
||||
# Checks for header files.
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
|
||||
# Checks for library functions.
|
||||
|
||||
# Checks for all the given modules, setting a variety of result variables in the calling scope.
|
||||
PKG_CHECK_MODULES([GTK4], [gtk4 >= 4.0])
|
||||
PKG_CHECK_MODULES([ADWAITA], [libadwaita-1 >= 1.3.5])
|
||||
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
Loading…
x
Reference in New Issue
Block a user