diff --git a/CMakeLists.txt b/CMakeLists.txt index 508562cbeeb06353501bef996560404984a99458..f9bfbe9fe8b0c38812962fc094a5b0b0f905b04f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -228,6 +228,22 @@ set(SQL_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/database/memory.sql ) +### ### +# TEST OPENMP # +### ### + +try_compile(OPENMP_SUPPORT_OK + ${CMAKE_BINARY_DIR/___openmp_test_ok + ${CMAKE_CURRENT_SOURCE_DIR}/utils/cmake/TestOpenMP.c} + LINK_LIBRARIES -fopenmp +) + +if(OPENMP_SUPPORT_OK) + message(STATUS "Compiler has OpenMP support") +else() + message(FATAL_ERROR "Compiler doesn't have OpenMP support") +endif() + ### ### # THE COMPILATION DIRECTIVES # ### ### @@ -258,8 +274,8 @@ else() ${SQL_GENERATED_FILE} ) endif() -add_executable(lkt ${lkt_SOURCES}) -add_executable(luka ${luka_SOURCES} ${SQL_GENERATED_FILE}) +add_executable(lkt ${lkt_SOURCES}) +add_executable(luka ${luka_SOURCES} ${SQL_GENERATED_FILE}) set(MANPAGES_COMMANDS) if(GENERATE_MANPAGES) diff --git a/README.md b/README.md index 3467535e804c088ac08725d8f34bc8789df5a027..6bf616d8e3e9eec01c7b79cb04fc897b4d42d064 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,9 @@ A Karaoke player made to replace the old bash scripts on Sakura. - [cmake](https://cmake.org/) with at least the version 3.17 - a C compiler with C11 support +- a C++ compiler with C++20 support (for the Qt5 module) +- The C and C++ compilers must have OpenMP support (see the + [OpenMP C test program](utils/cmake/TestOpenMp.c)) - the [sqlite3](https://www.sqlite.org/) development library, version 3.31.0 or newer for [generated columns](https://www.sqlite.org/gencol.html) support - a POSIX.1-2008 compatible system (for MS Windows, use something like WSL2) diff --git a/utils/cmake/TestOpenMP.c b/utils/cmake/TestOpenMP.c new file mode 100644 index 0000000000000000000000000000000000000000..63c7d73b77ec5f263b6032a07c0d3a1a86eb2139 --- /dev/null +++ b/utils/cmake/TestOpenMP.c @@ -0,0 +1,14 @@ +int +main(void) +{ + int res = 0; + int A[10]; + memset(&A, 1, sizeof(A)); + + #pragma omp parallel for shared(A, res) reduction (+res) + for (int i = 0; i < 10; i += 1) { + res += A[i] + } + + return res; +} \ No newline at end of file