Rename "BLI_cpu.h" to "BLI_system.h" and add to it BLI_getpid() helper.
There is not much sense to have a whole BLI file just to check SSE2 on CPUs... So idea is to rename it to more generic "BLI_system", and add to it more system-related utils, like e.g. an include helper for getpid(), which allows to hide unix/windows internals from rest of the code... Reviewers: campbellbarton Reviewed By: campbellbarton Differential Revision: https://developer.blender.org/D439
This commit is contained in:
		@@ -51,6 +51,8 @@
 | 
			
		||||
#include "BLI_threads.h"
 | 
			
		||||
#include "BLI_math.h"
 | 
			
		||||
#include "BLI_utildefines.h"
 | 
			
		||||
#include "BLI_system.h"
 | 
			
		||||
#include BLI_SYSTEM_PID_H
 | 
			
		||||
 | 
			
		||||
#include "BLF_translation.h"
 | 
			
		||||
 | 
			
		||||
@@ -100,9 +102,7 @@
 | 
			
		||||
/* untitled blend's need getpid for a unique name */
 | 
			
		||||
#ifndef WIN32
 | 
			
		||||
#  include <dirent.h>
 | 
			
		||||
#  include <unistd.h>
 | 
			
		||||
#else
 | 
			
		||||
#  include <process.h>
 | 
			
		||||
#  include "BLI_winstuff.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -18,14 +18,21 @@
 | 
			
		||||
 * ***** END GPL LICENSE BLOCK *****
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef __BLI_CPU_H__
 | 
			
		||||
#define __BLI_CPU_H__ 
 | 
			
		||||
#ifndef __BLI_SYSTEM_H__
 | 
			
		||||
#define __BLI_SYSTEM_H__
 | 
			
		||||
 | 
			
		||||
/** \file BLI_cpu.h
 | 
			
		||||
/** \file BLI_system.h
 | 
			
		||||
 *  \ingroup bli
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
int BLI_cpu_support_sse2(void);
 | 
			
		||||
 | 
			
		||||
/* getpid */
 | 
			
		||||
#ifdef WIN32
 | 
			
		||||
#  define BLI_SYSTEM_PID_H <process.h>
 | 
			
		||||
#else
 | 
			
		||||
#  define BLI_SYSTEM_PID_H <unistd.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif  /* __BLI_SYSTEM_H__ */
 | 
			
		||||
 | 
			
		||||
