Skip to content

Commit

Permalink
update for recursive CMake project
Browse files Browse the repository at this point in the history
  • Loading branch information
George K. Thiruvathukal committed Sep 25, 2021
1 parent 6844fcf commit ef44ac4
Show file tree
Hide file tree
Showing 39 changed files with 51 additions and 1,006 deletions.
45 changes: 45 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
project(OpSystemsCodeExamples)

cmake_minimum_required(VERSION 2.8.11)

set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

add_subdirectory(better_gets)
add_subdirectory(bounded-buffer)
add_subdirectory(c_intro)
add_subdirectory(dining-philosophers)
add_subdirectory(dir_list)
add_subdirectory(domain_sock)
add_subdirectory(file_rw)
add_subdirectory(fork)
add_subdirectory(fork_exec)
add_subdirectory(fork_pipe)
add_subdirectory(fork_sigchld)
add_subdirectory(fork_sigchld2)
add_subdirectory(getopt)
add_subdirectory(gnu_pth)
add_subdirectory(llnl_pthreads_examples)
add_subdirectory(malloc)
add_subdirectory(mmap)
add_subdirectory(mmap_locks)
add_subdirectory(monitor)
add_subdirectory(mutex)
add_subdirectory(objects)
add_subdirectory(parity)
add_subdirectory(qsort-demo)
add_subdirectory(read-write-demo)
add_subdirectory(regex-demo)
add_subdirectory(semaphore)
add_subdirectory(simple_adt)
add_subdirectory(spin_lock)
add_subdirectory(std-hsearch)
add_subdirectory(std-queue)
add_subdirectory(std-tsearch)
add_subdirectory(stm)
add_subdirectory(strbuffer_t)
add_subdirectory(strlen)
add_subdirectory(strtok)
add_subdirectory(syscall)
add_subdirectory(vectored_io)
add_subdirectory(wait)
28 changes: 0 additions & 28 deletions better_gets/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1 @@
project(BETTER_GETS_DEMO)
cmake_minimum_required(VERSION 2.6)

if (CMAKE_VERSION VERSION_LESS "3.1")
add_definitions(-std=c++11)
else()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()

if(UNIX AND NOT APPLE)
message(">> Linux")
add_compile_options(-DWITH_LINUX)
else()
message(">> non-Linux")
add_compile_options(-DWITH_APPLE)
endif()


set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

#find_package(GTest REQUIRED)
#include_directories(${GTEST_INCLUDE_DIRS})

# Link runTests with what we want to test and the GTest and pthread library

add_executable(better-gets-demo main.c)
20 changes: 0 additions & 20 deletions bounded-buffer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,3 @@
project("pthreads")

cmake_minimum_required(VERSION 2.6)

# https://stackoverflow.com/questions/6594796/how-do-i-make-cmake-output-into-a-bin-dir
# We only need 'bin' here.


# Just ignore this. Only needed when using GoogleTest.
if (CMAKE_VERSION VERSION_LESS "3.1")
add_definitions(-std=c++11)
else()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()

set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

add_executable(bounded-buffer bounded-buffer.c bbuffer.c bbuffer.h bboptions.c bboptions.h millisleep.c millisleep.h)
target_link_libraries(bounded-buffer pthread)

28 changes: 0 additions & 28 deletions c_intro/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1 @@
project(C_INTRO_DEMO)
cmake_minimum_required(VERSION 2.6)

if (CMAKE_VERSION VERSION_LESS "3.1")
add_definitions(-std=c++11)
else()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()

if(UNIX AND NOT APPLE)
message(">> Linux")
add_compile_options(-DWITH_LINUX)
else()
message(">> non-Linux")
add_compile_options(-DWITH_APPLE)
endif()


set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

#find_package(GTest REQUIRED)
#include_directories(${GTEST_INCLUDE_DIRS})

# Link runTests with what we want to test and the GTest and pthread library

add_executable(c-intro-demo main.cc debug.cc list.cc tests.cc)
15 changes: 0 additions & 15 deletions dining-philosophers/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
project("diners")

cmake_minimum_required(VERSION 2.6)

# Just ignore this. Only needed when using GoogleTest.
if (CMAKE_VERSION VERSION_LESS "3.1")
add_definitions(-std=c++11)
else()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

add_executable(diner-demo diner-demo.c diners.h diners.c millisleep.h millisleep.c)
target_link_libraries(diner-demo pthread)

28 changes: 0 additions & 28 deletions dir_list/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1 @@
project(DIRLIST_DEMO)
cmake_minimum_required(VERSION 2.6)

if (CMAKE_VERSION VERSION_LESS "3.1")
add_definitions(-std=c++11)
else()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()

if(UNIX AND NOT APPLE)
message(">> Linux")
add_compile_options(-DWITH_LINUX)
else()
message(">> non-Linux")
add_compile_options(-DWITH_APPLE)
endif()


set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

#find_package(GTest REQUIRED)
#include_directories(${GTEST_INCLUDE_DIRS})

# Link runTests with what we want to test and the GTest and pthread library

