Skip to content

Commit afd70a6

Browse files
committed
Merge branch 'mcmctree_dating_onnx_merged'
2 parents 5d1e76d + 2983efb commit afd70a6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+8011
-1643
lines changed

.github/FUNDING.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 71 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,38 @@ include_directories("${PROJECT_SOURCE_DIR}")
151151
include_directories("${PROJECT_SOURCE_DIR}/yaml-cpp/include")
152152
include_directories(after system "/usr/local/include")
153153

154+
##################################################################
155+
# onnxruntime
156+
##################################################################
157+
option(USE_NN "Use neutual network (nn) with version 1.13 or later onnxruntime" OFF)
158+
option(USE_OLD_NN "Use neutual network (nn) with version 1.12 or before onnxruntime" OFF)
159+
160+
if(USE_NN)
161+
add_definitions(-D_NN)
162+
elseif(USE_OLD_NN)
163+
add_definitions(-D_OLD_NN)
164+
endif()
165+
166+
# Find onnxruntime library for machine learning
167+
if (USE_NN OR USE_OLD_NN)
168+
if (onnxruntime_INCLUDE_DIRS)
169+
add_definitions(-I${onnxruntime_INCLUDE_DIRS})
170+
else()
171+
find_package(onnxruntime)
172+
if(onnxruntime_FOUND)
173+
add_definitions(-I${onnxruntime_INCLUDE_DIRS})
174+
endif()
175+
endif()
176+
endif()
177+
178+
if(USE_NN OR USE_OLD_NN)
179+
if(NOT ONNXRUNTIME_ROOTDIR)
180+
if(WIN32)
181+
set(ONNXRUNTIME_ROOTDIR "C:/Program Files (x86)/onnxruntime")
182+
endif()
183+
endif()
184+
endif()
185+
154186
##################################################################
155187
# Include the Terraphast library
156188
##################################################################
@@ -393,6 +425,10 @@ if (__ARM_NEON AND APPLE)
393425
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Dthread_local=")
394426
endif()
395427

428+
##################################################################
429+
# detect 32 or 64 bit binary
430+
##################################################################
431+
set (BINARY32 "FALSE")
396432
if(CMAKE_SIZEOF_VOID_P EQUAL 4 OR IQTREE_FLAGS MATCHES "m32")
397433
error("32-bit compilation is not supported")
398434
else()
@@ -467,14 +503,14 @@ if (NOT IQTREE_FLAGS MATCHES "single")
467503
if(OSX_NATIVE_ARCHITECTURE STREQUAL "arm64")
468504
link_directories(${PROJECT_SOURCE_DIR}/libmac_m1)
469505
else()
470-
link_directories(${PROJECT_SOURCE_DIR}/libmac)
471-
endif()
506+
link_directories(${PROJECT_SOURCE_DIR}/libmac)
507+
endif()
472508
elseif (UNIX AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
473-
if (__ARM_NEON)
474-
link_directories(${PROJECT_SOURCE_DIR}/liblinux_arm)
475-
else()
476-
link_directories(${PROJECT_SOURCE_DIR}/lib)
477-
endif()
509+
if (__ARM_NEON)
510+
link_directories(${PROJECT_SOURCE_DIR}/liblinux_arm)
511+
else()
512+
link_directories(${PROJECT_SOURCE_DIR}/lib)
513+
endif()
478514
elseif (WIN32)
479515
link_directories(${PROJECT_SOURCE_DIR}/lib)
480516
endif()
@@ -749,6 +785,10 @@ add_subdirectory(tree)
749785
add_subdirectory(terrace)
750786
add_subdirectory(simulator)
751787

788+
if (USE_NN OR USE_OLD_NN)
789+
add_subdirectory(nn)
790+
endif()
791+
752792
if (USE_CMAPLE STREQUAL "ON")
753793
SET(INSTALL_CMAPLE OFF CACHE BOOL "Disable installation of googletest" FORCE)
754794
add_subdirectory(cmaple)
@@ -773,6 +813,10 @@ if (USE_LSD2)
773813
add_subdirectory(lsd2)
774814
endif()
775815

816+
##################################################################
817+
# the main executable
818+
##################################################################
819+
776820
add_library(kernelsse tree/phylokernelsse.cpp)
777821

778822
if (NOT IQTREE_FLAGS MATCHES "novx")
@@ -848,6 +892,10 @@ if (NOT IQTREE_FLAGS MATCHES "avx" AND NOT IQTREE_FLAGS MATCHES "fma")
848892
endif()
849893
endif()
850894

895+
if(USE_NN OR USE_OLD_NN)
896+
target_link_libraries(iqtree2 nn)
897+
endif()
898+
851899
##################################################################
852900
# setup linking flags
853901
##################################################################
@@ -884,7 +932,22 @@ if (USE_CMAPLE_AA STREQUAL "ON")
884932
target_link_libraries(iqtree2-aa pll ncl nclextra utils pda lbfgsb whtest sprng vectorclass model
885933
gsl alignment tree simulator terrace yaml-cpp phyloYAML main-aa maple-aa ${PLATFORM_LIB} ${STD_LIB} ${THREAD_LIB} ${ATOMIC_LIB})
886934
endif()
887-
935+
936+
# onnxruntime library
937+
if (USE_NN OR USE_OLD_NN)
938+
if (onnxruntime_LIBRARIES)
939+
target_link_libraries(iqtree2 ${onnxruntime_LIBRARIES})
940+
else()
941+
if (APPLE)
942+
target_link_libraries(iqtree2 /usr/local/lib/libonnxruntime.dylib)
943+
elseif(UNIX)
944+
target_link_libraries(iqtree2 /usr/local/lib/libonnxruntime.so)
945+
else()
946+
target_link_libraries(iqtree2 onnxruntime)
947+
endif()
948+
endif()
949+
endif()
950+
888951
if (USE_TERRAPHAST)
889952
target_link_libraries(iqtree2 terracetphast)
890953
if (USE_CMAPLE_AA STREQUAL "ON")

0 commit comments

Comments
 (0)