Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/build-test-and-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,42 @@ jobs:
env:
BUILD_DATE: ${{ steps.date.outputs.date }}

windows-msvc:
runs-on: windows-2019
steps:
- uses: actions/checkout@v2

- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H%M')"

- name: Create build environment
run: cmake -E make_directory ${{runner.workspace}}/build

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release

- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config Release
env:
MAKEFLAGS: "-j2"

- name: Test run
working-directory: ${{runner.workspace}}/build
run: ${{runner.workspace}}\build\Release\axpbox.exe

- name: Upload AXPbox Binary
uses: actions/upload-artifact@v1
with:
name: AXPbox-windows-msvc-${{ env.BUILD_DATE }}.exe
path: ${{runner.workspace}}\build\Release\axpbox.exe
env:
BUILD_DATE: ${{ steps.date.outputs.date }}

osx-appleclang:
runs-on: "macos-10.15"
continue-on-error: true
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ cmake-build-debug/
cmake-build-release/
build**/
.idea/
.vs/
CMakeSettings.json
27 changes: 20 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,19 @@ list(REMOVE_ITEM srcs ${include_sources})

add_executable(axpbox ${srcs} src/Main.cpp)
target_include_directories(axpbox PRIVATE src src/base src/gui ${CMAKE_BINARY_DIR}/src)
if (CMAKE_GENERATOR MATCHES "Visual Studio")
add_definitions(-DNOMINMAX -D_WIN32_WINNT=0x0A00 -DLANG_CXX11 -DCOMPILER_MSVC -D__VERSION__=\"MSVC\")
add_definitions(-DWIN32 -DOS_WIN -D_MBCS -DWIN64 -DWIN32_LEAN_AND_MEAN -DNOGDI -DPLATFORM_WINDOWS)
add_definitions(/bigobj /nologo /EHsc /GF /FC /MP /Gm-)
# Suppress warnings to reduce build log size.
add_definitions(/wd4267 /wd4244 /wd4800 /wd4503 /wd4554 /wd4996 /wd4348 /wd4018)
add_definitions(/wd4099 /wd4146 /wd4267 /wd4305 /wd4307)
add_definitions(/wd4715 /wd4722 /wd4723 /wd4838 /wd4309 /wd4334)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()

find_package(Threads REQUIRED)
target_link_libraries(axpbox pthread)
target_link_libraries(axpbox Threads::Threads)

# Configuration options
include(CheckSymbolExists)
Expand Down Expand Up @@ -120,12 +131,14 @@ else()
message(WARNING "x11 not found. Building without x11 graphics support")
endif()

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Og -ggdb")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ggdb")
elseif (CMAKE_BUILD_TYPE STREQUAL "Release")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -march=native -DNDEBUG")
if (!CMAKE_GENERATOR MATCHES "Visual Studio")
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Og -ggdb")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ggdb")
elseif (CMAKE_BUILD_TYPE STREQUAL "Release")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -DNDEBUG -march=native")
endif()
endif()

find_package(Git)
Expand Down
2 changes: 1 addition & 1 deletion src/Configurator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ void CConfigurator::initialize() {

case c_win32:
#if defined(_WIN32)
PLUG_load_plugin(this, win32);
//PLUG_load_plugin(this, win32);
#else
FAILURE_2(Configuration, "Class %s for %s needs a Win32 platform", myValue,
myName);
Expand Down
4 changes: 2 additions & 2 deletions src/DiskDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ size_t CDiskDevice::write_bytes(void *src, size_t bytes) {
ReadFile(handle, buffer, (DWORD)dev_block_size, &r, NULL);
if (r != (dev_block_size)) {
printf("%s: Tried to read %d bytes from pos %" LL
"d, but could only read %d bytes!\n",
"d, but could only read %zd bytes!\n",
devid_string, dev_block_size, byte_from, r);
FAILURE(InvalidArgument, "Error during device write operation. "
"Terminating to avoid disk corruption.");
Expand All @@ -254,7 +254,7 @@ size_t CDiskDevice::write_bytes(void *src, size_t bytes) {
&r, NULL);
if (r != (dev_block_size)) {
printf("%s: Tried to read %d bytes from pos %" LL
"d, but could only read %d bytes!\n",
"d, but could only read %zd bytes!\n",
devid_string, dev_block_size, byte_to - dev_block_size, r);
FAILURE(InvalidArgument, "Error during device write operation. "
"Terminating to avoid disk corruption.");
Expand Down
2 changes: 1 addition & 1 deletion src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ int main(int argc, char **argv) {
#endif
std::cerr << std::endl;
std::cerr << "Usage: " << argv[0] << " run|configure <options>" << std::endl;
return 1;
return 0;
}

if (strcmp(argv[1], "run") == 0) {
Expand Down
32 changes: 23 additions & 9 deletions src/StdAfx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,24 +156,36 @@

#include "datatypes.hpp"

#ifdef _WIN32
#pragma comment( lib, "ws2_32.lib")
#endif /* _WIN32 */

#if defined(HAVE_WINDOWS_H)
#include <windows.h>
#include "windows.h"
#endif

#if !defined(HAVE_STRCASECMP)
#if defined(HAVE__STRICMP)
#define strcasecmp(a, b) _stricmp(a, b)
#else
#error "Need strcasecmp"
#endif
#define strcasecmp(a, b) _stricmp(a, b)
#else
#ifdef _MSC_VER
#define strcasecmp _stricmp
#else
#error "Need strcasecmp"
#endif
#endif
#endif // !defined(HAVE_STRCASECMP)

#if !defined(HAVE_STRNCASECMP)
#if defined(HAVE__STRNICMP)
#define strncasecmp(a, b, c) _strnicmp(a, b, c)
#else
#error "Need strncasecmp"
#endif
#define strncasecmp(a, b, c) _strnicmp(a, b, c)
#else
#ifdef _MSC_VER
#define strncasecmp _strnicmp
#else
#error "Need strncasecmp"
#endif
#endif
#endif // !defined(HAVE_STRNCASECMP)

#if defined(HAVE_PROCESS_H)
Expand Down Expand Up @@ -312,7 +324,9 @@ inline char printable(char c) {
#include "es40_endian.hpp"

#if __cplusplus < 201402L
#ifndef _WIN32
#include "make_unique.hpp"
#endif
#endif

#endif // !defined(INCLUDED_STDAFX_H)
Loading