-
Notifications
You must be signed in to change notification settings - Fork 107
Better CMake config, standard #include orders #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
b329af0
ae15169
f286636
22c2856
6069b16
5bcd9d8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| cmake-build-debug | ||
| .idea | ||
| *.so | ||
| CMakeFiles/ | ||
| CMakeCache.txt | ||
| Makefile | ||
| cmake_install.cmake | ||
|
|
||
| asynchronous | ||
| asynchronous-user_data | ||
| synchronous | ||
| synchronous-user_data | ||
| websockets |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,71 +1,55 @@ | ||
| cmake_minimum_required(VERSION 3.2) | ||
| project(binapi) | ||
|
|
||
| set(CMAKE_CXX_STANDARD 14) | ||
| set(CMAKE_CXX_STANDARD 20) | ||
|
|
||
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fsanitize=address") | ||
| find_package(Threads REQUIRED) | ||
| find_package(OpenSSL REQUIRED SSL Crypto) | ||
| find_package(ZLIB REQUIRED) | ||
|
|
||
| add_definitions( | ||
| -UNDEBUG | ||
| -DDTF_HEADER_ONLY | ||
| ) | ||
| add_library(binapi SHARED | ||
| src/api.cpp | ||
| src/dtf.cpp | ||
| src/enums.cpp | ||
| src/errors.cpp | ||
| src/pairslist.cpp | ||
| src/reports.cpp | ||
| src/tools.cpp | ||
| src/types.cpp | ||
| src/websocket.cpp) | ||
|
|
||
| include_directories( | ||
| ./include | ||
| ) | ||
| target_include_directories(binapi PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) | ||
|
|
||
| if (DEFINED ${BOOST_INCLUDE_DIR}) | ||
| include_directories( | ||
| ${BOOST_INCLUDE_DIR} | ||
| ) | ||
| endif() | ||
| target_compile_options(binapi PUBLIC | ||
| -pipe -Wall -Wextra | ||
| $<$<CONFIG:DEBUG>:-g3 -Og -fno-inline -fstack-protector-all -fsanitize=address> | ||
| $<$<CONFIG:RELEASE>:-O3 -s>) | ||
|
|
||
| set(BINAPI_HEADERS | ||
| binapi/api.hpp | ||
| binapi/flatjson.hpp | ||
| binapi/dtf.hpp | ||
| binapi/double_type.hpp | ||
| binapi/enums.hpp | ||
| binapi/errors.hpp | ||
| binapi/invoker.hpp | ||
| binapi/message.hpp | ||
| binapi/pairslist.hpp | ||
| binapi/reports.hpp | ||
| binapi/tools.hpp | ||
| binapi/types.hpp | ||
| binapi/websocket.hpp | ||
| ) | ||
| target_link_options(binapi PUBLIC | ||
| $<$<CONFIG:DEBUG>:-fsanitize=address>) | ||
|
|
||
| set(BINAPI_SOURCES | ||
| src/api.cpp | ||
| src/enums.cpp | ||
| src/errors.cpp | ||
| src/pairslist.cpp | ||
| src/reports.cpp | ||
| src/tools.cpp | ||
| src/types.cpp | ||
| src/websocket.cpp | ||
| ) | ||
| target_link_libraries(binapi PUBLIC | ||
| ZLIB::ZLIB | ||
| OpenSSL::Crypto OpenSSL::SSL | ||
| ${BOOST_LIBRARIES} | ||
| ${CMAKE_THREAD_LIBS_INIT}) | ||
|
|
||
| add_executable( | ||
| ${PROJECT_NAME} | ||
| # | ||
| main.cpp | ||
| # | ||
| ${BINAPI_SOURCES} | ||
| ) | ||
| target_include_directories(binapi PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) | ||
|
|
||
| if (DEFINED ${BOOST_LIB_DIR}) | ||
| target_link_libraries( | ||
| ${PROJECT_NAME} | ||
| -L${BOOST_LIB_DIR} | ||
| ) | ||
| endif() | ||
| add_executable(example_asynchronous examples/asynchronous/main.cpp) | ||
| target_link_libraries(example_asynchronous binapi) | ||
|
|
||
| target_link_libraries( | ||
| ${PROJECT_NAME} | ||
| z | ||
| crypto | ||
| ssl | ||
| pthread | ||
| ) | ||
| add_executable(example_asynchronous-user_data examples/asynchronous-user_data/main.cpp) | ||
| target_link_libraries(example_asynchronous-user_data binapi) | ||
|
|
||
| add_executable(example_synchronous examples/synchronous/main.cpp) | ||
| target_link_libraries(example_synchronous binapi) | ||
|
|
||
| add_executable(example_synchronous-user_data examples/synchronous-user_data/main.cpp) | ||
| target_link_libraries(example_synchronous-user_data binapi) | ||
|
|
||
| add_executable(example_websockets examples/websockets/main.cpp) | ||
| target_link_libraries(example_websockets binapi) | ||
|
|
||
| add_executable(example_api main.cpp) | ||
| target_link_libraries(example_api binapi) | ||
|
Comment on lines
+42
to
+55
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably don’t want to propagate these options to users.
Also,
-sis a linker option, I'm not sure it has any effect here. Better to move totarget_link_options.