diff options
author | Egor Pugin <egor.pugin@gmail.com> | 2020-05-02 02:16:27 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-02 02:16:27 +0300 |
commit | 6436825328cd3bf4a1c964bc84638bc93cfaff1e (patch) | |
tree | cd933546a1bfc38e44c9487c2c4327ed569673bd | |
parent | c378b6fb97a30175e957c8ce0bd8ad7bf5bcbe7f (diff) | |
parent | 3b7da8cd1e2f77d73cc19533fc657ba10a80c8cd (diff) |
Merge pull request #139 from OgreTransporter/master
Various fixes
-rw-r--r-- | CMakeLists.txt | 20 | ||||
-rw-r--r-- | include/tgbot/export.h | 22 | ||||
-rw-r--r-- | test/CMakeLists.txt | 2 |
3 files changed, 42 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6587a48..871e9b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,7 @@ project(TgBot) # options option(ENABLE_TESTS "Set to ON to enable building of tests" OFF) option(BUILD_SHARED_LIBS "Build tgbot-cpp shared/static library." OFF) +option(BUILD_DOCUMENTATION "Build doxygen API documentation." OFF) # sources set(CMAKE_CXX_STANDARD 14) @@ -58,6 +59,10 @@ else() find_package(Boost 1.59.0 COMPONENTS system REQUIRED) endif() include_directories(${Boost_INCLUDE_DIR}) +link_directories(${Boost_LIBRARY_DIR_RELEASE}) +if(NOT Boost_USE_STATIC_LIBS) + add_definitions(-DBOOST_ALL_DYN_LINK) +endif() set(LIB_LIST ${CMAKE_THREAD_LIBS_INIT} @@ -88,3 +93,18 @@ if (ENABLE_TESTS) enable_testing() add_subdirectory(test) endif() + +# Documentation +if(BUILD_DOCUMENTATION) + find_package(Doxygen REQUIRED) + add_custom_target(doc_doxygen ALL + COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Generating API documentation with Doxygen" + VERBATIM) + install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc/html/ TYPE DOC) +endif() + +if(BUILD_SHARED_LIBS) + add_definitions(-DTGBOT_DLL) +endif()
\ No newline at end of file diff --git a/include/tgbot/export.h b/include/tgbot/export.h index 55789d9..1bfb503 100644 --- a/include/tgbot/export.h +++ b/include/tgbot/export.h @@ -2,7 +2,27 @@ #define TGBOT_EXPORT_H #ifndef TGBOT_API -#define TGBOT_API + #ifdef TGBOT_DLL + #if defined _WIN32 || defined __CYGWIN__ + #define TGBOT_HELPER_DLL_EXPORT __declspec(dllexport) + #define TGBOT_HELPER_DLL_IMPORT __declspec(dllimport) + #else + #if __GNUC__ >= 4 + #define TGBOT_HELPER_DLL_EXPORT __attribute__ ((visibility ("default"))) + #define TGBOT_HELPER_DLL_IMPORT __attribute__ ((visibility ("default"))) + #else + #define TGBOT_HELPER_DLL_EXPORT + #define TGBOT_HELPER_DLL_IMPORT + #endif + #endif + #ifdef TgBot_EXPORTS + #define TGBOT_API TGBOT_HELPER_DLL_EXPORT + #else + #define TGBOT_API TGBOT_HELPER_DLL_IMPORT + #endif + #else + #define TGBOT_API + #endif #endif #endif //TGBOT_EXPORT_H diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3f8249b..0cce236 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -7,5 +7,5 @@ set(TEST_SRC_LIST include_directories("${PROJECT_SOURCE_DIR}/test") add_executable(${PROJECT_NAME}_test ${TEST_SRC_LIST}) -target_link_libraries(${PROJECT_NAME}_test TgBot) +target_link_libraries(${PROJECT_NAME}_test ${PROJECT_NAME}) add_test(${PROJECT_NAME}_test ${PROJECT_NAME}_test) |