2020-07-10 22:48:07 +03:00
|
|
|
cmake_minimum_required(VERSION 3.6)
|
2020-04-07 06:50:46 +03:00
|
|
|
project(Algorithms_in_C
|
2020-05-29 17:47:36 +03:00
|
|
|
LANGUAGES C
|
2020-04-07 06:50:46 +03:00
|
|
|
VERSION 1.0.0
|
|
|
|
DESCRIPTION "Set of algorithms implemented in C."
|
|
|
|
)
|
|
|
|
|
2020-07-23 17:44:18 +03:00
|
|
|
# Set compilation standards
|
2020-07-10 22:48:07 +03:00
|
|
|
set(CMAKE_C_STANDARD 11)
|
|
|
|
set(CMAKE_C_STANDARD_REQUIRED YES)
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
|
|
|
# add_compile_options(/Za)
|
|
|
|
endif(MSVC)
|
|
|
|
|
2020-07-23 17:44:18 +03:00
|
|
|
# check for math library
|
|
|
|
# addresses a bug when linking on OSX
|
2020-07-10 22:48:07 +03:00
|
|
|
find_library(MATH_LIBRARY m)
|
|
|
|
|
2021-10-03 21:16:43 +03:00
|
|
|
# Optional flag - can be set by user
|
2020-07-23 17:44:18 +03:00
|
|
|
# Default "ON"
|
2020-04-07 07:24:13 +03:00
|
|
|
option(USE_OPENMP "flag to use OpenMP for multithreading" ON)
|
2020-07-10 22:48:07 +03:00
|
|
|
if(USE_OPENMP)
|
|
|
|
find_package(OpenMP)
|
|
|
|
if (OpenMP_C_FOUND)
|
|
|
|
message(STATUS "Building with OpenMP Multithreading.")
|
|
|
|
else()
|
|
|
|
message(STATUS "No OpenMP found, no multithreading.")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2020-07-23 17:44:18 +03:00
|
|
|
## Check for some required header files
|
|
|
|
include(CheckIncludeFile)
|
|
|
|
include(CheckSymbolExists)
|
|
|
|
check_include_file(stdbool.h HAS_STDBOOL_H)
|
|
|
|
check_include_file(inttypes.h HAS_INTTYPES_H)
|
|
|
|
check_include_file(complex.h HAS_COMPLEX_H)
|
|
|
|
if(HAS_COMPLEX_H)
|
|
|
|
check_symbol_exists(complex complex.h HAS_COMPLEX_TYPE)
|
|
|
|
endif(HAS_COMPLEX_H)
|
|
|
|
if (NOT HAS_STDBOOL_H)
|
|
|
|
message(FATAL_ERROR "Missing required header: 'stdbool.h'")
|
|
|
|
endif()
|
|
|
|
if (NOT HAS_INTTYPES_H)
|
|
|
|
message(FATAL_ERROR "Missing required header: 'inttypes.h'")
|
|
|
|
endif()
|
|
|
|
|
2021-10-03 21:16:43 +03:00
|
|
|
## Add subdirectories containing CMakeLists.txt
|
2020-07-23 17:44:18 +03:00
|
|
|
# to configure and compile files in the respective folders
|
2021-02-18 01:38:41 +03:00
|
|
|
add_subdirectory(developer_tools)
|
2020-07-29 20:18:11 +03:00
|
|
|
add_subdirectory(hash)
|
2020-07-10 22:48:07 +03:00
|
|
|
add_subdirectory(misc)
|
2020-07-31 14:00:30 +03:00
|
|
|
add_subdirectory(games)
|
2021-10-03 21:16:43 +03:00
|
|
|
add_subdirectory(audio)
|
2020-07-10 22:48:07 +03:00
|
|
|
add_subdirectory(sorting)
|
2020-08-17 00:39:31 +03:00
|
|
|
add_subdirectory(geometry)
|
2020-07-10 22:48:07 +03:00
|
|
|
add_subdirectory(graphics)
|
|
|
|
add_subdirectory(searching)
|
|
|
|
add_subdirectory(conversions)
|
2020-07-22 05:59:18 +03:00
|
|
|
add_subdirectory(client_server)
|
2020-07-10 22:48:07 +03:00
|
|
|
add_subdirectory(project_euler)
|
|
|
|
add_subdirectory(machine_learning)
|
2022-12-28 23:35:41 +03:00
|
|
|
add_subdirectory(process_scheduling_algorithms)
|
2020-07-10 22:48:07 +03:00
|
|
|
add_subdirectory(numerical_methods)
|
2023-03-24 22:27:10 +03:00
|
|
|
add_subdirectory(math)
|
2023-03-29 23:42:08 +03:00
|
|
|
add_subdirectory(cipher)
|
2020-04-07 07:24:13 +03:00
|
|
|
|
2020-07-23 17:44:18 +03:00
|
|
|
## Configure Doxygen documentation system
|
2020-05-25 05:28:28 +03:00
|
|
|
cmake_policy(SET CMP0054 NEW)
|
|
|
|
cmake_policy(SET CMP0057 NEW)
|
|
|
|
find_package(Doxygen OPTIONAL_COMPONENTS dot dia)
|
|
|
|
if(DOXYGEN_FOUND)
|
2020-06-05 16:08:37 +03:00
|
|
|
set(DOXYGEN_GENERATE_MAN NO)
|
2020-05-25 05:28:28 +03:00
|
|
|
set(DOXYGEN_USE_MATHJAX YES)
|
2020-05-26 02:17:03 +03:00
|
|
|
set(DOXYGEN_GENERATE_HTML YES)
|
2020-06-28 18:27:18 +03:00
|
|
|
# set(DOXYGEN_HTML_TIMESTAMP YES)
|
2020-05-29 17:16:55 +03:00
|
|
|
set(DOXYGEN_EXTRACT_STATIC YES)
|
2020-05-25 05:28:28 +03:00
|
|
|
set(DOXYGEN_INLINE_SOURCES YES)
|
2020-05-26 02:06:21 +03:00
|
|
|
set(DOXYGEN_CREATE_SUBDIRS YES)
|
2020-06-05 16:22:46 +03:00
|
|
|
set(DOXYGEN_GENERATE_TREEVIEW YES)
|
2020-06-28 22:30:06 +03:00
|
|
|
set(DOXYGEN_JAVADOC_AUTOBRIEF YES)
|
2020-05-25 05:28:28 +03:00
|
|
|
set(DOXYGEN_STRIP_CODE_COMMENTS NO)
|
2020-07-10 22:48:07 +03:00
|
|
|
set(DOXYGEN_ENABLE_PREPROCESSING YES)
|
2020-06-05 16:08:37 +03:00
|
|
|
set(DOXYGEN_EXT_LINKS_IN_WINDOW YES)
|
2020-05-26 02:06:21 +03:00
|
|
|
set(DOXYGEN_OPTIMIZE_OUTPUT_FOR_C YES)
|
2020-06-05 16:08:37 +03:00
|
|
|
set(DOXYGEN_CLANG_ASSISTED_PARSING YES)
|
2020-05-29 17:16:55 +03:00
|
|
|
set(DOXYGEN_FILE_PATTERNS *.c *.h *.md)
|
|
|
|
set(DOXYGEN_MATHJAX_EXTENSIONS TeX/AMSmath TeX/AMSsymbols)
|
|
|
|
set(DOXYGEN_TAGFILES "doc/cppreference-doxygen-web.tag.xml=http://en.cppreference.com/w/")
|
2020-05-26 04:21:26 +03:00
|
|
|
set(DOXYGEN_MATHJAX_RELPATH "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML")
|
2020-05-25 05:28:28 +03:00
|
|
|
if(Doxygen_dot_FOUND)
|
|
|
|
set(DOXYGEN_HAVE_DOT YES)
|
2020-05-26 00:02:03 +03:00
|
|
|
set(DOXYGEN_CALL_GRAPH YES)
|
2020-05-25 05:28:28 +03:00
|
|
|
set(DOXYGEN_INTERACTIVE_SVG YES)
|
2020-05-26 02:17:03 +03:00
|
|
|
set(DOXYGEN_DOT_IMAGE_FORMAT "svg")
|
2020-05-25 05:28:28 +03:00
|
|
|
endif()
|
2020-07-10 22:48:07 +03:00
|
|
|
if(OPENMP_FOUND)
|
|
|
|
set(DOXYGEN_PREDEFINED "_OPENMP=1")
|
|
|
|
endif()
|
|
|
|
if(GLUT_FOUND)
|
|
|
|
set(DOXYGEN_PREDEFINED ${DOXYGEN_PREDEFINED} "GLUT_FOUND=1")
|
|
|
|
endif()
|
2020-05-25 05:28:28 +03:00
|
|
|
|
|
|
|
doxygen_add_docs(
|
|
|
|
doc
|
|
|
|
${PROJECT_SOURCE_DIR}
|
|
|
|
COMMENT "Generate documentation"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2020-07-23 17:44:18 +03:00
|
|
|
## Enable tool to generate binary distribution files
|
2020-04-07 06:50:46 +03:00
|
|
|
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
|
|
|
|
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
|
|
|
|
include(CPack)
|