Process the rc file before building.

This commit is contained in:
Username404 2021-03-12 21:24:28 +01:00
parent 0c7c890a21
commit 76fbe593eb
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
4 changed files with 19 additions and 8 deletions

View File

@ -1,6 +1,16 @@
cmake_minimum_required(VERSION 3.18) cmake_minimum_required(VERSION 3.18)
project(Yerbacon VERSION 0.0.1 LANGUAGES C CXX) project(Yerbacon VERSION 0.0.1 LANGUAGES C CXX)
if (NOT DEFINED CODENAME)
set(CODENAME "Unknown")
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/misc/codename.txt")
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/misc/codename.txt" CODENAME)
endif ()
endif()
file(COPY "resources/Yerbacon.manifest" "resources/Yerbacon.ico" DESTINATION "processed")
configure_file("resources/Yerbacon.rc" "processed/Yerbacon.rc" @ONLY)
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "-Wall") set(CMAKE_CXX_FLAGS "-Wall")
@ -38,7 +48,7 @@ string(TIMESTAMP TIME "%Y.%m+%d")
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}-${TIME}") set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}-${TIME}")
set(CPACK_PACKAGE_VENDOR "Contributor(s)") set(CPACK_PACKAGE_VENDOR "Contributor(s)")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resources/Yerbacon.png") set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resources/Yerbacon.png")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/desc.txt") set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/misc/desc.txt")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Transpiler for the yerbacon language.") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Transpiler for the yerbacon language.")
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md") set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
@ -48,7 +58,7 @@ set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION}-${TI
set(CPACK_STRIP_FILES TRUE) set(CPACK_STRIP_FILES TRUE)
include_directories(${CMAKE_CURRENT_LIST_DIR}) include_directories(${CMAKE_CURRENT_LIST_DIR})
add_executable(ybcon src/main.cpp resources/Yerbacon.rc src/parser/MainParse.cpp src/transpiler/MainTranspile.cpp src/etc/filefuncs.cpp src/etc/lexer.cpp src/headers/lex.hpp src/headers/misc.hpp src/headers/parsing/ParseComponents.hpp src/headers/parsing/StandardComponents.hpp) add_executable(ybcon src/main.cpp ${CMAKE_CURRENT_BINARY_DIR}/processed/Yerbacon.rc src/parser/MainParse.cpp src/transpiler/MainTranspile.cpp src/etc/filefuncs.cpp src/etc/lexer.cpp src/headers/lex.hpp src/headers/misc.hpp src/headers/parsing/ParseComponents.hpp src/headers/parsing/StandardComponents.hpp)
target_compile_definitions(ybcon PRIVATE YBCON_VERSION="${PROJECT_VERSION}") target_compile_definitions(ybcon PRIVATE YBCON_VERSION="${PROJECT_VERSION}")
# lpkg = linux package, wpkg = windows package # lpkg = linux package, wpkg = windows package
@ -77,7 +87,7 @@ if (UNIX AND NOT MINGW)
install(DIRECTORY src DESTINATION ${CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX}) install(DIRECTORY src DESTINATION ${CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX})
install(DIRECTORY resources DESTINATION ${CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX}) install(DIRECTORY resources DESTINATION ${CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX})
install(DIRECTORY scripts DESTINATION ${CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX}) install(DIRECTORY scripts DESTINATION ${CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX})
install(FILES CMakeLists.txt desc.txt LICENSE.txt README.md changelog.txt DESTINATION ${CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX}) install(FILES CMakeLists.txt misc/desc.txt LICENSE.txt README.md changelog.txt DESTINATION ${CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX})
else() else()
if (NOT DEFINED CPACK_GENERATOR) if (NOT DEFINED CPACK_GENERATOR)
set(CPACK_GENERATOR TGZ;STGZ;RPM;DEB) set(CPACK_GENERATOR TGZ;STGZ;RPM;DEB)

1
misc/codename.txt Normal file
View File

@ -0,0 +1 @@
Caterpillar

View File

@ -3,8 +3,8 @@
256 ICON "Yerbacon.ico" 256 ICON "Yerbacon.ico"
1 VERSIONINFO 1 VERSIONINFO
FILEVERSION 0,0,0,1 FILEVERSION @CMAKE_PROJECT_VERSION_MAJOR@,@CMAKE_PROJECT_VERSION_MINOR@,@CMAKE_PROJECT_VERSION_PATCH@,0
PRODUCTVERSION 0,0,0,1 PRODUCTVERSION @CMAKE_PROJECT_VERSION_MAJOR@,@CMAKE_PROJECT_VERSION_MINOR@,@CMAKE_PROJECT_VERSION_PATCH@
BEGIN BEGIN
BLOCK "StringFileInfo" BLOCK "StringFileInfo"
BEGIN BEGIN
@ -12,12 +12,12 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "" VALUE "CompanyName", ""
VALUE "FileDescription", "The Yerbacon compiler" VALUE "FileDescription", "The Yerbacon compiler"
VALUE "FileVersion", "0.0.0.1" VALUE "FileVersion", "@CMAKE_PROJECT_VERSION@.0"
VALUE "InternalName", "Ybcon" VALUE "InternalName", "Ybcon"
VALUE "LegalCopyright", "" VALUE "LegalCopyright", ""
VALUE "OriginalName", "Yerbacon.exe" VALUE "OriginalName", "ybcon.exe"
VALUE "ProductName", "Yerbacon" VALUE "ProductName", "Yerbacon"
VALUE "ProductVersion", "Caterpillar 0.0.0.1" VALUE "ProductVersion", "@CODENAME@ @CMAKE_PROJECT_VERSION@.0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"