Skip to content
Permalink
Browse files

Compilation/execution on ARM is now possible

  • Loading branch information
turleypol committed Jan 6, 2020
1 parent 14e02f2 commit 6ef50f50dd7afa8e8db787b0f00d7be0c23691ac
@@ -0,0 +1,51 @@
name: ARMbuild

on: [push, pull_request]

jobs:
build:
strategy:
fail-fast: false
matrix:
config:
- os: "ubuntu-latest"
cxx-compiler: g++-8
c-compiler: gcc-8
build-type: RelWithDebInfo
runs-on: ${{ matrix.config.os }}

steps:
- uses: actions/checkout@v1
- uses: uraimo/run-on-arch-action@v1.0.5
id: runcmd
with:
architecture: armv7
distribution: stretch
run: |
uname -a
apt-get update
apt-get -y install locales
sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen
locale-gen en_US
locale-gen en_US.UTF-8
update-locale
update-locale LANG=en_US.UTF-8 LANGUAGE
apt-get install build-essential -y
apt-get install cmake libssl-dev -y
apt-get install zlib1g-dev -y
apt-get install git -y
cd bin-build
cmake ..
cmake --build . --config RelWithDebInfo -- -j 2
ctest -j2 --output-on-failure --repeat-until-fail 2 -C RelWithDebInfo
cmake --build . --config RelWithDebInfo --target package
cmake --build . --config RelWithDebInfo --target create_dbg_zip
cd ../bin
mkdir release
mv *.zip release

- name: Upload Artefact
uses: actions/upload-artifact@v1
with:
name: Nightly-ARMv7-Stretch-gcc-6
path: bin/release
@@ -52,6 +52,11 @@ if(${ENABLE_TIDY})
endif()


include(CheckIncludeFiles)
include(ExternalProject)
include(CheckCXXSourceCompiles)
include(TestBigEndian)

include(cmake/init.cmake)

set(output_bin_dir "${CMAKE_SOURCE_DIR}/bin")
@@ -93,10 +98,6 @@ endif()

message("")

include(CheckIncludeFiles)
include(ExternalProject)


include(cmake/compile_defs.cmake)
include(cmake/release.cmake)
if (${CMAKE_VERSION} VERSION_LESS "3.16")
@@ -36,6 +36,11 @@ function(set_compile_flags target is_executable)
_GNU_SOURCE
LINUX
)
if (${file_offset_bits})
target_compile_definitions(${target} PRIVATE
_FILE_OFFSET_BITS=64
)
endif()
endif()

if (${windows})
@@ -62,7 +67,7 @@ function(set_compile_flags target is_executable)
-Wall
-Wextra
>

$<$<AND:${FORCE_ARCH_BITS},${linux}>:
-m${ARCH_BITS}
>
@@ -33,16 +33,18 @@ function (readfile file content content_len)
set(${content_len} ${len} PARENT_SCOPE)
endfunction()

function (compareresult scriptname)
function (compareresult scriptname result)
execute_process(
COMMAND ${CMAKE_COMMAND} -E compare_files "${scriptname}.out" "${scriptname}.tst"
RESULT_VARIABLE test_not_successful
OUTPUT_QUIET
ERROR_QUIET
)
if (NOT ${test_not_successful})
set(${result} 1 PARENT_SCOPE)
return()
endif()
set(${result} 0 PARENT_SCOPE)
readfile("${scriptname}.out" outcontent outlen)
readfile("${scriptname}.tst" tstcontent tstlen)
if (${outlen} EQUAL ${tstlen})
@@ -54,10 +56,12 @@ function (compareresult scriptname)
message("${scriptname}.src failed:")
message("Line ${line} Expected:\n${out}\nGot:\n${tst}")
cleanup(${scriptname})
set(${result} 0 PARENT_SCOPE)
message(SEND_ERROR "Line differs")
endif()
endforeach()
else()
message("\"${tst}\"")
message(SEND_ERROR "Testdata length differs")
cleanup(${scriptname})
endif()
@@ -126,7 +130,10 @@ foreach(script ${scripts})
message(SEND_ERROR "${scriptname}.ecl did not run")
message(${runecl_out})
else()
compareresult(${scriptname})
compareresult(${scriptname} success)
if (NOT ${success})
message(${runecl_out})
endif()
endif()
endif()
endif()
@@ -58,14 +58,61 @@ macro(detect_arch)
endif()
endmacro()

