forked from kempj/hpxMP
-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
120 lines (95 loc) · 3.43 KB
/
CMakeLists.txt
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
# Copyright (c) 2018 Bibek Wagle
# Copyright (c) 2018 Tianyi Zhang
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
PROJECT(HPXMP CXX ASM)
cmake_minimum_required(VERSION 2.8)
execute_process(COMMAND gcc -dumpmachine OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE ARCH)
if(${ARCH} STREQUAL "riscv64-linux-gnu")
set(ASM_SOURCE_FILE src/riscv64_asm_functions.s)
else()
set(ASM_SOURCE_FILE src/asm_functions.s)
endif()
set(hpxmp_sources
${ASM_SOURCE_FILE}
src/intel_hpxMP.cpp
src/hpx_runtime.cpp
src/kmp_atomic.cpp
src/loop_schedule.cpp
src/gcc_hpxMP.cpp)
set(hpxmp_headers
src/intel_hpxMP.h
src/hpx_runtime.h
src/kmp_atomic.h
src/loop_schedule.h
src/gcc_hpxMP.h)
set(HPXMP_WITH_TRACE OFF CACHE BOOL "display traces in debug mode")
if(HPXMP_WITH_TRACE)
add_definitions(-DHPXMP_HAVE_TRACE)
endif()
set(HPXMP_WITH_OMPT OFF CACHE BOOL "ompt support for hpxmp")
if(HPXMP_WITH_OMPT)
add_definitions(-DHPXMP_HAVE_OMPT=1)
set(hpxmp_sources
${hpxmp_sources}
src/ompt_hpx-general.cpp)
set(hpxmp_headers ${hpxmp_headers}
src/ompt.h
src/ompt-event-specific.h
src/ompt-internal.h)
endif()
set(HPXMP_WITH_POOL OFF CACHE BOOL "ompt support for hpxmp")
if(HPXMP_WITH_POOL)
add_definitions(-DHPXMP_HAVE_POOL=1)
set(hpxmp_sources
${hpxmp_sources}
src/thread_pool.cpp)
set(hpxmp_headers ${hpxmp_headers}
src/thread_pool.h)
endif()
set(HPXMP_WITH_OMP_50_ENABLED OFF CACHE BOOL "enable openmp 5.0 features in hpxmp")
if(HPXMP_WITH_OMP_50_ENABLED)
add_definitions(-DHPXMP_HAVE_OMP_50_ENABLED)
endif()
#decide whether debug or release build
set(RELEASE_BUILD FALSE)
string(TOLOWER "${CMAKE_BUILD_TYPE}" libhpxmp_build_type_lowercase)
if("${libhpxmp_build_type_lowercase}" STREQUAL "release")
set(RELEASE_BUILD TRUE)
endif()
# Find and include HPX settings
if(NOT HPX_WITH_HPXMP)
if (NOT HPX_DIR)
message(FATAL "HPX_DIR not set, unable to find HPX!")
endif()
message(STATUS "HPX_DIR=${HPX_DIR}")
SET(CMAKE_ASM_FLAGS "${CFLAGS} -x assembler-with-cpp")
# This adds the HPX cmake configuration directory to the search path.
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
${HPX_DIR}/share/cmake-${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}/Modules)
# Instruct cmake to find the HPX settings
find_package(HPX NO_CMAKE_PACKAGE_REGISTRY REQUIRED)
set(HPX_RPATH "${HPX_RPATH}:${CMAKE_INSTALL_PREFIX}/lib/hpx:${CMAKE_BINARY_DIR}/lib/hpx")
include_directories(${HPX_INCLUDE_DIRS})
link_directories(${HPX_LIBRARY_DIR})
add_library(hpxmp SHARED ${hpxmp_sources} ${hpxmp_headers})
foreach(dir ${HPX_LIBRARY_DIR})
target_link_libraries(hpxmp PRIVATE -L${dir})
endforeach()
target_link_libraries(hpxmp PRIVATE ${HPX_LIBRARIES})
else()
foreach(__source ${hpxmp_sources})
add_hpx_library_sources_noglob(hpx_external
SOURCES "${__source}" APPEND)
endforeach()
foreach(__header ${hpxmp_headers})
add_hpx_library_headers_noglob(hpx_external
HEADERS "${PROJECT_SOURCE_DIR}/${__header}" APPEND)
endforeach()
endif()
add_subdirectory(examples)
add_subdirectory(tests)
enable_testing()
find_package(Boost)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L${Boost_LIBRARY_DIRS}")