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:
Bastien Montagne
2014-04-02 11:43:54 +02:00
parent cb7cfd3ab6
commit 35747ee3d5
9 changed files with 25 additions and 28 deletions

View File

@@ -51,6 +51,8 @@
#include "BLI_threads.h" #include "BLI_threads.h"
#include "BLI_math.h" #include "BLI_math.h"
#include "BLI_utildefines.h" #include "BLI_utildefines.h"
#include "BLI_system.h"
#include BLI_SYSTEM_PID_H
#include "BLF_translation.h" #include "BLF_translation.h"
@@ -100,9 +102,7 @@
/* untitled blend's need getpid for a unique name */ /* untitled blend's need getpid for a unique name */
#ifndef WIN32 #ifndef WIN32
# include <dirent.h> # include <dirent.h>
# include <unistd.h>
#else #else
# include <process.h>
# include "BLI_winstuff.h" # include "BLI_winstuff.h"
#endif #endif

View File

@@ -18,14 +18,21 @@
* ***** END GPL LICENSE BLOCK ***** * ***** END GPL LICENSE BLOCK *****
*/ */
#ifndef __BLI_CPU_H__ #ifndef __BLI_SYSTEM_H__
#define __BLI_CPU_H__ #define __BLI_SYSTEM_H__
/** \file BLI_cpu.h /** \file BLI_system.h
* \ingroup bli * \ingroup bli
*/ */
int BLI_cpu_support_sse2(void); 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
#endif /* __BLI_SYSTEM_H__ */

View File

@@ -55,7 +55,6 @@ set(SRC
intern/buffer.c intern/buffer.c
intern/callbacks.c intern/callbacks.c
intern/convexhull2d.c intern/convexhull2d.c
intern/cpu.c
intern/dynlib.c intern/dynlib.c
intern/easing.c intern/easing.c
intern/edgehash.c intern/edgehash.c
@@ -97,6 +96,7 @@ set(SRC
intern/string.c intern/string.c
intern/string_cursor_utf8.c intern/string_cursor_utf8.c
intern/string_utf8.c intern/string_utf8.c
intern/system.c
intern/task.c intern/task.c
intern/threads.c intern/threads.c
intern/time.c intern/time.c
@@ -117,7 +117,6 @@ set(SRC
BLI_callbacks.h BLI_callbacks.h
BLI_compiler_attrs.h BLI_compiler_attrs.h
BLI_convexhull2d.h BLI_convexhull2d.h
BLI_cpu.h
BLI_dlrbTree.h BLI_dlrbTree.h
BLI_dynlib.h BLI_dynlib.h
BLI_dynstr.h BLI_dynstr.h
@@ -168,6 +167,7 @@ set(SRC
BLI_string_cursor_utf8.h BLI_string_cursor_utf8.h
BLI_string_utf8.h BLI_string_utf8.h
BLI_sys_types.h BLI_sys_types.h
BLI_system.h
BLI_task.h BLI_task.h
BLI_threads.h BLI_threads.h
BLI_timecode.h BLI_timecode.h

View File

@@ -4,7 +4,7 @@
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * 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, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -18,12 +18,12 @@
* ***** END GPL LICENSE BLOCK ***** * ***** END GPL LICENSE BLOCK *****
*/ */
/** \file blender/blenlib/intern/cpu.c /** \file blender/blenlib/intern/system.c
* \ingroup bli * \ingroup bli
*/ */
#include "BLI_cpu.h" #include "BLI_system.h"
int BLI_cpu_support_sse2(void) int BLI_cpu_support_sse2(void)
{ {

View File

@@ -81,12 +81,9 @@
#include "zlib.h" #include "zlib.h"
#ifndef WIN32 #ifdef WIN32
# include <unistd.h>
#else
# include "winsock2.h" # include "winsock2.h"
# include <io.h> # include <io.h>
# include <process.h> // for getpid
# include "BLI_winstuff.h" # include "BLI_winstuff.h"
#endif #endif

View File

@@ -39,6 +39,8 @@
#include "BLI_path_util.h" #include "BLI_path_util.h"
#include "BLI_fileops.h" #include "BLI_fileops.h"
#include "BLI_md5.h" #include "BLI_md5.h"
#include "BLI_system.h"
#include BLI_SYSTEM_PID_H
#include "IMB_imbuf_types.h" #include "IMB_imbuf_types.h"
#include "IMB_imbuf.h" #include "IMB_imbuf.h"
@@ -59,12 +61,9 @@
# endif # endif
# include <shlobj.h> /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff # include <shlobj.h> /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff
* because 'near' is disabled through BLI_windstuff */ * because 'near' is disabled through BLI_windstuff */
# include <process.h> /* getpid */
# include <direct.h> /* chdir */ # include <direct.h> /* chdir */
# include "BLI_winstuff.h" # include "BLI_winstuff.h"
# include "utfconv.h" # include "utfconv.h"
#else
# include <unistd.h>
#endif #endif
#define URI_MAX (FILE_MAX * 3 + 8) #define URI_MAX (FILE_MAX * 3 + 8)

View File

@@ -41,7 +41,7 @@
#include "DNA_lamp_types.h" #include "DNA_lamp_types.h"
#include "BLI_blenlib.h" #include "BLI_blenlib.h"
#include "BLI_cpu.h" #include "BLI_system.h"
#include "BLI_math.h" #include "BLI_math.h"
#include "BLI_rand.h" #include "BLI_rand.h"
#include "BLI_utildefines.h" #include "BLI_utildefines.h"

View File

@@ -46,10 +46,7 @@
# endif # endif
# include <shlobj.h> /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff # include <shlobj.h> /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff
* because 'near' is disabled through BLI_windstuff */ * because 'near' is disabled through BLI_windstuff */
# include <process.h> /* getpid */
# include "BLI_winstuff.h" # include "BLI_winstuff.h"
#else
# include <unistd.h> /* getpid */
#endif #endif
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
@@ -60,6 +57,8 @@
#include "BLI_utildefines.h" #include "BLI_utildefines.h"
#include "BLI_threads.h" #include "BLI_threads.h"
#include "BLI_callbacks.h" #include "BLI_callbacks.h"
#include "BLI_system.h"
#include BLI_SYSTEM_PID_H
#include "BLF_translation.h" #include "BLF_translation.h"

View File

@@ -40,13 +40,6 @@
# include <xmmintrin.h> # include <xmmintrin.h>
#endif #endif
/* crash handler */
#ifdef WIN32
# include <process.h> /* getpid */
#else
# include <unistd.h> /* getpid */
#endif
#ifdef WIN32 #ifdef WIN32
# include <windows.h> # include <windows.h>
# include "utfconv.h" # include "utfconv.h"
@@ -79,6 +72,8 @@
#include "BLI_callbacks.h" #include "BLI_callbacks.h"
#include "BLI_blenlib.h" #include "BLI_blenlib.h"
#include "BLI_mempool.h" #include "BLI_mempool.h"
#include "BLI_system.h"
#include BLI_SYSTEM_PID_H
#include "DNA_ID.h" #include "DNA_ID.h"
#include "DNA_scene_types.h" #include "DNA_scene_types.h"