macro(test_file_offset)
check_cxx_source_compiles(
"#include <sys/types.h>
#define KB ((off_t)1024)
#define MB ((off_t)1024 * KB)
#define GB ((off_t)1024 * MB)
#define TB ((off_t)1024 * GB)
int t2[(((64 * GB -1) % 671088649) == 268434537)
&& (((TB - (64 * GB -1) + 255) % 1792151290) == 305159546)? 1: -1];
int main()
{
return 0;
}"
file_offset_test
)
endmacro()

macro(detect_platform)
set (linux 0)
set (windows 0)
set (arm_proc 0)
if (UNIX AND NOT WIN32)
set (linux 1)
elseif (WIN32)
set (windows 1)
endif()

test_big_endian(bigendian)
if (bigendian)
#Error? I don't think that it really works
message("Platform is Big Endian")
else()
message("Platform is Little Endian")
endif()

message("Compiling on processor ${CMAKE_SYSTEM_PROCESSOR}")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm.*|ARM.*)")
set(arm_proc 1)
endif()

#atleast a problem when arm (32bit) processor runs in a VM
set(file_offset_bits 0)
if (linux)
test_file_offset()
if (NOT file_offset_test)
set(CMAKE_REQUIRED_DEFINITIONS -D_FILE_OFFSET_BITS=64)
test_file_offset()
set(CMAKE_REQUIRED_DEFINITIONS )
if (file_offset_test)
set(file_offset_bits 1)
message("Using 64bit file interface")
endif()
endif()
endif()
endmacro()

macro(fix_compiler_flags)
@@ -109,15 +156,20 @@ macro(prepare_build)
if(windows)
set(HAVE_OPENSSL true)
set(HAVE_MYSQL true)
set(HAVE_ZLIB true)
else()
check_include_files (openssl/md5.h HAVE_OPENSSL)
check_include_files (mysql/mysql.h HAVE_MYSQL)
check_include_files (zlib.h HAVE_ZLIB)
endif()
if (NOT HAVE_OPENSSL)
message(FATAL_ERROR "OpenSSL not found")
endif()
if (NOT HAVE_ZLIB)
message(FATAL_ERROR "ZLib not found")
endif()
if (NOT HAVE_MYSQL)
message("MySQL not found")
message(WARNING "MySQL not found")
endif()
configure_file(
${CMAKE_CURRENT_LIST_DIR}/cmake/env/pol_global_config.h.in
@@ -191,6 +243,9 @@ endmacro()

macro(git_revision_target)
find_package(Git)
if (NOT GIT_EXECUTABLE)
message(WARNING "Git not found unable to store revision")
endif()
add_custom_target(git_rev
COMMAND ${CMAKE_COMMAND}
-DGIT=${GIT_EXECUTABLE}
@@ -28,6 +28,7 @@ if (${linux})
target_link_libraries(${lib_name} PUBLIC
crypto
pthread
atomic
)
elseif(${windows})
target_link_libraries(${lib_name} PUBLIC
@@ -349,7 +349,7 @@ MF_NO_MYSQL( mf_mysql_connect )
MF_NO_MYSQL( mf_mysql_select_db )
MF_NO_MYSQL( mf_mysql_query )
MF_NO_MYSQL( mf_mysql_num_fields )
MF_NO_MYSQL( mf_mysql_field_names )
MF_NO_MYSQL( mf_mysql_field_name )
MF_NO_MYSQL( mf_mysql_affected_rows )
MF_NO_MYSQL( mf_mysql_num_rows )
MF_NO_MYSQL( mf_mysql_close )
@@ -9,6 +9,7 @@

#include <string>
#include <vector>
#include "../clib/rawtypes.h"

namespace Pol
{
@@ -21,11 +22,11 @@ namespace Core
class Coordinate
{
public:
unsigned short x;
unsigned short y;
char z;
u16 x;
u16 y;
s8 z;

Coordinate( unsigned short i_x, unsigned short i_y, char i_z ) : x( i_x ), y( i_y ), z( i_z ) {}
Coordinate( u16 i_x, u16 i_y, s8 i_z ) : x( i_x ), y( i_y ), z( i_z ) {}
/*Coordinate( const Coordinate& );
const Coordinate& operator=( const Coordinate& );*/
};

0 comments on commit 6ef50f5

Please sign in to comment.
You can’t perform that action at this time.