Skip to content

Commit

Permalink
Merge branch 'master' into update_feather
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos authored Feb 10, 2024
2 parents e7a9904 + 0b277c2 commit 200cc6a
Show file tree
Hide file tree
Showing 12 changed files with 131 additions and 1,106 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: CI

on: [ push, pull_request ]

jobs:
build-and-test:

name: ${{ matrix.os }} (${{ matrix.configuration }})
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
configuration: [ Debug, Release ]
os: [ macos-latest, ubuntu-latest, windows-latest ]

steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
submodules: 'true'

- name: Setup MySQL
uses: ankane/setup-mysql@v1
if : startsWith(matrix.os, 'macos')

- name: Configure cmake
run: cmake -B${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{ matrix.configuration }}

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{ matrix.configuration }}
26 changes: 26 additions & 0 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Clang Format Diff

on: [ push, pull_request ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: install clang-format
run: sudo apt install clang-format

- name: check-diff
run: |
diff=`git-clang-format --diff HEAD^`
if ! [[ "$diff" = "no modified files to format" || "$diff" = "clang-format did not modify any files" ]]; then
echo "The diff you sent is not formatted correctly."
echo "The suggested format is"
echo "$diff"
exit 1
fi
37 changes: 19 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
cmake_minimum_required(VERSION 3.15)
project(feather)

#for mac
#SET(CMAKE_C_COMPILER "/usr/local/bin/gcc-8")
#SET(CMAKE_CXX_COMPILER "/usr/local/bin/g++-8")
#set(CMAKE_BUILD_TYPE Release)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
message(STATUS "CXX Standard: ${CMAKE_CXX_STANDARD}")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -std=c++20")
SET(ENABLE_MYSQL OFF)
SET(ENABLE_MYSQL ON)

SET(ENABLE_PG OFF)
SET(ENABLE_SQLITE3 ON)
SET(ENABLE_SQLITE3 OFF)

SET(ENABLE_GZIP OFF)

Expand Down Expand Up @@ -63,23 +59,28 @@ set(SOURCE_FILES
main.cpp
)

if (MSVC)
add_compile_options(/bigobj)
endif ()

if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcoroutines")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcoroutines -pthread -std=c++20")
#-ftree-slp-vectorize with coroutine cause link error. disable it util gcc fix.
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-tree-slp-vectorize")
endif()

add_subdirectory(ormpp)

add_executable(feather ${SOURCE_FILES})
add_executable(${PROJECT_NAME} ${SOURCE_FILES})

include_directories("cinatra/include" ${OPENSSL_INCLUDE_DIR})

target_link_libraries(feather ${Boost_LIBRARIES} uuid -lstdc++fs)

if (ENABLE_MYSQL)
target_link_libraries(feather ${MYSQL_LIBRARY})
target_include_directories(feather PRIVATE ${MYSQL_INCLUDE_DIR} ormpp)
target_link_libraries(${PROJECT_NAME} ${MYSQL_LIBRARY})
target_include_directories(${PROJECT_NAME} PRIVATE ${MYSQL_INCLUDE_DIR} ormpp)
if (MSVC AND CMAKE_BUILD_TYPE STREQUAL "Debug")
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/MD")
endif()
endif()

if (ENABLE_SQLITE3)
Expand All @@ -88,20 +89,20 @@ if (ENABLE_SQLITE3)
endif()

if (ENABLE_PG)
target_link_libraries(feather ${PGSQL_LIBRARY})
target_include_directories(feather PRIVATE ${PGSQL_INCLUDE_DIR} ormpp)
target_link_libraries(${PROJECT_NAME} ${PGSQL_LIBRARY})
target_include_directories(${PROJECT_NAME} PRIVATE ${PGSQL_INCLUDE_DIR} ormpp)
endif()

if (ENABLE_SSL)
target_link_libraries(feather ${OPENSSL_LIBRARIES} pthread -ldl)
target_link_libraries(${PROJECT_NAME} ${OPENSSL_LIBRARIES} pthread -ldl)
endif()

if (ENABLE_CLIENT_SSL)
target_link_libraries(feather ${OPENSSL_LIBRARIES} pthread -ldl)
target_link_libraries(${PROJECT_NAME} ${OPENSSL_LIBRARIES} pthread -ldl)
endif()

if (ENABLE_GZIP)
target_link_libraries(feather ${ZLIB_LIBRARIES})
target_link_libraries(${PROJECT_NAME} ${ZLIB_LIBRARIES})
endif()

install(TARGETS feather DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
12 changes: 3 additions & 9 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,11 @@ If you want to use SSL, you also need to install a SSL library. This is not nece
**Build**

```
git clone https://github.com/qicosmos/feather.git
git clone --recurse-submodules https://github.com/qicosmos/feather.git
git submodule update --init
cmake -B build
mkdir build
cd build
cmake ..
make -j
cmake --build build
```

# Example
Expand Down
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@

*Read this in other languages: [English](https://github.com/qicosmos/feather/blob/master/README.en.md), [简体中文](https://github.com/qicosmos/feather/blob/master/README.md)

[如何在archlinux上运行feather](https://github.com/qicosmos/feather/blob/master/docs/feather%20compile%20and%20run%20in%20marjaro_archlinux(author-SkyFire).md)

[如何在win10上运行feather](https://github.com/qicosmos/feather/blob/master/docs/window_build(author-tc).txt)

[如何在mac上运行feather](https://github.com/qicosmos/feather/blob/master/docs/feather%20Mac%E7%BC%96%E8%AF%91%E6%96%87%E6%A1%A3.md)

[如何在windows和linux上运行feather](https://github.com/qicosmos/feather/blob/master/docs/featehr%20%E4%BD%BF%E7%94%A8.txt)
[feather使用](https://github.com/qicosmos/feather/blob/master/docs/featehr%20%E4%BD%BF%E7%94%A8.md)

Feather是一个适合快速开发的modern c++ web框架,Feather的目标是让使用者以最小的精力和成本来开发一个web网站。

Expand Down
51 changes: 51 additions & 0 deletions docs/featehr 使用.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# feather使用说明

1. 安装依赖库

```text
mysql
```

2. 编译

```shell
git clone --recurse-submodules https://github.com/qicosmos/feather.git

cmake -B build

cmake --build build
```

3. 运行

* 创建运行时需要的目录结构

`feather`目录下执行(此处假设构建目录为`feather/build`):

```shell
mkdir runtime
cd runtime
cp -rvt . ../build/feather ../purecpp ../cfg
```

此时`runtime`目录下应该有文件(目录):

```text
cfg/ feather* purecpp/
```

* 修改配置文件(以下均相对于`runtime`目录)

配置文件为`cfg/feather.cfg`,修改其中的数据库用户名和密码为真实数据。

* 运行

`runtime`目录下执行:

```shell
./feather
```

* 访问

**注意**:在数据库无数据的时候无法看到页面,可以通过访问:`http://localhost:8080/sign_out_page`注册用户并发表一篇文章。这时其他页面就可以访问了。
34 changes: 0 additions & 34 deletions docs/featehr 使用.txt

This file was deleted.

Loading

0 comments on commit 200cc6a

Please sign in to comment.