add_executable(dirlist-demo main.c)
29 changes: 0 additions & 29 deletions domain_sock/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,31 +1,2 @@
project(CLIENT_SERVER_DEMO)
cmake_minimum_required(VERSION 2.6)

if (CMAKE_VERSION VERSION_LESS "3.1")
add_definitions(-std=c++11)
else()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()

if(UNIX AND NOT APPLE)
message(">> Linux")
add_compile_options(-DWITH_LINUX)
else()
message(">> non-Linux")
add_compile_options(-DWITH_APPLE)
endif()


set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

#find_package(GTest REQUIRED)
#include_directories(${GTEST_INCLUDE_DIRS})

# Link runTests with what we want to test and the GTest and pthread library

add_executable(client client.c)

add_executable(server server.c)
28 changes: 0 additions & 28 deletions file_rw/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1 @@
project(FILE_RW__DEMO)
cmake_minimum_required(VERSION 2.6)

if (CMAKE_VERSION VERSION_LESS "3.1")
add_definitions(-std=c++11)
else()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()

if(UNIX AND NOT APPLE)
message(">> Linux")
add_compile_options(-DWITH_LINUX)
else()
message(">> non-Linux")
add_compile_options(-DWITH_APPLE)
endif()


set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

#find_package(GTest REQUIRED)
#include_directories(${GTEST_INCLUDE_DIRS})

# Link runTests with what we want to test and the GTest and pthread library

add_executable(file-rw-demo main.c)
28 changes: 0 additions & 28 deletions fork/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1 @@
project(FORK_DEMO)
cmake_minimum_required(VERSION 2.6)

if (CMAKE_VERSION VERSION_LESS "3.1")
add_definitions(-std=c++11)
else()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()

if(UNIX AND NOT APPLE)
message(">> Linux")
add_compile_options(-DWITH_LINUX)
else()
message(">> non-Linux")
add_compile_options(-DWITH_APPLE)
endif()


set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

#find_package(GTest REQUIRED)
#include_directories(${GTEST_INCLUDE_DIRS})

# Link runTests with what we want to test and the GTest and pthread library

add_executable(fork-demo main.c)
28 changes: 0 additions & 28 deletions fork_exec/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1 @@
project(FORK_EXEC_DEMO)
cmake_minimum_required(VERSION 2.6)

if (CMAKE_VERSION VERSION_LESS "3.1")
add_definitions(-std=c++11)
else()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()

if(UNIX AND NOT APPLE)
message(">> Linux")
add_compile_options(-DWITH_LINUX)
else()
message(">> non-Linux")
add_compile_options(-DWITH_APPLE)
endif()


set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

#find_package(GTest REQUIRED)
#include_directories(${GTEST_INCLUDE_DIRS})

# Link runTests with what we want to test and the GTest and pthread library

add_executable(fork-exec-demo main.c)
28 changes: 0 additions & 28 deletions fork_pipe/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1 @@
project(FORK_PIPE_DEMO)
cmake_minimum_required(VERSION 2.6)

if (CMAKE_VERSION VERSION_LESS "3.1")
add_definitions(-std=c++11)
else()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()

if(UNIX AND NOT APPLE)
message(">> Linux")
add_compile_options(-DWITH_LINUX)
else()
message(">> non-Linux")
add_compile_options(-DWITH_APPLE)
endif()


set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

#find_package(GTest REQUIRED)
#include_directories(${GTEST_INCLUDE_DIRS})

# Link runTests with what we want to test and the GTest and pthread library

add_executable(fork-pipe-demo main.c)
28 changes: 0 additions & 28 deletions fork_sigchld/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1 @@
project(FORK_SIGCHLD_DEMO)
cmake_minimum_required(VERSION 2.6)

if (CMAKE_VERSION VERSION_LESS "3.1")
add_definitions(-std=c++11)
else()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()

if(UNIX AND NOT APPLE)
message(">> Linux")
add_compile_options(-DWITH_LINUX)
else()
message(">> non-Linux")
add_compile_options(-DWITH_APPLE)
endif()


set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

#find_package(GTest REQUIRED)
#include_directories(${GTEST_INCLUDE_DIRS})

# Link runTests with what we want to test and the GTest and pthread library

add_executable(fork-sigchld-demo main.c)
28 changes: 0 additions & 28 deletions fork_sigchld2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1 @@
project(FORK_SIGCHLD2_DEMO)
cmake_minimum_required(VERSION 2.6)

if (CMAKE_VERSION VERSION_LESS "3.1")
add_definitions(-std=c++11)
else()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()

if(UNIX AND NOT APPLE)
message(">> Linux")
add_compile_options(-DWITH_LINUX)
else()
message(">> non-Linux")
add_compile_options(-DWITH_APPLE)
endif()


set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

#find_package(GTest REQUIRED)
#include_directories(${GTEST_INCLUDE_DIRS})

# Link runTests with what we want to test and the GTest and pthread library

add_executable(fork-sigchld2-demo main.c)
Loading

0 comments on commit ef44ac4

Please sign in to comment.