1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
|
Description: Do not use external libraries - use system libraries
Author: Steffen Moeller <moeller@debian.org>, Andreas Tille <tille@debian.org>, Nilesh Patra <npatra974@gmail.com>
Forwarded: not-needed
Last-Update: 2020-10-27
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,8 +11,8 @@
find_package(Threads REQUIRED)
# Use all standard-compliant optimizations
-set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -mcx16 -g")
-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -mcx16 -g")
+set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -g -fPIC -fopenmp")
+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -g -fPIC -fopenmp")
# Set the output folder where your program will be created
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/bin)
@@ -22,110 +22,22 @@
# The following folder will be included
include_directories("${PROJECT_SOURCE_DIR}")
-# Add external projects
-include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
-
-# TODO: We're using INSTALL_DIR very wrong. We *should* be actually installing
-# the external projects into their prefixes and working with the installed
-# files. Instead we're building but not installing them and trying to work with
-# the non-installed build trees.
-#
-# Hence the blanked out INSTALL_COMMANDs to suppress the install step.
-#
-# We need to NOT blank out UPDATE_COMMAND or we can never change the Git revision we point to.
-# The cost of this is that we have to re-configure on every build if we do update.
-
-# sdsl-lite (full build using its cmake config)
-ExternalProject_Add(sdsl-lite
- GIT_REPOSITORY "https://github.com/simongog/sdsl-lite.git"
- GIT_TAG "ddb0fbbc33bb183baa616f17eb48e261ac2a3672"
- CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_DIR} # TODO ADD static build flag
- UPDATE_COMMAND ""
- INSTALL_COMMAND "")
-ExternalProject_Get_property(sdsl-lite INSTALL_DIR)
-set(sdsl-lite_INCLUDE "${INSTALL_DIR}/src/sdsl-lite-build/include")
-set(sdsl-lite-divsufsort_INCLUDE "${INSTALL_DIR}/src/sdsl-lite-build/external/libdivsufsort/include")
-set(sdsl-lite_LIB "${INSTALL_DIR}/src/sdsl-lite-build/lib")
-set(sdsl-lite-divsufsort_LIB "${INSTALL_DIR}/src/sdsl-lite-build/external/libdivsufsort/lib")
-
-# DYNAMIC (full build using its cmake config)
-ExternalProject_Add(dynamic
- GIT_REPOSITORY "https://github.com/vgteam/DYNAMIC.git"
- GIT_TAG "615d8be5276bcd4c5a3d8e31679b4f8e81b2eefc"
- # we don't actually install dynamic... it's header only
- #CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_DIR}
- UPDATE_COMMAND ""
- INSTALL_COMMAND ""
- BUILD_COMMAND ""
- CONFIGURE_COMMAND "")
-ExternalProject_Get_property(dynamic INSTALL_DIR)
-set(dynamic_INCLUDE "${INSTALL_DIR}/src/dynamic/include")
-
-# In-place Parallel Super Scalar Samplesort (IPS⁴o), header only
-ExternalProject_Add(ips4o
- GIT_REPOSITORY "https://github.com/SaschaWitt/ips4o.git"
- GIT_TAG "a34d7d40c0f1279510e35e0dc2c69637b3c5d0b6"
- #GIT_REPOSITORY "https://github.com/ekg/ips4o.git"
- #GIT_TAG "f7eccc5a26928b5c0772922f7b76072414ef1801"
- UPDATE_COMMAND ""
- INSTALL_COMMAND ""
- BUILD_COMMAND ""
- CONFIGURE_COMMAND "")
-ExternalProject_Get_property(ips4o SOURCE_DIR)
-set(ips4o_INCLUDE "${SOURCE_DIR}")
-
-# atomic queue
-ExternalProject_Add(atomicqueue
- GIT_REPOSITORY "https://github.com/max0x7ba/atomic_queue.git"
- GIT_TAG "430f732da0889b090705ad00ce15d4463fe7b536"
- UPDATE_COMMAND ""
- INSTALL_COMMAND ""
- BUILD_COMMAND ""
- CONFIGURE_COMMAND "")
-ExternalProject_Get_property(atomicqueue SOURCE_DIR)
-set(atomicqueue_INCLUDE "${SOURCE_DIR}")
-
-# paryfor parallel_for
-ExternalProject_Add(paryfor
- GIT_REPOSITORY "https://github.com/ekg/paryfor"
- GIT_TAG "509b28a092f732a068e2908bb9e359a8562cd32f"
- UPDATE_COMMAND ""
- INSTALL_COMMAND ""
- BUILD_COMMAND ""
- CONFIGURE_COMMAND "")
-ExternalProject_Get_property(paryfor SOURCE_DIR)
-set(paryfor_INCLUDE "${SOURCE_DIR}")
-
-# taywee's C++ args library, header only
-ExternalProject_Add(tayweeargs
- GIT_REPOSITORY "https://github.com/Taywee/args.git"
- GIT_TAG "3de44ec671db452cc0c4ef86399b108939768abb"
- UPDATE_COMMAND ""
- INSTALL_COMMAND "")
-ExternalProject_Get_property(tayweeargs SOURCE_DIR)
-set(tayweeargs_INCLUDE "${SOURCE_DIR}")
-
-#set(CMAKE_BUILD_TYPE Release)
+set(atomicqueue_INCLUDE "/usr/include/atomic_queue")
# set up our target executable and specify its dependencies and includes
add_executable(mmmulti
${CMAKE_SOURCE_DIR}/src/main.cpp
)
-add_dependencies(mmmulti sdsl-lite)
-add_dependencies(mmmulti dynamic)
-add_dependencies(mmmulti ips4o)
-add_dependencies(mmmulti atomicqueue)
-add_dependencies(mmmulti paryfor)
-add_dependencies(mmmulti tayweeargs)
target_include_directories(mmmulti PUBLIC
"${CMAKE_SOURCE_DIR}/src"
- "${sdsl-lite_INCLUDE}"
- "${sdsl-lite-divsufsort_INCLUDE}"
- "${dynamic_INCLUDE}"
- "${ips4o_INCLUDE}"
+# "${sdsl-lite_INCLUDE}"
+# "${sdsl-lite-divsufsort_INCLUDE}"
+# "${dynamic_INCLUDE}"
+# "${ips4o_INCLUDE}"
"${atomicqueue_INCLUDE}"
- "${paryfor_INCLUDE}"
- "${tayweeargs_INCLUDE}")
+# "${paryfor_INCLUDE}"
+# "${tayweeargs_INCLUDE}"
+ )
# macOS doesn't want you to link in libatomic this way
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
@@ -137,9 +49,9 @@
)
elseif (TRUE)
target_link_libraries(mmmulti
- "${sdsl-lite_LIB}/libsdsl.a"
- "${sdsl-lite-divsufsort_LIB}/libdivsufsort.a"
- "${sdsl-lite-divsufsort_LIB}/libdivsufsort64.a"
+ "-lsdsl"
+ "-ldivsufsort"
+ "-ldivsufsort64"
"-latomic"
Threads::Threads
)
@@ -150,7 +62,7 @@
elseif (TRUE)
# this was hard to track down
# https://stackoverflow.com/questions/35116327/when-g-static-link-pthread-cause-segmentation-fault-why
- set(CMAKE_EXE_LINKER_FLAGS "-static -Wl,--whole-archive -lpthread -Wl,--no-whole-archive")
+ set (CMAKE_SHARED_LINKER_FLAGS "-lpthread -Wl,--as-needed")
endif()
|