Add: introduce CMake for project management
CMake works on all our supported platforms, like MSVC, Mingw, GCC,
Clang, and many more. It allows for a single way of doing things,
so no longer we need shell scripts and vbs scripts to work on all
our supported platforms.
Additionally, CMake allows to generate project files for like MSVC,
KDevelop, etc.
This heavily reduces the lines of code we need to support multiple
platforms from a project perspective.
Addtiionally, this heavily improves our detection of libraries, etc.
2019-04-07 09:57:55 +00:00
|
|
|
# Macro which contains all bits and pieces to create the regression tests.
|
|
|
|
# This creates both a standalone target 'regression', and it integrates with
|
|
|
|
# 'ctest'. The first is prefered, as it is more verbose, and takes care of
|
|
|
|
# dependencies correctly.
|
|
|
|
#
|
2023-12-05 14:37:53 +00:00
|
|
|
# create_regression(file1 ...)
|
Add: introduce CMake for project management
CMake works on all our supported platforms, like MSVC, Mingw, GCC,
Clang, and many more. It allows for a single way of doing things,
so no longer we need shell scripts and vbs scripts to work on all
our supported platforms.
Additionally, CMake allows to generate project files for like MSVC,
KDevelop, etc.
This heavily reduces the lines of code we need to support multiple
platforms from a project perspective.
Addtiionally, this heavily improves our detection of libraries, etc.
2019-04-07 09:57:55 +00:00
|
|
|
#
|
|
|
|
macro(create_regression)
|
2023-12-05 14:37:53 +00:00
|
|
|
set(REGRESSION_SOURCE_FILES ${ARGN})
|
|
|
|
|
Add: introduce CMake for project management
CMake works on all our supported platforms, like MSVC, Mingw, GCC,
Clang, and many more. It allows for a single way of doing things,
so no longer we need shell scripts and vbs scripts to work on all
our supported platforms.
Additionally, CMake allows to generate project files for like MSVC,
KDevelop, etc.
This heavily reduces the lines of code we need to support multiple
platforms from a project perspective.
Addtiionally, this heavily improves our detection of libraries, etc.
2019-04-07 09:57:55 +00:00
|
|
|
foreach(REGRESSION_SOURCE_FILE IN LISTS REGRESSION_SOURCE_FILES)
|
2021-02-22 18:01:21 +00:00
|
|
|
string(REPLACE "${CMAKE_SOURCE_DIR}/regression/" "" REGRESSION_SOURCE_FILE_NAME "${REGRESSION_SOURCE_FILE}")
|
|
|
|
string(CONCAT REGRESSION_BINARY_FILE "${CMAKE_BINARY_DIR}/ai/" "${REGRESSION_SOURCE_FILE_NAME}")
|
Add: introduce CMake for project management
CMake works on all our supported platforms, like MSVC, Mingw, GCC,
Clang, and many more. It allows for a single way of doing things,
so no longer we need shell scripts and vbs scripts to work on all
our supported platforms.
Additionally, CMake allows to generate project files for like MSVC,
KDevelop, etc.
This heavily reduces the lines of code we need to support multiple
platforms from a project perspective.
Addtiionally, this heavily improves our detection of libraries, etc.
2019-04-07 09:57:55 +00:00
|
|
|
|
|
|
|
add_custom_command(OUTPUT ${REGRESSION_BINARY_FILE}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
|
|
${REGRESSION_SOURCE_FILE}
|
|
|
|
${REGRESSION_BINARY_FILE}
|
|
|
|
MAIN_DEPENDENCY ${REGRESSION_SOURCE_FILE}
|
|
|
|
COMMENT "Copying ${REGRESSION_SOURCE_FILE_NAME} regression file"
|
|
|
|
)
|
|
|
|
|
|
|
|
list(APPEND REGRESSION_BINARY_FILES ${REGRESSION_BINARY_FILE})
|
2020-09-25 11:55:25 +00:00
|
|
|
endforeach()
|
Add: introduce CMake for project management
CMake works on all our supported platforms, like MSVC, Mingw, GCC,
Clang, and many more. It allows for a single way of doing things,
so no longer we need shell scripts and vbs scripts to work on all
our supported platforms.
Additionally, CMake allows to generate project files for like MSVC,
KDevelop, etc.
This heavily reduces the lines of code we need to support multiple
platforms from a project perspective.
Addtiionally, this heavily improves our detection of libraries, etc.
2019-04-07 09:57:55 +00:00
|
|
|
|
2023-12-05 14:37:53 +00:00
|
|
|
get_filename_component(REGRESSION_TEST_NAME "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
|
Add: introduce CMake for project management
CMake works on all our supported platforms, like MSVC, Mingw, GCC,
Clang, and many more. It allows for a single way of doing things,
so no longer we need shell scripts and vbs scripts to work on all
our supported platforms.
Additionally, CMake allows to generate project files for like MSVC,
KDevelop, etc.
This heavily reduces the lines of code we need to support multiple
platforms from a project perspective.
Addtiionally, this heavily improves our detection of libraries, etc.
2019-04-07 09:57:55 +00:00
|
|
|
|
2023-12-05 14:37:53 +00:00
|
|
|
# Create a new target which copies regression files
|
|
|
|
add_custom_target(regression_${REGRESSION_TEST_NAME}_files
|
Add: introduce CMake for project management
CMake works on all our supported platforms, like MSVC, Mingw, GCC,
Clang, and many more. It allows for a single way of doing things,
so no longer we need shell scripts and vbs scripts to work on all
our supported platforms.
Additionally, CMake allows to generate project files for like MSVC,
KDevelop, etc.
This heavily reduces the lines of code we need to support multiple
platforms from a project perspective.
Addtiionally, this heavily improves our detection of libraries, etc.
2019-04-07 09:57:55 +00:00
|
|
|
DEPENDS
|
|
|
|
${REGRESSION_BINARY_FILES}
|
|
|
|
)
|
|
|
|
|
2023-12-05 14:37:53 +00:00
|
|
|
add_dependencies(regression_files regression_${REGRESSION_TEST_NAME}_files)
|
|
|
|
|
|
|
|
add_custom_target(regression_${REGRESSION_TEST_NAME}
|
|
|
|
COMMAND ${CMAKE_COMMAND}
|
|
|
|
-DOPENTTD_EXECUTABLE=$<TARGET_FILE:openttd>
|
|
|
|
-DEDITBIN_EXECUTABLE=${EDITBIN_EXECUTABLE}
|
|
|
|
-DREGRESSION_TEST=${REGRESSION_TEST_NAME}
|
|
|
|
-P "${CMAKE_SOURCE_DIR}/cmake/scripts/Regression.cmake"
|
|
|
|
DEPENDS openttd regression_${REGRESSION_TEST_NAME}_files
|
|
|
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
|
|
|
COMMENT "Running regression test ${REGRESSION_TEST_NAME}"
|
|
|
|
)
|
Add: introduce CMake for project management
CMake works on all our supported platforms, like MSVC, Mingw, GCC,
Clang, and many more. It allows for a single way of doing things,
so no longer we need shell scripts and vbs scripts to work on all
our supported platforms.
Additionally, CMake allows to generate project files for like MSVC,
KDevelop, etc.
This heavily reduces the lines of code we need to support multiple
platforms from a project perspective.
Addtiionally, this heavily improves our detection of libraries, etc.
2019-04-07 09:57:55 +00:00
|
|
|
|
2023-12-05 14:37:53 +00:00
|
|
|
# Also make sure that 'make test' runs the regression
|
|
|
|
add_test(NAME regression_${REGRESSION_TEST_NAME}
|
|
|
|
COMMAND ${CMAKE_COMMAND}
|
|
|
|
-DOPENTTD_EXECUTABLE=$<TARGET_FILE:openttd>
|
|
|
|
-DEDITBIN_EXECUTABLE=${EDITBIN_EXECUTABLE}
|
|
|
|
-DREGRESSION_TEST=${REGRESSION_TEST_NAME}
|
|
|
|
-P "${CMAKE_SOURCE_DIR}/cmake/scripts/Regression.cmake"
|
|
|
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
|
|
|
)
|
Add: introduce CMake for project management
CMake works on all our supported platforms, like MSVC, Mingw, GCC,
Clang, and many more. It allows for a single way of doing things,
so no longer we need shell scripts and vbs scripts to work on all
our supported platforms.
Additionally, CMake allows to generate project files for like MSVC,
KDevelop, etc.
This heavily reduces the lines of code we need to support multiple
platforms from a project perspective.
Addtiionally, this heavily improves our detection of libraries, etc.
2019-04-07 09:57:55 +00:00
|
|
|
|
2023-12-05 14:37:53 +00:00
|
|
|
add_dependencies(regression regression_${REGRESSION_TEST_NAME})
|
Add: introduce CMake for project management
CMake works on all our supported platforms, like MSVC, Mingw, GCC,
Clang, and many more. It allows for a single way of doing things,
so no longer we need shell scripts and vbs scripts to work on all
our supported platforms.
Additionally, CMake allows to generate project files for like MSVC,
KDevelop, etc.
This heavily reduces the lines of code we need to support multiple
platforms from a project perspective.
Addtiionally, this heavily improves our detection of libraries, etc.
2019-04-07 09:57:55 +00:00
|
|
|
endmacro()
|