common: fix cmake on linux/macos

This commit is contained in:
kojin 2021-09-03 06:43:33 -04:00 committed by Kojin
parent 831c8b9189
commit 0717bf788a
29 changed files with 61 additions and 41 deletions

View File

@ -16,9 +16,10 @@
// This module contains implementations of _aligned_malloc for platforms that don't have
// it built into their CRT/libc.
#ifndef _WIN32
#if !defined(_WIN32)
#include "common/Assertions.h"
#include "common/ScopedAlloc.h"
void *__fastcall _aligned_malloc(size_t size, size_t align)
{

View File

@ -9,6 +9,7 @@ add_library(common)
# x86emitter sources
target_sources(common PRIVATE
AlignedMalloc.cpp
VirtualMemory.cpp
EventSource.inl
SafeArray.inl
@ -45,9 +46,16 @@ target_sources(common PRIVATE
emitter/legacy_sse.cpp
emitter/movs.cpp
emitter/simd.cpp
emitter/LnxCpuDetect.cpp
emitter/WinCpuDetect.cpp
emitter/x86emitter.cpp
x86/MemcpyFast.cpp
Darwin/DarwinThreads.cpp
Darwin/DarwinMisc.cpp
Darwin/DarwinSemaphore.cpp
Linux/LnxHostSys.cpp
Linux/LnxThreads.cpp
Linux/LnxMisc.cpp
Windows/WinThreads.cpp
Windows/WinHostSys.cpp
Windows/WinMisc.cpp)

View File

@ -13,15 +13,16 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "../PrecompiledHeader.h"
#if defined(__APPLE__)
#include <cstring>
#include <cstdlib>
#include <sys/types.h>
#include <sys/sysctl.h>
#include <mach/mach_time.h>
#include <wx/string.h>
#include "common/Pcsx2Types.h"
#define NELEM(x) \
((sizeof(x) / sizeof(0 [x])) / ((size_t)(!(sizeof(x) % sizeof(0 [x])))))
@ -148,3 +149,4 @@ void ScreensaverAllow(bool allow)
{
// no-op
}
#endif

View File

@ -13,26 +13,22 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#if defined(__APPLE__)
#include <cstdio>
#include <cassert> // assert
#include <pthread.h> // pthread_setcancelstate()
#include <sys/time.h> // gettimeofday()
#include <mach/mach.h>
#include <mach/task.h> // semaphore_create() and semaphore_destroy()
#include <mach/semaphore.h> // semaphore_*()
#include <mach/mach_error.h> // mach_error_string()
#include <mach/mach_time.h> // mach_absolute_time()
#include "PrecompiledHeader.h"
#include "Threading.h"
#include "ThreadingInternal.h"
#include "wxBaseTools.h"
#include "wxGuiTools.h"
#include "common/Threading.h"
#include "common/ThreadingInternal.h"
#include "common/wxBaseTools.h"
#include "common/wxGuiTools.h"
// --------------------------------------------------------------------------------------
// Semaphore Implementation for Darwin/OSX
@ -242,3 +238,4 @@ int Threading::Semaphore::Count()
{
return __atomic_load_n(&m_counter, __ATOMIC_SEQ_CST);
}
#endif

View File

@ -13,19 +13,16 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "../PrecompiledHeader.h"
#include "PersistentThread.h"
#if defined(__APPLE__)
#include <unistd.h>
#if !defined(__APPLE__)
#error "DarwinThreads.cpp should only be compiled by projects or makefiles targeted at OSX."
#else
#include <mach/mach_init.h>
#include <mach/thread_act.h>
#include <mach/mach_port.h>
#include "common/PrecompiledHeader.h"
#include "common/PersistentThread.h"
// Note: assuming multicore is safer because it forces the interlocked routines to use
// the LOCK prefix. The prefix works on single core CPUs fine (but is slow), but not
// having the LOCK prefix is very bad indeed.

View File

@ -13,11 +13,14 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#define WXINTL_NO_GETTEXT_MACRO
#include <wx/app.h>
#if defined(__UNIX__)
#include <signal.h>
#endif
#include "common/Dependencies.h" // _ macro
#include "common/Threading.h"
#include "common/General.h"

View File

@ -13,7 +13,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _WIN32
#if !defined(_WIN32)
#include <wx/thread.h>
#include <sys/mman.h>
#include <signal.h>

View File

@ -13,13 +13,15 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _WIN32
#if !defined(_WIN32) && !defined(__APPLE__)
#include <ctype.h>
#include <time.h>
#include <unistd.h>
#include <sys/time.h>
#include <wx/utils.h>
#include "common/Pcsx2Types.h"
// Returns 0 on failure (not supported by the operating system).
u64 GetPhysicalMemory()
{

View File

@ -13,7 +13,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _WIN32
#if !defined(_WIN32) && !defined(__APPLE__)
#include <unistd.h>
#if defined(__linux__)
#include <sys/prctl.h>

View File

@ -15,6 +15,7 @@
#pragma once
#include <cstring> // memset
#include "common/Pcsx2Types.h"
#include "common/Pcsx2Defs.h"

View File

@ -16,6 +16,7 @@
#pragma once
#include <vector>
#include <cstdio>
#include "common/Pcsx2Types.h"
namespace Perf

View File

@ -15,7 +15,8 @@
#pragma once
#include "SafeArray.h"
#include "common/SafeArray.h"
#include "common/StringHelpers.h"
// Internal constructor for use by derived classes. This allows a derived class to
// use its own memory allocation (with an aligned memory, for example).

View File

@ -13,6 +13,8 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__APPLE__)
#include "common/Threading.h"
#include "common/wxBaseTools.h"
#include "common/wxGuiTools.h"
@ -160,3 +162,4 @@ int Threading::Semaphore::Count()
sem_getvalue(&m_sema, &retval);
return retval;
}
#endif

View File

@ -13,6 +13,8 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#if defined(_WIN32)
#include <wx/string.h>
#include "common/Pcsx2Defs.h"
#include "common/RedtapeWindows.h"
@ -114,3 +116,4 @@ void ScreensaverAllow(bool allow)
flags |= ES_DISPLAY_REQUIRED;
SetThreadExecutionState(flags);
}
#endif

