From 60cc59d1679634231d33ba25e2dbd6f1023a50e6 Mon Sep 17 00:00:00 2001 From: Martin Larralde Date: Mon, 21 Oct 2024 21:52:48 +0200 Subject: [PATCH] Fix OpenMP stub patch used for FastANI on MacOS --- src/FastANI/CMakeLists.txt | 3 ++- src/{pyfastani => FastANI}/omp.cpp | 2 ++ src/{pyfastani => FastANI}/omp.h | 1 + src/pyfastani/CMakeLists.txt | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) rename src/{pyfastani => FastANI}/omp.cpp (88%) rename src/{pyfastani => FastANI}/omp.h (86%) diff --git a/src/FastANI/CMakeLists.txt b/src/FastANI/CMakeLists.txt index 92dd225..f2ac771 100644 --- a/src/FastANI/CMakeLists.txt +++ b/src/FastANI/CMakeLists.txt @@ -33,7 +33,8 @@ foreach(_header ${FASTANI_HEADERS}) set(FASTANI_GENERATED_HEADERS ${FASTANI_GENERATED_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/include/${_header}) endforeach() -add_library(fastani src/cgi/core_genome_identity.cpp ${FASTANI_GENERATED_HEADERS}) +file(COPY omp.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/include/src) +add_library(fastani src/cgi/core_genome_identity.cpp omp.cpp ${FASTANI_GENERATED_HEADERS}) target_compile_definitions(fastani PUBLIC USE_BOOST=1 BOOST_NO_EXCEPTIONS=1) target_include_directories(fastani PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/include/src) diff --git a/src/pyfastani/omp.cpp b/src/FastANI/omp.cpp similarity index 88% rename from src/pyfastani/omp.cpp rename to src/FastANI/omp.cpp index f6c6889..54fe02a 100644 --- a/src/pyfastani/omp.cpp +++ b/src/FastANI/omp.cpp @@ -9,3 +9,5 @@ int omp_get_thread_num(void) { int omp_get_num_threads(void) { return 1; } + +void omp_set_num_threads(int) {} diff --git a/src/pyfastani/omp.h b/src/FastANI/omp.h similarity index 86% rename from src/pyfastani/omp.h rename to src/FastANI/omp.h index d55ee42..5c80f12 100644 --- a/src/pyfastani/omp.h +++ b/src/FastANI/omp.h @@ -8,6 +8,7 @@ extern "C" { extern int omp_get_thread_num(void); extern int omp_get_num_threads(void); +extern void omp_set_num_threads(int); #ifdef __cplusplus } diff --git a/src/pyfastani/CMakeLists.txt b/src/pyfastani/CMakeLists.txt index 336e0e9..62510f5 100644 --- a/src/pyfastani/CMakeLists.txt +++ b/src/pyfastani/CMakeLists.txt @@ -1,4 +1,4 @@ add_subdirectory(_sequtils) cython_extension(_fasta LINKS sequtils ) -cython_extension(_fastani LINKS fastani sequtils SOURCES omp.cpp _utils.cpp) \ No newline at end of file +cython_extension(_fastani LINKS fastani sequtils SOURCES _utils.cpp) \ No newline at end of file