Skip to content

Commit

Permalink
Refactor CMakeLists.txt and stenographer.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
royshil committed Oct 10, 2024
1 parent 1de9357 commit 0c1ee70
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ include(cmake/BuildICU.cmake)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE ICU)
target_include_directories(${CMAKE_PROJECT_NAME} SYSTEM PUBLIC ${ICU_INCLUDE_DIR})

if(MSVC or APPLE)
if(WIN32 OR APPLE)
if(NOT buildspec)
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/buildspec.json" buildspec)
endif()
Expand All @@ -124,6 +124,7 @@ if(MSVC or APPLE)
else()
include(cmake/FetchWebsocketpp.cmake)
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${websocketpp_SOURCE_DIR}/)
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${asio_SOURCE_DIR}/)
endif()

target_sources(
Expand Down
25 changes: 16 additions & 9 deletions cmake/FetchWebsocketpp.cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
include(FetchContent)

FetchContent_Declare(
websocketpp
URL https://github.com/zaphoyd/websocketpp/archive/refs/tags/0.8.2.tar.gz
URL_HASH SHA256=6ce889d85ecdc2d8fa07408d6787e7352510750daa66b5ad44aacb47bea76755
)

FetchContent_MakeAvailable(websocketpp)
include(FetchContent)

FetchContent_Declare(
websocketpp
URL https://github.com/zaphoyd/websocketpp/archive/refs/tags/0.8.2.tar.gz
URL_HASH SHA256=6ce889d85ecdc2d8fa07408d6787e7352510750daa66b5ad44aacb47bea76755)

FetchContent_MakeAvailable(websocketpp)

# Fetch ASIO
FetchContent_Declare(
asio
URL https://github.com/chriskohlhoff/asio/archive/asio-1-28-0.tar.gz
URL_HASH SHA256=1ef87b17e5e32f1a1b4cd840acac6c2a8d0dcde365dde3f9dcd5d1eae0495290)

FetchContent_MakeAvailable(websocketpp asio)
8 changes: 4 additions & 4 deletions cmake/linux/compilerconfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ set(_obs_gcc_c_options
-Wformat-security
-Wno-conversion
-Wno-deprecated-declarations
-Wno-error=conversion
-Wno-error=deprecated-declarations
-Wno-float-conversion
-Wno-implicit-fallthrough
Expand All @@ -42,14 +43,13 @@ set(_obs_gcc_c_options
-Wvla)

# gcc options for C++
set(_obs_gcc_cxx_options
# cmake-format: sortable
${_obs_gcc_c_options} -Wconversion -Wfloat-conversion -Winvalid-offsetof -Wno-overloaded-virtual)
set(_obs_gcc_cxx_options # cmake-format: sortable
${_obs_gcc_c_options} -Winvalid-offsetof -Wno-overloaded-virtual)

add_compile_options(
-fopenmp-simd
"$<$<COMPILE_LANG_AND_ID:C,GNU>:${_obs_gcc_c_options}>"
"$<$<COMPILE_LANG_AND_ID:C,GNU>:-Wint-conversion;-Wno-missing-prototypes;-Wno-strict-prototypes;-Wpointer-sign>"
"$<$<COMPILE_LANG_AND_ID:C,GNU>:-Wno-missing-prototypes;-Wno-strict-prototypes;-Wpointer-sign>"
"$<$<COMPILE_LANG_AND_ID:CXX,GNU>:${_obs_gcc_cxx_options}>"
"$<$<COMPILE_LANG_AND_ID:C,Clang>:${_obs_clang_c_options}>"
"$<$<COMPILE_LANG_AND_ID:CXX,Clang>:${_obs_clang_cxx_options}>")
Expand Down
2 changes: 0 additions & 2 deletions src/stenographer/stenographer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
#define ASIO_STANDALONE
#define _WEBSOCKETPP_CPP11_TYPE_TRAITS_

#ifndef __linux__
#include <websocketpp/config/asio_no_tls.hpp>
#endif
#include <websocketpp/server.hpp>
#include <nlohmann/json.hpp>
#include <queue>
Expand Down

0 comments on commit 0c1ee70

Please sign in to comment.