Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
yubindy committed Mar 10, 2022
1 parent 8a2e2ac commit 09d80b5
Show file tree
Hide file tree
Showing 17 changed files with 1,467 additions and 247 deletions.
206 changes: 103 additions & 103 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,105 +1,105 @@
# cmake_minimum_required(VERSION 1.0.1)
# project(yutbin_server)
# set(CMAKE_CXX_STANDARD 17)
# set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# link_libraries(-pthread)
# SET(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS} -g)

# aux_source_directory(src/base WS_BASE)
# aux_source_directory(src/net WS_net)

# # aux_source_directory(../src/http WS_HTTP)
# # aux_source_directory(../src/net WS_NET)

# include_directories(
# # ${CMAKE_CURRENT_SOURCE_DIR}
# # ${CMAKE_CURRENT_BINARY_DIR}
# # ${CMAKE_CURRENT_BINARY_DIR}/include
# ${CMAKE_CURRENT_SOURCE_DIR}/include #确定引入文件的工作目录
# # ${PROTO_HDRS}
# # ${GRPC_HDRS}
# )
# add_executable(yutbin_server
# # ../src/httpServer.cpp
# test/testlog.cpp
# ${WS_BASE}
# ${WS_net}
# )
cmake_minimum_required(VERSION 1.01)

# Options. Turn on with 'cmake -Dmyvarname=ON'.
option(test "Build all tests." OFF) # Makes boolean 'test' available.

# Make PROJECT_SOURCE_DIR, PROJECT_BINARY_DIR, and PROJECT_NAME available.
cmake_minimum_required(VERSION 1.0.1)
project(yutbin_server)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

link_libraries(-pthread)
SET(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS} -g)

aux_source_directory(src/base WS_BASE)
aux_source_directory(src/net WS_net)

# aux_source_directory(../src/http WS_HTTP)
# aux_source_directory(../src/net WS_NET)

include_directories(
# ${CMAKE_CURRENT_SOURCE_DIR}
# ${CMAKE_CURRENT_BINARY_DIR}
# ${CMAKE_CURRENT_BINARY_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/include #确定引入文件的工作目录
# ${PROTO_HDRS}
# ${GRPC_HDRS}
)
add_executable(yutbin_server
# ../src/httpServer.cpp
test/testlog.cpp
${WS_BASE}
${WS_net}
)
# cmake_minimum_required(VERSION 1.01)

# # Options. Turn on with 'cmake -Dmyvarname=ON'.
# option(test "Build all tests." OFF) # Makes boolean 'test' available.

# # Make PROJECT_SOURCE_DIR, PROJECT_BINARY_DIR, and PROJECT_NAME available.
# project(yutbin_server)

set(CMAKE_CXX_FLAGS "-g -Wall")

# force static runtime libraries for msvc builds
if(MSVC)
set(variables
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_MINSIZEREL
)
foreach(variable ${variables})
if(${variable} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${variable} "${${variable}}")
endif()
endforeach()
endif()

# If you want your own include/ directory, set this, and then you can do
# include_directories(${COMMON_INCLUDES}) in other CMakeLists.txt files.
set(COMMON_INCLUDES ${PROJECT_SOURCE_DIR}/include)

################################
# Normal Libraries & Executables
################################
add_library(project1_lib project1.cpp)
add_executable(project1 main.cpp)
# Key idea: SEPARATE OUT your main() function into its own file so it can be its
# own executable. Separating out main() means you can add this library to be
# used elsewhere.

target_link_libraries(project1 project1_lib)

################################
# Testing
################################
if (test)
if (APPLE)
add_definitions(-DGTEST_USE_OWN_TR1_TUPLE)
add_definitions(-D__GLIBCXX__)
endif (APPLE)

# This adds another subdirectory, which has 'project(gtest)'.
add_subdirectory(lib/gtest-1.6.0)

enable_testing()

# Include the gtest library. gtest_SOURCE_DIR is available due to
# 'project(gtest)' above.
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})

##############
# Unit Tests
##############
add_executable(runUnitTests test_project1.cpp)

# Standard linking to gtest stuff.
target_link_libraries(runUnitTests gtest gtest_main)

# Extra linking for the project.
target_link_libraries(runUnitTests project1_lib)

# This is so you can do 'make test' to see all your tests run, instead of
# manually running the executable runUnitTests to see those specific tests.
add_test(NAME that-test-I-made COMMAND runUnitTests)

# You can also omit NAME and COMMAND. The second argument could be some other
# test executable.
add_test(that-other-test-I-made runUnitTests)
endif()
# set(CMAKE_CXX_FLAGS "-g -Wall")

# # force static runtime libraries for msvc builds
# if(MSVC)
# set(variables
# CMAKE_CXX_FLAGS_DEBUG
# CMAKE_CXX_FLAGS_RELEASE
# CMAKE_CXX_FLAGS_RELWITHDEBINFO
# CMAKE_CXX_FLAGS_MINSIZEREL
# )
# foreach(variable ${variables})
# if(${variable} MATCHES "/MD")
# string(REGEX REPLACE "/MD" "/MT" ${variable} "${${variable}}")
# endif()
# endforeach()
# endif()

# # If you want your own include/ directory, set this, and then you can do
# # include_directories(${COMMON_INCLUDES}) in other CMakeLists.txt files.
# set(COMMON_INCLUDES ${PROJECT_SOURCE_DIR}/include)

# ################################
# # Normal Libraries & Executables
# ################################
# add_library(project1_lib project1.cpp)
# add_executable(project1 main.cpp)
# # Key idea: SEPARATE OUT your main() function into its own file so it can be its
# # own executable. Separating out main() means you can add this library to be
# # used elsewhere.

# target_link_libraries(project1 project1_lib)

# ################################
# # Testing
# ################################
# if (test)
# if (APPLE)
# add_definitions(-DGTEST_USE_OWN_TR1_TUPLE)
# add_definitions(-D__GLIBCXX__)
# endif (APPLE)

# # This adds another subdirectory, which has 'project(gtest)'.
# add_subdirectory(lib/gtest-1.6.0)

# enable_testing()

# # Include the gtest library. gtest_SOURCE_DIR is available due to
# # 'project(gtest)' above.
# include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})

# ##############
# # Unit Tests
# ##############
# add_executable(runUnitTests test_project1.cpp)

# # Standard linking to gtest stuff.
# target_link_libraries(runUnitTests gtest gtest_main)

# # Extra linking for the project.
# target_link_libraries(runUnitTests project1_lib)

# # This is so you can do 'make test' to see all your tests run, instead of
# # manually running the executable runUnitTests to see those specific tests.
# add_test(NAME that-test-I-made COMMAND runUnitTests)

# # You can also omit NAME and COMMAND. The second argument could be some other
# # test executable.
# add_test(that-other-test-I-made runUnitTests)
# endif()
Loading

0 comments on commit 09d80b5

Please sign in to comment.