mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-14 03:59:36 +00:00
First compile, Logger works
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -49,3 +49,4 @@ SDL2-2.0.12/Makefile.rules
|
|||||||
SDL2-2.0.12/sdl2.pc
|
SDL2-2.0.12/sdl2.pc
|
||||||
SDL2-2.0.12/sdl2-config
|
SDL2-2.0.12/sdl2-config
|
||||||
install_manifest.txt
|
install_manifest.txt
|
||||||
|
AerofoilMac
|
||||||
|
|||||||
66
.vscode/settings.json
vendored
Normal file
66
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
{
|
||||||
|
"files.associations": {
|
||||||
|
"iostream": "cpp",
|
||||||
|
"array": "cpp",
|
||||||
|
"atomic": "cpp",
|
||||||
|
"bit": "cpp",
|
||||||
|
"*.tcc": "cpp",
|
||||||
|
"bitset": "cpp",
|
||||||
|
"cctype": "cpp",
|
||||||
|
"chrono": "cpp",
|
||||||
|
"clocale": "cpp",
|
||||||
|
"cmath": "cpp",
|
||||||
|
"codecvt": "cpp",
|
||||||
|
"compare": "cpp",
|
||||||
|
"complex": "cpp",
|
||||||
|
"concepts": "cpp",
|
||||||
|
"condition_variable": "cpp",
|
||||||
|
"cstdarg": "cpp",
|
||||||
|
"cstddef": "cpp",
|
||||||
|
"cstdint": "cpp",
|
||||||
|
"cstdio": "cpp",
|
||||||
|
"cstdlib": "cpp",
|
||||||
|
"cstring": "cpp",
|
||||||
|
"ctime": "cpp",
|
||||||
|
"cwchar": "cpp",
|
||||||
|
"cwctype": "cpp",
|
||||||
|
"deque": "cpp",
|
||||||
|
"map": "cpp",
|
||||||
|
"unordered_map": "cpp",
|
||||||
|
"vector": "cpp",
|
||||||
|
"exception": "cpp",
|
||||||
|
"algorithm": "cpp",
|
||||||
|
"functional": "cpp",
|
||||||
|
"iterator": "cpp",
|
||||||
|
"memory": "cpp",
|
||||||
|
"memory_resource": "cpp",
|
||||||
|
"numeric": "cpp",
|
||||||
|
"optional": "cpp",
|
||||||
|
"random": "cpp",
|
||||||
|
"ratio": "cpp",
|
||||||
|
"regex": "cpp",
|
||||||
|
"string": "cpp",
|
||||||
|
"string_view": "cpp",
|
||||||
|
"system_error": "cpp",
|
||||||
|
"tuple": "cpp",
|
||||||
|
"type_traits": "cpp",
|
||||||
|
"utility": "cpp",
|
||||||
|
"fstream": "cpp",
|
||||||
|
"initializer_list": "cpp",
|
||||||
|
"iosfwd": "cpp",
|
||||||
|
"istream": "cpp",
|
||||||
|
"limits": "cpp",
|
||||||
|
"mutex": "cpp",
|
||||||
|
"new": "cpp",
|
||||||
|
"ostream": "cpp",
|
||||||
|
"ranges": "cpp",
|
||||||
|
"shared_mutex": "cpp",
|
||||||
|
"sstream": "cpp",
|
||||||
|
"stdexcept": "cpp",
|
||||||
|
"stop_token": "cpp",
|
||||||
|
"streambuf": "cpp",
|
||||||
|
"thread": "cpp",
|
||||||
|
"cinttypes": "cpp",
|
||||||
|
"typeinfo": "cpp"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,10 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#ifdef __MACOS__
|
||||||
|
#include <sys/sysctl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
GpSystemServices_POSIX::GpSystemServices_POSIX()
|
GpSystemServices_POSIX::GpSystemServices_POSIX()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -44,7 +48,19 @@ IGpThreadEvent *GpSystemServices_POSIX::CreateThreadEvent(bool autoReset, bool s
|
|||||||
|
|
||||||
uint64_t GpSystemServices_POSIX::GetFreeMemoryCosmetic() const
|
uint64_t GpSystemServices_POSIX::GetFreeMemoryCosmetic() const
|
||||||
{
|
{
|
||||||
|
#ifdef __MACOS__
|
||||||
|
{ /* This works on *bsd and darwin. */
|
||||||
|
unsigned int usermem;
|
||||||
|
size_t len = sizeof usermem;
|
||||||
|
static int mib[2] = { CTL_HW, HW_USERMEM };
|
||||||
|
|
||||||
|
if (sysctl (mib, 2, &usermem, &len, NULL, 0) == 0
|
||||||
|
&& len == sizeof (usermem))
|
||||||
|
return (long) usermem;
|
||||||
|
}
|
||||||
|
#else
|
||||||
long pages = sysconf(_SC_AVPHYS_PAGES);
|
long pages = sysconf(_SC_AVPHYS_PAGES);
|
||||||
long pageSize = sysconf(_SC_PAGE_SIZE);
|
long pageSize = sysconf(_SC_PAGE_SIZE);
|
||||||
return pages * pageSize;
|
return pages * pageSize;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,13 @@
|
|||||||
|
|
||||||
#include "PLDrivers.h"
|
#include "PLDrivers.h"
|
||||||
|
|
||||||
|
#ifdef __MACOS__
|
||||||
|
#include <SDL.h>
|
||||||
|
#include <SDL_rwops.h>
|
||||||
|
#else
|
||||||
#include "SDL2/SDL.h"
|
#include "SDL2/SDL.h"
|
||||||
#include "SDL2/SDL_rwops.h"
|
#include "SDL2/SDL_rwops.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -22,7 +27,7 @@
|
|||||||
|
|
||||||
#include "UTF8.h"
|
#include "UTF8.h"
|
||||||
|
|
||||||
#ifdef __CYGWIN__
|
#if defined(__CYGWIN__) || defined(__MACOS__)
|
||||||
typedef off_t off64_t;
|
typedef off_t off64_t;
|
||||||
#define fstat64 fstat
|
#define fstat64 fstat
|
||||||
#define fseek64 fseek
|
#define fseek64 fseek
|
||||||
@@ -183,6 +188,9 @@ bool GpFileSystem_X::ResolvePath(PortabilityLayer::VirtualDirectory_t virtualDir
|
|||||||
case PortabilityLayer::VirtualDirectories::kFontCache:
|
case PortabilityLayer::VirtualDirectories::kFontCache:
|
||||||
prefsAppend = "FontCache";
|
prefsAppend = "FontCache";
|
||||||
break;
|
break;
|
||||||
|
case PortabilityLayer::VirtualDirectories::kLogs:
|
||||||
|
prefsAppend = "..";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
@@ -289,6 +297,7 @@ GpIOStream *GpFileSystem_X::OpenFileNested(PortabilityLayer::VirtualDirectory_t
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
std::string resolvedPath;
|
std::string resolvedPath;
|
||||||
|
|
||||||
if (!ResolvePath(virtualDirectory, subPaths, numSubPaths, resolvedPath))
|
if (!ResolvePath(virtualDirectory, subPaths, numSubPaths, resolvedPath))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
|||||||
@@ -26,15 +26,17 @@ IGpDisplayDriver *GpDriver_CreateDisplayDriver_SDL_GL2(const GpDisplayDriverProp
|
|||||||
IGpAudioDriver *GpDriver_CreateAudioDriver_SDL(const GpAudioDriverProperties &properties);
|
IGpAudioDriver *GpDriver_CreateAudioDriver_SDL(const GpAudioDriverProperties &properties);
|
||||||
IGpInputDriver *GpDriver_CreateInputDriver_SDL2_Gamepad(const GpInputDriverProperties &properties);
|
IGpInputDriver *GpDriver_CreateInputDriver_SDL2_Gamepad(const GpInputDriverProperties &properties);
|
||||||
|
|
||||||
|
#ifdef __MACOS__
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
#else
|
||||||
SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[])
|
SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[])
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
GpLogDriver_X::Init();
|
|
||||||
|
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER) < 0)
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
GpFileSystem_X::GetInstance()->Init();
|
GpFileSystem_X::GetInstance()->Init();
|
||||||
|
GpLogDriver_X::Init();
|
||||||
|
|
||||||
IGpLogDriver *logger = GpLogDriver_X::GetInstance();
|
IGpLogDriver *logger = GpLogDriver_X::GetInstance();
|
||||||
GpDriverCollection *drivers = GpAppInterface_Get()->PL_GetDriverCollection();
|
GpDriverCollection *drivers = GpAppInterface_Get()->PL_GetDriverCollection();
|
||||||
|
|||||||
@@ -2,7 +2,13 @@
|
|||||||
|
|
||||||
#include "IGpClipboardContents.h"
|
#include "IGpClipboardContents.h"
|
||||||
#include "IGpThreadEvent.h"
|
#include "IGpThreadEvent.h"
|
||||||
|
|
||||||
|
#ifdef __MACOS__
|
||||||
|
#include <SDL.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
#else
|
||||||
#include "SDL2/SDL.h"
|
#include "SDL2/SDL.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
@@ -1,13 +1,23 @@
|
|||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
|
||||||
project (Aerofoil)
|
project (Aerofoil)
|
||||||
|
SET(PLATFORM "X" CACHE STRING "Defines the target platform")
|
||||||
|
SET(EXECNAME "AerofoilX" CACHE STRING "Defines the exec name")
|
||||||
|
|
||||||
message(${CMAKE_BINARY_DIR})
|
message(${CMAKE_BINARY_DIR})
|
||||||
|
|
||||||
find_package(SDL2 REQUIRED)
|
find_package(SDL2 REQUIRED)
|
||||||
|
|
||||||
|
if(PLATFORM STREQUAL "MAC")
|
||||||
|
SET(EXECNAME "AerofoilMac" CACHE STRING "Defines the exec name" FORCE)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||||
|
add_definitions(-D__MACOS__)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message("Building ${EXECNAME} for: ${PLATFORM}")
|
||||||
|
|
||||||
add_definitions(-DGP_DEBUG_CONFIG=0)
|
add_definitions(-DGP_DEBUG_CONFIG=0)
|
||||||
|
|
||||||
|
|
||||||
add_library(stb STATIC
|
add_library(stb STATIC
|
||||||
stb/stb_image_write.c
|
stb/stb_image_write.c
|
||||||
)
|
)
|
||||||
@@ -231,7 +241,7 @@ target_include_directories(GpApp PRIVATE
|
|||||||
target_link_libraries(GpApp PortabilityLayer)
|
target_link_libraries(GpApp PortabilityLayer)
|
||||||
|
|
||||||
if(CMAKE_HOST_UNIX)
|
if(CMAKE_HOST_UNIX)
|
||||||
add_executable(AerofoilX
|
add_executable(${EXECNAME}
|
||||||
AerofoilPortable/GpSystemServices_POSIX.cpp
|
AerofoilPortable/GpSystemServices_POSIX.cpp
|
||||||
AerofoilPortable/GpThreadEvent_Cpp11.cpp
|
AerofoilPortable/GpThreadEvent_Cpp11.cpp
|
||||||
AerofoilSDL/GpAudioDriver_SDL2.cpp
|
AerofoilSDL/GpAudioDriver_SDL2.cpp
|
||||||
@@ -248,7 +258,7 @@ if(CMAKE_HOST_UNIX)
|
|||||||
AerofoilX/GpFileSystem_X.cpp
|
AerofoilX/GpFileSystem_X.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(AerofoilX PRIVATE
|
target_include_directories(${EXECNAME} PRIVATE
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Common>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Common>
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/GpCommon>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/GpCommon>
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/GpShell>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/GpShell>
|
||||||
@@ -258,8 +268,8 @@ if(CMAKE_HOST_UNIX)
|
|||||||
${SDL2_INCLUDE_DIRS}
|
${SDL2_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(AerofoilX ${SDL2_LIBRARIES} GpApp GpShell)
|
target_link_libraries(${EXECNAME} ${SDL2_LIBRARIES} GpApp GpShell)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
install (TARGETS AerofoilX)
|
install (TARGETS ${EXECNAME})
|
||||||
|
|||||||
@@ -3,6 +3,9 @@
|
|||||||
#define __PL_BINARY_SEARCH_H__
|
#define __PL_BINARY_SEARCH_H__
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#ifdef __MACOS__
|
||||||
|
#include <stddef.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace PortabilityLayer
|
namespace PortabilityLayer
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user