Skip to content

Commit b5f9b4b

Browse files
authored
Merge pull request #177 from intel-innersource/cmake_fixes
CMake install section update
2 parents 47dcecf + 99f474e commit b5f9b4b

File tree

6 files changed

+51
-8
lines changed

6 files changed

+51
-8
lines changed

.bdsignore.all

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.bdsignore.all
22
Makefile
3-
license.txt
43
Doxyfile
54
LICENSE
65
README

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ endif(UNIX)
6868
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
6969
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
7070

71-
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) # default is /usr/local
71+
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr") # default is "/usr/local", pcm default is "/usr"
7272
set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "..." FORCE)
7373
else()
7474
set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/usr" CACHE PATH "..." FORCE)

doc/license.txt

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,27 @@ This notice belongs to the code originating from "Intel Performance Counter Moni
22

33
Copyright (c) 2009-2016, Intel Corporation
44
All rights reserved.
5-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6-
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7-
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8-
* Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
* Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
* Redistributions in binary form must reproduce the above copyright notice,
11+
this list of conditions and the following disclaimer in the documentation
12+
and/or other materials provided with the distribution.
13+
14+
* Neither the name of Intel Corporation nor the names of its
15+
contributors may be used to endorse or promote products derived from
16+
this software without specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
928

10-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

pcm.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ rm -rf $RPM_BUILD_ROOT
4141

4242
%files
4343
%defattr(-,root,root,0755)
44-
%doc doc/license.txt doc/LINUX_HOWTO.txt
44+
%doc LICENSE doc/LINUX_HOWTO.txt
4545
%{_sbindir}/pcm-core
4646
%{_sbindir}/pcm-iio
4747
%{_sbindir}/pcm-latency

src/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,18 @@ if(UNIX) # APPLE, LINUX, FREE_BSD
147147
endforeach(opcode_file ${OPCODE_FILES})
148148

149149
file(COPY "PMURegisterDeclarations" DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
150+
install(DIRECTORY "PMURegisterDeclarations" DESTINATION "share/pcm")
151+
152+
# Install docs
153+
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION "share/licenses/pcm/")
154+
install(FILES ${CMAKE_SOURCE_DIR}/README.md DESTINATION "share/doc/pcm/")
155+
156+
file(GLOB DOC_FILES ${CMAKE_SOURCE_DIR}/doc/*.txt ${CMAKE_SOURCE_DIR}/doc/*.md)
157+
foreach(doc_file ${DOC_FILES})
158+
get_filename_component(doc_file_name ${doc_file} NAME)
159+
configure_file(${doc_file} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${doc_file_name} COPYONLY)
160+
install(FILES ${doc_file} DESTINATION "share/doc/pcm/")
161+
endforeach(doc_file ${DOC_FILES})
150162

151163
endif(UNIX)
152164

src/pcm-raw.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,20 @@ bool addEventFromDB(PCM::RawPMUConfigs& curPMUConfigs, string fullEventStr)
520520
static size_t offcoreEventIndex = 0;
521521

522522
const std::string path = std::string("PMURegisterDeclarations/") + PCM::getInstance()->getCPUFamilyModelString() + ".json";
523+
524+
std::ifstream in(path);
525+
if (!in.is_open())
526+
{
527+
const auto alt_path = std::string("/usr/share/pcm/") + path;
528+
in.open(alt_path);
529+
if (!in.is_open())
530+
{
531+
const auto err_msg = std::string("event file ") + path + " or " + alt_path + " is not avaiable.";
532+
throw std::invalid_argument(err_msg);
533+
}
534+
}
535+
in.close();
536+
523537
if (PMURegisterDeclarations.get() == nullptr)
524538
{
525539
// declaration not loaded yet

0 commit comments

Comments
 (0)