@@ -55,7 +55,6 @@ set(SRC
 | 
			
		||||
	intern/buffer.c
 | 
			
		||||
	intern/callbacks.c
 | 
			
		||||
	intern/convexhull2d.c
 | 
			
		||||
	intern/cpu.c
 | 
			
		||||
	intern/dynlib.c
 | 
			
		||||
	intern/easing.c
 | 
			
		||||
	intern/edgehash.c
 | 
			
		||||
@@ -97,6 +96,7 @@ set(SRC
 | 
			
		||||
	intern/string.c
 | 
			
		||||
	intern/string_cursor_utf8.c
 | 
			
		||||
	intern/string_utf8.c
 | 
			
		||||
	intern/system.c
 | 
			
		||||
	intern/task.c
 | 
			
		||||
	intern/threads.c
 | 
			
		||||
	intern/time.c
 | 
			
		||||
@@ -117,7 +117,6 @@ set(SRC
 | 
			
		||||
	BLI_callbacks.h
 | 
			
		||||
	BLI_compiler_attrs.h
 | 
			
		||||
	BLI_convexhull2d.h
 | 
			
		||||
	BLI_cpu.h
 | 
			
		||||
	BLI_dlrbTree.h
 | 
			
		||||
	BLI_dynlib.h
 | 
			
		||||
	BLI_dynstr.h
 | 
			
		||||
@@ -168,6 +167,7 @@ set(SRC
 | 
			
		||||
	BLI_string_cursor_utf8.h
 | 
			
		||||
	BLI_string_utf8.h
 | 
			
		||||
	BLI_sys_types.h
 | 
			
		||||
	BLI_system.h
 | 
			
		||||
	BLI_task.h
 | 
			
		||||
	BLI_threads.h
 | 
			
		||||
	BLI_timecode.h
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@
 | 
			
		||||
 * 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. 
 | 
			
		||||
 * 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
 | 
			
		||||
@@ -18,12 +18,12 @@
 | 
			
		||||
 * ***** END GPL LICENSE BLOCK *****
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/** \file blender/blenlib/intern/cpu.c
 | 
			
		||||
/** \file blender/blenlib/intern/system.c
 | 
			
		||||
 *  \ingroup bli
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include "BLI_cpu.h"
 | 
			
		||||
#include "BLI_system.h"
 | 
			
		||||
 | 
			
		||||
int BLI_cpu_support_sse2(void)
 | 
			
		||||
{
 | 
			
		||||
@@ -81,12 +81,9 @@
 | 
			
		||||
 | 
			
		||||
#include "zlib.h"
 | 
			
		||||
 | 
			
		||||
#ifndef WIN32
 | 
			
		||||
#  include <unistd.h>
 | 
			
		||||
#else
 | 
			
		||||
#ifdef WIN32
 | 
			
		||||
#  include "winsock2.h"
 | 
			
		||||
#  include <io.h>
 | 
			
		||||
#  include <process.h> // for getpid
 | 
			
		||||
#  include "BLI_winstuff.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -39,6 +39,8 @@
 | 
			
		||||
#include "BLI_path_util.h"
 | 
			
		||||
#include "BLI_fileops.h"
 | 
			
		||||
#include "BLI_md5.h"
 | 
			
		||||
#include "BLI_system.h"
 | 
			
		||||
#include BLI_SYSTEM_PID_H
 | 
			
		||||
 | 
			
		||||
#include "IMB_imbuf_types.h"
 | 
			
		||||
#include "IMB_imbuf.h"
 | 
			
		||||
@@ -59,12 +61,9 @@
 | 
			
		||||
#  endif
 | 
			
		||||
#  include <shlobj.h>  /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff
 | 
			
		||||
                        * because 'near' is disabled through BLI_windstuff */
 | 
			
		||||
#  include <process.h> /* getpid */
 | 
			
		||||
#  include <direct.h> /* chdir */
 | 
			
		||||
#  include "BLI_winstuff.h"
 | 
			
		||||
#  include "utfconv.h"
 | 
			
		||||
#else
 | 
			
		||||
#  include <unistd.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define URI_MAX (FILE_MAX * 3 + 8)
 | 
			
		||||
 
 | 
			
		||||
@@ -41,7 +41,7 @@
 | 
			
		||||
#include "DNA_lamp_types.h"
 | 
			
		||||
 | 
			
		||||
#include "BLI_blenlib.h"
 | 
			
		||||
#include "BLI_cpu.h"
 | 
			
		||||
#include "BLI_system.h"
 | 
			
		||||
#include "BLI_math.h"
 | 
			
		||||
#include "BLI_rand.h"
 | 
			
		||||
#include "BLI_utildefines.h"
 | 
			
		||||
 
 | 
			
		||||
@@ -46,10 +46,7 @@
 | 
			
		||||
#  endif
 | 
			
		||||
#  include <shlobj.h>  /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff
 | 
			
		||||
                        * because 'near' is disabled through BLI_windstuff */
 | 
			
		||||
#  include <process.h> /* getpid */
 | 
			
		||||
#  include "BLI_winstuff.h"
 | 
			
		||||
#else
 | 
			
		||||
#  include <unistd.h> /* getpid */
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include "MEM_guardedalloc.h"
 | 
			
		||||
@@ -60,6 +57,8 @@
 | 
			
		||||
#include "BLI_utildefines.h"
 | 
			
		||||
#include "BLI_threads.h"
 | 
			
		||||
#include "BLI_callbacks.h"
 | 
			
		||||
#include "BLI_system.h"
 | 
			
		||||
#include BLI_SYSTEM_PID_H
 | 
			
		||||
 | 
			
		||||
#include "BLF_translation.h"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -40,13 +40,6 @@
 | 
			
		||||
#  include <xmmintrin.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* crash handler */
 | 
			
		||||
#ifdef WIN32
 | 
			
		||||
#  include <process.h> /* getpid */
 | 
			
		||||
#else
 | 
			
		||||
#  include <unistd.h> /* getpid */
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef WIN32
 | 
			
		||||
#  include <windows.h>
 | 
			
		||||
#  include "utfconv.h"
 | 
			
		||||
@@ -79,6 +72,8 @@
 | 
			
		||||
#include "BLI_callbacks.h"
 | 
			
		||||
#include "BLI_blenlib.h"
 | 
			
		||||
#include "BLI_mempool.h"
 | 
			
		||||
#include "BLI_system.h"
 | 
			
		||||
#include BLI_SYSTEM_PID_H
 | 
			
		||||
 | 
			
		||||
#include "DNA_ID.h"
 | 
			
		||||
#include "DNA_scene_types.h"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user