ocloc package with ocloc binary, ocloc library, and ocloc library header

Change-Id: I252ecdf9cff1ca20e39b2b4b5675410ac51ed38a
This commit is contained in:
Krystian Chmielewski
2020-04-28 11:18:59 +02:00
committed by sys_ocldev
parent 997dcd607f
commit caee16d968
7 changed files with 56 additions and 118 deletions

View File

@ -7,7 +7,6 @@
set(CLOC_LIB_SRCS_UTILITIES
${CMAKE_CURRENT_SOURCE_DIR}/safety_caller.h
${CMAKE_CURRENT_SOURCE_DIR}/get_current_dir.h
${CMAKE_CURRENT_SOURCE_DIR}/get_path.h
)
if(WIN32)
@ -17,15 +16,12 @@ if(WIN32)
${CMAKE_CURRENT_SOURCE_DIR}/windows/seh_exception.cpp
${CMAKE_CURRENT_SOURCE_DIR}/windows/seh_exception.h
${CMAKE_CURRENT_SOURCE_DIR}/windows/get_current_dir_windows.cpp
${CMAKE_CURRENT_SOURCE_DIR}/windows/get_path.cpp
)
else()
list(APPEND CLOC_LIB_SRCS_UTILITIES
${CMAKE_CURRENT_SOURCE_DIR}/linux/safety_caller_linux.cpp
${CMAKE_CURRENT_SOURCE_DIR}/linux/get_current_dir_linux.cpp
${CMAKE_CURRENT_SOURCE_DIR}/linux/get_path.cpp
)
endif()
target_sources(ocloc_lib PRIVATE ${CLOC_LIB_SRCS_UTILITIES})
target_sources(ocloc PRIVATE ${CLOC_LIB_SRCS_UTILITIES})

View File

@ -1,10 +0,0 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
extern std::string getPath();

View File

@ -1,24 +0,0 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include <sstream>
#include <string>
#include <sys/types.h>
#include <unistd.h>
std::string getPath() {
char exepath[128] = {0};
std::stringstream ss;
ss << "/proc/" << getpid() << "/exe";
if (readlink(ss.str().c_str(), exepath, 128) != -1) {
std::string path = std::string(exepath);
path = path.substr(0, path.find_last_of('/') + 1);
return path;
} else {
return std::string("");
}
}

View File

@ -1,12 +0,0 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include <string>
std::string getPath() {
return std::string("");
}