Skip to content

Commit ec75721

Browse files
authored
Merge pull request #14 from deflinhec/develop
Develop
2 parents f5569f8 + 3d19d9c commit ec75721

File tree

13 files changed

+659
-99
lines changed

13 files changed

+659
-99
lines changed

.dockerignore

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
.git/*
2-
3-
# Executable generated files
4-
build/proj/*
5-
build/unix*/*
6-
include/*
7-
lib/*
8-
bin/*
9-
10-
# Windows generated files
11-
out/*
12-
.vs/*
13-
**/out/*
14-
**/.vs/*
1+
.git/*
2+
.vscode/*
3+
4+
# Downloaded source files
5+
test/googletest-src/*
6+
benchmark/benchmark-src/*
7+
8+
# Executable generated files
9+
build/*
10+
include/*
11+
lib/*
12+
bin/*
13+
14+
# Windows generated files
15+
out/*
16+
.vs/*
17+
**/out/*
18+
**/.vs/*

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
# git should never touch line endings
22
* -text
3+
4+
*.sh text eol=lf

.github/workflows/tests.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,7 @@ jobs:
5757
shell: bash
5858
run: |
5959
cd ${GITHUB_WORKSPACE}/build
60-
ctest -C Debug
61-
- name: Export libraries
62-
if: runner.os == 'Windows'
63-
run: |
64-
del build\bin\*.pdb
65-
xcopy /y vcpkg\installed\${{ env.RUNVCPKG_VCPKG_TRIPLET_OUT }}\bin\*.dll build\bin\
60+
ctest -C Debug --verbose
6661
- uses: actions/upload-artifact@v2
6762
with:
6863
name: Gsx2jsonpp-${{ matrix.os }}

.gitignore

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/build/*
2-
/include/*
3-
/lib/*
4-
/bin/*
1+
/.vscode/*
2+
/build/*
3+
/include/*
4+
/lib/*
5+
/bin/*

CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ endfunction(add_sources)
3535
###################################################
3636

3737
option(${PROJECT_NAME}_BUILD_TESTS "Build tests" ON)
38+
option(${PROJECT_NAME}_BUILD_BENCHMARK_TESTS "Build benchmark" ON)
3839

3940
set(SERVER_SOURCES
4041
${CMAKE_CURRENT_SOURCE_DIR}/src/gsx2json.cpp
@@ -123,10 +124,20 @@ install(TARGETS ${PROJECT_NAME}
123124
LIBRARY DESTINATION lib
124125
)
125126

127+
if (MSVC AND _VCPKG_INSTALLED_DIR)
128+
install(DIRECTORY "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$<CONFIG:Debug>:/debug>/bin/"
129+
DESTINATION bin
130+
FILES_MATCHING PATTERN "*.dll" )
131+
endif()
132+
126133
###################################################
127134
### Testing
128135
###################################################
129136

137+
if (${PROJECT_NAME}_BUILD_BENCHMARK_TESTS)
138+
add_subdirectory(benchmark)
139+
endif()
140+
130141
if (${PROJECT_NAME}_BUILD_TESTS)
131142
enable_testing ()
132143
add_subdirectory(test)

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ In this example below I'm going to use `5000` as port, and output log file under
4545
4646
After launched, Gsx2Jsonpp should be accessable in your browser [localhost:5000](http://localhost:5000/hi).
4747
48-
Supervisor have been setup within the container to guarantee an auto restart after accidentially crashed.
48+
Supervisor have been setup within the container to guarantee an auto restart after accidentially crashed(hopefully not).
4949
5050
## :toolbox: Build from source
5151
@@ -204,6 +204,5 @@ There are three sections to the returned data.
204204
205205
- :white_check_mark: docker image
206206
207-
- :white_large_square: json file lockdown
208-
207+
- :white_large_square: md5 checksum
209208

benchmark/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/benchmark-*

benchmark/CMakeLists.txt

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Download and unpack benchmark at configure time
2+
configure_file(CMakeLists.txt.in benchmark-download/CMakeLists.txt)
3+
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
4+
RESULT_VARIABLE result
5+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/benchmark-download )
6+
if(result)
7+
message(FATAL_ERROR "CMake step for benchmark failed: ${result}")
8+
endif()
9+
execute_process(COMMAND ${CMAKE_COMMAND} --build .
10+
RESULT_VARIABLE result
11+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/benchmark-download )
12+
if(result)
13+
message(FATAL_ERROR "Build step for benchmark failed: ${result}")
14+
endif()
15+
16+
# configure Google Benchmarks
17+
set(BENCHMARK_ENABLE_TESTING OFF CACHE INTERNAL "" FORCE)
18+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/benchmark-src
19+
${CMAKE_CURRENT_BINARY_DIR}/benchmark-build
20+
EXCLUDE_FROM_ALL)
21+
22+
add_executable(run-benchmark
23+
main.cpp
24+
${SERVER_SOURCES}
25+
${SERVER_HEADERS}
26+
)
27+
28+
set_target_properties(run-benchmark PROPERTIES
29+
XCODE_GENERATE_SCHEME TRUE
30+
XCODE_SCHEME_WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/bin
31+
)
32+
33+
target_include_directories(run-benchmark
34+
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}"
35+
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/benchmark-src"
36+
PUBLIC "${PROJECT_SOURCE_DIR}/src"
37+
PUBLIC "${PROJECT_SOURCE_DIR}/cpp-httplib"
38+
PUBLIC "${PROJECT_SOURCE_DIR}/json/include"
39+
PUBLIC "${PROJECT_SOURCE_DIR}/uriparser/include"
40+
)
41+
42+
target_link_libraries(run-benchmark uriparser)
43+
target_link_libraries(run-benchmark httplib::httplib)
44+
target_link_libraries(run-benchmark cxxopts::cxxopts)
45+
target_link_libraries(run-benchmark nlohmann_json::nlohmann_json)
46+
target_link_libraries(run-benchmark benchmark)

benchmark/CMakeLists.txt.in

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
cmake_minimum_required(VERSION 2.8.2)
2+
3+
project(benchmark-download NONE)
4+
5+
include(ExternalProject)
6+
ExternalProject_Add(benchmark
7+
GIT_REPOSITORY https://github.com/google/benchmark.git
8+
GIT_TAG master
9+
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/benchmark-src"
10+
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/benchmark-build"
11+
CONFIGURE_COMMAND ""
12+
BUILD_COMMAND ""
13+
INSTALL_COMMAND ""
14+
TEST_COMMAND ""
15+
)

0 commit comments

Comments
 (0)