Skip to content

Commit 30445f1

Browse files
committed
Adding OMPD library directory, but it has problems with sed command to generate ompd.h
1 parent 2678326 commit 30445f1

File tree

13 files changed

+3866
-0
lines changed

13 files changed

+3866
-0
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ set(OPENMP_TEST_OPENMP_FLAGS ${OPENMP_TEST_COMPILER_OPENMP_FLAGS} CACHE STRING
5656
add_subdirectory(runtime)
5757

5858

59+
# Build OMPD
60+
add_subdirectory(libompd)
61+
5962
set(ENABLE_LIBOMPTARGET ON)
6063
# Currently libomptarget cannot be compiled on Windows or MacOS X.
6164
# Since the device plugins are only supported on Linux anyway,

libompd/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
3+
add_subdirectory(src)

libompd/src/CMakeLists.txt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
project (libompd)
2+
3+
add_library (ompd_intel SHARED TargetValue.cpp ompd_intel.cpp)
4+
5+
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
6+
7+
include_directories (
8+
${CMAKE_BINARY_DIR}/include
9+
${CMAKE_CURRENT_SOURCE_DIR}
10+
)
11+
12+
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/include)
13+
14+
ADD_CUSTOM_TARGET (
15+
ompd-header ALL
16+
DEPENDS ${CMAKE_BINARY_DIR}/include/ompd.h ${CMAKE_BINARY_DIR}/include/ompd_typedefs.h
17+
)
18+
19+
add_custom_command (
20+
OUTPUT ${CMAKE_BINARY_DIR}/include/ompd.h ${CMAKE_BINARY_DIR}/include/ompd_typedefs.h
21+
COMMAND ${BASH}
22+
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/split_def_typedef.sh
23+
${CMAKE_CURRENT_SOURCE_DIR}/ompd-template.h
24+
${CMAKE_BINARY_DIR}/include/ompd_typedefs.h
25+
${CMAKE_BINARY_DIR}/include/ompd.h
26+
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ompd-template.h
27+
)
28+
29+
INSTALL( TARGETS ompd_intel
30+
LIBRARY DESTINATION lib
31+
ARCHIVE DESTINATION lib/static
32+
RUNTIME DESTINATION bin )
33+
34+
INSTALL(FILES ${CMAKE_BINARY_DIR}/include/ompd.h DESTINATION include)
35+

libompd/src/Debug.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include "Debug.h"
2+
3+
std::ostream& GdbColor::operator<<(std::ostream& os, GdbColor::Code code) {
4+
return os << "\033[" << static_cast<int>(code) << "m";
5+
}
6+

libompd/src/Debug.h

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#include <ostream>
2+
#include <iostream>
3+
4+
#ifndef GDB_DEBUG_H_
5+
#define GDB_DEBUG_H_
6+
7+
8+
namespace GdbColor {
9+
enum Code {
10+
FG_RED = 31,
11+
FG_GREEN = 32,
12+
FG_BLUE = 34,
13+
FG_DEFAULT = 39,
14+
BG_RED = 41,
15+
BG_GREEN = 42,
16+
BG_BLUE = 44,
17+
BG_DEFAULT = 49
18+
};
19+
// std::ostream& operator<<(std::ostream& os, Code code);
20+
std::ostream& operator<<(std::ostream& os, Code code) {
21+
return os << "\033[" << static_cast<int>(code) << "m";
22+
}
23+
}
24+
25+
//class ColorOut: public std::ostream
26+
class ColorOut
27+
{
28+
private:
29+
std::ostream& out;
30+
GdbColor::Code color;
31+
public:
32+
ColorOut(std::ostream& _out, GdbColor::Code _color):out(_out), color(_color){}
33+
template<typename T>
34+
const ColorOut& operator<< (const T& val) const
35+
{out << color << val << GdbColor::FG_DEFAULT;
36+
return *this;}
37+
/* template<typename T>
38+
const ColorOut& operator<< (const T* val) const
39+
{out << GdbColor::FG_RED << val << GdbColor::FG_DEFAULT;
40+
return *this;}
41+
template <class _CharT, class _Traits = std::char_traits<_CharT> >
42+
const ColorOut& operator<< ( const
43+
std::basic_ios<_CharT,_Traits>& (*pf)(std::basic_ios<_CharT,_Traits>&))const
44+
{out << GdbColor::FG_RED << pf << GdbColor::FG_DEFAULT;
45+
return *this;}
46+
*/
47+
const ColorOut& operator<< (std::ostream& (*pf)(std::ostream&)) const
48+
{out << color << pf << GdbColor::FG_DEFAULT;
49+
return *this;}
50+
51+
};
52+
53+
static ColorOut dout(std::cout, GdbColor::FG_RED);
54+
static ColorOut sout(std::cout, GdbColor::FG_GREEN);
55+
static ColorOut hout(std::cout, GdbColor::FG_BLUE);
56+
57+
58+
#endif /*GDB_DEBUG_H_*/

0 commit comments

Comments
 (0)