Skip to content

Commit 7d532ef

Browse files
author
4l3x777
committed
first release.
1 parent 8ea63e9 commit 7d532ef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+62289
-34
lines changed

.github/workflows/release.yml

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: 'EHLIB'
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
upload-release:
10+
runs-on: ubuntu-latest
11+
needs: [build_linux, build_windows]
12+
steps:
13+
- uses: actions/checkout@v1
14+
15+
- name: Create Release
16+
id: create_release
17+
uses: actions/create-release@v1
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
with:
21+
tag_name: ${{ github.run_number }}
22+
release_name: ehlib-0.0.${{ github.run_number }}
23+
draft: false
24+
prerelease: false
25+
26+
- name: Download artifacts
27+
uses: actions/download-artifact@v1
28+
with:
29+
name: uploads
30+
31+
- name: Upload Linux artifact
32+
id: upload-linux
33+
uses: actions/upload-release-asset@v1
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
with:
37+
upload_url: ${{ steps.create_release.outputs.upload_url }}
38+
asset_path: ./uploads/ehlib-0.0.${{ github.run_number }}-Linux-release.tar.gz
39+
asset_name: ehlib-0.0.${{ github.run_number }}-Linux-release.tar.gz
40+
asset_content_type: application/vnd.debian.binary-package
41+
42+
- name: Upload Windows artifact
43+
id: upload-windows
44+
uses: actions/upload-release-asset@v1
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
with:
48+
upload_url: ${{ steps.create_release.outputs.upload_url }}
49+
asset_path: ./uploads/ehlib-0.0.${{ github.run_number }}-win64-release.zip
50+
asset_name: ehlib-0.0.${{ github.run_number }}-win64-release.zip
51+
asset_content_type: application/zip
52+
53+
build_linux:
54+
runs-on: ubuntu-latest
55+
steps:
56+
- uses: actions/checkout@v2
57+
with:
58+
submodules: true
59+
60+
- name: Set PATCH_VERSION
61+
run: cmake . -DPATCH_VERSION=${{ github.run_number }}
62+
63+
- name: Running cmake
64+
run: cmake --build . --config Release
65+
66+
- name: Run tests
67+
run: cmake --build . --target test --config Release
68+
69+
- name: Create package
70+
run: cmake --build . --target package --config Release
71+
72+
- name: Upload Linux artifact
73+
uses: actions/upload-artifact@v1
74+
with:
75+
name: uploads
76+
path: ehlib-0.0.${{ github.run_number }}-Linux-release.tar.gz
77+
78+
build_windows:
79+
runs-on: windows-latest
80+
steps:
81+
- uses: actions/checkout@v2
82+
83+
- name: Set PATCH_VERSION
84+
shell: cmd
85+
run: |
86+
mkdir build
87+
cd build
88+
cmake -DPATCH_VERSION=${{ github.run_number }} ../
89+
90+
- name: Running cmake
91+
shell: cmd
92+
run: |
93+
cd build
94+
cmake --build . --config Release
95+
96+
- name: Run tests
97+
shell: cmd
98+
run: |
99+
cd build
100+
cmake --build . --target RUN_TESTS --config Release
101+
102+
- name: Create package
103+
shell: cmd
104+
run: |
105+
cd build
106+
cmake --build . --target package --config Release
107+
108+
- name: Upload Windows artifact
109+
uses: actions/upload-artifact@v1
110+
with:
111+
name: uploads
112+
path: ./build/ehlib-0.0.${{ github.run_number }}-win64-release.zip

.gitignore

+2-32
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,2 @@
1-
# Prerequisites
2-
*.d
3-
4-
# Compiled Object files
5-
*.slo
6-
*.lo
7-
*.o
8-
*.obj
9-
10-
# Precompiled Headers
11-
*.gch
12-
*.pch
13-
14-
# Compiled Dynamic libraries
15-
*.so
16-
*.dylib
17-
*.dll
18-
19-
# Fortran module files
20-
*.mod
21-
*.smod
22-
23-
# Compiled Static libraries
24-
*.lai
25-
*.la
26-
*.a
27-
*.lib
28-
29-
# Executables
30-
*.exe
31-
*.out
32-
*.app
1+
/build/
2+
/.vscode/

CMakeLists.txt

