CPUFeatures plug-in: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
LoRd MuldeR (talk | contribs) No edit summary |
LoRd MuldeR (talk | contribs) No edit summary |
||
Line 4: | Line 4: | ||
It is based on CPU detection code from the [http://www.videolan.org/developers/x264.html x264] project. | It is based on CPU detection code from the [http://www.videolan.org/developers/x264.html x264] project. | ||
== Example == | |||
How to use the CPUFeatures plug-in: | |||
<highlight-nsis>!include "CPUFeatures.nsh" | |||
; Get CPU flags (this is for debugging!) | |||
Section | |||
${CPUFeatures.GetFlags} $0 | |||
DetailPrint "CPU Flags: $0" | |||
SectionEnd | |||
; Get all supported features + vendor name | |||
Section | |||
${CPUFeatures.GetFeatures} $0 | |||
DetailPrint "CPU Features: $0" | |||
${CPUFeatures.GetVendor} $0 | |||
DetailPrint "CPU Vendor: $0" | |||
SectionEnd | |||
; Check individual feature flags | |||
; Find a list of supported feature flags in CPUFeatures.nsh! | |||
Section | |||
${CPUFeatures.CheckFeature} "MMX1" $0 | |||
DetailPrint "Has MMX: $0" | |||
${CPUFeatures.CheckFeature} "SSE1" $0 | |||
DetailPrint "Has SSE: $0" | |||
${CPUFeatures.CheckFeature} "SSE2" $0 | |||
DetailPrint "Has SSE2: $0" | |||
${CPUFeatures.CheckFeature} "SSE3" $0 | |||
DetailPrint "Has SSE3: $0" | |||
${CPUFeatures.CheckFeature} "SSSE3" $0 | |||
DetailPrint "Has SSSE3: $0" | |||
${CPUFeatures.CheckFeature} "SSE4.2" $0 | |||
DetailPrint "Has SSE4.2: $0" | |||
; Next call is supposed to fail! | |||
${CPUFeatures.CheckFeature} "SSE7" $0 | |||
DetailPrint "Has SSE7: $0" | |||
SectionEnd</highlight-nsis> | |||
== License == | == License == |
Revision as of 20:59, 16 February 2013
Author: LoRd MuldeR (talk, contrib) |
This very simple plug-in can detect the supported CPU features (MMX, SSE, AVX, etc) at runtime.
It is based on CPU detection code from the x264 project.
Example
How to use the CPUFeatures plug-in:
!include "CPUFeatures.nsh" ; Get CPU flags (this is for debugging!) Section ${CPUFeatures.GetFlags} $0 DetailPrint "CPU Flags: $0" SectionEnd ; Get all supported features + vendor name Section ${CPUFeatures.GetFeatures} $0 DetailPrint "CPU Features: $0" ${CPUFeatures.GetVendor} $0 DetailPrint "CPU Vendor: $0" SectionEnd ; Check individual feature flags ; Find a list of supported feature flags in CPUFeatures.nsh! Section ${CPUFeatures.CheckFeature} "MMX1" $0 DetailPrint "Has MMX: $0" ${CPUFeatures.CheckFeature} "SSE1" $0 DetailPrint "Has SSE: $0" ${CPUFeatures.CheckFeature} "SSE2" $0 DetailPrint "Has SSE2: $0" ${CPUFeatures.CheckFeature} "SSE3" $0 DetailPrint "Has SSE3: $0" ${CPUFeatures.CheckFeature} "SSSE3" $0 DetailPrint "Has SSSE3: $0" ${CPUFeatures.CheckFeature} "SSE4.2" $0 DetailPrint "Has SSE4.2: $0" ; Next call is supposed to fail! ${CPUFeatures.CheckFeature} "SSE7" $0 DetailPrint "Has SSE7: $0" SectionEnd
License
CPUFeatures plug-in for NSIS Copyright (C) 2013 LoRd_MuldeR <mulder2@gmx.de> Copyright (C) 2003-2013 x264 project This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Please see the GNU General Public License for details!
Download
Download current version:
CPUFeatures.2013-02-16.zip (88 KB)
Source Code
Public Git Repository:
https://github.com/lordmulder/CPUFeaturesLib.git (Browse)
Public SVN Repository:
http://code.google.com/p/mulder/source/browse/trunk/Utils/CPUFeatures/
Support
E-Mail:
MuldeR2 (at) gmx (dot) de