re-indent some scripts w/cmake_format and beautify_bash
This commit is contained in:
345
CMakeLists.txt
345
CMakeLists.txt
@@ -7,17 +7,22 @@ endif()
|
||||
|
||||
# Must stay before the project() command:
|
||||
if(${CMAKE_EXTRA_GENERATOR} MATCHES "Eclipse CDT4")
|
||||
set(CMAKE_CXX_COMPILER_ARG1 "-std=c++11" CACHE STRING "C++ version for eclipse" FORCE)
|
||||
set(CMAKE_CXX_COMPILER_ARG1
|
||||
"-std=c++11"
|
||||
CACHE STRING "C++ version for eclipse" FORCE)
|
||||
# Users building with Eclipse should set CMAKE_ECLIPSE_VERSION through the
|
||||
# command line to their current version of Eclipse:
|
||||
#set(CMAKE_ECLIPSE_VERSION "4.6.0" CACHE STRING "Eclipse version" FORCE)
|
||||
# set(CMAKE_ECLIPSE_VERSION "4.6.0" CACHE STRING "Eclipse version" FORCE)
|
||||
endif()
|
||||
|
||||
project(RawTherapee)
|
||||
|
||||
# The default target is Debug:
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "")
|
||||
set(CMAKE_BUILD_TYPE Debug CACHE STRING "One of: None Debug Release RelWithDebInfo MinSizeRel" FORCE)
|
||||
set(CMAKE_BUILD_TYPE
|
||||
Debug
|
||||
CACHE STRING "One of: None Debug Release RelWithDebInfo MinSizeRel"
|
||||
FORCE)
|
||||
endif()
|
||||
|
||||
string(TOUPPER ${CMAKE_BUILD_TYPE} UPPER_CMAKE_BUILD_TYPE)
|
||||
@@ -26,11 +31,15 @@ string(TOUPPER ${CMAKE_BUILD_TYPE} UPPER_CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9")
|
||||
message(FATAL_ERROR "Building RawTherapee requires using GCC version 4.9 or higher!")
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION
|
||||
VERSION_LESS "4.9")
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Building RawTherapee requires using GCC version 4.9 or higher!")
|
||||
endif()
|
||||
|
||||
# We might want to build using the old C++ ABI, even when using a new GCC version:
|
||||
# We might want to build using the old C++ ABI, even when using a new GCC
|
||||
# version:
|
||||
if(USE_OLD_CXX_ABI)
|
||||
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
|
||||
endif()
|
||||
@@ -46,30 +55,50 @@ message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
|
||||
|
||||
# Cache name suffix examples: "" = ~/.config/RawTherapee, "5" = ~/.config/RawTherapee-5, "_testing" = ~/.config/RawTherapee_testing
|
||||
# Use "" for stable releases and "5-dev" for anything else.
|
||||
set(CACHE_NAME_SUFFIX "" CACHE STRING "RawTherapee's cache folder suffix")
|
||||
# Cache name suffix examples: "" = ~/.config/RawTherapee, "5" =
|
||||
# ~/.config/RawTherapee-5, "_testing" = ~/.config/RawTherapee_testing Use "" for
|
||||
# stable releases and "5-dev" for anything else.
|
||||
set(CACHE_NAME_SUFFIX
|
||||
""
|
||||
CACHE STRING "RawTherapee's cache folder suffix")
|
||||
|
||||
# By default we don't use a specific processor target, so PROC_TARGET_NUMBER is set to 0.
|
||||
# Specify other values to optimize for specific processor architecture as listed in ProcessorTargets.cmake:
|
||||
set(PROC_TARGET_NUMBER 0 CACHE STRING "Selected target processor from the list above (taken from ProcessorTargets.cmake)")
|
||||
# By default we don't use a specific processor target, so PROC_TARGET_NUMBER is
|
||||
# set to 0. Specify other values to optimize for specific processor architecture
|
||||
# as listed in ProcessorTargets.cmake:
|
||||
set(PROC_TARGET_NUMBER
|
||||
0
|
||||
CACHE
|
||||
STRING
|
||||
"Selected target processor from the list above (taken from ProcessorTargets.cmake)"
|
||||
)
|
||||
|
||||
# Set special compilation flags for rtengine which get added to CMAKE_CXX_FLAGS:
|
||||
# Some Linux distros build with -O2 instead of -O3. We explicitly enable auto vectorization by using -ftree-vectorize
|
||||
set(RTENGINE_CXX_FLAGS "-ftree-vectorize" CACHE STRING "Special compilation flags for RTEngine")
|
||||
# Some Linux distros build with -O2 instead of -O3. We explicitly enable auto
|
||||
# vectorization by using -ftree-vectorize
|
||||
set(RTENGINE_CXX_FLAGS
|
||||
"-ftree-vectorize"
|
||||
CACHE STRING "Special compilation flags for RTEngine")
|
||||
|
||||
# Loads the ProcessorTargets list:
|
||||
include(ProcessorTargets.cmake)
|
||||
set(PROC_LABEL "undefined" CACHE STRING "Target processor label, unused if PROC_TARGET_NUMBER = 0 or 2")
|
||||
set(PROC_FLAGS "" CACHE STRING "Target processor related build/link flags")
|
||||
set(PROC_LABEL
|
||||
"undefined"
|
||||
CACHE STRING
|
||||
"Target processor label, unused if PROC_TARGET_NUMBER = 0 or 2")
|
||||
set(PROC_FLAGS
|
||||
""
|
||||
CACHE STRING "Target processor related build/link flags")
|
||||
if((NOT (PROC_TARGET_NUMBER EQUAL 0)) AND (NOT (PROC_TARGET_NUMBER EQUAL 2)))
|
||||
set(PROC_LABEL ${PROC_TARGET_${PROC_TARGET_NUMBER}_LABEL})
|
||||
endif()
|
||||
if(NOT(PROC_TARGET_NUMBER EQUAL 0))
|
||||
if(NOT (PROC_TARGET_NUMBER EQUAL 0))
|
||||
set(PROC_FLAGS ${PROC_TARGET_${PROC_TARGET_NUMBER}_FLAGS})
|
||||
endif()
|
||||
if(UNIX AND PROC_LABEL STREQUAL "undefined")
|
||||
execute_process(COMMAND uname -p OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE cpu)
|
||||
execute_process(
|
||||
COMMAND uname -p
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
OUTPUT_VARIABLE cpu)
|
||||
if("${cpu}" STREQUAL "unknown")
|
||||
set(PROC_LABEL "${CMAKE_SYSTEM_PROCESSOR}")
|
||||
else()
|
||||
@@ -77,7 +106,8 @@ if(UNIX AND PROC_LABEL STREQUAL "undefined")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If PROC_FORCED_LABEL exists, its value is loaded in PROC_LABEL to override the one from ProcessorTargets:
|
||||
# If PROC_FORCED_LABEL exists, its value is loaded in PROC_LABEL to override the
|
||||
# one from ProcessorTargets:
|
||||
if(DEFINED PROC_FORCED_LABEL)
|
||||
set(PROC_LABEL ${PROC_FORCED_LABEL})
|
||||
endif()
|
||||
@@ -87,7 +117,8 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PROC_FLAGS}")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PROC_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PROC_FLAGS}")
|
||||
|
||||
# Stop compilation on typos such as std:swap (missing colon will be detected as unused label):
|
||||
# Stop compilation on typos such as std:swap (missing colon will be detected as
|
||||
# unused label):
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=unused-label")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=delete-incomplete")
|
||||
|
||||
@@ -106,21 +137,35 @@ endif()
|
||||
include(FindUnalignedMalloc)
|
||||
|
||||
if(WIN32)
|
||||
# Add additional paths. Look in the MinGW path first, then in the Gtkmm path.
|
||||
# If you wish to build some dependent libraries, you have to install them in MinGW to use them:
|
||||
set(CMAKE_PREFIX_PATH $ENV{MINGW_BASEPATH} $ENV{GTKMM_BASEPATH} CACHE STRING "Additional search paths")
|
||||
# Add additional paths. Look in the MinGW path first, then in the Gtkmm
|
||||
# path. If you wish to build some dependent libraries, you have to install
|
||||
# them in MinGW to use them:
|
||||
set(CMAKE_PREFIX_PATH
|
||||
$ENV{MINGW_BASEPATH} $ENV{GTKMM_BASEPATH}
|
||||
CACHE STRING "Additional search paths")
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
if(CMAKE_CXX_COMPILER MATCHES "g\\+\\+-mp-4.[5-8]" OR CMAKE_CXX_COMPILER_ARG1 MATCHES "g\\+\\+-mp-4.[5-8]")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /usr/lib/libstdc++.6.dylib -Wl,-headerpad_max_install_names -mtune=generic")
|
||||
message(STATUS "CMAKE_CXX_COMPILER is MacPorts GCC.\n CMAKE_EXE_LINKER_FLAGS: ${CMAKE_EXE_LINKER_FLAGS}")
|
||||
if(CMAKE_CXX_COMPILER MATCHES "g\\+\\+-mp-4.[5-8]"
|
||||
OR CMAKE_CXX_COMPILER_ARG1 MATCHES "g\\+\\+-mp-4.[5-8]")
|
||||
set(CMAKE_EXE_LINKER_FLAGS
|
||||
"${CMAKE_EXE_LINKER_FLAGS} /usr/lib/libstdc++.6.dylib -Wl,-headerpad_max_install_names -mtune=generic"
|
||||
)
|
||||
message(
|
||||
STATUS
|
||||
"CMAKE_CXX_COMPILER is MacPorts GCC.\n CMAKE_EXE_LINKER_FLAGS: ${CMAKE_EXE_LINKER_FLAGS}"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Set minimum system version
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-headerpad_max_install_names -mtune=generic")
|
||||
set(CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}"
|
||||
)
|
||||
set(CMAKE_C_FLAGS
|
||||
"${CMAKE_C_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS
|
||||
"${CMAKE_EXE_LINKER_FLAGS} -Wl,-headerpad_max_install_names -mtune=generic"
|
||||
)
|
||||
endif()
|
||||
|
||||
option(USE_EXPERIMENTAL_LANG_VERSIONS "Build with -std=c++0x" OFF)
|
||||
@@ -132,18 +177,33 @@ option(WITH_SAN "Build with run-time sanitizer" OFF)
|
||||
option(WITH_PROF "Build with profiling instrumentation" OFF)
|
||||
option(WITH_SYSTEM_KLT "Build using system KLT library." OFF)
|
||||
option(OPTION_OMP "Build with OpenMP support" ON)
|
||||
option(STRICT_MUTEX "True (recommended): MyMutex will behave like POSIX Mutex; False: MyMutex will behave like POSIX RecMutex; Note: forced to ON for Debug builds" ON)
|
||||
option(TRACE_MYRWMUTEX "Trace custom R/W Mutex (Debug builds only); redirecting std::out to a file is strongly recommended!" OFF)
|
||||
option(AUTO_GDK_FLUSH "Use gdk_flush on all gdk_thread_leave other than the GUI thread; set it ON if you experience X Server warning/errors" OFF)
|
||||
#option(TARGET32BIT "Build for 32-bit architecture when ON, otherwise 64-bit. Default is OFF" OFF)
|
||||
option(
|
||||
STRICT_MUTEX
|
||||
"True (recommended): MyMutex will behave like POSIX Mutex; False: MyMutex will behave like POSIX RecMutex; Note: forced to ON for Debug builds"
|
||||
ON)
|
||||
option(
|
||||
TRACE_MYRWMUTEX
|
||||
"Trace custom R/W Mutex (Debug builds only); redirecting std::out to a file is strongly recommended!"
|
||||
OFF)
|
||||
option(
|
||||
AUTO_GDK_FLUSH
|
||||
"Use gdk_flush on all gdk_thread_leave other than the GUI thread; set it ON if you experience X Server warning/errors"
|
||||
OFF)
|
||||
# option(TARGET32BIT "Build for 32-bit architecture when ON, otherwise 64-bit.
|
||||
# Default is OFF" OFF)
|
||||
|
||||
option(ENABLE_TCMALLOC "Use the tcmalloc library if available" OFF)
|
||||
set(TCMALLOC_LIB_DIR "" CACHE PATH "Custom path for the tcmalloc library")
|
||||
set(TCMALLOC_LIB_DIR
|
||||
""
|
||||
CACHE PATH "Custom path for the tcmalloc library")
|
||||
|
||||
# Set installation directories:
|
||||
if(WIN32 OR APPLE)
|
||||
if(BUILD_BUNDLE)
|
||||
message(STATUS "You have set BUILD_BUNDLE=ON but this is not necessary - the option is forced to ON for Windows and macOS.")
|
||||
message(
|
||||
STATUS
|
||||
"You have set BUILD_BUNDLE=ON but this is not necessary - the option is forced to ON for Windows and macOS."
|
||||
)
|
||||
endif()
|
||||
set(BUILD_BUNDLE ON FORCE)
|
||||
endif()
|
||||
@@ -281,26 +341,35 @@ if(NOT DEFINED APPDATADIR)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT APPLE)
|
||||
if(DEFINED LENSFUNDBDIR AND NOT IS_ABSOLUTE "${LENSFUNDBDIR}")
|
||||
set(LENSFUNDBDIR "${DATADIR}/${LENSFUNDBDIR}")
|
||||
if(NOT APPLE)
|
||||
if(DEFINED LENSFUNDBDIR AND NOT IS_ABSOLUTE "${LENSFUNDBDIR}")
|
||||
set(LENSFUNDBDIR "${DATADIR}/${LENSFUNDBDIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
if("${CODESIGNID}")
|
||||
set(CODESIGNID "${CODESIGNID}" CACHE STRING "Codesigning Identity")
|
||||
set(CODESIGNID
|
||||
"${CODESIGNID}"
|
||||
CACHE STRING "Codesigning Identity")
|
||||
endif()
|
||||
if("${NOTARY}")
|
||||
set(NOTARY "${NOTARY}" CACHE STRING "Notarization Identity")
|
||||
set(NOTARY
|
||||
"${NOTARY}"
|
||||
CACHE STRING "Notarization Identity")
|
||||
endif()
|
||||
if("${LOCAL_PREFIX}")
|
||||
set(LOCAL_PREFIX "${LOCAL_PREFIX}" CACHE STRING "macos/gtk parent directory ie /usr or /opt")
|
||||
set(LOCAL_PREFIX
|
||||
"${LOCAL_PREFIX}"
|
||||
CACHE STRING "macos/gtk parent directory ie /usr or /opt")
|
||||
elseif(NOT DEFINED LOCAL_PREFIX)
|
||||
set(LOCAL_PREFIX "/usr")
|
||||
endif()
|
||||
if("${FANCY_DMG}")
|
||||
set(FANCY_DMG ON CACHE BOOL "Use the andreyvit/create-dmg script to make a fancy .dmg")
|
||||
set(FANCY_DMG
|
||||
ON
|
||||
CACHE BOOL
|
||||
"Use the andreyvit/create-dmg script to make a fancy .dmg")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -308,7 +377,10 @@ endif()
|
||||
if(NOT BUILD_BUNDLE)
|
||||
foreach(path BINDIR DATADIR LIBDIR DOCDIR CREDITSDIR LICENCEDIR)
|
||||
if(NOT (IS_ABSOLUTE "${${path}}"))
|
||||
message(FATAL_ERROR "The ${path} path has to be absolute when using -DBUILD_BUNDLE=OFF")
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"The ${path} path has to be absolute when using -DBUILD_BUNDLE=OFF"
|
||||
)
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
@@ -337,11 +409,11 @@ endif()
|
||||
find_package(PkgConfig)
|
||||
|
||||
if(WIN32)
|
||||
pkg_check_modules (GTK REQUIRED gtk+-3.0>=3.22.24)
|
||||
pkg_check_modules (GTKMM REQUIRED gtkmm-3.0>=3.22)
|
||||
pkg_check_modules(GTK REQUIRED gtk+-3.0>=3.22.24)
|
||||
pkg_check_modules(GTKMM REQUIRED gtkmm-3.0>=3.22)
|
||||
else()
|
||||
pkg_check_modules (GTK REQUIRED gtk+-3.0>=3.16)
|
||||
pkg_check_modules (GTKMM REQUIRED gtkmm-3.0>=3.16)
|
||||
pkg_check_modules(GTK REQUIRED gtk+-3.0>=3.16)
|
||||
pkg_check_modules(GTKMM REQUIRED gtkmm-3.0>=3.16)
|
||||
endif()
|
||||
|
||||
if(GTK_VERSION VERSION_GREATER "3.24.1" AND GTK_VERSION VERSION_LESS "3.24.7")
|
||||
@@ -350,19 +422,26 @@ if(GTK_VERSION VERSION_GREATER "3.24.1" AND GTK_VERSION VERSION_LESS "3.24.7")
|
||||
else()
|
||||
set(CERTAINTY "likely to")
|
||||
endif()
|
||||
message(WARNING "\nWarning! You are using GTK+ version " ${GTK_VERSION} " which is " ${CERTAINTY} " have an issue where combobox menu scroll-arrows are missing when a Gtk::ComboBox list does not fit vertically on the screen. As a result, users of your build will not be able to select items in the following comboboxes: Processing Profiles, Film Simulation, and the camera and lens profiles in Profiled Lens Correction.\nIt is recommended that you either downgrade GTK+ to <= 3.24.1 or upgrade to >= 3.24.7.")
|
||||
message(
|
||||
WARNING
|
||||
"\nWarning! You are using GTK+ version "
|
||||
${GTK_VERSION}
|
||||
" which is "
|
||||
${CERTAINTY}
|
||||
" have an issue where combobox menu scroll-arrows are missing when a Gtk::ComboBox list does not fit vertically on the screen. As a result, users of your build will not be able to select items in the following comboboxes: Processing Profiles, Film Simulation, and the camera and lens profiles in Profiled Lens Correction.\nIt is recommended that you either downgrade GTK+ to <= 3.24.1 or upgrade to >= 3.24.7."
|
||||
)
|
||||
endif()
|
||||
|
||||
pkg_check_modules (GLIB2 REQUIRED glib-2.0>=2.44)
|
||||
pkg_check_modules (GLIBMM REQUIRED glibmm-2.4>=2.44)
|
||||
pkg_check_modules (CAIROMM REQUIRED cairomm-1.0)
|
||||
pkg_check_modules (GIO REQUIRED gio-2.0>=2.44)
|
||||
pkg_check_modules (GIOMM REQUIRED giomm-2.4>=2.44)
|
||||
pkg_check_modules (GTHREAD REQUIRED gthread-2.0>=2.44)
|
||||
pkg_check_modules (GOBJECT REQUIRED gobject-2.0>=2.44)
|
||||
pkg_check_modules (SIGC REQUIRED sigc++-2.0>=2.3.1)
|
||||
pkg_check_modules (LENSFUN REQUIRED lensfun>=0.2)
|
||||
pkg_check_modules (RSVG REQUIRED librsvg-2.0>=2.40)
|
||||
pkg_check_modules(GLIB2 REQUIRED glib-2.0>=2.44)
|
||||
pkg_check_modules(GLIBMM REQUIRED glibmm-2.4>=2.44)
|
||||
pkg_check_modules(CAIROMM REQUIRED cairomm-1.0)
|
||||
pkg_check_modules(GIO REQUIRED gio-2.0>=2.44)
|
||||
pkg_check_modules(GIOMM REQUIRED giomm-2.4>=2.44)
|
||||
pkg_check_modules(GTHREAD REQUIRED gthread-2.0>=2.44)
|
||||
pkg_check_modules(GOBJECT REQUIRED gobject-2.0>=2.44)
|
||||
pkg_check_modules(SIGC REQUIRED sigc++-2.0>=2.3.1)
|
||||
pkg_check_modules(LENSFUN REQUIRED lensfun>=0.2)
|
||||
pkg_check_modules(RSVG REQUIRED librsvg-2.0>=2.40)
|
||||
|
||||
if(WIN32)
|
||||
add_definitions(-DWIN32)
|
||||
@@ -389,7 +468,7 @@ if(WITH_SYSTEM_KLT)
|
||||
endif()
|
||||
|
||||
# Check for libcanberra-gtk3 (sound events on Linux):
|
||||
if(UNIX AND(NOT APPLE))
|
||||
if(UNIX AND (NOT APPLE))
|
||||
pkg_check_modules(CANBERRA-GTK REQUIRED libcanberra-gtk3)
|
||||
endif()
|
||||
|
||||
@@ -400,9 +479,12 @@ endif()
|
||||
if(WITH_LTO)
|
||||
# Using LTO with older versions of binutils requires setting extra flags
|
||||
set(BINUTILS_VERSION_MININUM "2.29")
|
||||
execute_process(COMMAND ar --version OUTPUT_VARIABLE BINUTILS_VERSION_DETECTED)
|
||||
string(REGEX REPLACE ".* ([0-9.]+)\n.*" "\\1" BINUTILS_VERSION_DETECTED "${BINUTILS_VERSION_DETECTED}")
|
||||
if("${BINUTILS_VERSION_DETECTED}" VERSION_LESS "${BINUTILS_VERSION_MININUM}")
|
||||
execute_process(COMMAND ar --version
|
||||
OUTPUT_VARIABLE BINUTILS_VERSION_DETECTED)
|
||||
string(REGEX REPLACE ".* ([0-9.]+)\n.*" "\\1" BINUTILS_VERSION_DETECTED
|
||||
"${BINUTILS_VERSION_DETECTED}")
|
||||
if("${BINUTILS_VERSION_DETECTED}" VERSION_LESS
|
||||
"${BINUTILS_VERSION_MININUM}")
|
||||
if(APPLE)
|
||||
if(!CMAKE_AR)
|
||||
set(CMAKE_AR "/opt/local/bin/ar")
|
||||
@@ -414,7 +496,15 @@ if(WITH_LTO)
|
||||
set(CMAKE_AR "/usr/bin/gcc-ar")
|
||||
set(CMAKE_RANLIB "/usr/bin/gcc-ranlib")
|
||||
endif()
|
||||
message(STATUS "Binutils version detected as less than " ${BINUTILS_VERSION_MININUM} " - setting CMake parameters to enable LTO linking:\n CMAKE_AR=\"" ${CMAKE_AR} "\"\n CMAKE_RANLIB=\"" ${CMAKE_RANLIB} "\"")
|
||||
message(
|
||||
STATUS
|
||||
"Binutils version detected as less than "
|
||||
${BINUTILS_VERSION_MININUM}
|
||||
" - setting CMake parameters to enable LTO linking:\n CMAKE_AR=\""
|
||||
${CMAKE_AR}
|
||||
"\"\n CMAKE_RANLIB=\""
|
||||
${CMAKE_RANLIB}
|
||||
"\"")
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -flto")
|
||||
@@ -425,7 +515,8 @@ endif()
|
||||
if(WITH_SAN)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=${WITH_SAN}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${WITH_SAN}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=${WITH_SAN}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS
|
||||
"${CMAKE_EXE_LINKER_FLAGS} -fsanitize=${WITH_SAN}")
|
||||
endif()
|
||||
|
||||
if(WITH_PROF)
|
||||
@@ -434,11 +525,14 @@ if(WITH_PROF)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wuninitialized -Wcast-qual -Wno-deprecated-declarations -Wno-unused-result -Wunused-macros")
|
||||
set(CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} -Wall -Wuninitialized -Wcast-qual -Wno-deprecated-declarations -Wno-unused-result -Wunused-macros"
|
||||
)
|
||||
if(OPTION_OMP)
|
||||
find_package(OpenMP)
|
||||
if(OPENMP_FOUND)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS} -Werror=unknown-pragmas")
|
||||
set(CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS} -Werror=unknown-pragmas")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -452,13 +546,14 @@ if(OPENMP_FOUND)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${_f})
|
||||
endforeach()
|
||||
check_c_source_compiles(
|
||||
"#include <fftw3.h>
|
||||
"#include <fftw3.h>
|
||||
int main()
|
||||
{
|
||||
fftwf_init_threads();
|
||||
fftwf_plan_with_nthreads(1);
|
||||
return 0;
|
||||
}" _fftw3f_multithread)
|
||||
}"
|
||||
_fftw3f_multithread)
|
||||
if(_fftw3f_multithread)
|
||||
add_definitions(-DRT_FFTW3F_OMP)
|
||||
else()
|
||||
@@ -476,63 +571,83 @@ get_filename_component(ABS_BINARY_DIR "${CMAKE_BINARY_DIR}" ABSOLUTE)
|
||||
set(OUT_OF_SOURCE_BUILD TRUE)
|
||||
if(ABS_SOURCE_DIR STREQUAL ABS_BINARY_DIR)
|
||||
set(OUT_OF_SOURCE_BUILD FALSE)
|
||||
message(WARNING "You are performing an in-source build. This is discouraged. For an explanation and the advantages of out-of-source builds, please refer to http://www.cmake.org/Wiki/CMake_FAQ#What_is_an_.22out-of-source.22_build.3F")
|
||||
message(
|
||||
WARNING
|
||||
"You are performing an in-source build. This is discouraged. For an explanation and the advantages of out-of-source builds, please refer to http://www.cmake.org/Wiki/CMake_FAQ#What_is_an_.22out-of-source.22_build.3F"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Remove files which could require manual work.
|
||||
# We will remove this after some time to have a clean build system without file modifications in the source tree again. (?)
|
||||
set(OOSB_FILES "${PROJECT_SOURCE_DIR}/rtdata/rawtherapee.desktop" "${PROJECT_SOURCE_DIR}/rtgui/version.h" "${PROJECT_SOURCE_DIR}/rtgui/config.h" "${PROJECT_SOURCE_DIR}/AboutThisBuild.txt")
|
||||
# Remove files which could require manual work. We will remove this after some
|
||||
# time to have a clean build system without file modifications in the source
|
||||
# tree again. (?)
|
||||
set(OOSB_FILES
|
||||
"${PROJECT_SOURCE_DIR}/rtdata/rawtherapee.desktop"
|
||||
"${PROJECT_SOURCE_DIR}/rtgui/version.h"
|
||||
"${PROJECT_SOURCE_DIR}/rtgui/config.h"
|
||||
"${PROJECT_SOURCE_DIR}/AboutThisBuild.txt")
|
||||
if(OUT_OF_SOURCE_BUILD)
|
||||
foreach(f ${OOSB_FILES})
|
||||
file(REMOVE "${f}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# Check for generated files in the source tree which should not be there when doing an out-of-source build.
|
||||
# Without checking for this it might happen that old versions are used for the compilation:
|
||||
# Check for generated files in the source tree which should not be there when
|
||||
# doing an out-of-source build. Without checking for this it might happen that
|
||||
# old versions are used for the compilation:
|
||||
if(OUT_OF_SOURCE_BUILD)
|
||||
foreach(f ${OOSB_FILES})
|
||||
if(EXISTS "${f}")
|
||||
message(SEND_ERROR "Generated \"${f}\" found inside the source tree. Please remove it as it is a relic of the old build system and prevents valid compilation now.")
|
||||
message(
|
||||
SEND_ERROR
|
||||
"Generated \"${f}\" found inside the source tree. Please remove it as it is a relic of the old build system and prevents valid compilation now."
|
||||
)
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
### Start generating AboutThisBuild.txt
|
||||
# Set the platform bit-depth:
|
||||
# Start generating AboutThisBuild.txt Set the platform bit-depth:
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(PROC_BIT_DEPTH 32 bits)
|
||||
else()
|
||||
set(PROC_BIT_DEPTH 64 bits)
|
||||
endif()
|
||||
|
||||
# Get compiler name and version.
|
||||
# Only CMake > 2.8.7 knows CMAKE_*_COMPILER_VERSION
|
||||
# Get compiler name and version. Only CMake > 2.8.7 knows
|
||||
# CMAKE_*_COMPILER_VERSION
|
||||
if(CMAKE_VERSION VERSION_GREATER 2.8.7)
|
||||
get_filename_component(COMPILER_INFO ${CMAKE_C_COMPILER} NAME_WE)
|
||||
set(COMPILER_INFO "${COMPILER_INFO} ${CMAKE_C_COMPILER_VERSION}")
|
||||
else()
|
||||
execute_process(COMMAND gcc -dumpversion OUTPUT_VARIABLE GCC_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(
|
||||
COMMAND gcc -dumpversion
|
||||
OUTPUT_VARIABLE GCC_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
set(COMPILER_INFO "gcc ${GCC_VERSION}")
|
||||
endif()
|
||||
|
||||
# Get C++ and linker flags for rtengine (the GUI's C++ flags may have fewer flags):
|
||||
set(CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${UPPER_CMAKE_BUILD_TYPE}} ${RTENGINE_CXX_FLAGS}")
|
||||
set(LFLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${UPPER_CMAKE_BUILD_TYPE}}")
|
||||
# Get C++ and linker flags for rtengine (the GUI's C++ flags may have fewer
|
||||
# flags):
|
||||
set(CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${UPPER_CMAKE_BUILD_TYPE}} ${RTENGINE_CXX_FLAGS}"
|
||||
)
|
||||
set(LFLAGS
|
||||
"${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${UPPER_CMAKE_BUILD_TYPE}}"
|
||||
)
|
||||
|
||||
set(ABOUT_COMMAND_WITH_ARGS ${CMAKE_COMMAND}
|
||||
-DPROJECT_SOURCE_DIR:STRING=${PROJECT_SOURCE_DIR}
|
||||
set(ABOUT_COMMAND_WITH_ARGS
|
||||
${CMAKE_COMMAND} -DPROJECT_SOURCE_DIR:STRING=${PROJECT_SOURCE_DIR}
|
||||
-DCACHE_NAME_SUFFIX:STRING=${CACHE_NAME_SUFFIX}
|
||||
-DPROC_LABEL:STRING="${PROC_LABEL}"
|
||||
-DPROC_BIT_DEPTH:STRING="${PROC_BIT_DEPTH}"
|
||||
-DBUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
|
||||
-DGTKMM_VERSION:STRING=${GTKMM_VERSION}
|
||||
-DOPTION_OMP:STRING=${OPTION_OMP}
|
||||
-DGTKMM_VERSION:STRING=${GTKMM_VERSION} -DOPTION_OMP:STRING=${OPTION_OMP}
|
||||
-DWITH_MYFILE_MMAP:STRING=${WITH_MYFILE_MMAP}
|
||||
-DLENSFUN_VERSION:STRING=${LENSFUN_VERSION})
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND ABOUT_COMMAND_WITH_ARGS -DSYSTEM:STRING=Windows
|
||||
list(
|
||||
APPEND
|
||||
ABOUT_COMMAND_WITH_ARGS
|
||||
-DSYSTEM:STRING=Windows
|
||||
-DCXX_FLAGS:STRING="${CXX_FLAGS}"
|
||||
-DLFLAGS:STRING="${LFLAGS}"
|
||||
-DCOMPILER_INFO:STRING="${COMPILER_INFO}"
|
||||
@@ -540,39 +655,45 @@ if(WIN32)
|
||||
-DBIT_DEPTH:STRING="${CMAKE_SIZEOF_VOID_P}")
|
||||
elseif(APPLE)
|
||||
list(APPEND ABOUT_COMMAND_WITH_ARGS -DSYSTEM:STRING=Apple
|
||||
-DCXX_FLAGS:STRING=${CXX_FLAGS}
|
||||
-DLFLAGS:STRING=${LFLAGS}
|
||||
-DCOMPILER_INFO:STRING=${COMPILER_INFO})
|
||||
-DCXX_FLAGS:STRING=${CXX_FLAGS} -DLFLAGS:STRING=${LFLAGS}
|
||||
-DCOMPILER_INFO:STRING=${COMPILER_INFO})
|
||||
else()
|
||||
list(APPEND ABOUT_COMMAND_WITH_ARGS -DSYSTEM:STRING=Linux
|
||||
-DCXX_FLAGS:STRING=${CXX_FLAGS}
|
||||
-DLFLAGS:STRING=${LFLAGS}
|
||||
-DCOMPILER_INFO:STRING=${COMPILER_INFO})
|
||||
-DCXX_FLAGS:STRING=${CXX_FLAGS} -DLFLAGS:STRING=${LFLAGS}
|
||||
-DCOMPILER_INFO:STRING=${COMPILER_INFO})
|
||||
endif()
|
||||
|
||||
list(APPEND ABOUT_COMMAND_WITH_ARGS -P "${PROJECT_SOURCE_DIR}/UpdateInfo.cmake")
|
||||
|
||||
add_custom_target(UpdateInfo ALL
|
||||
add_custom_target(
|
||||
UpdateInfo ALL
|
||||
COMMAND ${ABOUT_COMMAND_WITH_ARGS}
|
||||
COMMENT "Creating AboutThisBuild.txt and other version-dependent files")
|
||||
|
||||
### End generating AboutThisBuild.txt
|
||||
# End generating AboutThisBuild.txt
|
||||
|
||||
install(FILES AUTHORS.txt DESTINATION "${CREDITSDIR}")
|
||||
install(FILES LICENSE.txt DESTINATION "${LICENCEDIR}")
|
||||
install(FILES "${CMAKE_BINARY_DIR}/AboutThisBuild.txt" DESTINATION "${CREDITSDIR}")
|
||||
install(FILES RELEASE_NOTES.txt DESTINATION "${CREDITSDIR}" OPTIONAL)
|
||||
install(FILES "${CMAKE_BINARY_DIR}/AboutThisBuild.txt"
|
||||
DESTINATION "${CREDITSDIR}")
|
||||
install(
|
||||
FILES RELEASE_NOTES.txt
|
||||
DESTINATION "${CREDITSDIR}"
|
||||
OPTIONAL)
|
||||
|
||||
# The standard location for man pages in Linux is /usr/share/man
|
||||
# Use "manpath" to see the search paths for man pages on your system.
|
||||
# The standard location for man pages in Linux is /usr/share/man Use "manpath"
|
||||
# to see the search paths for man pages on your system.
|
||||
if(BUILD_BUNDLE)
|
||||
if(APPLE)
|
||||
install(FILES "${PROJECT_SOURCE_DIR}/doc/manpage/rawtherapee.1" DESTINATION "${DATADIR}/man/man1")
|
||||
install(FILES "${PROJECT_SOURCE_DIR}/doc/manpage/rawtherapee.1"
|
||||
DESTINATION "${DATADIR}/man/man1")
|
||||
else()
|
||||
install(FILES "${PROJECT_SOURCE_DIR}/doc/manpage/rawtherapee.1" DESTINATION "${DATADIR}/share/man/man1")
|
||||
install(FILES "${PROJECT_SOURCE_DIR}/doc/manpage/rawtherapee.1"
|
||||
DESTINATION "${DATADIR}/share/man/man1")
|
||||
endif()
|
||||
else()
|
||||
install(FILES "${PROJECT_SOURCE_DIR}/doc/manpage/rawtherapee.1" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/man/man1")
|
||||
install(FILES "${PROJECT_SOURCE_DIR}/doc/manpage/rawtherapee.1"
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/share/man/man1")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
@@ -580,7 +701,8 @@ if(WIN32)
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
install(FILES com.rawtherapee.RawTherapee.appdata.xml DESTINATION "${APPDATADIR}")
|
||||
install(FILES com.rawtherapee.RawTherapee.appdata.xml
|
||||
DESTINATION "${APPDATADIR}")
|
||||
endif()
|
||||
|
||||
# check whether the used version of lensfun has lfDatabase::LoadDirectory
|
||||
@@ -608,26 +730,31 @@ int main()
|
||||
lfDatabase *db = 0;
|
||||
bool b = db->LoadDirectory(0);
|
||||
return 0;
|
||||
}" LENSFUN_HAS_LOAD_DIRECTORY)
|
||||
}"
|
||||
LENSFUN_HAS_LOAD_DIRECTORY)
|
||||
|
||||
set(TCMALLOC_LIB_DIR)
|
||||
if(ENABLE_TCMALLOC)
|
||||
if(TCMALLOC_LIB_DIR)
|
||||
find_library(TCMALLOC_LIBRARIES tcmalloc PATHS ${TCMALLOC_LIB_DIR} NO_DEFAULT_PATH)
|
||||
find_library(TCMALLOC_LIBRARIES tcmalloc PATHS ${TCMALLOC_LIB_DIR}
|
||||
NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_library(TCMALLOC_LIBRARIES tcmalloc)
|
||||
endif()
|
||||
if(TCMALLOC_LIBRARIES)
|
||||
message(STATUS "using tcmalloc library in ${TCMALLOC_LIBRARIES}")
|
||||
else()
|
||||
set(TCMALLOC_LIBRARIES "" CACHE INTERNAL "" FORCE)
|
||||
set(TCMALLOC_LIBRARIES
|
||||
""
|
||||
CACHE INTERNAL "" FORCE)
|
||||
message(STATUS "tcmalloc not found")
|
||||
endif()
|
||||
else()
|
||||
set(TCMALLOC_LIBRARIES "" CACHE INTERNAL "" FORCE)
|
||||
set(TCMALLOC_LIBRARIES
|
||||
""
|
||||
CACHE INTERNAL "" FORCE)
|
||||
endif()
|
||||
|
||||
|
||||
add_subdirectory(rtexif)
|
||||
add_subdirectory(rtengine)
|
||||
add_subdirectory(rtgui)
|
||||
|
105
UpdateInfo.cmake
105
UpdateInfo.cmake
@@ -1,13 +1,21 @@
|
||||
# cmakefile executed within a makefile target
|
||||
|
||||
# If we find ReleaseInfo.cmake we use the info from there and don't need Git to be installed
|
||||
find_file(REL_INFO_FILE ReleaseInfo.cmake PATHS "${PROJECT_SOURCE_DIR}" NO_DEFAULT_PATH)
|
||||
# If we find ReleaseInfo.cmake we use the info from there and don't need Git to
|
||||
# be installed
|
||||
find_file(
|
||||
REL_INFO_FILE ReleaseInfo.cmake
|
||||
PATHS "${PROJECT_SOURCE_DIR}"
|
||||
NO_DEFAULT_PATH)
|
||||
if(REL_INFO_FILE STREQUAL REL_INFO_FILE-NOTFOUND)
|
||||
# we look for the git command in this paths by order of preference
|
||||
if(WIN32)
|
||||
find_program(GIT_CMD git.exe HINTS ENV Path PATH_SUFFIXES ../)
|
||||
find_program(
|
||||
GIT_CMD git.exe
|
||||
HINTS ENV Path
|
||||
PATH_SUFFIXES ../)
|
||||
elseif(APPLE)
|
||||
find_program(GIT_CMD git PATHS "/opt/local/bin" "/usr/local/bin" "/usr/bin")
|
||||
find_program(GIT_CMD git PATHS "/opt/local/bin" "/usr/local/bin"
|
||||
"/usr/bin")
|
||||
find_program(GIT_CMD git)
|
||||
set(SHELL "/bin/bash")
|
||||
else(WIN32) # Linux
|
||||
@@ -22,46 +30,72 @@ if(REL_INFO_FILE STREQUAL REL_INFO_FILE-NOTFOUND)
|
||||
message(STATUS "git command found: ${GIT_CMD}")
|
||||
endif()
|
||||
|
||||
# Get version description.
|
||||
# Depending on whether you checked out a branch (dev) or a tag (release),
|
||||
# "git describe" will return "5.0-gtk2-2-g12345678" or "5.0-gtk2", respectively.
|
||||
execute_process(COMMAND ${GIT_CMD} describe --tags --always OUTPUT_VARIABLE GIT_DESCRIBE OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
|
||||
# Get version description. Depending on whether you checked out a branch
|
||||
# (dev) or a tag (release), "git describe" will return
|
||||
# "5.0-gtk2-2-g12345678" or "5.0-gtk2", respectively.
|
||||
execute_process(
|
||||
COMMAND ${GIT_CMD} describe --tags --always
|
||||
OUTPUT_VARIABLE GIT_DESCRIBE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
|
||||
|
||||
# Get branch name.
|
||||
# Will return empty if you checked out a commit or tag. Empty string handled later.
|
||||
execute_process(COMMAND ${GIT_CMD} symbolic-ref --short -q HEAD OUTPUT_VARIABLE GIT_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
|
||||
# Get branch name. Will return empty if you checked out a commit or tag.
|
||||
# Empty string handled later.
|
||||
execute_process(
|
||||
COMMAND ${GIT_CMD} symbolic-ref --short -q HEAD
|
||||
OUTPUT_VARIABLE GIT_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
|
||||
|
||||
# Get commit hash.
|
||||
execute_process(COMMAND ${GIT_CMD} rev-parse --short --verify HEAD OUTPUT_VARIABLE GIT_COMMIT OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
|
||||
execute_process(
|
||||
COMMAND ${GIT_CMD} rev-parse --short --verify HEAD
|
||||
OUTPUT_VARIABLE GIT_COMMIT OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
|
||||
|
||||
# Get commit date, YYYY-MM-DD.
|
||||
execute_process(COMMAND ${GIT_CMD} show -s --format=%cd --date=format:%Y-%m-%d OUTPUT_VARIABLE GIT_COMMIT_DATE OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
|
||||
execute_process(
|
||||
COMMAND ${GIT_CMD} show -s --format=%cd --date=format:%Y-%m-%d
|
||||
OUTPUT_VARIABLE GIT_COMMIT_DATE OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
|
||||
|
||||
# Get number of commits since tagging. This is what "GIT_DESCRIBE" uses.
|
||||
# Works when checking out branch, tag or commit.
|
||||
# Get a list of all tags in repo:
|
||||
execute_process(COMMAND ${GIT_CMD} tag --merged HEAD OUTPUT_VARIABLE GIT_TAG WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
|
||||
# Works when checking out branch, tag or commit. Get a list of all tags in
|
||||
# repo:
|
||||
execute_process(
|
||||
COMMAND ${GIT_CMD} tag --merged HEAD
|
||||
OUTPUT_VARIABLE GIT_TAG
|
||||
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
|
||||
# Replace newlines with semicolons so that it can be split:
|
||||
string(REPLACE "\n" ";" GIT_TAG_LIST "${GIT_TAG}")
|
||||
execute_process(COMMAND ${GIT_CMD} rev-list --count HEAD --not ${GIT_TAG_LIST} OUTPUT_VARIABLE GIT_COMMITS_SINCE_TAG OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
|
||||
execute_process(
|
||||
COMMAND ${GIT_CMD} rev-list --count HEAD --not ${GIT_TAG_LIST}
|
||||
OUTPUT_VARIABLE GIT_COMMITS_SINCE_TAG OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
|
||||
|
||||
# Get number of commits since branching.
|
||||
# Works when checking out branch, tag or commit.
|
||||
execute_process(COMMAND ${GIT_CMD} rev-list --count HEAD --not --tags OUTPUT_VARIABLE GIT_COMMITS_SINCE_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
|
||||
# Get number of commits since branching. Works when checking out branch, tag
|
||||
# or commit.
|
||||
execute_process(
|
||||
COMMAND ${GIT_CMD} rev-list --count HEAD --not --tags
|
||||
OUTPUT_VARIABLE GIT_COMMITS_SINCE_BRANCH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
|
||||
|
||||
# If user checked-out something which is not a branch, use the description as branch name.
|
||||
# If user checked-out something which is not a branch, use the description
|
||||
# as branch name.
|
||||
if(GIT_BRANCH STREQUAL "")
|
||||
set(GIT_BRANCH "${GIT_DESCRIBE}")
|
||||
endif()
|
||||
|
||||
# Create numeric version.
|
||||
# This version is nonsense, either don't use it at all or use it only where you have no other choice, e.g. Inno Setup's VersionInfoVersion.
|
||||
# Strip everything after hyphen, e.g. "5.0-gtk2" -> "5.0", "5.1-rc1" -> "5.1" (ergo BS).
|
||||
# Create numeric version. This version is nonsense, either don't use it at
|
||||
# all or use it only where you have no other choice, e.g. Inno Setup's
|
||||
# VersionInfoVersion. Strip everything after hyphen, e.g. "5.0-gtk2" ->
|
||||
# "5.0", "5.1-rc1" -> "5.1" (ergo BS).
|
||||
if(GIT_COMMITS_SINCE_TAG STREQUAL "")
|
||||
set(GIT_NUMERIC_VERSION_BS "0.0.0")
|
||||
else()
|
||||
string(REGEX REPLACE "-.*" "" GIT_NUMERIC_VERSION_BS ${GIT_DESCRIBE})
|
||||
set(GIT_NUMERIC_VERSION_BS "${GIT_NUMERIC_VERSION_BS}.${GIT_COMMITS_SINCE_TAG}")
|
||||
set(GIT_NUMERIC_VERSION_BS
|
||||
"${GIT_NUMERIC_VERSION_BS}.${GIT_COMMITS_SINCE_TAG}")
|
||||
endif()
|
||||
|
||||
message(STATUS "Git checkout information:")
|
||||
@@ -75,7 +109,10 @@ if(REL_INFO_FILE STREQUAL REL_INFO_FILE-NOTFOUND)
|
||||
|
||||
if(NOT DEFINED CACHE_NAME_SUFFIX)
|
||||
set(CACHE_NAME_SUFFIX "${GIT_DESCRIBE}")
|
||||
message(STATUS "CACHE_NAME_SUFFIX was not defined, it is now \"${CACHE_NAME_SUFFIX}\"")
|
||||
message(
|
||||
STATUS
|
||||
"CACHE_NAME_SUFFIX was not defined, it is now \"${CACHE_NAME_SUFFIX}\""
|
||||
)
|
||||
else()
|
||||
message(STATUS "CACHE_NAME_SUFFIX is \"${CACHE_NAME_SUFFIX}\"")
|
||||
endif()
|
||||
@@ -87,7 +124,8 @@ endif(REL_INFO_FILE STREQUAL REL_INFO_FILE-NOTFOUND)
|
||||
if(WIN32)
|
||||
if(BIT_DEPTH EQUAL 4)
|
||||
set(BUILD_BIT_DEPTH 32)
|
||||
# 32 bits builds has to be installable on 64 bits system, to support WinXP/64.
|
||||
# 32 bits builds has to be installable on 64 bits system, to support
|
||||
# WinXP/64.
|
||||
set(ARCHITECTURE_ALLOWED "x86 x64 ia64")
|
||||
# installing in 32 bits mode even on 64 bits OS and architecture
|
||||
set(INSTALL_MODE "")
|
||||
@@ -95,16 +133,21 @@ if(WIN32)
|
||||
set(BUILD_BIT_DEPTH 64)
|
||||
# Restricting the 64 bits builds to 64 bits systems only
|
||||
set(ARCHITECTURE_ALLOWED "x64 ia64")
|
||||
# installing in 64 bits mode for all 64 bits processors, even for itanium architecture
|
||||
# installing in 64 bits mode for all 64 bits processors, even for
|
||||
# itanium architecture
|
||||
set(INSTALL_MODE "x64 ia64")
|
||||
endif(BIT_DEPTH EQUAL 4)
|
||||
# set part of the output archive name
|
||||
set(SYSTEM_NAME "WinVista")
|
||||
|
||||
configure_file("${PROJECT_SOURCE_DIR}/tools/win/InnoSetup/WindowsInnoSetup.iss.in" "${CMAKE_BINARY_DIR}/rtdata/WindowsInnoSetup.iss")
|
||||
configure_file(
|
||||
"${PROJECT_SOURCE_DIR}/tools/win/InnoSetup/WindowsInnoSetup.iss.in"
|
||||
"${CMAKE_BINARY_DIR}/rtdata/WindowsInnoSetup.iss")
|
||||
endif(WIN32)
|
||||
|
||||
# build version.h from template
|
||||
configure_file("${PROJECT_SOURCE_DIR}/rtgui/version.h.in" "${CMAKE_BINARY_DIR}/rtgui/version.h")
|
||||
configure_file("${PROJECT_SOURCE_DIR}/rtgui/version.h.in"
|
||||
"${CMAKE_BINARY_DIR}/rtgui/version.h")
|
||||
# build AboutThisBuild.txt from template
|
||||
configure_file("${PROJECT_SOURCE_DIR}/AboutThisBuild.txt.in" "${CMAKE_BINARY_DIR}/AboutThisBuild.txt")
|
||||
configure_file("${PROJECT_SOURCE_DIR}/AboutThisBuild.txt.in"
|
||||
"${CMAKE_BINARY_DIR}/AboutThisBuild.txt")
|
||||
|
@@ -16,79 +16,79 @@ fMagenta="$(tput setaf 5)"
|
||||
fRed="$(tput setaf 1)"
|
||||
|
||||
function msg {
|
||||
printf "\\n${fBold}-- %s${fNormal}\\n" "${@}"
|
||||
printf "\\n${fBold}-- %s${fNormal}\\n" "${@}"
|
||||
}
|
||||
|
||||
function msgError {
|
||||
printf "\\n${fBold}Error:${fNormal}\\n%s\\n" "${@}"
|
||||
printf "\\n${fBold}Error:${fNormal}\\n%s\\n" "${@}"
|
||||
}
|
||||
|
||||
function GetDependencies {
|
||||
otool -L "$1" | awk 'NR >= 2 && $1 !~ /^(\/usr\/lib|\/System|@executable_path|@rpath)\// { print $1 }'
|
||||
otool -L "$1" | awk 'NR >= 2 && $1 !~ /^(\/usr\/lib|\/System|@executable_path|@rpath)\// { print $1 }'
|
||||
}
|
||||
|
||||
function CheckLink {
|
||||
GetDependencies "$1" | while read -r; do
|
||||
local dest="${LIB}/$(basename "${REPLY}")"
|
||||
test -f "${dest}" || { ditto --arch "${arch}" "${REPLY}" "${dest}"; CheckLink "${dest}"; }
|
||||
done
|
||||
GetDependencies "$1" | while read -r; do
|
||||
local dest="${LIB}/$(basename "${REPLY}")"
|
||||
test -f "${dest}" || { ditto --arch "${arch}" "${REPLY}" "${dest}"; CheckLink "${dest}"; }
|
||||
done
|
||||
}
|
||||
|
||||
function ModifyInstallNames {
|
||||
find -E "${CONTENTS}" -type f -regex '.*/(rawtherapee-cli|rawtherapee|.*\.(dylib|so))' | while read -r x; do
|
||||
msg "Modifying install names: ${x}"
|
||||
{
|
||||
# id
|
||||
if [ ${x:(-6)} == ".dylib" ] || [ f${x:(-3)} == ".so" ]; then
|
||||
install_name_tool -id /Applications/"${LIB}"/$(basename ${x}) ${x}
|
||||
fi
|
||||
GetDependencies "${x}" | while read -r y
|
||||
do
|
||||
install_name_tool -change ${y} /Applications/"${LIB}"/$(basename ${y}) ${x}
|
||||
done
|
||||
} | bash -v
|
||||
done
|
||||
find -E "${CONTENTS}" -type f -regex '.*/(rawtherapee-cli|rawtherapee|.*\.(dylib|so))' | while read -r x; do
|
||||
msg "Modifying install names: ${x}"
|
||||
{
|
||||
# id
|
||||
if [ ${x:(-6)} == ".dylib" ] || [ f${x:(-3)} == ".so" ]; then
|
||||
install_name_tool -id /Applications/"${LIB}"/$(basename ${x}) ${x}
|
||||
fi
|
||||
GetDependencies "${x}" | while read -r y
|
||||
do
|
||||
install_name_tool -change ${y} /Applications/"${LIB}"/$(basename ${y}) ${x}
|
||||
done
|
||||
} | bash -v
|
||||
done
|
||||
}
|
||||
|
||||
# Source check
|
||||
if [[ ! -d "${CMAKE_BUILD_TYPE}" ]]; then
|
||||
msgError "${PWD}/${CMAKE_BUILD_TYPE} folder does not exist. Please execute 'make install' first."
|
||||
exit 1
|
||||
msgError "${PWD}/${CMAKE_BUILD_TYPE} folder does not exist. Please execute 'make install' first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Update project version
|
||||
if [[ -x "$(which git)" && -d "${PROJECT_SOURCE_DIR}/.git" ]]; then
|
||||
### This section is copied from tools/generateReleaseInfo
|
||||
# Get version description.
|
||||
# Depending on whether you checked out a branch (dev) or a tag (release),
|
||||
# "git describe" will return "5.0-gtk2-2-g12345678" or "5.0-gtk2", respectively.
|
||||
gitDescribe="$(git describe --tags --always)"
|
||||
|
||||
# Apple requires a numeric version of the form n.n.n
|
||||
# https://goo.gl/eWDQv6
|
||||
|
||||
# Get number of commits since tagging. This is what gitDescribe uses.
|
||||
# Works when checking out branch, tag or commit.
|
||||
gitCommitsSinceTag="$(git rev-list --count HEAD --not $(git tag --merged HEAD))"
|
||||
|
||||
# Create numeric version.
|
||||
# This version is nonsense, either don't use it at all or use it only where you have no other choice, e.g. Inno Setup's VersionInfoVersion.
|
||||
# Strip everything after hyphen, e.g. "5.0-gtk2" -> "5.0", "5.1-rc1" -> "5.1" (ergo BS).
|
||||
if [[ -z $gitCommitsSinceTag ]]; then
|
||||
gitVersionNumericBS="0.0.0"
|
||||
else
|
||||
gitVersionNumericBS="${gitDescribe%%-*}" # Remove everything after first hyphen.
|
||||
gitVersionNumericBS="${gitVersionNumericBS}.${gitCommitsSinceTag}" # Remove everything until after first hyphen: 5.0
|
||||
fi
|
||||
### Copy end.
|
||||
|
||||
PROJECT_FULL_VERSION="$gitDescribe"
|
||||
PROJECT_VERSION="$gitVersionNumericBS"
|
||||
### This section is copied from tools/generateReleaseInfo
|
||||
# Get version description.
|
||||
# Depending on whether you checked out a branch (dev) or a tag (release),
|
||||
# "git describe" will return "5.0-gtk2-2-g12345678" or "5.0-gtk2", respectively.
|
||||
gitDescribe="$(git describe --tags --always)"
|
||||
|
||||
# Apple requires a numeric version of the form n.n.n
|
||||
# https://goo.gl/eWDQv6
|
||||
|
||||
# Get number of commits since tagging. This is what gitDescribe uses.
|
||||
# Works when checking out branch, tag or commit.
|
||||
gitCommitsSinceTag="$(git rev-list --count HEAD --not $(git tag --merged HEAD))"
|
||||
|
||||
# Create numeric version.
|
||||
# This version is nonsense, either don't use it at all or use it only where you have no other choice, e.g. Inno Setup's VersionInfoVersion.
|
||||
# Strip everything after hyphen, e.g. "5.0-gtk2" -> "5.0", "5.1-rc1" -> "5.1" (ergo BS).
|
||||
if [[ -z $gitCommitsSinceTag ]]; then
|
||||
gitVersionNumericBS="0.0.0"
|
||||
else
|
||||
gitVersionNumericBS="${gitDescribe%%-*}" # Remove everything after first hyphen.
|
||||
gitVersionNumericBS="${gitVersionNumericBS}.${gitCommitsSinceTag}" # Remove everything until after first hyphen: 5.0
|
||||
fi
|
||||
### Copy end.
|
||||
|
||||
PROJECT_FULL_VERSION="$gitDescribe"
|
||||
PROJECT_VERSION="$gitVersionNumericBS"
|
||||
fi
|
||||
|
||||
MINIMUM_SYSTEM_VERSION="$(otool -l "${CMAKE_BUILD_TYPE}"/MacOS/rawtherapee | grep -A2 'LC_VERSION_MIN_MACOSX' | awk '$1 ~ /version/ { printf $2 }')"
|
||||
if [[ -z "${MINIMUM_SYSTEM_VERSION}" ]]; then
|
||||
MINIMUM_SYSTEM_VERSION="$(sw_vers -productVersion | cut -d. -f-2)"
|
||||
MINIMUM_SYSTEM_VERSION="$(sw_vers -productVersion | cut -d. -f-2)"
|
||||
fi
|
||||
|
||||
arch=x86_64
|
||||
@@ -111,7 +111,7 @@ CODESIGNID="$(cmake .. -LA -N | grep "CODESIGNID" | cut -d "=" -f2)"
|
||||
NOTARY="$(cmake .. -LA -N | grep "NOTARY" | cut -d "=" -f2)"
|
||||
FANCY_DMG="$(cmake .. -LA -N | grep "FANCY_DMG" | cut -d "=" -f2)"
|
||||
if [[ -n ${FANCY_DMG} ]] ; then
|
||||
echo "Fancy .dmg build is ON."
|
||||
echo "Fancy .dmg build is ON."
|
||||
fi
|
||||
|
||||
APP="${PROJECT_NAME}.app"
|
||||
@@ -212,8 +212,8 @@ ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/themes/Default/gtk-3.0/gtk-
|
||||
msg "Copy Adwaita icons"
|
||||
iconfolders=("16x16/actions" "16x16/devices" "16x16/mimetypes" "16x16/places" "16x16/status" "48x48/devices")
|
||||
for f in "${iconfolders[@]}"; do
|
||||
mkdir -p ${RESOURCES}/share/icons/Adwaita/${f}
|
||||
ditto ${LOCAL_PREFIX}/local/share/icons/Adwaita/${f}/* "${RESOURCES}"/share/icons/Adwaita/${f}
|
||||
mkdir -p ${RESOURCES}/share/icons/Adwaita/${f}
|
||||
ditto ${LOCAL_PREFIX}/local/share/icons/Adwaita/${f}/* "${RESOURCES}"/share/icons/Adwaita/${f}
|
||||
done
|
||||
ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/icons/Adwaita/index.theme
|
||||
"${LOCAL_PREFIX}/local/bin/gtk-update-icon-cache" "${RESOURCES}/share/icons/Adwaita"
|
||||
@@ -263,133 +263,133 @@ ModifyInstallNames
|
||||
# fix @rpath in Frameworks
|
||||
msg "Registering @rpath in Frameworks folder."
|
||||
for frameworklibs in "${LIB}"/*{dylib,so} ; do
|
||||
install_name_tool -delete_rpath ${LOCAL_PREFIX}/local/lib "${frameworklibs}"
|
||||
install_name_tool -add_rpath /Applications/"${LIB}" "${frameworklibs}"
|
||||
install_name_tool -delete_rpath ${LOCAL_PREFIX}/local/lib "${frameworklibs}"
|
||||
install_name_tool -add_rpath /Applications/"${LIB}" "${frameworklibs}"
|
||||
done
|
||||
install_name_tool -delete_rpath RawTherapee.app/Contents/Frameworks "${EXECUTABLE}"-cli
|
||||
install_name_tool -add_rpath @executable_path "${EXECUTABLE}"-cli
|
||||
|
||||
# Codesign the app
|
||||
if [ -n "${CODESIGNID}" ] ; then
|
||||
msg "Codesigning Application."
|
||||
install -m 0644 "${PROJECT_SOURCE_DATA_DIR}"/rt.entitlements "${CMAKE_BUILD_TYPE}"/rt.entitlements
|
||||
plutil -convert binary1 "${CMAKE_BUILD_TYPE}"/rt.entitlements
|
||||
mv "${EXECUTABLE}"-cli "${LIB}"
|
||||
for frameworklibs in "${LIB}"/* ; do
|
||||
codesign -v -s "${CODESIGNID}" -i com.rawtherapee.RawTherapee --force --verbose -o runtime --timestamp "${frameworklibs}"
|
||||
done
|
||||
codesign --timestamp --strict -v -s "${CODESIGNID}" -i com.rawtherapee.RawTherapee -o runtime --entitlements "${CMAKE_BUILD_TYPE}"/rt.entitlements "${APP}"
|
||||
spctl -a -vvvv "${APP}"
|
||||
msg "Codesigning Application."
|
||||
install -m 0644 "${PROJECT_SOURCE_DATA_DIR}"/rt.entitlements "${CMAKE_BUILD_TYPE}"/rt.entitlements
|
||||
plutil -convert binary1 "${CMAKE_BUILD_TYPE}"/rt.entitlements
|
||||
mv "${EXECUTABLE}"-cli "${LIB}"
|
||||
for frameworklibs in "${LIB}"/* ; do
|
||||
codesign -v -s "${CODESIGNID}" -i com.rawtherapee.RawTherapee --force --verbose -o runtime --timestamp "${frameworklibs}"
|
||||
done
|
||||
codesign --timestamp --strict -v -s "${CODESIGNID}" -i com.rawtherapee.RawTherapee -o runtime --entitlements "${CMAKE_BUILD_TYPE}"/rt.entitlements "${APP}"
|
||||
spctl -a -vvvv "${APP}"
|
||||
fi
|
||||
|
||||
# Notarize the app
|
||||
if [ -n "$NOTARY" ] ; then
|
||||
msg "Notarizing the application:"
|
||||
ditto -c -k --sequesterRsrc --keepParent "${APP}" "${APP}.zip"
|
||||
uuid=`xcrun altool --notarize-app --primary-bundle-id "com.rawtherapee.RawTherapee" ${NOTARY} --file "${APP}.zip" 2>&1 | grep 'RequestUUID' | awk '{ print $3 }'`
|
||||
echo "Result= $uuid" # Display identifier string
|
||||
sleep 15
|
||||
while :
|
||||
do
|
||||
fullstatus=`xcrun altool --notarization-info "$uuid" ${NOTARY} 2>&1` # get the status
|
||||
status1=`echo "$fullstatus" | grep 'Status\:' | awk '{ print $2 }'`
|
||||
if [ "$status1" = "success" ]; then
|
||||
xcrun stapler staple *app # staple the ticket
|
||||
xcrun stapler validate -v *app
|
||||
echo "Notarization success"
|
||||
break
|
||||
elif [ "$status1" = "in" ]; then
|
||||
echo "Notarization still in progress, sleeping for 15 seconds and trying again"
|
||||
sleep 15
|
||||
else
|
||||
echo "Notarization failed fullstatus below"
|
||||
echo "$fullstatus"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
msg "Notarizing the application:"
|
||||
ditto -c -k --sequesterRsrc --keepParent "${APP}" "${APP}.zip"
|
||||
uuid=`xcrun altool --notarize-app --primary-bundle-id "com.rawtherapee.RawTherapee" ${NOTARY} --file "${APP}.zip" 2>&1 | grep 'RequestUUID' | awk '{ print $3 }'`
|
||||
echo "Result= $uuid" # Display identifier string
|
||||
sleep 15
|
||||
while :
|
||||
do
|
||||
fullstatus=`xcrun altool --notarization-info "$uuid" ${NOTARY} 2>&1` # get the status
|
||||
status1=`echo "$fullstatus" | grep 'Status\:' | awk '{ print $2 }'`
|
||||
if [ "$status1" = "success" ]; then
|
||||
xcrun stapler staple *app # staple the ticket
|
||||
xcrun stapler validate -v *app
|
||||
echo "Notarization success"
|
||||
break
|
||||
elif [ "$status1" = "in" ]; then
|
||||
echo "Notarization still in progress, sleeping for 15 seconds and trying again"
|
||||
sleep 15
|
||||
else
|
||||
echo "Notarization failed fullstatus below"
|
||||
echo "$fullstatus"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
function CreateDmg {
|
||||
local srcDir="$(mktemp -dt $$)"
|
||||
|
||||
msg "Preparing disk image sources at ${srcDir}:"
|
||||
cp -R "${APP}" "${srcDir}"
|
||||
cp "${RESOURCES}"/share/LICENSE.txt "${srcDir}"
|
||||
ln -s /Applications "${srcDir}"
|
||||
|
||||
# Web bookmarks
|
||||
function CreateWebloc {
|
||||
defaults write "${srcDir}/$1" URL "$2"
|
||||
mv "${srcDir}/$1".{plist,webloc}
|
||||
}
|
||||
CreateWebloc 'Website' 'https://www.rawtherapee.com/'
|
||||
CreateWebloc 'Documentation' 'https://rawpedia.rawtherapee.com/'
|
||||
CreateWebloc 'Forum' 'https://discuss.pixls.us/c/software/rawtherapee'
|
||||
CreateWebloc 'Report Bug' 'https://github.com/Beep6581/RawTherapee/issues/new'
|
||||
|
||||
# Disk image name
|
||||
dmg_name="${PROJECT_NAME// /_}_OSX_${MINIMUM_SYSTEM_VERSION}_${PROC_BIT_DEPTH}_${PROJECT_FULL_VERSION}"
|
||||
lower_build_type="$(tr '[:upper:]' '[:lower:]' <<< "$CMAKE_BUILD_TYPE")"
|
||||
if [[ ${lower_build_type} != release ]]; then
|
||||
dmg_name="${dmg_name}_${lower_build_type}"
|
||||
fi
|
||||
|
||||
msg "Creating disk image:"
|
||||
if [ ! -z ${FANCY_DMG} ] ; then
|
||||
echo "Building Fancy .dmg"
|
||||
mkdir "${srcDir}/.background"
|
||||
cp -R "${PROJECT_SOURCE_DATA_DIR}/rtdmg.icns" "${srcDir}/.VolumeIcon.icns"
|
||||
cp -R "${PROJECT_SOURCE_DATA_DIR}/rtdmg-bkgd.png" "${srcDir}/.background/background.png"
|
||||
SetFile -c incC "${srcDir}/.VolumeIcon.icns"
|
||||
create-dmg "${dmg_name}.dmg" "${srcDir}" \
|
||||
--volname "${PROJECT_NAME}_${PROJECT_FULL_VERSION}" \
|
||||
--volicon "${srcDir}/.VolumeIcon.icns" \
|
||||
--sandbox-safe \
|
||||
--no-internet-enable \
|
||||
--eula LICENSE.txt \
|
||||
--hdiutil-verbose \
|
||||
--rez /Library/Developer/CommandLineTools/usr/bin/Rez
|
||||
else
|
||||
hdiutil create -format UDBZ -fs HFS+ -srcdir "${srcDir}" -volname "${PROJECT_NAME}_${PROJECT_FULL_VERSION}" "${dmg_name}.dmg"
|
||||
fi
|
||||
|
||||
# Sign disk image
|
||||
if [ -n "$CODESIGNID" ] ; then
|
||||
codesign --deep --force -v -s "${CODESIGNID}" --timestamp "${dmg_name}.dmg"
|
||||
fi
|
||||
|
||||
# Notarize the dmg
|
||||
if ! test -z "$NOTARY" ; then
|
||||
msg "Notarizing the dmg:"
|
||||
zip "${dmg_name}.dmg.zip" "${dmg_name}.dmg"
|
||||
uuid=`xcrun altool --notarize-app --primary-bundle-id "com.rawtherapee" ${NOTARY} --file "${dmg_name}.dmg.zip" 2>&1 | grep 'RequestUUID' | awk '{ print $3 }'`
|
||||
echo "dmg Result= $uuid" # Display identifier string
|
||||
sleep 15
|
||||
while :
|
||||
do
|
||||
fullstatus=`xcrun altool --notarization-info "$uuid" ${NOTARY} 2>&1` # get the status
|
||||
status1=`echo "$fullstatus" | grep 'Status\:' | awk '{ print $2 }'`
|
||||
if [ "$status1" = "success" ]; then
|
||||
xcrun stapler staple "${dmg_name}.dmg" # staple the ticket
|
||||
xcrun stapler validate -v "${dmg_name}.dmg"
|
||||
echo "dmg Notarization success"
|
||||
break
|
||||
elif [ "$status1" = "in" ]; then
|
||||
echo "dmg Notarization still in progress, sleeping for 15 seconds and trying again"
|
||||
sleep 15
|
||||
else
|
||||
echo "dmg Notarization failed fullstatus below"
|
||||
echo "$fullstatus"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Zip disk image for redistribution
|
||||
msg "Zipping disk image for redistribution:"
|
||||
rm "${dmg_name}.dmg"
|
||||
msg "Removing disk image caches:"
|
||||
rm -rf "${srcDir}"
|
||||
local srcDir="$(mktemp -dt $$)"
|
||||
|
||||
msg "Preparing disk image sources at ${srcDir}:"
|
||||
cp -R "${APP}" "${srcDir}"
|
||||
cp "${RESOURCES}"/share/LICENSE.txt "${srcDir}"
|
||||
ln -s /Applications "${srcDir}"
|
||||
|
||||
# Web bookmarks
|
||||
function CreateWebloc {
|
||||
defaults write "${srcDir}/$1" URL "$2"
|
||||
mv "${srcDir}/$1".{plist,webloc}
|
||||
}
|
||||
CreateWebloc 'Website' 'https://www.rawtherapee.com/'
|
||||
CreateWebloc 'Documentation' 'https://rawpedia.rawtherapee.com/'
|
||||
CreateWebloc 'Forum' 'https://discuss.pixls.us/c/software/rawtherapee'
|
||||
CreateWebloc 'Report Bug' 'https://github.com/Beep6581/RawTherapee/issues/new'
|
||||
|
||||
# Disk image name
|
||||
dmg_name="${PROJECT_NAME// /_}_OSX_${MINIMUM_SYSTEM_VERSION}_${PROC_BIT_DEPTH}_${PROJECT_FULL_VERSION}"
|
||||
lower_build_type="$(tr '[:upper:]' '[:lower:]' <<< "$CMAKE_BUILD_TYPE")"
|
||||
if [[ ${lower_build_type} != release ]]; then
|
||||
dmg_name="${dmg_name}_${lower_build_type}"
|
||||
fi
|
||||
|
||||
msg "Creating disk image:"
|
||||
if [ ! -z ${FANCY_DMG} ] ; then
|
||||
echo "Building Fancy .dmg"
|
||||
mkdir "${srcDir}/.background"
|
||||
cp -R "${PROJECT_SOURCE_DATA_DIR}/rtdmg.icns" "${srcDir}/.VolumeIcon.icns"
|
||||
cp -R "${PROJECT_SOURCE_DATA_DIR}/rtdmg-bkgd.png" "${srcDir}/.background/background.png"
|
||||
SetFile -c incC "${srcDir}/.VolumeIcon.icns"
|
||||
create-dmg "${dmg_name}.dmg" "${srcDir}" \
|
||||
--volname "${PROJECT_NAME}_${PROJECT_FULL_VERSION}" \
|
||||
--volicon "${srcDir}/.VolumeIcon.icns" \
|
||||
--sandbox-safe \
|
||||
--no-internet-enable \
|
||||
--eula LICENSE.txt \
|
||||
--hdiutil-verbose \
|
||||
--rez /Library/Developer/CommandLineTools/usr/bin/Rez
|
||||
else
|
||||
hdiutil create -format UDBZ -fs HFS+ -srcdir "${srcDir}" -volname "${PROJECT_NAME}_${PROJECT_FULL_VERSION}" "${dmg_name}.dmg"
|
||||
fi
|
||||
|
||||
# Sign disk image
|
||||
if [ -n "$CODESIGNID" ] ; then
|
||||
codesign --deep --force -v -s "${CODESIGNID}" --timestamp "${dmg_name}.dmg"
|
||||
fi
|
||||
|
||||
# Notarize the dmg
|
||||
if ! test -z "$NOTARY" ; then
|
||||
msg "Notarizing the dmg:"
|
||||
zip "${dmg_name}.dmg.zip" "${dmg_name}.dmg"
|
||||
uuid=`xcrun altool --notarize-app --primary-bundle-id "com.rawtherapee" ${NOTARY} --file "${dmg_name}.dmg.zip" 2>&1 | grep 'RequestUUID' | awk '{ print $3 }'`
|
||||
echo "dmg Result= $uuid" # Display identifier string
|
||||
sleep 15
|
||||
while :
|
||||
do
|
||||
fullstatus=`xcrun altool --notarization-info "$uuid" ${NOTARY} 2>&1` # get the status
|
||||
status1=`echo "$fullstatus" | grep 'Status\:' | awk '{ print $2 }'`
|
||||
if [ "$status1" = "success" ]; then
|
||||
xcrun stapler staple "${dmg_name}.dmg" # staple the ticket
|
||||
xcrun stapler validate -v "${dmg_name}.dmg"
|
||||
echo "dmg Notarization success"
|
||||
break
|
||||
elif [ "$status1" = "in" ]; then
|
||||
echo "dmg Notarization still in progress, sleeping for 15 seconds and trying again"
|
||||
sleep 15
|
||||
else
|
||||
echo "dmg Notarization failed fullstatus below"
|
||||
echo "$fullstatus"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Zip disk image for redistribution
|
||||
msg "Zipping disk image for redistribution:"
|
||||
rm "${dmg_name}.dmg"
|
||||
msg "Removing disk image caches:"
|
||||
rm -rf "${srcDir}"
|
||||
}
|
||||
CreateDmg
|
||||
msg "Finishing build:"
|
||||
|
Reference in New Issue
Block a user