1
1
#########################################################################
2
- # DecentTree cmake build definition
2
+ # decenttree cmake build definition
3
3
# Copyright (c) 2012-2020 Bui Quang Minh, Lam-Tung Nguyen, James Barbetti
4
4
#########################################################################
5
5
6
- cmake_minimum_required (VERSION 2.8.10 FATAL_ERROR)
7
- project (decentTree )
6
+ cmake_minimum_required (VERSION 3.18.0 FATAL_ERROR)
7
+ project (decenttree )
8
8
9
9
# Windows example usages:
10
10
#------------------------
@@ -46,7 +46,6 @@ project(decentTree)
46
46
# assuming you installed LLVM via Homebrew: brew install --with-toolchain llvm
47
47
# cmake -G XCode -DCMAKE_XCODE_ATTRIBUTE_CC=/usr/local/opt/llvm/bin/clang -DCMAKE_XCODE_ATTRIBUTE_CXX=/usr/local/opt/llvm/bin/clang++ <source_dir>
48
48
#
49
- #
50
49
# Compile OpenMP version: cmake ....
51
50
# Compile 32-bit version: cmake -DDECENTTREE_FLAGS=m32 ....
52
51
# Compile static version: cmake -DDECENTTREE_FLAGS=static ....
@@ -60,12 +59,11 @@ project(decentTree)
60
59
61
60
set (CMAKE_LEGACY_CYGWIN_WIN32 0)
62
61
set (GCC_MIN_VERSION "4.8" )
63
- add_definitions (-DDECENT_TREE)
64
62
65
63
# The version number.
66
- set (decentTree_VERSION_MAJOR 1)
67
- set (decentTree_VERSION_MINOR 0)
68
- set (decentTree_VERSION_PATCH ".0" )
64
+ set (decenttree_VERSION_MAJOR 1)
65
+ set (decenttree_VERSION_MINOR 0)
66
+ set (decenttree_VERSION_PATCH ".0" )
69
67
70
68
if (CMAKE_C_COMPILER MATCHES "mpic" )
71
69
set (DECENTTREE_FLAGS "${DECENTTREE_FLAGS} mpi" )
@@ -493,27 +491,6 @@ if (DECENTTREE_FLAGS MATCHES "libcxx")
493
491
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++" )
494
492
endif ()
495
493
496
- message ("CMake build type: ${CMAKE_BUILD_TYPE} " )
497
-
498
- if (CMAKE_BUILD_TYPE STREQUAL "Release" )
499
- message ("C flags : ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE} " )
500
- message ("CXX flags : ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} " )
501
- elseif (CMAKE_BUILD_TYPE STREQUAL "Debug" )
502
- message ("C flags : ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG} " )
503
- message ("CXX flags : ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG} " )
504
- elseif (CMAKE_BUILD_TYPE STREQUAL "Profile" )
505
- message ("C flags : ${CMAKE_C_FLAGS_PROFILE} " )
506
- message ("CXX flags : ${CMAKE_CXX_FLAGS_PROFILE} " )
507
- else ()
508
- message ("C flags : ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE} " )
509
- message ("CXX flags : ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} " )
510
- endif ()
511
-
512
- message ("LINKER flags : ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_RELEASE} " )
513
- get_directory_property ( COMPILER_DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS )
514
- message ("Compiler defns : ${COMPILER_DEFINITIONS} " )
515
-
516
-
517
494
if (GCC)
518
495
set (CMAKE_CXX_FLAGS_DEBUG "-O0 -g -fno-inline-functions -fno-inline-functions-called-once -fno-default-inline -fno-inline" )
519
496
set (CMAKE_C_FLAGS_DEBUG "-O0 -g -fno-inline-functions -fno-inline-functions-called-once -fno-default-inline -fno-inline" )
@@ -545,12 +522,15 @@ configure_file (
545
522
"${PROJECT_BINARY_DIR} /decenttree_config.h"
546
523
)
547
524
525
+ configure_file (
526
+ "${PROJECT_SOURCE_DIR} /iqtree_config.h.in"
527
+ "${PROJECT_BINARY_DIR} /iqtree_config.h"
528
+ )
529
+
548
530
# add the binary tree to the search path for include files
549
531
# so that we will find decenttree_config.h
550
532
include_directories ("${PROJECT_BINARY_DIR} " )
551
533
552
- #zlib will be detected for appearance
553
- #include_directories("${PROJECT_BINARY_DIR}/zlib-1.2.7")
554
534
555
535
if (NOT DECENTTREE_FLAGS MATCHES "nozlib" )
556
536
find_package (ZLIB)
@@ -572,11 +552,36 @@ endif(ZLIB_FOUND)
572
552
add_subdirectory (vectorclass)
573
553
LIST (APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR} " )
574
554
555
+ add_compile_definitions (USE_PROGRESS_DISPLAY=1)
556
+ add_compile_definitions (USE_VECTORCLASS_LIBRARY=1)
557
+ add_compile_definitions (USE_GZSTREAM=1)
558
+ add_compile_definitions (DECENT_TREE=1)
559
+
560
+ message ("CMake build type: ${CMAKE_BUILD_TYPE} " )
561
+ message ("CMake source dir: ${CMAKE_SOURCE_DIR} " )
562
+ if (CMAKE_BUILD_TYPE STREQUAL "Release" )
563
+ message ("C flags : ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE} " )
564
+ message ("CXX flags : ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} " )
565
+ elseif (CMAKE_BUILD_TYPE STREQUAL "Debug" )
566
+ message ("C flags : ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG} " )
567
+ message ("CXX flags : ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG} " )
568
+ elseif (CMAKE_BUILD_TYPE STREQUAL "Profile" )
569
+ message ("C flags : ${CMAKE_C_FLAGS_PROFILE} " )
570
+ message ("CXX flags : ${CMAKE_CXX_FLAGS_PROFILE} " )
571
+ else ()
572
+ message ("C flags : ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE} " )
573
+ message ("CXX flags : ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} " )
574
+ endif ()
575
+ message ("LINKER flags : ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_RELEASE} " )
576
+ get_directory_property ( COMPILER_DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS )
577
+ message ("Compiler defns : ${COMPILER_DEFINITIONS} " )
578
+ message ("Binary directory: ${PROJECT_BINARY_DIR} " )
579
+
575
580
##################################################################
576
581
# the main executable
577
582
##################################################################
578
583
579
- add_executable (decentTree
584
+ add_executable (decenttree
580
585
decenttree.cpp
581
586
flatmatrix.cpp flatmatrix.h
582
587
starttree.cpp starttree.h
@@ -592,9 +597,9 @@ add_executable(decentTree
592
597
operatingsystem.cpp operatingsystem.h safe_io.h)
593
598
594
599
if (ZLIB_FOUND)
595
- target_link_libraries (decentTree ${ZLIB_LIBRARIES} )
600
+ target_link_libraries (decenttree ${ZLIB_LIBRARIES} )
596
601
else (ZLIB_FOUND)
597
- target_link_libraries (decentTree zlibstatic)
602
+ target_link_libraries (decenttree zlibstatic)
598
603
endif (ZLIB_FOUND)
599
604
600
605
add_executable (hod_tree
@@ -611,15 +616,10 @@ endif(Backtrace_FOUND)
611
616
612
617
if (NOT DECENTTREE_FLAGS MATCHES "avx" AND NOT DECENTTREE_FLAGS MATCHES "fma" )
613
618
if (NOT DECENTTREE_FLAGS MATCHES "nosse" )
614
- set_target_properties (decentTree vectorclass PROPERTIES COMPILE_FLAGS "${SSE_FLAGS} " )
619
+ set_target_properties (decenttree vectorclass PROPERTIES COMPILE_FLAGS "${SSE_FLAGS} " )
615
620
endif ()
616
621
endif ()
617
622
618
- add_compile_definitions (USE_PROGRESS_DISPLAY=1)
619
- add_compile_definitions (USE_VECTORCLASS_LIBRARY=1)
620
- add_compile_definitions (USE_GZSTREAM=1)
621
-
622
-
623
623
##################################################################
624
624
# setup linking flags
625
625
##################################################################
@@ -647,9 +647,9 @@ if (NOT DECENTTREE_FLAGS MATCHES "single")
647
647
endif ()
648
648
elseif (CLANG AND WIN32 )
649
649
if (BINARY32)
650
- target_link_libraries (decentTree ${PROJECT_SOURCE_DIR} /lib32/libiomp5md.dll)
650
+ target_link_libraries (decenttree ${PROJECT_SOURCE_DIR} /lib32/libiomp5md.dll)
651
651
else ()
652
- target_link_libraries (decentTree ${PROJECT_SOURCE_DIR} /lib/libiomp5md.dll)
652
+ target_link_libraries (decenttree ${PROJECT_SOURCE_DIR} /lib/libiomp5md.dll)
653
653
endif ()
654
654
# set(THREAD_LIB "ompstatic")
655
655
endif ()
@@ -661,7 +661,7 @@ if (NOT DECENTTREE_FLAGS MATCHES "single")
661
661
endif ()
662
662
663
663
# basic linking librararies
664
- target_link_libraries (decentTree vectorclass
664
+ target_link_libraries (decenttree vectorclass
665
665
${PLATFORM_LIB} ${STD_LIB} ${THREAD_LIB} ${ATOMIC_LIB} )
666
666
667
667
# MPI libraries
@@ -673,7 +673,7 @@ endif()
673
673
674
674
# setup the executable name
675
675
##################################################################
676
- set_target_properties (decentTree PROPERTIES OUTPUT_NAME "decentTree ${EXE_SUFFIX} " )
676
+ set_target_properties (decenttree PROPERTIES OUTPUT_NAME "decenttree ${EXE_SUFFIX} " )
677
677
678
678
# strip the release build
679
679
if (NOT DECENTTREE_FLAGS MATCHES "no-strip" AND CMAKE_BUILD_TYPE STREQUAL "Release" AND (GCC OR CLANG) AND NOT APPLE ) # strip is not necessary for MSVC
@@ -692,19 +692,19 @@ endif()
692
692
693
693
if (WIN32 )
694
694
if (MSVC )
695
- #ADD_CUSTOM_COMMAND(TARGET decentTree POST_BUILD COMMAND copy "${BINARY_DIR}/decentTree ${EXE_SUFFIX}.exe" "${BINARY_DIR}/decentTree${EXE_SUFFIX}-click.exe")
695
+ #ADD_CUSTOM_COMMAND(TARGET decenttree POST_BUILD COMMAND copy "${BINARY_DIR}/decenttree ${EXE_SUFFIX}.exe" "${BINARY_DIR}/decentTree${EXE_SUFFIX}-click.exe")
696
696
else ()
697
- ADD_CUSTOM_COMMAND (TARGET decentTree POST_BUILD COMMAND copy "decentTree ${EXE_SUFFIX} .exe" "decentTree${EXE_SUFFIX} -click.exe" )
697
+ ADD_CUSTOM_COMMAND (TARGET decenttree POST_BUILD COMMAND copy "decenttree ${EXE_SUFFIX} .exe" "decentTree${EXE_SUFFIX} -click.exe" )
698
698
endif ()
699
699
endif ()
700
700
701
701
##############################################################
702
702
# add the install targets
703
703
##############################################################
704
- install (TARGETS decentTree DESTINATION bin)
704
+ install (TARGETS decenttree DESTINATION bin)
705
705
706
706
if (WIN32 OR WIN64)
707
- install (FILES "${BINARY_DIR} /decentTree ${EXE_SUFFIX} -click.exe" DESTINATION bin)
707
+ install (FILES "${BINARY_DIR} /decenttree ${EXE_SUFFIX} -click.exe" DESTINATION bin)
708
708
if (NOT DECENTTREE_FLAGS MATCHES "single" AND MSVC )
709
709
if (BINARY32)
710
710
install (FILES "${PROJECT_SOURCE_DIR} /lib32/pthreadVC2.dll" DESTINATION bin)
0 commit comments