initial commit
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
build/
 | 
			
		||||
							
								
								
									
										60
									
								
								CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,60 @@
 | 
			
		||||
cmake_minimum_required(VERSION 3.0)
 | 
			
		||||
get_filename_component(project_name ${CMAKE_CURRENT_SOURCE_DIR} NAME)
 | 
			
		||||
project(${project_name})
 | 
			
		||||
 | 
			
		||||
set(EXTENSION           "cpp")
 | 
			
		||||
 | 
			
		||||
set(CMAKE_CXX_STANDARD  14)
 | 
			
		||||
 | 
			
		||||
set(FLAGS_ANY           "-Wall -Wextra -Winline")
 | 
			
		||||
set(FLAGS_DEBUG         "-DDEBUG -O0 -pg")
 | 
			
		||||
set(FLAGS_RELEASE       "-DNDEBUG -O2")
 | 
			
		||||
 | 
			
		||||
set(EXAMPLESDIRS        mp et)
 | 
			
		||||
 | 
			
		||||
set(INCLUDE_DIRS        "")
 | 
			
		||||
set(LIBRARIES           "-lpthread")
 | 
			
		||||
 | 
			
		||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
 | 
			
		||||
 | 
			
		||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS_ANY}")
 | 
			
		||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${FLAGS_ANY} ${FLAGS_DEBUG}")
 | 
			
		||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${FLAGS_ANY} ${FLAGS_RELEASE}")
 | 
			
		||||
 | 
			
		||||
## Examples
 | 
			
		||||
foreach(examplesdir ${EXAMPLESDIRS})
 | 
			
		||||
	set(examplesfulldir examples/${examplesdir})
 | 
			
		||||
	set(examplespath ${CMAKE_CURRENT_SOURCE_DIR}/${examplesfulldir})
 | 
			
		||||
	file(GLOB examples RELATIVE ${examplespath} ${examplespath}/*)
 | 
			
		||||
	if(examples)
 | 
			
		||||
		foreach(child ${examples})
 | 
			
		||||
			set(example_bin_filename "")
 | 
			
		||||
			set(example "")
 | 
			
		||||
			if(IS_DIRECTORY ${examplespath}/${child})
 | 
			
		||||
				set(example_bin_filename ${child})
 | 
			
		||||
				set(example ${examplesdir}_${example_bin_filename})
 | 
			
		||||
				file(GLOB_RECURSE example_src ${examplespath}/${child}/*.${EXTENSION})
 | 
			
		||||
			else()
 | 
			
		||||
				get_filename_component(extension ${child} EXT)
 | 
			
		||||
				if(${extension} MATCHES "^.${EXTENSION}$")
 | 
			
		||||
					get_filename_component(example_name ${child} NAME_WE)
 | 
			
		||||
					set(example_bin_filename ${example_name})
 | 
			
		||||
					set(example ${examplesdir}_${example_bin_filename})
 | 
			
		||||
					set(example_src ${examplespath}/${child})
 | 
			
		||||
				endif()
 | 
			
		||||
			endif()
 | 
			
		||||
			if(example)
 | 
			
		||||
				if(example_src)
 | 
			
		||||
					message(STATUS "+ Example: ${examplesdir}/${example}")
 | 
			
		||||
					add_executable(${example} ${example_src})
 | 
			
		||||
					target_include_directories(${example} PUBLIC ${SRCDIRS} ${LIBSDIRS} ${INCLUDE_DIRS})
 | 
			
		||||
					target_link_libraries(${example} ${LIBRARIES} ${USER_LIBRARIES})
 | 
			
		||||
					set_target_properties(${example} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${examplesfulldir})
 | 
			
		||||
					set_target_properties(${example} PROPERTIES OUTPUT_NAME ${example_bin_filename})
 | 
			
		||||
				else()
 | 
			
		||||
					message(WARNING "! Example ${example}: no sources")
 | 
			
		||||
				endif()
 | 
			
		||||
			endif()
 | 
			
		||||
		endforeach()
 | 
			
		||||
	endif()
 | 
			
		||||
endforeach()
 | 
			
		||||
							
								
								
									
										15
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
## Purpose
 | 
			
		||||
 | 
			
		||||
The purpose of this repository is to provide code examples that can be compiled and run for people reading my PhD thesis.
 | 
			
		||||
These examples codes are **not** for production and often are simplified with regard of technical specificities (for example, but not limited to, perfect forwarding).
 | 
			
		||||
 | 
			
		||||
## Usage
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
mkdir build
 | 
			
		||||
cd build
 | 
			
		||||
cmake ..
 | 
			
		||||
make
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
then run any example binary, located inside the `build/examples/` directory.
 | 
			
		||||
		Reference in New Issue
	
	Block a user