Skip to content

Commit

Permalink
Improving the version number of the VM, so it has the commitish if it…
Browse files Browse the repository at this point in the history
… is a non-release version. Release versions have a tag in the repository
  • Loading branch information
tesonep committed Sep 1, 2021
1 parent 95af58b commit e1a923f
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 32 deletions.
68 changes: 37 additions & 31 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,45 @@ cmake_policy(SET CMP0053 NEW)

include(macros.cmake)

# Extract VCS information
include(cmake/versionExtraction.cmake)
extractVCSInformation(GIT_COMMIT_HASH GIT_DESCRIBE GIT_COMMIT_DATE)

set(VERSION_MAJOR 9)
set(VERSION_MINOR 0)
set(VERSION_PATCH "8-${GIT_COMMIT_HASH}")

message("CMAKE_GENERATOR=${CMAKE_GENERATOR}")
message(STATUS "CMAKE_GENERATOR=${CMAKE_GENERATOR}")

# Build options
option(FEATURE_FFI "Enable FFI" ON)
option(FEATURE_THREADED_FFI "Enable Threaded (running in another thread) FFI" ON)
option(FEATURE_NETWORK "Enable network and sockets" ON)
option(FEATURE_LIB_SDL2 "Build SDL2 support" ON)
option(FEATURE_LIB_CAIRO "Build Cairo support" ON)
option(FEATURE_LIB_FREETYPE2 "Build freetype2 support" ON)
option(FEATURE_LIB_GIT2 "Build LibGit2 support" ON)
# PTHREADW32_DIR should be set to the location of the PTHREADW32
option(FEATURE_LIB_PTHREADW32 "Windows only, link to win32 version of pthread" OFF)
option(GENERATE_SOURCES "If it generates the sources" ON)
option(ALWAYS_INTERACTIVE "Be interactive by default" OFF)
option(BUILD_BUNDLE "Builds a bundle with all dependencies" ON)
option(FEATURE_COMPILE_GNUISATION "Use gcc gnu extensions to compile the VM" ON)
option(PHARO_DEPENDENCIES_PREFER_DOWNLOAD_BINARIES "Prefer downloading dependencies" OFF)
option(FEATURE_COMPILE_INLINE_MEMORY_ACCESSORS "Use inline memory accessors instead of macros" ON)
option(PHARO_VM_IN_WORKER_THREAD "Have support for pharo running in a different thread that the main one" ON)
option(FEATURE_FFI "Enable FFI" ON)
option(FEATURE_THREADED_FFI "Enable Threaded (running in another thread) FFI" ON)
option(FEATURE_NETWORK "Enable network and sockets" ON)
option(FEATURE_LIB_SDL2 "Build SDL2 support" ON)
option(FEATURE_LIB_CAIRO "Build Cairo support" ON)
option(FEATURE_LIB_FREETYPE2 "Build freetype2 support" ON)
option(FEATURE_LIB_GIT2 "Build LibGit2 support" ON)
option(FEATURE_LIB_PTHREADW32 "Windows only, link to win32 version of pthread" OFF)
option(GENERATE_SOURCES "If it generates the sources" ON)
option(ALWAYS_INTERACTIVE "Be interactive by default" OFF)
option(BUILD_BUNDLE "Builds a bundle with all dependencies" ON)
option(FEATURE_COMPILE_GNUISATION "Use gcc gnu extensions to compile the VM" ON)
option(PHARO_DEPENDENCIES_PREFER_DOWNLOAD_BINARIES "Prefer downloading dependencies" OFF)
option(FEATURE_COMPILE_INLINE_MEMORY_ACCESSORS "Use inline memory accessors instead of macros" ON)
option(PHARO_VM_IN_WORKER_THREAD "Have support for pharo running in a different thread that the main one" ON)
option(BUILD_IS_RELEASE "Is this a release version?" OFF)

set(APPNAME "Pharo" CACHE STRING "VM Application name")
set(FLAVOUR "CoInterpreter" CACHE STRING "The kind of VM to generate. Possible values: StackVM, CoInterpreter")
set(PHARO_LIBRARY_PATH "@executable_path/Plugins" CACHE STRING "The RPATH to use in the build")
set(ICEBERG_DEFAULT_REMOTE "scpUrl" CACHE STRING "If Iceberg uses HTTPS (httpsUrl) or tries first with SSH (scpUrl)")

# Extract VCS information
include(cmake/versionExtraction.cmake)
extractVCSInformation(GIT_COMMIT_HASH GIT_DESCRIBE GIT_COMMIT_DATE)

set(VERSION_MAJOR 9)
set(VERSION_MINOR 0)

if(BUILD_IS_RELEASE)
set(VERSION_PATCH "8")
else()
set(VERSION_PATCH "8-${GIT_COMMIT_HASH}")
endif(BUILD_IS_RELEASE)

message(STATUS "Building version ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")

# Visual Studio stores user build settings in file 'CmakeSettings.json'. We would like to manage that via a project template.
# To push out new template, update 'template_uuid' field in 'template_file' with value from https://www.uuidgenerator.net/
Expand All @@ -62,16 +68,16 @@ if(EXISTS "${user_file}")
set(template_uuid ${CMAKE_MATCH_1})

if("${user_uuid}" STREQUAL "${template_uuid}")
message("Project build settings unchanged (${template_file})")
message(STATUS "Project build settings unchanged (${template_file})")
else()
message("NOTICE!! Project template build settings have changed.")
message("NOTICE!! Back up your user build settings (${user_file})")
message("NOTICE!! and replace whole file with project template build settings (${template_file}).")
message("NOTICE!! Then restore parts of your user settings as you require.")
message(STATUS "NOTICE!! Project template build settings have changed.")
message(STATUS "NOTICE!! Back up your user build settings (${user_file})")
message(STATUS "NOTICE!! and replace whole file with project template build settings (${template_file}).")
message(STATUS "NOTICE!! Then restore parts of your user settings as you require.")
message(FATAL_ERROR "Read output NOTICES!!")
endif()
else()
message("No user build settings.")
message(STATUS "No user build settings.")
endif()

# BUILD VM
Expand Down
5 changes: 4 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ def runBuild(platformName, configuration, headless = true){

def platform = headless ? platformName : "${platformName}-stockReplacement"
def buildDirectory = headless ? "build" :"build-stockReplacement"
def additionalParameters = headless ? "" : "-DALWAYS_INTERACTIVE=1"
def additionalParameters = ""

additionalParameters += headless ? "" : "-DALWAYS_INTERACTIVE=1 "
additionalParameters += isRelease() ? "-DBUILD_IS_RELEASE=ON " : "-DBUILD_IS_RELEASE=OFF "

stage("Checkout-${platform}"){
dir('repository') {
Expand Down
2 changes: 2 additions & 0 deletions include/pharovm/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@

#cmakedefine PHARO_VM_IN_WORKER_THREAD

#cmakedefine BUILD_IS_RELEASE

#if defined(_MSC_VER)
#define VM_BUILD_STRING VM_NAME " @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@ built on " __DATE__ " " __TIME__ " Compiler: Visual C"
#define COMPILER_VERSION "Visual C"
Expand Down

0 comments on commit e1a923f

Please sign in to comment.