aboutsummaryrefslogtreecommitdiff
path: root/works/life/operating-system-experiment/CMakeLists.txt
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-02-12 15:55:21 +0800
committerYuqian Yang <crupest@crupest.life>2025-02-12 15:55:21 +0800
commit1ecfd0ab7f1f511268fd6404dbc110c3c277b48c (patch)
tree49449a4076ded9bd937a51679318edbe2a532cae /works/life/operating-system-experiment/CMakeLists.txt
parent55d8b025e8d6ea971e8ee5762c892405fedc316b (diff)
parentf8c10dd1fc55e60f35286475356e48c4f642eb63 (diff)
downloadcrupest-1ecfd0ab7f1f511268fd6404dbc110c3c277b48c.tar.gz
crupest-1ecfd0ab7f1f511268fd6404dbc110c3c277b48c.tar.bz2
crupest-1ecfd0ab7f1f511268fd6404dbc110c3c277b48c.zip
import(life): IMPORT crupest/life COMPLETE.
Diffstat (limited to 'works/life/operating-system-experiment/CMakeLists.txt')
-rw-r--r--works/life/operating-system-experiment/CMakeLists.txt37
1 files changed, 37 insertions, 0 deletions
diff --git a/works/life/operating-system-experiment/CMakeLists.txt b/works/life/operating-system-experiment/CMakeLists.txt
new file mode 100644
index 0000000..79fe786
--- /dev/null
+++ b/works/life/operating-system-experiment/CMakeLists.txt
@@ -0,0 +1,37 @@
+cmake_minimum_required(VERSION 3.20)
+
+set(CMAKE_TOOLCHAIN_FILE $ENV{VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake
+ CACHE STRING "Vcpkg toolchain file")
+
+project(operating-system-experiment)
+
+set(CMAKE_CXX_STANDARD 17)
+
+find_package(fmt CONFIG REQUIRED)
+find_package(Microsoft.GSL CONFIG REQUIRED)
+add_library(cru_system SHARED Thread.cpp Mutex.cpp Interlocked.cpp Semaphore.cpp)
+target_link_libraries(cru_system PUBLIC Microsoft.GSL::GSL fmt::fmt)
+target_compile_definitions(cru_system PUBLIC CRU_EXPORT_API)
+if(UNIX)
+target_link_libraries(cru_system PUBLIC pthread)
+endif()
+
+add_executable(main main.cpp)
+target_link_libraries(main PRIVATE cru_system)
+
+add_executable(data_race_demo DataRaceDemo.cpp)
+target_link_libraries(data_race_demo PRIVATE cru_system)
+
+add_executable(mutex_avoid_data_race_demo MutexAvoidDataRaceDemo.cpp)
+target_link_libraries(mutex_avoid_data_race_demo PRIVATE cru_system)
+
+add_executable(interlocked_avoid_data_race_demo InterlockedAvoidDataRaceDemo.cpp)
+target_link_libraries(interlocked_avoid_data_race_demo PRIVATE cru_system)
+
+add_executable(semaphore_avoid_data_race_demo SemaphoreAvoidDataRaceDemo.cpp)
+target_link_libraries(semaphore_avoid_data_race_demo PRIVATE cru_system)
+
+add_executable(parallel_calculation_demo ParallelCalculationDemo.cpp)
+target_link_libraries(parallel_calculation_demo PRIVATE cru_system)
+
+add_executable(dead_lock_detection_demo DeadLockDetectionDemo.cpp)