View File

@ -14,6 +14,7 @@
*/
#include <wx/wx.h>
#include "common/Pcsx2Defs.h" // __fastcall
bool pxIsEnglish(int id)
{

View File

@ -80,7 +80,7 @@ close(IN);
open(OUT,">$output");
### Print the header
print OUT "#pragma once\n\n";
print OUT "#include \"Pcsx2Types.h\"\n";
print OUT "#include \"common/Pcsx2Types.h\"\n";
print OUT "#include <wx/gdicmn.h>\n\n";
print OUT "class $wx_img_class\n{\n";
print OUT "public:\n";

View File

@ -25,11 +25,11 @@
#include <mutex>
#include <queue>
#include "Pcsx2Defs.h"
#include "common/Pcsx2Defs.h"
#include "bitwise.h"
#include "Utilities/pxStreams.h"
#include "Utilities/Console.h"
#include "common/pxStreams.h"
#include "common/Console.h"
#include "App.h"
#include "DebugTools/Debug.h"

View File

@ -16,7 +16,7 @@
#pragma once
#include "Global.h"
#include "Utilities/mt_queue.h"
#include "common/mt_queue.h"
enum PadOptions
{

View File

@ -21,7 +21,7 @@
#include "Global.h"
#include "keyboard.h"
#include "Utilities/mt_queue.h"
#include "common/mt_queue.h"
extern keyEvent event;
extern MtQueue<keyEvent> g_ev_fifo;

View File

@ -15,7 +15,7 @@
#pragma once
#include "Pcsx2Defs.h"
#include "common/Pcsx2Defs.h"
#include "App.h"
#if defined(__unix__) || defined(__APPLE__)

View File

@ -17,7 +17,7 @@
#include <wx/wx.h>
#include "Utilities/EmbeddedImage.h"
#include "common/EmbeddedImage.h"
enum gui_img
{

View File

@ -17,7 +17,7 @@
#include "SPU2/Global.h"
#include "Dialogs.h"
#include "Config.h"
#include "Utilities/Path.h"
#include "common/Path.h"
bool DebugEnabled = false;
bool _MsgToConsole = false;

View File

@ -19,7 +19,7 @@
#include "USB/deviceproxy.h"
#include "USB/usb-pad/padproxy.h"
#include "USB/usb-mic/audiodeviceproxy.h"
#include "Utilities/Console.h"
#include "common/Console.h"
void SysMessage_stderr(const char* fmt, ...)
{

View File

@ -19,7 +19,7 @@
#include "jpge.h"
#include "jo_mpeg.h"
#include "USB/gtk.h"
#include "Utilities/Console.h"
#include "common/Console.h"
#include <stdio.h>
#include <stdlib.h>

View File

@ -16,7 +16,7 @@
#pragma once
#include "USB/usb-hid/usb-hid.h"
#include "USB/linux/util.h"
#include "Utilities/Console.h"
#include "common/Console.h"
#include <linux/input.h>
#include <unistd.h>
#include <dirent.h>

View File

@ -17,7 +17,7 @@
#include "USB/linux/ini.h"
#include "USB/configuration.h"
#include "USB/gtk.h"
#include "Utilities/Console.h"
#include "common/Console.h"
namespace usb_msd
{

View File

@ -18,7 +18,7 @@
#include "shared.h"
#include "USB/linux/util.h"
#include "USB/readerwriterqueue/readerwriterqueue.h"
#include "Utilities/Console.h"
#include "common/Console.h"
//#include <dirent.h> //gtk.h pulls in?
#include <thread>
#include <array>

View File

@ -15,7 +15,7 @@
#include "shared.h"
#include "USB/icon_buzz_24.h"
#include "Utilities/Console.h"
#include "common/Console.h"
#include <chrono>
#include <thread>

View File

@ -16,7 +16,7 @@
#pragma once
#include <linux/joystick.h>
#include <unistd.h>
#include "Pcsx2Types.h"
#include "common/Pcsx2Types.h"
#include "USB/gtk.h"
#include "USB/usb-pad/padproxy.h"
#include "USB/configuration.h"