diff options
author | Kirk Shoop <kirk.shoop@microsoft.com> | 2015-06-04 07:52:22 -0700 |
---|---|---|
committer | Kirk Shoop <kirk.shoop@microsoft.com> | 2015-06-04 08:22:07 -0700 |
commit | 001ac1e827530a3b0e7411b77c37be89c95251c0 (patch) | |
tree | 4500b72e2e15a8f2253ee72f3487530c2c276296 /Rx | |
parent | 73b1adbbabb43c8bb887178de628e0871e6b350d (diff) | |
download | RxCpp-001ac1e827530a3b0e7411b77c37be89c95251c0.tar.gz |
CMake - require 3.2 and refactor
NOTE: binaries have moved!
OSX
<build>/test/rxcppv2_test
<build>/examples/pythagorian/pythagorian
Windows
<build>\test\Debug\rxcppv2_test.exe
<build>\examples\pythagorian\Debug\pythagorian.exe
NOTE: cmake can be run in the root! This will make a dir named build
with the binaries
cmake .
cmake --build .
Diffstat (limited to 'Rx')
-rw-r--r-- | Rx/v2/examples/cep/CMakeLists.txt | 41 | ||||
-rw-r--r-- | Rx/v2/examples/doxygen/CMakeLists.txt | 32 | ||||
-rw-r--r-- | Rx/v2/examples/println/CMakeLists.txt | 34 | ||||
-rw-r--r-- | Rx/v2/examples/pythagorian/CMakeLists.txt | 34 | ||||
-rw-r--r-- | Rx/v2/examples/stop/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Rx/v2/examples/tests/CMakeLists.txt | 35 | ||||
-rw-r--r-- | Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp | 2 | ||||
-rw-r--r-- | Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp | 2 | ||||
-rw-r--r-- | Rx/v2/src/rxcpp/operators/rx-window_time.hpp | 2 | ||||
-rw-r--r-- | Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp | 2 | ||||
-rw-r--r-- | Rx/v2/src/rxcpp/rx-scheduler.hpp | 2 | ||||
-rw-r--r-- | Rx/v2/test/CMakeLists.txt | 93 | ||||
-rw-r--r-- | Rx/v2/test/test.cpp | 2 |
13 files changed, 247 insertions, 36 deletions
diff --git a/Rx/v2/examples/cep/CMakeLists.txt b/Rx/v2/examples/cep/CMakeLists.txt index c04bead..542a858 100644 --- a/Rx/v2/examples/cep/CMakeLists.txt +++ b/Rx/v2/examples/cep/CMakeLists.txt @@ -1,30 +1,8 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.2 FATAL_ERROR) get_filename_component(SAMPLE_PROJECT "${CMAKE_CURRENT_SOURCE_DIR}" NAME) -project(${SAMPLE_PROJECT}) - -FIND_PACKAGE(Threads) - -MESSAGE( STATUS "CMAKE_CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID} ) -if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - MESSAGE( STATUS "using clang settings" ) - add_compile_options( -Wall -Wextra -Werror ) - add_compile_options( -std=c++11 -stdlib=libc++ ) - add_compile_options( -ftemplate-depth=1024 ) # sometimes you just do what the compiler tells you -elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU") - MESSAGE( STATUS "using gnu settings" ) - add_compile_options( -Wall -Wextra -Werror ) - add_compile_options( -std=c++11 ) -elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") - MESSAGE( STATUS "using msvc settings" ) - add_compile_options( /W4 /WX ) - add_compile_options( /wd4503 ) # truncated symbol - add_compile_options( /wd4702 ) # unreachable code - add_compile_options( /bigobj ) - add_definitions( /DUNICODE /D_UNICODE ) # it is a new millenium -endif() - +project(${SAMPLE_PROJECT} LANGUAGES C CXX) # define some folders get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH) @@ -34,20 +12,25 @@ get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH) MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} ) -include_directories(SYSTEM ${RXCPP_DIR}/ext/catch/include) -include_directories(${RXCPP_DIR}/Ix/CPP/src ${RXCPP_DIR}/Rx/v2/src) +include(${RXCPP_DIR}/projects/CMake/shared.cmake) # define the sources set(SAMPLE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ) add_executable(${SAMPLE_PROJECT} ${SAMPLE_SOURCES}) -TARGET_LINK_LIBRARIES(${SAMPLE_PROJECT} ${CMAKE_THREAD_LIBS_INIT}) +add_executable(rxcpp::examples::${SAMPLE_PROJECT} ALIAS ${SAMPLE_PROJECT}) +target_compile_options(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_OPTIONS}) +target_compile_features(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_FEATURES}) +target_include_directories(${SAMPLE_PROJECT} + PUBLIC ${RX_SRC_DIR} ${RX_CATCH_DIR} + ) +target_link_libraries(${SAMPLE_PROJECT} ${CMAKE_THREAD_LIBS_INIT}) # configure unit tests via CTest enable_testing() set(CTEST_CONFIGURATION_TYPE "${JOB_BUILD_CONFIGURATION}") -add_test(NAME RunTests +add_test(NAME RunTests WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" - COMMAND ${SAMPLE_PROJECT} ${TEST_ARGS})
\ No newline at end of file + COMMAND ${SAMPLE_PROJECT} ${TEST_ARGS}) diff --git a/Rx/v2/examples/doxygen/CMakeLists.txt b/Rx/v2/examples/doxygen/CMakeLists.txt new file mode 100644 index 0000000..d89b175 --- /dev/null +++ b/Rx/v2/examples/doxygen/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 3.2 FATAL_ERROR) + +get_filename_component(SAMPLE_PROJECT "${CMAKE_CURRENT_SOURCE_DIR}" NAME) + +project(${SAMPLE_PROJECT} LANGUAGES C CXX) + +# define some folders +get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH) +get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH) +get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH) +get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH) + +MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} ) + +include(${RXCPP_DIR}/projects/CMake/shared.cmake) + +# define the sources +file(GLOB SAMPLE_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp") +add_executable(${SAMPLE_PROJECT} ${SAMPLE_SOURCES}) +add_executable(rxcpp::examples::${SAMPLE_PROJECT} ALIAS ${SAMPLE_PROJECT}) +target_compile_options(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_OPTIONS}) +target_compile_features(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_FEATURES}) +target_include_directories(${SAMPLE_PROJECT} PUBLIC ${RX_SRC_DIR} ${RX_CATCH_DIR}) +target_link_libraries(${SAMPLE_PROJECT} ${CMAKE_THREAD_LIBS_INIT}) + +# configure unit tests via CTest +enable_testing() +set(CTEST_CONFIGURATION_TYPE "${JOB_BUILD_CONFIGURATION}") + +add_test(NAME RunTests + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + COMMAND ${SAMPLE_PROJECT} ${TEST_ARGS}) diff --git a/Rx/v2/examples/println/CMakeLists.txt b/Rx/v2/examples/println/CMakeLists.txt new file mode 100644 index 0000000..82cd2a4 --- /dev/null +++ b/Rx/v2/examples/println/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.2 FATAL_ERROR) + +get_filename_component(SAMPLE_PROJECT "${CMAKE_CURRENT_SOURCE_DIR}" NAME) + +project(${SAMPLE_PROJECT} LANGUAGES C CXX) + +# define some folders +get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH) +get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH) +get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH) +get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH) + +MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} ) + +include(${RXCPP_DIR}/projects/CMake/shared.cmake) + +# define the sources +set(SAMPLE_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp +) +add_executable(${SAMPLE_PROJECT} ${SAMPLE_SOURCES}) +add_executable(rxcpp::examples::${SAMPLE_PROJECT} ALIAS ${SAMPLE_PROJECT}) +target_compile_options(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_OPTIONS}) +target_compile_features(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_FEATURES}) +target_include_directories(${SAMPLE_PROJECT} PUBLIC ${RX_SRC_DIR}) +target_link_libraries(${SAMPLE_PROJECT} ${CMAKE_THREAD_LIBS_INIT}) + +# configure unit tests via CTest +enable_testing() +set(CTEST_CONFIGURATION_TYPE "${JOB_BUILD_CONFIGURATION}") + +add_test(NAME RunTests + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + COMMAND ${SAMPLE_PROJECT} ${TEST_ARGS}) diff --git a/Rx/v2/examples/pythagorian/CMakeLists.txt b/Rx/v2/examples/pythagorian/CMakeLists.txt new file mode 100644 index 0000000..82cd2a4 --- /dev/null +++ b/Rx/v2/examples/pythagorian/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.2 FATAL_ERROR) + +get_filename_component(SAMPLE_PROJECT "${CMAKE_CURRENT_SOURCE_DIR}" NAME) + +project(${SAMPLE_PROJECT} LANGUAGES C CXX) + +# define some folders +get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH) +get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH) +get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH) +get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH) + +MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} ) + +include(${RXCPP_DIR}/projects/CMake/shared.cmake) + +# define the sources +set(SAMPLE_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp +) +add_executable(${SAMPLE_PROJECT} ${SAMPLE_SOURCES}) +add_executable(rxcpp::examples::${SAMPLE_PROJECT} ALIAS ${SAMPLE_PROJECT}) +target_compile_options(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_OPTIONS}) +target_compile_features(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_FEATURES}) +target_include_directories(${SAMPLE_PROJECT} PUBLIC ${RX_SRC_DIR}) +target_link_libraries(${SAMPLE_PROJECT} ${CMAKE_THREAD_LIBS_INIT}) + +# configure unit tests via CTest +enable_testing() +set(CTEST_CONFIGURATION_TYPE "${JOB_BUILD_CONFIGURATION}") + +add_test(NAME RunTests + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + COMMAND ${SAMPLE_PROJECT} ${TEST_ARGS}) diff --git a/Rx/v2/examples/stop/CMakeLists.txt b/Rx/v2/examples/stop/CMakeLists.txt index b1791ad..82cd2a4 100644 --- a/Rx/v2/examples/stop/CMakeLists.txt +++ b/Rx/v2/examples/stop/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.2 FATAL_ERROR) get_filename_component(SAMPLE_PROJECT "${CMAKE_CURRENT_SOURCE_DIR}" NAME) -project(${SAMPLE_PROJECT} LANGUAGES CXX) +project(${SAMPLE_PROJECT} LANGUAGES C CXX) # define some folders get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH) diff --git a/Rx/v2/examples/tests/CMakeLists.txt b/Rx/v2/examples/tests/CMakeLists.txt new file mode 100644 index 0000000..af849ff --- /dev/null +++ b/Rx/v2/examples/tests/CMakeLists.txt @@ -0,0 +1,35 @@ +cmake_minimum_required(VERSION 3.2 FATAL_ERROR) + +get_filename_component(SAMPLE_PROJECT "${CMAKE_CURRENT_SOURCE_DIR}" NAME) + +project(${SAMPLE_PROJECT} LANGUAGES C CXX) + +# define some folders +get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH) +get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH) +get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH) +get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH) + +MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} ) + +include(${RXCPP_DIR}/projects/CMake/shared.cmake) + +# define the sources +set(SAMPLE_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/take.cpp +) +add_executable(${SAMPLE_PROJECT} ${SAMPLE_SOURCES}) +add_executable(rxcpp::examples::${SAMPLE_PROJECT} ALIAS ${SAMPLE_PROJECT}) +target_compile_options(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_OPTIONS}) +target_compile_features(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_FEATURES}) +target_include_directories(${SAMPLE_PROJECT} PUBLIC ${RX_SRC_DIR} ${RX_CATCH_DIR}) +target_link_libraries(${SAMPLE_PROJECT} ${CMAKE_THREAD_LIBS_INIT}) + +# configure unit tests via CTest +enable_testing() +set(CTEST_CONFIGURATION_TYPE "${JOB_BUILD_CONFIGURATION}") + +add_test(NAME RunTests + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + COMMAND ${SAMPLE_PROJECT} ${TEST_ARGS}) diff --git a/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp b/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp index f1edbe6..776c020 100644 --- a/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp @@ -58,7 +58,7 @@ struct buffer_with_time , cs(std::move(cs)) , dest(std::move(d)) , coordinator(std::move(c)) - , worker(std::move(coordinator.get_worker())) + , worker(coordinator.get_worker()) , expected(worker.now()) { } diff --git a/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp b/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp index ba8d62a..936315d 100644 --- a/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp @@ -58,7 +58,7 @@ struct buffer_with_time_or_count , cs(std::move(cs)) , dest(std::move(d)) , coordinator(std::move(c)) - , worker(std::move(coordinator.get_worker())) + , worker(coordinator.get_worker()) , chunk_id(0) { } diff --git a/Rx/v2/src/rxcpp/operators/rx-window_time.hpp b/Rx/v2/src/rxcpp/operators/rx-window_time.hpp index a64d83d..db6d11b 100644 --- a/Rx/v2/src/rxcpp/operators/rx-window_time.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-window_time.hpp @@ -56,7 +56,7 @@ struct window_with_time , cs(std::move(cs)) , dest(std::move(d)) , coordinator(std::move(c)) - , worker(std::move(coordinator.get_worker())) + , worker(coordinator.get_worker()) , expected(worker.now()) { } diff --git a/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp b/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp index 5bb65ab..ab36006 100644 --- a/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp @@ -56,7 +56,7 @@ struct window_with_time_or_count , cs(std::move(cs)) , dest(std::move(d)) , coordinator(std::move(c)) - , worker(std::move(coordinator.get_worker())) + , worker(coordinator.get_worker()) , cursor(0) , subj_id(0) { diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index d28fd82..40d3337 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -370,7 +370,7 @@ public: { } explicit scheduler(detail::const_scheduler_interface_ptr i) - : inner(std::move(std::const_pointer_cast<scheduler_interface>(i))) + : inner(std::const_pointer_cast<scheduler_interface>(i)) { } diff --git a/Rx/v2/test/CMakeLists.txt b/Rx/v2/test/CMakeLists.txt new file mode 100644 index 0000000..5d64906 --- /dev/null +++ b/Rx/v2/test/CMakeLists.txt @@ -0,0 +1,93 @@ +cmake_minimum_required(VERSION 3.2 FATAL_ERROR) + +project(rxcppv2_test LANGUAGES C CXX) + +# define some folders + +get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH) +get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH) +get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH) + +MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} ) + +include(${RXCPP_DIR}/projects/CMake/shared.cmake) + +set(TEST_DIR ${RXCPP_DIR}/Rx/v2/test) + +# define the sources of the self test +set(TEST_SOURCES + ${TEST_DIR}/test.cpp + ${TEST_DIR}/subscriptions/observer.cpp + ${TEST_DIR}/subscriptions/subscription.cpp + ${TEST_DIR}/subjects/subject.cpp + ${TEST_DIR}/sources/create.cpp + ${TEST_DIR}/sources/defer.cpp + ${TEST_DIR}/sources/interval.cpp + ${TEST_DIR}/sources/scope.cpp + ${TEST_DIR}/sources/timer.cpp + ${TEST_DIR}/operators/amb.cpp + ${TEST_DIR}/operators/amb_variadic.cpp + ${TEST_DIR}/operators/buffer.cpp + ${TEST_DIR}/operators/combine_latest.1.cpp + ${TEST_DIR}/operators/combine_latest.2.cpp + ${TEST_DIR}/operators/concat.cpp + ${TEST_DIR}/operators/concat_map.cpp + ${TEST_DIR}/operators/distinct_until_changed.cpp + ${TEST_DIR}/operators/filter.cpp + ${TEST_DIR}/operators/flat_map.cpp + ${TEST_DIR}/operators/group_by.cpp + ${TEST_DIR}/operators/lift.cpp + ${TEST_DIR}/operators/map.cpp + ${TEST_DIR}/operators/merge.cpp + ${TEST_DIR}/operators/observe_on.cpp + ${TEST_DIR}/operators/pairwise.cpp + ${TEST_DIR}/operators/publish.cpp + ${TEST_DIR}/operators/reduce.cpp + ${TEST_DIR}/operators/repeat.cpp + ${TEST_DIR}/operators/retry.cpp + ${TEST_DIR}/operators/scan.cpp + ${TEST_DIR}/operators/skip.cpp + ${TEST_DIR}/operators/skip_until.cpp + ${TEST_DIR}/operators/subscribe_on.cpp + ${TEST_DIR}/operators/switch_on_next.cpp + ${TEST_DIR}/operators/take.cpp + ${TEST_DIR}/operators/take_until.cpp + ${TEST_DIR}/operators/window.cpp + ${TEST_DIR}/operators/zip.1.cpp + ${TEST_DIR}/operators/zip.2.cpp +) +add_executable(rxcppv2_test ${TEST_SOURCES}) +add_executable(rxcpp::tests ALIAS rxcppv2_test) +target_compile_options(rxcppv2_test PUBLIC ${RX_COMPILE_OPTIONS}) +target_compile_features(rxcppv2_test PUBLIC ${RX_COMPILE_FEATURES}) +target_include_directories(rxcppv2_test + PUBLIC ${RX_SRC_DIR} ${RX_CATCH_DIR} + ) +target_link_libraries(rxcppv2_test ${CMAKE_THREAD_LIBS_INIT}) + +# define the sources of the self test +set(ONE_SOURCES + ${TEST_DIR}/test.cpp + #${TEST_DIR}/operators/combine_latest.1.cpp + #${TEST_DIR}/operators/combine_latest.2.cpp +) +add_executable(one_test ${ONE_SOURCES}) +add_executable(rxcpp::one_test ALIAS one_test) +target_compile_options(one_test PUBLIC ${RX_COMPILE_OPTIONS}) +target_compile_features(one_test PUBLIC ${RX_COMPILE_FEATURES}) +target_include_directories(one_test + PUBLIC ${RX_SRC_DIR} ${RX_CATCH_DIR} + ) +target_link_libraries(one_test ${CMAKE_THREAD_LIBS_INIT}) + +# configure unit tests via CTest +enable_testing() + +add_test(NAME RunTests COMMAND rxcppv2_test) + +add_test(NAME ListTests COMMAND rxcppv2_test --list-tests) +set_tests_properties(ListTests PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ test cases") + +add_test(NAME ListTags COMMAND rxcppv2_test --list-tags) +set_tests_properties(ListTags PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags") + diff --git a/Rx/v2/test/test.cpp b/Rx/v2/test/test.cpp index 8fe512e..8cd3e05 100644 --- a/Rx/v2/test/test.cpp +++ b/Rx/v2/test/test.cpp @@ -1,5 +1,5 @@ #include <exception> -#if (__GLIBCXX__ / 10000) == 2014 +#if (__GLIBCXX__ / 10000) == 2014 || (__GLIBCXX__ / 10000) == 2015 namespace std { inline bool uncaught_exception() noexcept(true) { return current_exception() != nullptr; |