+165
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
cmake_minimum_required(VERSION 3.25)
2+
3+
set(PATCH_VERSION "1" CACHE INTERNAL "Patch version")
4+
set(PROJECT_VESRION 0.0.${PATCH_VERSION})
5+
project(ehlib VERSION ${PROJECT_VESRION})
6+
7+
include(FetchContent)
8+
9+
FetchContent_Declare(
10+
mbedtls
11+
GIT_REPOSITORY https://github.com/Mbed-TLS/mbedtls.git
12+
GIT_TAG v3.4.1
13+
)
14+
FetchContent_MakeAvailable(mbedtls)
15+
16+
if(NOT mbedtls_POPULATED)
17+
FetchContent_Populate(mbedtls)
18+
add_subdirectory(${mbedtls_SOURCE_DIR} ${mbedtls_BINARY_DIR} EXCLUDE_FROM_ALL)
19+
endif()
20+
21+
FetchContent_Declare(
22+
googletest
23+
GIT_REPOSITORY https://github.com/google/googletest.git
24+
GIT_TAG v1.14.0
25+
)
26+
27+
FetchContent_GetProperties(googletest)
28+
if(NOT googletest_POPULATED)
29+
FetchContent_Populate(googletest)
30+
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} EXCLUDE_FROM_ALL)
31+
endif()
32+
33+
include_directories(include src)
34+
35+
add_library(
36+
mongoose
37+
STATIC
38+
src/mongoose/mongoose.c
39+
)
40+
41+
add_library(
42+
ehlib
43+
STATIC
44+
src/ehlib.cpp
45+
src/params.cpp
46+
src/utils.cpp
47+
src/mimetype/mime_type.cpp
48+
)
49+
50+
add_executable(
51+
test_ehlib_gtest
52+
tests/test_ehlib_gtest.cpp
53+
)
54+
55+
target_link_libraries(
56+
mongoose
57+
mbedtls
58+
mbedcrypto
59+
mbedx509)
60+
61+
target_link_libraries(
62+
ehlib
63+
mongoose)
64+
65+
if(WIN32)
66+
target_link_libraries(
67+
test_ehlib_gtest
68+
gtest
69+
gtest_main
70+
ehlib
71+
ws2_32)
72+
else()
73+
target_link_libraries(
74+
test_ehlib_gtest
75+
gtest
76+
gtest_main
77+
ehlib)
78+
endif()
79+
80+
set_target_properties(
81+
ehlib
82+
test_ehlib_gtest
83+
PROPERTIES
84+
CXX_STANDARD 17
85+
CXX_STANDARD_REQUIRED ON
86+
)
87+
88+
if (MSVC)
89+
target_compile_definitions(mongoose PRIVATE MG_TLS=1)
90+
91+
target_compile_options(ehlib PRIVATE /W4)
92+
93+
target_compile_options(test_ehlib_gtest PRIVATE /W4)
94+
else ()
95+
target_compile_definitions(mongoose PRIVATE MG_TLS=1)
96+
97+
target_link_options(ehlib PRIVATE -static-libgcc -static-libstdc++)
98+
99+
target_link_options(test_ehlib_gtest PRIVATE -static-libgcc -static-libstdc++)
100+
101+
target_compile_options(
102+
ehlib
103+
PRIVATE
104+
-Wall
105+
-Wextra
106+
-pedantic
107+
)
108+
109+
target_compile_options(
110+
mongoose
111+
PRIVATE
112+
-Wall
113+
-Wextra
114+
-pedantic
115+
)
116+
117+
target_compile_options(
118+
test_ehlib_gtest
119+
PRIVATE
120+
-Wall
121+
-Wextra
122+
-pedantic
123+
)
124+
endif()
125+
126+
install(
127+
TARGETS ehlib mongoose mbedtls mbedcrypto mbedx509
128+
RUNTIME DESTINATION ehlib/bin COMPONENT applications
129+
LIBRARY DESTINATION ehlib/lib COMPONENT release
130+
ARCHIVE DESTINATION ehlib/lib COMPONENT release
131+
)
132+
133+
install(
134+
DIRECTORY include
135+
DESTINATION ehlib
136+
COMPONENT release
137+
FILES_MATCHING
138+
PATTERN "*.h"
139+
)
140+
141+
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
142+
set(CPACK_COMPONENTS_ALL release)
143+
144+
# CPack area
145+
if (WIN32)
146+
set(CPACK_GENERATOR "ZIP")
147+
else ()
148+
set(CPACK_GENERATOR "TGZ")
149+
endif()
150+
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
151+
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
152+
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
153+
set(CPACK_PACKAGE_CONTACT https://github.com/4l3x777/ehlib)
154+
include(CPack)
155+
156+
# Tests area
157+
enable_testing()
158+
159+
add_test(
160+
NAME
161+
unit_tests_test_ehlib_gtest
162+
COMMAND
163+
test_ehlib_gtest
164+
)
165+

0 commit comments

Comments
 (0)