1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-12 18:42:36 +01:00

Allow compilation of testpaint on non-x86 targets (#7989)

This will enable compilation of testpaint on targets different than x86.
It won't function the way it does on x86, but it should provide a way of
tackling various compilation errors that can only be seen in the very
specific environment required by testpaint proper.
This commit is contained in:
Michał Janiszewski
2018-09-15 23:37:45 +02:00
committed by GitHub
parent 47eea292b5
commit 92b556352b
3 changed files with 14 additions and 4 deletions

View File

@@ -216,7 +216,7 @@ add_custom_target(g2 DEPENDS ${PROJECT} g2.dat)
# Include tests # Include tests
if (WITH_TESTS) if (WITH_TESTS)
enable_testing() enable_testing()
if (UNIX AND (NOT USE_MMAP) AND FORCE32) if (UNIX AND (NOT USE_MMAP))
include("${ROOT_DIR}/test/testpaint/CMakeLists.txt" NO_POLICY_SCOPE) include("${ROOT_DIR}/test/testpaint/CMakeLists.txt" NO_POLICY_SCOPE)
endif () endif ()
include("${ROOT_DIR}/test/tests/CMakeLists.txt" NO_POLICY_SCOPE) include("${ROOT_DIR}/test/tests/CMakeLists.txt" NO_POLICY_SCOPE)

View File

@@ -18,7 +18,7 @@ add_custom_command(
DEPENDS ${OPENRCT2_EXE} DEPENDS ${OPENRCT2_EXE}
) )
add_custom_target(segfiles DEPENDS openrct2_text openrct2_data) add_custom_target(segfiles DEPENDS openrct2_text openrct2_data)
if (NOT USE_MMAP) if (NOT USE_MMAP AND FORCE32)
set(OBJ_FORMAT "elf32-i386") set(OBJ_FORMAT "elf32-i386")
set(LINKER_SCRIPT "ld_script_i386.xc") set(LINKER_SCRIPT "ld_script_i386.xc")
if (APPLE) if (APPLE)
@@ -92,6 +92,11 @@ if (NOT MINGW AND NOT MSVC)
target_link_libraries(testpaint ${ICU_LIBRARIES}) target_link_libraries(testpaint ${ICU_LIBRARIES})
endif () endif ()
set_target_properties(testpaint PROPERTIES COMPILE_FLAGS "-DNO_VEHICLES -D__TESTPAINT__ -Wno-unused") # Only use custom linker script for 32 bit builds. For 64 bit builds, it should still _compile_.
set_target_properties(testpaint PROPERTIES LINK_FLAGS ${RCT2_SEGMENT_LINKER_FLAGS}) if (FORCE32)
set_target_properties(testpaint PROPERTIES LINK_FLAGS ${RCT2_SEGMENT_LINKER_FLAGS})
else ()
set(TESTPAINT_64BIT_FLAGS "-Wno-int-to-pointer-cast -fpermissive -Wno-error")
endif ()
set_target_properties(testpaint PROPERTIES COMPILE_FLAGS "-DNO_VEHICLES -D__TESTPAINT__ -Wno-unused ${TESTPAINT_64BIT_FLAGS}")
add_dependencies(testpaint segfiles) add_dependencies(testpaint segfiles)

View File

@@ -451,6 +451,10 @@ static void TestGeneralSupportHeightCall()
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
#if !defined(__i386__)
fprintf(stderr, "Testpaint can only be properly executed on x86\n");
return 1;
#else
TestGeneralSupportHeightCall(); TestGeneralSupportHeightCall();
std::vector<TestCase> testCases; std::vector<TestCase> testCases;
@@ -636,4 +640,5 @@ int main(int argc, char* argv[])
} }
return 0; return 0;
#endif
} }