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
|
|
|
cmake_minimum_required(VERSION 3.5)
|
|
|
|
|
2021-04-20 19:38:46 +00:00
|
|
|
if(NOT REV_MAJOR)
|
|
|
|
set(REV_MAJOR 0)
|
|
|
|
endif()
|
|
|
|
if(NOT REV_MINOR)
|
|
|
|
set(REV_MINOR 0)
|
|
|
|
endif()
|
|
|
|
|
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
|
|
|
#
|
|
|
|
# Finds the current version of the current folder.
|
|
|
|
#
|
|
|
|
|
|
|
|
find_package(Git QUIET)
|
|
|
|
# ${CMAKE_SOURCE_DIR}/.git may be a directory or a regular file
|
2020-09-25 11:55:25 +00:00
|
|
|
if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
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
|
|
|
# Make sure LC_ALL is set to something desirable
|
|
|
|
set(SAVED_LC_ALL "$ENV{LC_ALL}")
|
|
|
|
set(ENV{LC_ALL} C)
|
|
|
|
|
|
|
|
# Assume the dir is not modified
|
|
|
|
set(REV_MODIFIED 0)
|
|
|
|
|
|
|
|
# Refresh the index to make sure file stat info is in sync, then look for modifications
|
2023-08-02 18:59:06 +00:00
|
|
|
execute_process(COMMAND ${GIT_EXECUTABLE} -C "${CMAKE_SOURCE_DIR}" update-index --refresh
|
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_SOURCE_DIR}
|
|
|
|
OUTPUT_QUIET
|
|
|
|
)
|
|
|
|
|
|
|
|
# See if git tree is modified
|
2023-08-02 18:59:06 +00:00
|
|
|
execute_process(COMMAND ${GIT_EXECUTABLE} -C "${CMAKE_SOURCE_DIR}" diff-index HEAD
|
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
|
|
|
OUTPUT_VARIABLE IS_MODIFIED
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
)
|
2020-09-25 11:55:25 +00:00
|
|
|
if(NOT IS_MODIFIED STREQUAL "")
|
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
|
|
|
set(REV_MODIFIED 2)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Get last commit hash
|
2023-08-02 18:59:06 +00:00
|
|
|
execute_process(COMMAND ${GIT_EXECUTABLE} -C "${CMAKE_SOURCE_DIR}" rev-parse --verify HEAD
|
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
|
|
|
OUTPUT_VARIABLE FULLHASH
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
ERROR_QUIET
|
|
|
|
)
|
|
|
|
set(REV_HASH "${FULLHASH}")
|
|
|
|
|
|
|
|
string(SUBSTRING "${FULLHASH}" 0 10 SHORTHASH)
|
|
|
|
|
|
|
|
# Get the last commit date
|
2024-04-10 08:50:44 +00:00
|
|
|
set(ENV{TZ} "UTC0")
|
2024-06-05 19:42:47 +00:00
|
|
|
execute_process(COMMAND ${GIT_EXECUTABLE} -C "${CMAKE_SOURCE_DIR}" show -s --date=iso-local --pretty=format:%cd HEAD
|
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
|
|
|
OUTPUT_VARIABLE COMMITDATE
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
)
|
|
|
|
string(REGEX REPLACE "([0-9]+)-([0-9]+)-([0-9]+).*" "\\1\\2\\3" COMMITDATE "${COMMITDATE}")
|
|
|
|
set(REV_ISODATE "${COMMITDATE}")
|
2020-06-05 19:43:22 +00:00
|
|
|
string(SUBSTRING "${REV_ISODATE}" 0 4 REV_YEAR)
|
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 the branch
|
2023-08-02 18:59:06 +00:00
|
|
|
execute_process(COMMAND ${GIT_EXECUTABLE} -C "${CMAKE_SOURCE_DIR}" symbolic-ref -q HEAD
|
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
|
|
|
OUTPUT_VARIABLE BRANCH
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
ERROR_QUIET
|
|
|
|
)
|
|
|
|
string(REGEX REPLACE ".*/" "" BRANCH "${BRANCH}")
|
|
|
|
|
|
|
|
# Get the tag
|
2023-08-02 18:59:06 +00:00
|
|
|
execute_process(COMMAND ${GIT_EXECUTABLE} -C "${CMAKE_SOURCE_DIR}" describe --tags --abbrev=9 --dirty=-m
|
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
|
|
|
OUTPUT_VARIABLE TAG
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
ERROR_QUIET
|
|
|
|
)
|
|
|
|
string(REGEX REPLACE "\^0$" "" TAG "${TAG}")
|
|
|
|
|
2020-09-25 11:55:25 +00:00
|
|
|
if(REV_MODIFIED EQUAL 0)
|
2020-10-20 17:38:49 +00:00
|
|
|
set(HASHSUFFIX "")
|
2020-09-25 11:55:25 +00:00
|
|
|
elseif(REV_MODIFIED EQUAL 2)
|
2020-10-20 17:38:49 +00:00
|
|
|
set(HASHSUFFIX "-m")
|
2020-09-25 11:55:25 +00:00
|
|
|
else()
|
2020-10-20 17:38:49 +00:00
|
|
|
set(HASHSUFFIX "-u")
|
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
|
|
|
endif()
|
|
|
|
|
|
|
|
# Set the version string
|
2020-09-25 11:55:25 +00:00
|
|
|
if(NOT TAG STREQUAL "")
|
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
|
|
|
set(REV_VERSION "${TAG}")
|
|
|
|
set(REV_ISTAG 1)
|
|
|
|
|
2020-06-05 01:42:31 +00:00
|
|
|
string(REGEX REPLACE "^[0-9.]+$" "" STABLETAG "${TAG}")
|
2021-04-01 11:04:34 +00:00
|
|
|
if(STABLETAG STREQUAL "")
|
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
|
|
|
set(REV_ISSTABLETAG 1)
|
2020-09-25 11:55:25 +00:00
|
|
|
else()
|
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
|
|
|
set(REV_ISSTABLETAG 0)
|
2020-09-25 11:55:25 +00:00
|
|
|
endif()
|
|
|
|
else()
|
2020-10-20 17:38:49 +00:00
|
|
|
set(REV_VERSION "${REV_ISODATE}-${BRANCH}-g${SHORTHASH}${HASHSUFFIX}")
|
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
|
|
|
set(REV_ISTAG 0)
|
|
|
|
set(REV_ISSTABLETAG 0)
|
2020-09-25 11:55:25 +00:00
|
|
|
endif()
|
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
|
|
|
|
2021-09-06 16:49:08 +00:00
|
|
|
if(EXISTS "${CMAKE_SOURCE_DIR}/.ottdrev-vc")
|
|
|
|
file(READ "${CMAKE_SOURCE_DIR}/.ottdrev-vc" OTTDREVVC)
|
|
|
|
string(REPLACE "\n" ";" OTTDREVVC "${OTTDREVVC}")
|
|
|
|
list(GET OTTDREVVC 0 OTTDREV)
|
|
|
|
string(REPLACE "\t" ";" OTTDREV "${OTTDREV}")
|
|
|
|
list(GET OTTDREV 0 REV_RELEASE)
|
|
|
|
else()
|
|
|
|
set(REV_RELEASE "jgrpp-0.0")
|
|
|
|
endif()
|
|
|
|
|
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
|
|
|
# Restore LC_ALL
|
|
|
|
set(ENV{LC_ALL} "${SAVED_LC_ALL}")
|
2020-10-14 16:38:23 +00:00
|
|
|
elseif(EXISTS "${CMAKE_SOURCE_DIR}/.ottdrev-vc")
|
2020-06-27 16:32:44 +00:00
|
|
|
file(READ "${CMAKE_SOURCE_DIR}/.ottdrev-vc" OTTDREVVC)
|
|
|
|
string(REPLACE "\n" ";" OTTDREVVC "${OTTDREVVC}")
|
2020-10-14 16:38:23 +00:00
|
|
|
list(GET OTTDREVVC 0 OTTDREV)
|
|
|
|
list(GET OTTDREVVC 1 SRCHASH)
|
2020-06-27 16:32:44 +00:00
|
|
|
string(REPLACE "\t" ";" OTTDREV "${OTTDREV}")
|
|
|
|
list(GET OTTDREV 0 REV_VERSION)
|
2021-09-06 16:49:08 +00:00
|
|
|
list(GET OTTDREV 0 REV_RELEASE)
|
2020-06-27 16:32:44 +00:00
|
|
|
list(GET OTTDREV 1 REV_ISODATE)
|
|
|
|
list(GET OTTDREV 2 REV_MODIFIED)
|
|
|
|
list(GET OTTDREV 3 REV_HASH)
|
|
|
|
list(GET OTTDREV 4 REV_ISTAG)
|
|
|
|
list(GET OTTDREV 5 REV_ISSTABLETAG)
|
|
|
|
list(GET OTTDREV 6 REV_YEAR)
|
2020-10-14 16:38:23 +00:00
|
|
|
if(REV_MODIFIED EQUAL 2)
|
2020-06-27 16:32:44 +00:00
|
|
|
string(REGEX REPLACE "M$" "" REV_VERSION "${REV_VERSION}")
|
2020-10-14 16:38:23 +00:00
|
|
|
endif()
|
2020-06-27 16:32:44 +00:00
|
|
|
execute_process(COMMAND ./version_utils.sh -o
|
|
|
|
RESULT_VARIABLE CAN_CHECK_MODIFIED
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
)
|
2020-10-14 16:38:23 +00:00
|
|
|
if(CAN_CHECK_MODIFIED EQUAL 0)
|
2020-06-27 16:32:44 +00:00
|
|
|
execute_process(COMMAND ./version_utils.sh -s
|
|
|
|
OUTPUT_VARIABLE CURRENT_HASH
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
)
|
2020-10-14 16:38:23 +00:00
|
|
|
if(NOT CURRENT_HASH STREQUAL SRCHASH)
|
2020-06-27 16:32:44 +00:00
|
|
|
set(REV_MODIFIED 2)
|
|
|
|
string(SUBSTRING "${CURRENT_HASH}" 0 8 SHORT_CURRENT_HASH)
|
|
|
|
set(REV_VERSION "${REV_VERSION}-H${SHORT_CURRENT_HASH}")
|
|
|
|
set(REV_MODIFIED 2)
|
2020-10-14 16:38:23 +00:00
|
|
|
endif()
|
|
|
|
else()
|
2020-06-27 16:32:44 +00:00
|
|
|
set(REV_MODIFIED 1)
|
2020-10-14 16:38:23 +00:00
|
|
|
endif()
|
2020-09-25 11:55:25 +00:00
|
|
|
elseif(EXISTS "${CMAKE_SOURCE_DIR}/.ottdrev")
|
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
|
|
|
file(READ "${CMAKE_SOURCE_DIR}/.ottdrev" OTTDREV)
|
2020-06-05 19:43:22 +00:00
|
|
|
string(REPLACE "\n" "" OTTDREV "${OTTDREV}")
|
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
|
|
|
string(REPLACE "\t" ";" OTTDREV "${OTTDREV}")
|
|
|
|
list(GET OTTDREV 0 REV_VERSION)
|
|
|
|
list(GET OTTDREV 1 REV_ISODATE)
|
|
|
|
list(GET OTTDREV 2 REV_MODIFIED)
|
|
|
|
list(GET OTTDREV 3 REV_HASH)
|
|
|
|
list(GET OTTDREV 4 REV_ISTAG)
|
|
|
|
list(GET OTTDREV 5 REV_ISSTABLETAG)
|
|
|
|
list(GET OTTDREV 6 REV_YEAR)
|
2021-09-06 16:49:08 +00:00
|
|
|
set(REV_RELEASE "jgrpp-0.0")
|
2020-09-25 11:55:25 +00:00
|
|
|
else()
|
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
|
|
|
message(WARNING "No version detected; this build will NOT be network compatible")
|
|
|
|
set(REV_VERSION "norev0000")
|
2021-09-06 16:49:08 +00:00
|
|
|
set(REV_RELEASE "jgrpp-0.0")
|
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
|
|
|
set(REV_ISODATE "19700101")
|
|
|
|
set(REV_MODIFIED 1)
|
|
|
|
set(REV_HASH "unknown")
|
|
|
|
set(REV_ISTAG 0)
|
|
|
|
set(REV_ISSTABLETAG 0)
|
|
|
|
set(REV_YEAR "1970")
|
2020-09-25 11:55:25 +00:00
|
|
|
endif()
|
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
|
|
|
|
2021-09-06 16:49:08 +00:00
|
|
|
string(REGEX MATCH "^jgrpp-[0-9]+(\.[0-9]+)?(\.[0-9]+)?" REV_RELEASE "${REV_RELEASE}")
|
|
|
|
string(REPLACE "jgrpp-" "" REV_RELEASE "${REV_RELEASE}")
|
|
|
|
|
|
|
|
message(STATUS "Version string: ${REV_VERSION}, Release: ${REV_RELEASE}")
|
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
|
|
|
|
2020-09-25 11:55:25 +00:00
|
|
|
if(GENERATE_OTTDREV)
|
2020-07-12 11:59:24 +00:00
|
|
|
message(STATUS "Generating ${GENERATE_OTTDREV}")
|
|
|
|
file(WRITE ${CMAKE_SOURCE_DIR}/${GENERATE_OTTDREV} "${REV_VERSION}\t${REV_ISODATE}\t${REV_MODIFIED}\t${REV_HASH}\t${REV_ISTAG}\t${REV_ISSTABLETAG}\t${REV_YEAR}\n")
|
2022-06-12 08:18:42 +00:00
|
|
|
elseif(NOT "${FIND_VERSION_BINARY_DIR}" STREQUAL "")
|
2019-04-07 10:01:32 +00:00
|
|
|
message(STATUS "Generating rev.cpp")
|
|
|
|
configure_file("${CMAKE_SOURCE_DIR}/src/rev.cpp.in"
|
|
|
|
"${FIND_VERSION_BINARY_DIR}/rev.cpp")
|
|
|
|
|
2020-09-25 11:55:25 +00:00
|
|
|
if(WIN32)
|
2019-04-07 10:01:32 +00:00
|
|
|
message(STATUS "Generating ottdres.rc")
|
|
|
|
configure_file("${CMAKE_SOURCE_DIR}/src/os/windows/ottdres.rc.in"
|
|
|
|
"${FIND_VERSION_BINARY_DIR}/ottdres.rc")
|
2020-09-25 11:55:25 +00:00
|
|
|
endif()
|
2019-04-07 10:01:32 +00:00
|
|
|
|
|
|
|
message(STATUS "Generating CPackProperties.cmake")
|
|
|
|
configure_file("${CMAKE_SOURCE_DIR}/CPackProperties.cmake.in"
|
|
|
|
"${CPACK_BINARY_DIR}/CPackProperties.cmake" @ONLY)
|
2020-12-10 22:57:27 +00:00
|
|
|
|
|
|
|
message(STATUS "Generating Doxyfile")
|
|
|
|
configure_file("${CMAKE_SOURCE_DIR}/Doxyfile.in"
|
|
|
|
"${CPACK_BINARY_DIR}/Doxyfile")
|
|
|
|
|
|
|
|
message(STATUS "Generating Doxyfile_AI")
|
|
|
|
configure_file("${CMAKE_SOURCE_DIR}/src/script/api/Doxyfile_AI.in"
|
|
|
|
"${CPACK_BINARY_DIR}/Doxyfile_AI")
|
|
|
|
|
|
|
|
message(STATUS "Generating Doxyfile_GS")
|
|
|
|
configure_file("${CMAKE_SOURCE_DIR}/src/script/api/Doxyfile_GS.in"
|
|
|
|
"${CPACK_BINARY_DIR}/Doxyfile_GS")
|
2020-09-25 11:55:25 +00:00
|
|
|
endif()
|