File tree Expand file tree Collapse file tree 24 files changed +157
-127
lines changed
cpu_scheduling_algorithms
operations_on_datastructures Expand file tree Collapse file tree 24 files changed +157
-127
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,12 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
12
12
13
13
include (CTest) # for testing algorithms
14
14
15
+ option (ENABLE_TESTING "flag to test the repo" OFF )
16
+ if (ENABLE_TESTING)
17
+ message (STATUS "Testing enabled" )
18
+ enable_testing ()
19
+ endif ()
20
+
15
21
# Additional warnings and errors
16
22
if (MSVC )
17
23
add_compile_definitions (_CRT_SECURE_NO_WARNINGS)
@@ -23,13 +29,13 @@ endif()
23
29
option (USE_OPENMP "flag to use OpenMP for multithreading" ON )
24
30
if (USE_OPENMP)
25
31
find_package (OpenMP 3.0 COMPONENTS CXX)
26
- if (OpenMP_CXX_FOUND)
32
+ if (OpenMP_CXX_FOUND)
27
33
message (STATUS "Building with OpenMP Multithreading." )
28
34
else ()
29
35
message (STATUS "No OpenMP found, no multithreading." )
30
36
endif ()
31
37
endif ()
32
-
38
+
33
39
add_subdirectory (backtracking)
34
40
add_subdirectory (bit_manipulation)
35
41
add_subdirectory (ciphers)
@@ -59,19 +65,19 @@ cmake_policy(SET CMP0054 NEW)
59
65
cmake_policy (SET CMP0057 NEW)
60
66
61
67
find_package (Doxygen OPTIONAL_COMPONENTS dot dia)
62
- if (DOXYGEN_FOUND)
68
+ if (DOXYGEN_FOUND)
63
69
if (MSVC )
64
70
set (DOXYGEN_CPP_CLI_SUPPORT YES )
65
71
endif ()
66
72
67
73
if (Doxygen_dot_FOUND)
68
74
set (DOXYGEN_HAVE_DOT YES )
69
75
endif ()
70
-
76
+
71
77
if (OPENMP_FOUND)
72
78
set (DOXYGEN_PREDEFINED "_OPENMP=1" )
73
79
endif ()
74
-
80
+
75
81
if (GLUT_FOUND)
76
82
set (DOXYGEN_PREDEFINED ${DOXYGEN_PREDEFINED} "GLUT_FOUND=1" )
77
83
endif ()
Original file line number Diff line number Diff line change 1
1
# If necessary, use the RELATIVE flag, otherwise each source file may be listed
2
2
# with full pathname. RELATIVE may makes it easier to extract an executable name
3
3
# automatically.
4
- file ( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp )
4
+ file (GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
5
5
# file( GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/*.c )
6
6
# AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APP_SOURCES)
7
- foreach ( testsourcefile ${APP_SOURCES} )
7
+ foreach (testsourcefile ${APP_SOURCES} )
8
8
# I used a simple string replace, to cut off .cpp.
9
- string ( REPLACE ".cpp" "" testname ${testsourcefile} )
10
- add_executable ( ${testname} ${testsourcefile} )
9
+ string (REPLACE ".cpp" "" testname ${testsourcefile} )
10
+ add_executable (${testname} ${testsourcefile} )
11
11
12
12
set_target_properties (${testname} PROPERTIES LINKER_LANGUAGE CXX)
13
13
if (OpenMP_CXX_FOUND)
14
14
target_link_libraries (${testname} OpenMP::OpenMP_CXX)
15
15
endif ()
16
+ add_test (${testname} ${testname} )
16
17
install (TARGETS ${testname} DESTINATION "bin/backtracking" )
17
18
18
- endforeach ( testsourcefile ${APP_SOURCES} )
19
+ endforeach (testsourcefile ${APP_SOURCES} )
Original file line number Diff line number Diff line change 1
1
# If necessary, use the RELATIVE flag, otherwise each source file may be listed
2
2
# with full pathname. RELATIVE may makes it easier to extract an executable name
3
3
# automatically.
4
- file ( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp )
4
+ file (GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
5
5
# file( GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/*.c )
6
6
# AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APP_SOURCES)
7
- foreach ( testsourcefile ${APP_SOURCES} )
7
+ foreach (testsourcefile ${APP_SOURCES} )
8
8
# I used a simple string replace, to cut off .cpp.
9
- string ( REPLACE ".cpp" "" testname ${testsourcefile} )
10
- add_executable ( ${testname} ${testsourcefile} )
9
+ string (REPLACE ".cpp" "" testname ${testsourcefile} )
10
+ add_executable (${testname} ${testsourcefile} )
11
11
12
12
set_target_properties (${testname} PROPERTIES LINKER_LANGUAGE CXX)
13
13
if (OpenMP_CXX_FOUND)
14
14
target_link_libraries (${testname} OpenMP::OpenMP_CXX)
15
15
endif ()
16
+ add_test (${testname} ${testname} )
16
17
install (TARGETS ${testname} DESTINATION "bin/bit_manipulation" )
17
18
18
- endforeach ( testsourcefile ${APP_SOURCES} )
19
+ endforeach (testsourcefile ${APP_SOURCES} )
Original file line number Diff line number Diff line change 1
1
# If necessary, use the RELATIVE flag, otherwise each source file may be listed
2
2
# with full pathname. RELATIVE may makes it easier to extract an executable name
3
3
# automatically.
4
- file ( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp )
4
+ file (GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
5
5
# file( GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/*.c )
6
6
# AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APP_SOURCES)
7
- foreach ( testsourcefile ${APP_SOURCES} )
7
+ foreach (testsourcefile ${APP_SOURCES} )
8
8
# I used a simple string replace, to cut off .cpp.
9
- string ( REPLACE ".cpp" "" testname ${testsourcefile} )
10
- add_executable ( ${testname} ${testsourcefile} )
9
+ string (REPLACE ".cpp" "" testname ${testsourcefile} )
10
+ add_executable (${testname} ${testsourcefile} )
11
11
12
12
set_target_properties (${testname} PROPERTIES LINKER_LANGUAGE CXX)
13
13
if (OpenMP_CXX_FOUND)
14
14
target_link_libraries (${testname} OpenMP::OpenMP_CXX)
15
15
endif ()
16
+ add_test (${testname} ${testname} )
16
17
install (TARGETS ${testname} DESTINATION "bin/ciphers" )
17
18
18
- endforeach ( testsourcefile ${APP_SOURCES} )
19
+ endforeach (testsourcefile ${APP_SOURCES} )
Original file line number Diff line number Diff line change 2
2
# with full pathname. The RELATIVE flag makes it easier to extract an executable's name
3
3
# automatically.
4
4
5
- file ( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp )
6
- foreach ( testsourcefile ${APP_SOURCES} )
7
- string ( REPLACE ".cpp" "" testname ${testsourcefile} ) # File type. Example: `.cpp`
8
- add_executable ( ${testname} ${testsourcefile} )
5
+ file (GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
6
+ foreach (testsourcefile ${APP_SOURCES} )
7
+ string (REPLACE ".cpp" "" testname ${testsourcefile} ) # File type. Example: `.cpp`
8
+ add_executable (${testname} ${testsourcefile} )
9
9
10
10
set_target_properties (${testname} PROPERTIES LINKER_LANGUAGE CXX)
11
11
if (OpenMP_CXX_FOUND)
12
12
target_link_libraries (${testname} OpenMP::OpenMP_CXX)
13
13
endif ()
14
+ add_test (${testname} ${testname} )
14
15
install (TARGETS ${testname} DESTINATION "bin/cpu_scheduling_algorithms" ) # Folder name. Do NOT include `<>`
15
16
16
- endforeach ( testsourcefile ${APP_SOURCES} )
17
+ endforeach (testsourcefile ${APP_SOURCES} )
Original file line number Diff line number Diff line change 1
1
# If necessary, use the RELATIVE flag, otherwise each source file may be listed
2
2
# with full pathname. RELATIVE may makes it easier to extract an executable name
3
3
# automatically.
4
- file ( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp )
4
+ file (GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
5
5
# file( GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/*.c )
6
6
# AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APP_SOURCES)
7
- foreach ( testsourcefile ${APP_SOURCES} )
7
+ foreach (testsourcefile ${APP_SOURCES} )
8
8
# I used a simple string replace, to cut off .cpp.
9
- string ( REPLACE ".cpp" "" testname ${testsourcefile} )
10
- add_executable ( ${testname} ${testsourcefile} )
9
+ string (REPLACE ".cpp" "" testname ${testsourcefile} )
10
+ add_executable (${testname} ${testsourcefile} )
11
11
12
12
set_target_properties (${testname} PROPERTIES LINKER_LANGUAGE CXX)
13
13
if (OpenMP_CXX_FOUND)
14
14
target_link_libraries (${testname} OpenMP::OpenMP_CXX)
15
15
endif ()
16
+ add_test (${testname} ${testname} )
16
17
install (TARGETS ${testname} DESTINATION "bin/data_structures" )
17
18
18
- endforeach ( testsourcefile ${APP_SOURCES} )
19
+ endforeach (testsourcefile ${APP_SOURCES} )
19
20
20
21
add_subdirectory (cll)
Original file line number Diff line number Diff line change 1
1
# If necessary, use the RELATIVE flag, otherwise each source file may be listed
2
2
# with full pathname. RELATIVE may makes it easier to extract an executable name
3
3
# automatically.
4
- file ( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp )
4
+ file (GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
5
5
# file( GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/*.c )
6
6
# AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APP_SOURCES)
7
- foreach ( testsourcefile ${APP_SOURCES} )
7
+ foreach (testsourcefile ${APP_SOURCES} )
8
8
# I used a simple string replace, to cut off .cpp.
9
- string ( REPLACE ".cpp" "" testname ${testsourcefile} )
10
- add_executable ( ${testname} ${testsourcefile} )
9
+ string (REPLACE ".cpp" "" testname ${testsourcefile} )
10
+ add_executable (${testname} ${testsourcefile} )
11
11
12
12
set_target_properties (${testname} PROPERTIES LINKER_LANGUAGE CXX)
13
13
if (OpenMP_CXX_FOUND)
14
14
target_link_libraries (${testname} OpenMP::OpenMP_CXX)
15
15
endif ()
16
+ add_test (${testname} ${testname} )
16
17
install (TARGETS ${testname} DESTINATION "bin/divide_and_conquer" )
17
18
18
- endforeach ( testsourcefile ${APP_SOURCES} )
19
+ endforeach (testsourcefile ${APP_SOURCES} )
Original file line number Diff line number Diff line change 1
1
# If necessary, use the RELATIVE flag, otherwise each source file may be listed
2
2
# with full pathname. RELATIVE may makes it easier to extract an executable name
3
3
# automatically.
4
- file ( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp )
4
+ file (GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
5
5
# file( GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/*.c )
6
6
# AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APP_SOURCES)
7
- foreach ( testsourcefile ${APP_SOURCES} )
7
+ foreach (testsourcefile ${APP_SOURCES} )
8
8
# I used a simple string replace, to cut off .cpp.
9
- string ( REPLACE ".cpp" "" testname ${testsourcefile} )
10
- add_executable ( ${testname} ${testsourcefile} )
9
+ string (REPLACE ".cpp" "" testname ${testsourcefile} )
10
+ add_executable (${testname} ${testsourcefile} )
11
11
12
12
set_target_properties (${testname} PROPERTIES LINKER_LANGUAGE CXX)
13
13
if (OpenMP_CXX_FOUND)
14
14
target_link_libraries (${testname} OpenMP::OpenMP_CXX)
15
15
endif ()
16
+ add_test (${testname} ${testname} )
16
17
install (TARGETS ${testname} DESTINATION "bin/dynamic_programming" )
17
18
18
- endforeach ( testsourcefile ${APP_SOURCES} )
19
+ endforeach (testsourcefile ${APP_SOURCES} )
Original file line number Diff line number Diff line change 1
1
# If necessary, use the RELATIVE flag, otherwise each source file may be listed
2
2
# with full pathname. RELATIVE may makes it easier to extract an executable name
3
3
# automatically.
4
- file ( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp )
4
+ file (GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
5
5
# file( GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/*.c )
6
6
# AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APP_SOURCES)
7
- foreach ( testsourcefile ${APP_SOURCES} )
7
+ foreach (testsourcefile ${APP_SOURCES} )
8
8
# I used a simple string replace, to cut off .cpp.
9
- string ( REPLACE ".cpp" "" testname ${testsourcefile} )
10
- add_executable ( ${testname} ${testsourcefile} )
9
+ string (REPLACE ".cpp" "" testname ${testsourcefile} )
10
+ add_executable (${testname} ${testsourcefile} )
11
11
12
12
set_target_properties (${testname} PROPERTIES LINKER_LANGUAGE CXX)
13
13
if (OpenMP_CXX_FOUND)
14
14
target_link_libraries (${testname} OpenMP::OpenMP_CXX)
15
15
endif ()
16
+ add_test (${testname} ${testname} )
16
17
install (TARGETS ${testname} DESTINATION "bin/geometry" )
17
18
18
- endforeach ( testsourcefile ${APP_SOURCES} )
19
+ endforeach (testsourcefile ${APP_SOURCES} )
Original file line number Diff line number Diff line change 4
4
file (GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
5
5
#file(GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/*.c )
6
6
# AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APP_SOURCES)
7
- foreach ( testsourcefile ${APP_SOURCES} )
7
+ foreach (testsourcefile ${APP_SOURCES} )
8
8
# I used a simple string replace, to cut off .cpp.
9
- string ( REPLACE ".cpp" "" testname ${testsourcefile} )
10
- add_executable ( ${testname} ${testsourcefile} )
9
+ string (REPLACE ".cpp" "" testname ${testsourcefile} )
10
+ add_executable (${testname} ${testsourcefile} )
11
11
12
12
set_target_properties (${testname} PROPERTIES
13
13
LINKER_LANGUAGE CXX
14
14
)
15
15
if (OpenMP_CXX_FOUND)
16
16
target_link_libraries (${testname} OpenMP::OpenMP_CXX)
17
17
endif ()
18
+ add_test (${testname} ${testname} )
18
19
install (TARGETS ${testname} DESTINATION "bin/graph" )
19
20
20
- endforeach ( testsourcefile ${APP_SOURCES} )
21
+ endforeach (testsourcefile ${APP_SOURCES} )
You can’t perform that action at this time.
0 commit comments