fix macro definitions for correct documentation

This commit is contained in:
Krishna Vedala
2020-07-05 20:13:25 -04:00
parent eec24b3545
commit 802a822c65
3 changed files with 49 additions and 41 deletions

View File

@@ -17,7 +17,38 @@ if(MSVC)
endif(MSVC)
option(USE_OPENMP "flag to use OpenMP for multithreading" ON)
if(USE_OPENMP)
find_package(OpenMP)
if (OpenMP_CXX_FOUND)
message(STATUS "Building with OpenMP Multithreading.")
else()
message(STATUS "No OpenMP found, no multithreading.")
endif()
endif()
find_package(OpenGL)
if(NOT OpenGL_FOUND)
message(WARNING "OpenGL not found, not compiling graphics programs.")
else(NOT OpenGL_FOUND)
find_package(GLUT)
if(NOT GLUT_FOUND)
message(WARNING "GLUT not found, not compiling graphics programs.")
endif(NOT GLUT_FOUND)
endif(NOT OpenGL_FOUND)
add_subdirectory(math)
add_subdirectory(others)
add_subdirectory(search)
add_subdirectory(ciphers)
add_subdirectory(strings)
add_subdirectory(sorting)
add_subdirectory(geometry)
add_subdirectory(graphics)
add_subdirectory(probability)
add_subdirectory(data_structures)
add_subdirectory(machine_learning)
add_subdirectory(numerical_methods)
cmake_policy(SET CMP0054 NEW)
cmake_policy(SET CMP0057 NEW)
find_package(Doxygen OPTIONAL_COMPONENTS dot dia)
@@ -34,6 +65,7 @@ if(DOXYGEN_FOUND)
set(DOXYGEN_STRIP_CODE_COMMENTS NO)
set(DOXYGEN_EXT_LINKS_IN_WINDOW YES)
set(DOXYGEN_BUILTIN_STL_SUPPORT YES)
set(DOXYGEN_ENABLE_PREPROCESSING YES)
set(DOXYGEN_CLANG_ASSISTED_PARSING YES)
set(DOXYGEN_FILE_PATTERNS *.cpp *.h *.hpp *.md)
set(DOXYGEN_MATHJAX_EXTENSIONS TeX/AMSmath TeX/AMSsymbols)
@@ -48,6 +80,12 @@ if(DOXYGEN_FOUND)
set(DOXYGEN_INTERACTIVE_SVG YES)
set(DOXYGEN_DOT_IMAGE_FORMAT "svg")
endif()
if(OPENMP_FOUND)
set(DOXYGEN_PREDEFINED "_OPENMP=1")
endif()
if(GLUT_FOUND)
set(DOXYGEN_PREDEFINED ${DOXYGEN_PREDEFINED} "GLUT_FOUND=1")
endif()
doxygen_add_docs(
doc
@@ -56,28 +94,6 @@ if(DOXYGEN_FOUND)
)
endif()
if(USE_OPENMP)
find_package(OpenMP)
if (OpenMP_CXX_FOUND)
message(STATUS "Building with OpenMP Multithreading.")
else()
message(STATUS "No OpenMP found, no multithreading.")
endif()
endif()
add_subdirectory(math)
add_subdirectory(others)
add_subdirectory(search)
add_subdirectory(ciphers)
add_subdirectory(strings)
add_subdirectory(sorting)
add_subdirectory(geometry)
add_subdirectory(graphics)
add_subdirectory(probability)
add_subdirectory(data_structures)
add_subdirectory(machine_learning)
add_subdirectory(numerical_methods)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)

View File

@@ -1,17 +1,6 @@
# If necessary, use the RELATIVE flag, otherwise each source file may be listed
# with full pathname. RELATIVE may makes it easier to extract an executable name
# automatically.
find_package(OpenGL)
if(NOT OpenGL_FOUND)
message(WARNING "OpenGL not found, not compiling graphics programs.")
else(NOT OpenGL_FOUND)
find_package(GLUT)
if(NOT GLUT_FOUND)
message(WARNING "GLUT not found, not compiling graphics programs.")
endif(NOT GLUT_FOUND)
endif(NOT OpenGL_FOUND)
file( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp )
# file( GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/*.c )
# AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APP_SOURCES)
@@ -28,7 +17,7 @@ foreach( testsourcefile ${APP_SOURCES} )
if(APPLE)
target_compile_options(${testname} PUBLIC -Wno-deprecated)
endif(APPLE)
target_compile_definitions(${testname} PUBLIC USE_GLUT)
target_compile_definitions(${testname} PUBLIC GLUT_FOUND)
target_include_directories(${testname} PUBLIC ${GLUT_INCLUDE_DIRS})
target_link_libraries(${testname} OpenGL::GL ${GLUT_LIBRARIES})
endif(GLUT_FOUND)

View File

@@ -26,7 +26,10 @@
#include <omp.h>
#endif
namespace {
/**
* @namespace spirograph Functions related to spirograph.c
*/
namespace spirograph {
/** Generate spirograph curve into arrays `x` and `y` such that the i^th point
* in 2D is represented by `(x[i],y[i])`. The generating function is given by:
* \f{eqnarray*}{
@@ -104,7 +107,7 @@ void test() {
fp.close();
}
#ifdef USE_GLUT // this is set by CMAKE automatically, if available
#ifdef GLUT_FOUND // this is set by CMAKE automatically, if available
#ifdef __APPLE__
#include <GLUT/glut.h> // include path on Macs is different
#else
@@ -211,21 +214,21 @@ void timer_cb(int t) {
glutPostRedisplay();
}
#endif
} // namespace
} // namespace spirograph
/** Main function */
int main(int argc, char **argv) {
#ifdef USE_GLUT
#ifdef GLUT_FOUND
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
glutCreateWindow("Spirograph");
glutInitWindowSize(400, 400);
// glutIdleFunc(glutPostRedisplay);
glutTimerFunc(25, timer_cb, 0);
glutDisplayFunc(test2);
glutTimerFunc(25, spirograph::timer_cb, 0);
glutDisplayFunc(spirograph::test2);
glutMainLoop();
#else
test();
spirograph::test();
#endif
return 0;