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 a single grf file based
|
|
|
|
# on NFO and PNG files.
|
|
|
|
#
|
2023-12-04 16:41:02 +00:00
|
|
|
# create_grf_command(NFO_SOURCE_FILES nfo_file1 ... PNG_SOURCE_FILES png_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
|
|
|
#
|
|
|
|
function(create_grf_command)
|
2023-12-04 16:41:02 +00:00
|
|
|
cmake_parse_arguments(GRF "" "" "NFO_SOURCE_FILES;PNG_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
|
|
|
|
|
|
|
get_filename_component(GRF_SOURCE_FOLDER_NAME "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
|
|
|
|
get_filename_component(GRF_BINARY_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../${GRF_SOURCE_FOLDER_NAME}.grf ABSOLUTE)
|
|
|
|
|
|
|
|
# Copy over all the PNG files to the correct folder
|
|
|
|
foreach(GRF_PNG_SOURCE_FILE IN LISTS GRF_PNG_SOURCE_FILES)
|
|
|
|
get_filename_component(GRF_PNG_SOURCE_FILE_NAME "${GRF_PNG_SOURCE_FILE}" NAME)
|
|
|
|
set(GRF_PNG_BINARY_FILE "${CMAKE_CURRENT_BINARY_DIR}/sprites/${GRF_PNG_SOURCE_FILE_NAME}")
|
|
|
|
|
|
|
|
add_custom_command(OUTPUT ${GRF_PNG_BINARY_FILE}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
|
|
${GRF_PNG_SOURCE_FILE}
|
|
|
|
${GRF_PNG_BINARY_FILE}
|
|
|
|
MAIN_DEPENDENCY ${GRF_PNG_SOURCE_FILE}
|
|
|
|
COMMENT "Copying ${GRF_PNG_SOURCE_FILE_NAME} sprite file"
|
|
|
|
)
|
|
|
|
|
|
|
|
list(APPEND GRF_PNG_BINARY_FILES ${GRF_PNG_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-11-26 15:59:41 +00:00
|
|
|
add_custom_command(OUTPUT ${GRF_BINARY_FILE} ${GRF_BINARY_FILE}.hash
|
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
|
|
|
COMMAND ${CMAKE_COMMAND}
|
|
|
|
-DGRF_SOURCE_FOLDER=${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
-DGRF_BINARY_FILE=${GRF_BINARY_FILE}
|
|
|
|
-DNFORENUM_EXECUTABLE=${NFORENUM_EXECUTABLE}
|
|
|
|
-DGRFCODEC_EXECUTABLE=${GRFCODEC_EXECUTABLE}
|
2023-11-26 15:59:41 +00:00
|
|
|
-DGRFID_EXECUTABLE=${GRFID_EXECUTABLE}
|
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
|
|
|
-P ${CMAKE_SOURCE_DIR}/cmake/scripts/CreateGRF.cmake
|
2021-04-24 15:49:41 +00:00
|
|
|
MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/cmake/scripts/CreateGRF.cmake
|
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 ${GRF_PNG_BINARY_FILES}
|
2021-04-24 15:49:41 +00:00
|
|
|
${GRF_NFO_SOURCE_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
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
COMMENT "Generating ${GRF_SOURCE_FOLDER_NAME}.grf"
|
|
|
|
)
|
|
|
|
|
|
|
|
# For conviance, if you want to only test building the GRF
|
|
|
|
add_custom_target(${GRF_SOURCE_FOLDER_NAME}.grf
|
|
|
|
DEPENDS
|
|
|
|
${GRF_BINARY_FILE}
|
|
|
|
)
|
|
|
|
endfunction()
|