mirror of
https://github.com/Naios/continuable.git
synced 2025-12-06 16:56:44 +08:00
Rename and cleanup some CMake options
This commit is contained in:
parent
2ddc2477bb
commit
b54bb80147
@ -23,6 +23,7 @@ matrix:
|
|||||||
env:
|
env:
|
||||||
- COMPILER=g++-6
|
- COMPILER=g++-6
|
||||||
- NO_EXCEPTIONS=OFF
|
- NO_EXCEPTIONS=OFF
|
||||||
|
- WITH_AWAIT=OFF
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: clang
|
compiler: clang
|
||||||
@ -40,6 +41,7 @@ matrix:
|
|||||||
env:
|
env:
|
||||||
- COMPILER=clang++-5.0
|
- COMPILER=clang++-5.0
|
||||||
- NO_EXCEPTIONS=OFF
|
- NO_EXCEPTIONS=OFF
|
||||||
|
- WITH_AWAIT=OFF
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: clang
|
compiler: clang
|
||||||
@ -57,6 +59,7 @@ matrix:
|
|||||||
env:
|
env:
|
||||||
- COMPILER=clang++-5.0
|
- COMPILER=clang++-5.0
|
||||||
- NO_EXCEPTIONS=ON
|
- NO_EXCEPTIONS=ON
|
||||||
|
- WITH_AWAIT=ON
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- export CXX=$COMPILER
|
- export CXX=$COMPILER
|
||||||
@ -74,7 +77,7 @@ install:
|
|||||||
cd build
|
cd build
|
||||||
|
|
||||||
# Configure the project and build it
|
# Configure the project and build it
|
||||||
cmake -GNinja -DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS -Werror" -DTESTS_NO_EXCEPTIONS=$NO_EXCEPTIONS -DCMAKE_BUILD_TYPE=Debug ..
|
cmake -GNinja -DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS -Werror" -DCTI_CONTINUABLE_WITH_NO_EXCEPTIONS=$NO_EXCEPTIONS -DCTI_CONTINUABLE_WITH_AWAIT=$WITH_AWAIT -DCMAKE_BUILD_TYPE=Debug ..
|
||||||
}
|
}
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
|||||||
@ -1,16 +1,30 @@
|
|||||||
cmake_minimum_required(VERSION 3.2)
|
cmake_minimum_required(VERSION 3.2)
|
||||||
project(continuable VERSION 2.0.0 LANGUAGES C CXX)
|
project(continuable VERSION 2.0.0 LANGUAGES C CXX)
|
||||||
|
|
||||||
# Dependencies
|
string(COMPARE EQUAL ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}
|
||||||
|
IS_TOP_LEVEL_PROJECT)
|
||||||
|
|
||||||
|
option(CTI_CONTINUABLE_WITH_TESTS
|
||||||
|
"Build the continuable unit tests"
|
||||||
|
${IS_TOP_LEVEL_PROJECT})
|
||||||
|
|
||||||
|
option(CTI_CONTINUABLE_WITH_EXAMPLES
|
||||||
|
"Build the continuable examples"
|
||||||
|
${IS_TOP_LEVEL_PROJECT})
|
||||||
|
|
||||||
|
option(CTI_CONTINUABLE_WITH_NO_EXCEPTIONS
|
||||||
|
"Disable exception support"
|
||||||
|
OFF)
|
||||||
|
|
||||||
|
option(CTI_CONTINUABLE_WITH_AWAIT
|
||||||
|
"Enable co_await support"
|
||||||
|
OFF)
|
||||||
|
|
||||||
|
include(cmake/CMakeLists.txt)
|
||||||
|
|
||||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
if (NOT DEFINED CONTINUABLE_UNIT_TESTS
|
|
||||||
AND CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
|
||||||
set(CONTINUABLE_UNIT_TESTS ON)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include(cmake/CMakeLists.txt)
|
|
||||||
add_subdirectory(dep)
|
add_subdirectory(dep)
|
||||||
|
|
||||||
# continuable-base
|
# continuable-base
|
||||||
@ -73,11 +87,10 @@ set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
|
|||||||
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
|
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
|
||||||
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
|
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
|
||||||
|
|
||||||
|
|
||||||
include(CPack)
|
include(CPack)
|
||||||
|
|
||||||
# Testing
|
# Testing and examples
|
||||||
if (CONTINUABLE_UNIT_TESTS)
|
if (CTI_CONTINUABLE_WITH_TESTS OR CTI_CONTINUABLE_WITH_EXAMPLES)
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||||
string(REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
string(REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
@ -88,6 +101,12 @@ if (CONTINUABLE_UNIT_TESTS)
|
|||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
add_subdirectory(doc)
|
add_subdirectory(doc)
|
||||||
add_subdirectory(examples)
|
|
||||||
add_subdirectory(test)
|
if (CTI_CONTINUABLE_WITH_TESTS)
|
||||||
|
add_subdirectory(test)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (CTI_CONTINUABLE_WITH_EXAMPLES)
|
||||||
|
add_subdirectory(examples)
|
||||||
|
endif()
|
||||||
endif ()
|
endif ()
|
||||||
|
|||||||
@ -19,7 +19,10 @@ clone_script:
|
|||||||
- cmd: git submodule update --init --recursive
|
- cmd: git submodule update --init --recursive
|
||||||
|
|
||||||
before_build:
|
before_build:
|
||||||
- cmd: cmake -H. -Bbuild -A%PLATFORM% -DTESTS_NO_EXCEPTIONS=%NO_EXCEPTIONS%
|
- cmd: >
|
||||||
|
cmake -H. -Bbuild -A%PLATFORM%
|
||||||
|
-DCTI_CONTINUABLE_WITH_NO_EXCEPTIONS=%NO_EXCEPTIONS%
|
||||||
|
-DCTI_CONTINUABLE_WITH_AWAIT=ON
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
- cmd: cmake --build build --config %CONFIGURATION% --target ALL_BUILD -- /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /verbosity:minimal /maxcpucount:2 /nologo
|
- cmd: cmake --build build --config %CONFIGURATION% --target ALL_BUILD -- /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /verbosity:minimal /maxcpucount:2 /nologo
|
||||||
|
|||||||
@ -5,7 +5,7 @@ target_compile_options(continuable-features-warnings
|
|||||||
-pedantic
|
-pedantic
|
||||||
-Wextra)
|
-Wextra)
|
||||||
|
|
||||||
if (WITH_COROUTINES)
|
if (CTI_CONTINUABLE_WITH_AWAIT)
|
||||||
target_compile_options(continuable-coroutines
|
target_compile_options(continuable-coroutines
|
||||||
INTERFACE
|
INTERFACE
|
||||||
-fcoroutines-ts)
|
-fcoroutines-ts)
|
||||||
@ -15,7 +15,7 @@ if (WITH_COROUTINES)
|
|||||||
-DCONTINUABLE_HAS_EXPERIMENTAL_COROUTINE)
|
-DCONTINUABLE_HAS_EXPERIMENTAL_COROUTINE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (TESTS_NO_EXCEPTIONS)
|
if (CTI_CONTINUABLE_WITH_NO_EXCEPTIONS)
|
||||||
target_compile_options(continuable-features-noexcept
|
target_compile_options(continuable-features-noexcept
|
||||||
INTERFACE
|
INTERFACE
|
||||||
-fno-exceptions)
|
-fno-exceptions)
|
||||||
|
|||||||
@ -5,7 +5,7 @@ target_compile_options(continuable-features-warnings
|
|||||||
-pedantic
|
-pedantic
|
||||||
-Wextra)
|
-Wextra)
|
||||||
|
|
||||||
if (TESTS_NO_EXCEPTIONS)
|
if (CTI_CONTINUABLE_WITH_NO_EXCEPTIONS)
|
||||||
target_compile_options(continuable-features-noexcept
|
target_compile_options(continuable-features-noexcept
|
||||||
INTERFACE
|
INTERFACE
|
||||||
-fno-exceptions)
|
-fno-exceptions)
|
||||||
|
|||||||
@ -19,7 +19,7 @@ target_compile_options(continuable-features-warnings
|
|||||||
INTERFACE
|
INTERFACE
|
||||||
/W4)
|
/W4)
|
||||||
|
|
||||||
if (WITH_COROUTINES)
|
if (CTI_CONTINUABLE_WITH_AWAIT)
|
||||||
target_compile_options(continuable-coroutines
|
target_compile_options(continuable-coroutines
|
||||||
INTERFACE
|
INTERFACE
|
||||||
/await)
|
/await)
|
||||||
@ -29,7 +29,7 @@ if (WITH_COROUTINES)
|
|||||||
-DCONTINUABLE_HAS_EXPERIMENTAL_COROUTINE)
|
-DCONTINUABLE_HAS_EXPERIMENTAL_COROUTINE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (TESTS_NO_EXCEPTIONS)
|
if (CTI_CONTINUABLE_WITH_NO_EXCEPTIONS)
|
||||||
target_compile_definitions(continuable-features-noexcept
|
target_compile_definitions(continuable-features-noexcept
|
||||||
INTERFACE
|
INTERFACE
|
||||||
-D_HAS_EXCEPTIONS=0)
|
-D_HAS_EXCEPTIONS=0)
|
||||||
|
|||||||
@ -1,15 +1,17 @@
|
|||||||
if(CONTINUABLE_UNIT_TESTS AND NOT TARGET gtest)
|
|
||||||
add_subdirectory(googletest)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CONTINUABLE_UNIT_TESTS AND NOT TARGET cxx_function)
|
|
||||||
add_subdirectory(cxx_function)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CONTINUABLE_UNIT_TESTS AND NOT TARGET asio)
|
|
||||||
add_subdirectory(asio)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT TARGET function2)
|
if(NOT TARGET function2)
|
||||||
add_subdirectory(function2)
|
add_subdirectory(function2)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (CTI_CONTINUABLE_WITH_TESTS OR CTI_CONTINUABLE_WITH_EXAMPLES)
|
||||||
|
if(NOT TARGET gtest)
|
||||||
|
add_subdirectory(googletest)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT TARGET cxx_function)
|
||||||
|
add_subdirectory(cxx_function)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT TARGET asio)
|
||||||
|
add_subdirectory(asio)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user