diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..cc48558 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,46 @@ +cmake_minimum_required(VERSION 3.15) + +project(SquidTasks) + +add_library(${PROJECT_NAME} INTERFACE) + +# There doesn't seem to be a coroutines feature in CMAKE_CXX_KNOWN_FEATURES + +# Some errors in Sample_TextGame with std_20 +#target_compile_features(${PROJECT_NAME} INTERFACE "cxx_std_20") + +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + target_compile_options(${PROJECT_NAME} INTERFACE "-fcoroutines-ts") +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.10) + # Seems like we should use /await:strict here, but seems to fail. + #target_compile_options(${PROJECT_NAME} INTERFACE "/await:strict") + target_compile_options(${PROJECT_NAME} INTERFACE "/await") + else() + target_compile_options(${PROJECT_NAME} INTERFACE "/await") + endif() +endif() + +target_include_directories(${PROJECT_NAME} INTERFACE include) + +target_sources(${PROJECT_NAME} INTERFACE + include/Task.h + include/TaskManager.h + include/TasksConfig.h + include/TokenList.h + include/TaskFSM.h + include/FunctionGuard.h + # Private + include/Private/TaskPrivate.h + include/Private/TaskFSMPrivate.h + include/Private/TasksCommonPrivate.h + include/Private/tl/optional.hpp + ) + +option(SQUIDTASKS_BUILD_SAMPLES "Enable building with samples." OFF) + +if(SQUIDTASKS_BUILD_SAMPLES) + add_subdirectory(samples/Sample_Tests) + add_subdirectory(samples/Sample_Template) + add_subdirectory(samples/Sample_TextGame) +endif() \ No newline at end of file diff --git a/samples/Sample_Template/CMakeLists.txt b/samples/Sample_Template/CMakeLists.txt new file mode 100644 index 0000000..6e6f0f0 --- /dev/null +++ b/samples/Sample_Template/CMakeLists.txt @@ -0,0 +1,10 @@ +add_executable(Sample_Template) + +target_link_libraries(Sample_Template SquidTasks) + +target_include_directories(Sample_Template PRIVATE ../Common) + +target_sources(Sample_Template PRIVATE + ../Common/TimeSystem.h + Main.cpp +) \ No newline at end of file diff --git a/samples/Sample_Tests/CMakeLists.txt b/samples/Sample_Tests/CMakeLists.txt new file mode 100644 index 0000000..899439f --- /dev/null +++ b/samples/Sample_Tests/CMakeLists.txt @@ -0,0 +1,10 @@ +add_executable(Sample_Tests) + +target_link_libraries(Sample_Tests SquidTasks) + +target_include_directories(Sample_Tests PRIVATE ../Common) + +target_sources(Sample_Tests PRIVATE + ../Common/TimeSystem.h + Main.cpp +) \ No newline at end of file diff --git a/samples/Sample_TextGame/CMakeLists.txt b/samples/Sample_TextGame/CMakeLists.txt new file mode 100644 index 0000000..6d3ffad --- /dev/null +++ b/samples/Sample_TextGame/CMakeLists.txt @@ -0,0 +1,12 @@ +add_executable(Sample_TextGame) + +target_link_libraries(Sample_TextGame SquidTasks) + +target_include_directories(Sample_TextGame PRIVATE ../Common) + +target_sources(Sample_TextGame PRIVATE + ../Common/TimeSystem.h + TextGame.h + TextInput.h + Main.cpp +) \ No newline at end of file