find fcgi is a module now, a primitive readme
This commit is contained in:
parent
aae7873d67
commit
6909ba3138
@ -8,10 +8,10 @@ cmake_policy(SET CMP0076 NEW)
|
|||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
find_package(nlohmann_json REQUIRED)
|
find_package(nlohmann_json REQUIRED)
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(FCGI REQUIRED)
|
||||||
pkg_check_modules(FCGI fcgi)
|
|
||||||
|
|
||||||
add_executable(pica main.cpp)
|
add_executable(pica main.cpp)
|
||||||
target_include_directories(pica PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
target_include_directories(pica PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
@ -22,8 +22,8 @@ add_subdirectory(response)
|
|||||||
add_subdirectory(stream)
|
add_subdirectory(stream)
|
||||||
|
|
||||||
target_link_libraries(pica PRIVATE
|
target_link_libraries(pica PRIVATE
|
||||||
fcgi
|
FCGI::FCGI
|
||||||
fcgi++
|
FCGI::FCGI++
|
||||||
nlohmann_json::nlohmann_json
|
nlohmann_json::nlohmann_json
|
||||||
)
|
)
|
||||||
|
|
||||||
|
60
README.md
Normal file
60
README.md
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
# Pica - Backend for Megpie budgeting app
|
||||||
|
|
||||||
|
... some description
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
- fcgi
|
||||||
|
- nlohmann_json
|
||||||
|
|
||||||
|
|
||||||
|
### Building
|
||||||
|
|
||||||
|
```
|
||||||
|
$ git clone https://git.macaw.me/blue/pica
|
||||||
|
$ cd pica
|
||||||
|
$ mkdir build
|
||||||
|
$ cd build
|
||||||
|
$ cmake ..
|
||||||
|
$ cmake --build .
|
||||||
|
```
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
#### Webserver
|
||||||
|
First you need a webserver. In this example I'm going to use apache.
|
||||||
|
|
||||||
|
Install apache from your package manager.
|
||||||
|
|
||||||
|
Create a file like this in apache config dir (in my case it's `/etc/httpd/conf/extra/fcgi-pica.conf`)
|
||||||
|
```
|
||||||
|
<Location /pica>
|
||||||
|
ProxyPass "unix:/run/pica/pica.sock|fcgi://localhost"
|
||||||
|
ProxyPassReverse "http://localhost"
|
||||||
|
</Location>
|
||||||
|
```
|
||||||
|
|
||||||
|
Incude this file from apache config file (in my case it's `/etc/httpd/conf/httpd.conf`)
|
||||||
|
```
|
||||||
|
Include conf/extra/fcgi-pica.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
Start apache
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo systemctl start httpd
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Creating a directory
|
||||||
|
Next you need to create a directory for pica socket file
|
||||||
|
```
|
||||||
|
# mkdir /run/pica
|
||||||
|
# chown <your user> /run/pica
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Running an app
|
||||||
|
At this stage we're redy to run an app
|
||||||
|
```
|
||||||
|
$ cd build
|
||||||
|
$ ./pica
|
||||||
|
```
|
28
cmake/FindFCGI.cmake
Normal file
28
cmake/FindFCGI.cmake
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
find_library(FCGI_LIBRARIES fcgi NAMES FCGI libfcgi)
|
||||||
|
find_library(FCGI++_LIBRARIES fcgi++ NAMES FCGI++ libfcgi++)
|
||||||
|
|
||||||
|
if (FCGI_LIBRARIES AND FCGI++_LIBRARIES)
|
||||||
|
set(FCGI_FOUND TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (FCGI_FOUND)
|
||||||
|
add_library(FCGI::FCGI SHARED IMPORTED)
|
||||||
|
set_target_properties(FCGI::FCGI PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${FCGI_LIBRARIES}"
|
||||||
|
INTERFACE_LINK_LIBRARIES "${FCGI_LIBRARIES}"
|
||||||
|
)
|
||||||
|
add_library(FCGI::FCGI++ SHARED IMPORTED)
|
||||||
|
set_target_properties(FCGI::FCGI++ PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${FCGI++_LIBRARIES}"
|
||||||
|
INTERFACE_LINK_LIBRARIES "${FCGI++_LIBRARIES}"
|
||||||
|
)
|
||||||
|
|
||||||
|
if (NOT FCGI_FIND_QUIETLY)
|
||||||
|
message(STATUS "Found FCGI library: ${FCGI_LIBRARIES}")
|
||||||
|
message(STATUS "Found FCGI++ library: ${FCGI++_LIBRARIES}")
|
||||||
|
endif ()
|
||||||
|
else ()
|
||||||
|
if (FCGI_FIND_REQUIRED)
|
||||||
|
message(FATAL_ERROR "Could NOT find FCGI development files")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
Loading…
Reference in New Issue
Block a user