<div dir="ltr">Unfortunately, this does not add PCM_ROOT_DIR as a customizable variable in the cmake-gui. Any ideas?<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 8, 2015 at 3:35 PM, <span dir="ltr"><<a href="mailto:deepthi@multicorewareinc.com" target="_blank">deepthi@multicorewareinc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Deepthi Nandakumar <<a href="mailto:deepthi@multicorewareinc.com">deepthi@multicorewareinc.com</a>><br>
# Date 1431064348 -19800<br>
# Fri May 08 11:22:28 2015 +0530<br>
# Node ID 4203e7ac7d784a307d6d7174f69d96a86bc576c8<br>
# Parent 7a1fd70739410f874f8ccd51ad688a29364d5e72<br>
cmake: add support for finding Intel PCM on Windows<br>
<br>
diff -r 7a1fd7073941 -r 4203e7ac7d78 source/CMakeLists.txt<br>
--- a/source/CMakeLists.txt Tue May 05 14:44:19 2015 -0700<br>
+++ b/source/CMakeLists.txt Fri May 08 11:22:28 2015 +0530<br>
@@ -296,7 +296,7 @@<br>
endif()<br>
endif(WARNINGS_AS_ERRORS)<br>
<br>
-if (WIN32)<br>
+if(WIN32)<br>
# Visual leak detector<br>
find_package(VLD QUIET)<br>
if(VLD_FOUND)<br>
@@ -314,7 +314,20 @@<br>
# default to targeting Windows 7 for the NUMA APIs<br>
add_definitions(-D_WIN32_WINNT=_WIN32_WINNT_WIN7)<br>
endif(WINXP_SUPPORT)<br>
-endif()<br>
+endif(WIN32)<br>
+<br>
+if(WIN32)<br>
+ option(ENABLE_PCM "Enable profiling using Intel Performance Counter Monitor" OFF)<br>
+ if(ENABLE_PCM)<br>
+ find_package(PCM)<br>
+ if(PCM_FOUND)<br>
+ add_definitions(-DENABLE_PCM)<br>
+ list(APPEND PLATFORM_LIBS PCM)<br>
+ include_directories(${PCM_ROOT_DIR})<br>
+ add_subdirectory(profile/PCM)<br>
+ endif(PCM_FOUND)<br>
+ endif(ENABLE_PCM)<br>
+endif(WIN32)<br>
<br>
include(version) # determine X265_VERSION and X265_LATEST_TAG<br>
include_directories(. common encoder "${PROJECT_BINARY_DIR}")<br>
@@ -478,7 +491,6 @@<br>
source_group(input FILES ${InputFiles})<br>
source_group(output FILES ${OutputFiles})<br>
source_group(filters FILES ${FilterFiles})<br>
-<br>
check_include_files(getopt.h HAVE_GETOPT_H)<br>
if(NOT HAVE_GETOPT_H)<br>
if(MSVC)<br>
diff -r 7a1fd7073941 -r 4203e7ac7d78 source/cmake/FindPCM.cmake<br>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000<br>
+++ b/source/cmake/FindPCM.cmake Fri May 08 11:22:28 2015 +0530<br>
@@ -0,0 +1,25 @@<br>
+include(FindPackageHandleStandardArgs)<br>
+SET(PCM_ROOT_DIR "C:/Program Files/Intel/IntelPerformanceCounterMonitorV2.8" CACHE PATH "Location of Intel PCM Root Directory")<br>
+<br>
+find_path(PCM_ROOT_DIR<br>
+ NAMES cpucounters.h<br>
+ HINTS ${PCM_ROOT_DIR}<br>
+ DOC "PCM root directory")<br>
+<br>
+if(X64)<br>
+ find_path(PCM_OBJ_DIR<br>
+ NAMES cpucounters.obj<br>
+ HINTS ${PCM_ROOT_DIR}<br>
+ PATH_SUFFIXES PCM_Win/x64/Release PCM_Win/x64/Debug<br>
+ DOC "PCM Object files")<br>
+else()<br>
+ find_path(PCM_OBJ_DIR<br>
+ NAMES cpucounters.obj<br>
+ HINTS ${PCM_ROOT_DIR}<br>
+ PATH_SUFFIXES PCM_Win/Release PCM_Win/Debug<br>
+ DOC "PCM Object files")<br>
+endif(X64)<br>
+<br>
+mark_as_advanced(PCM_ROOT_DIR PCM_OBJ_DIR)<br>
+<br>
+find_package_handle_standard_args(PCM REQUIRED_VARS PCM_ROOT_DIR PCM_OBJ_DIR)<br>
diff -r 7a1fd7073941 -r 4203e7ac7d78 source/profile/CMakeLists.txt<br>
--- a/source/profile/CMakeLists.txt Tue May 05 14:44:19 2015 -0700<br>
+++ b/source/profile/CMakeLists.txt Fri May 08 11:22:28 2015 +0530<br>
@@ -23,3 +23,16 @@<br>
list(APPEND PLATFORM_LIBS libittnotify.a dl)<br>
endif()<br>
endif(ENABLE_VTUNE)<br>
+<br>
+if(WIN32)<br>
+ option(ENABLE_PCM "Enable profiling using Intel Performance Counter Monitor" OFF)<br>
+ if(ENABLE_PCM)<br>
+ find_package(PCM)<br>
+ if(PCM_FOUND)<br>
+ add_definitions(-DENABLE_PCM)<br>
+ add_subdirectory(PCM)<br>
+ list(APPEND PLATFORM_LIBS pcm)<br>
+ include_directories(${PCM_ROOT_DIR})<br>
+ endif(PCM_FOUND)<br>
+ endif(ENABLE_PCM)<br>
+endif(WIN32)<br>
\ No newline at end of file<br>
diff -r 7a1fd7073941 -r 4203e7ac7d78 source/profile/PCM/CMakeLists.txt<br>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000<br>
+++ b/source/profile/PCM/CMakeLists.txt Fri May 08 11:22:28 2015 +0530<br>
@@ -0,0 +1,5 @@<br>
+include_directories(${PCM_ROOT_DIR})<br>
+file(GLOB PCMFiles ${PCM_OBJ_DIR}/cpucounters.obj ${PCM_OBJ_DIR}/client_bw.obj ${PCM_OBJ_DIR}/msr.obj<br>
+ ${PCM_OBJ_DIR}/pci.obj ${PCM_OBJ_DIR}/winpmem.obj ${PCM_OBJ_DIR}/utils.obj)<br>
+source_group(ObjFiles FILES ${PCMFiles})<br>
+add_library(PCM ${PCMFiles} pcm.h pcm.cpp)<br>
diff -r 7a1fd7073941 -r 4203e7ac7d78 source/profile/PCM/pcm.cpp<br>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000<br>
+++ b/source/profile/PCM/pcm.cpp Fri May 08 11:22:28 2015 +0530<br>
@@ -0,0 +1,22 @@<br>
+/*****************************************************************************<br>
+ * Copyright (C) 2015 x265 project<br>
+ *<br>
+ * Authors: Deepthi Nandakumar <<a href="mailto:deepthi@multicorewareinc.com">deepthi@multicorewareinc.com</a>><br>
+ *<br>
+ * This program is free software; you can redistribute it and/or modify<br>
+ * it under the terms of the GNU General Public License as published by<br>
+ * the Free Software Foundation; either version 2 of the License, or<br>
+ * (at your option) any later version.<br>
+ *<br>
+ * This program is distributed in the hope that it will be useful,<br>
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
+ * GNU General Public License for more details.<br>
+ *<br>
+ * You should have received a copy of the GNU General Public License<br>
+ * along with this program; if not, write to the Free Software<br>
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.<br>
+ *<br>
+ * This program is also available under a commercial proprietary license.<br>
+ * For more information, contact us at license @ <a href="http://x265.com" target="_blank">x265.com</a>.<br>
+ *****************************************************************************/<br>
\ No newline at end of file<br>
diff -r 7a1fd7073941 -r 4203e7ac7d78 source/profile/PCM/pcm.h<br>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000<br>
+++ b/source/profile/PCM/pcm.h Fri May 08 11:22:28 2015 +0530<br>
@@ -0,0 +1,29 @@<br>
+/*****************************************************************************<br>
+ * Copyright (C) 2015 x265 project<br>
+ *<br>
+ * Authors: Deepthi Nandakumar <<a href="mailto:deepthi@multicorewareinc.com">deepthi@multicorewareinc.com</a>><br>
+ *<br>
+ * This program is free software; you can redistribute it and/or modify<br>
+ * it under the terms of the GNU General Public License as published by<br>
+ * the Free Software Foundation; either version 2 of the License, or<br>
+ * (at your option) any later version.<br>
+ *<br>
+ * This program is distributed in the hope that it will be useful,<br>
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
+ * GNU General Public License for more details.<br>
+ *<br>
+ * You should have received a copy of the GNU General Public License<br>
+ * along with this program; if not, write to the Free Software<br>
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.<br>
+ *<br>
+ * This program is also available under a commercial proprietary license.<br>
+ * For more information, contact us at license @ <a href="http://x265.com" target="_blank">x265.com</a>.<br>
+ *****************************************************************************/<br>
+<br>
+#ifndef PCM_H<br>
+#define PCM_H<br>
+<br>
+#include "cpucounters.h"<br>
+<br>
+#endif<br>
\ No newline at end of file<br>
</blockquote></div><br></div>