Op za 13 mrt. 2021 om 18:18 schreef Kornel Benko <kornel.be...@berlin.de>:

> Am Sat, 13 Mar 2021 17:51:26 +0100
> schrieb "'Kay F. Jahnke' via hugin and other free panoramic software"
>
> > Is that okay with you guys?
>
> Yes from my side.
>
>
OK from my side as well.



>
> > You might as well simply trust the user. Most people who've come so far
> > as doing their own builds should know that in-tree builds aren't cool. I
> > think it's best to keep it simple, no need to regulate everything. Just
> > my personal opinion...
>
> I don't trust. The messy things start if one tries to use cmake _and_
> automake-build in
> source. Better to omit the mess, less things that may go wrong.
>
>
> I don't even trust myself for that matter. When I was working on the Apple
I worked in the main folder and when ready modifying the CMakeLists.txt and
adding the CMakeModules folder and content, I tried to do a "cmake .."
which of course didn't work, but an error is easily made.
And it doesn't bother the user at all having it in the script. And if the
user does it wrong, he/she is immediately educated why he/she should not do
that. Keep things neat and tidy I would say.

Please find attached 2 patches.
The cmake.patch is universal and can be applied in all branches. It
contains fixes to the CMakeLists.txt and the CMakeModules (and the
out-of-tree build)
The mac_bundle.patch is only for the mac branch.
Both patches were made with "diff -u" and created from the root source
directory.

-- 
A list of frequently asked questions is available at: 
http://wiki.panotools.org/Hugin_FAQ
--- 
You received this message because you are subscribed to the Google Groups 
"hugin and other free panoramic software" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to hugin-ptx+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/hugin-ptx/CAGARPptQp8GVowOpABg2iKg0NYgh0JwAsc7E4FWty%3D7Fw_X0%3Dw%40mail.gmail.com.
diff --git a/scripts/make_bundle.sh b/scripts/make_bundle.sh
index 16f73d8..40cd80c 100755
--- a/scripts/make_bundle.sh
+++ b/scripts/make_bundle.sh
@@ -9,16 +9,10 @@
 # This script should be run from the mac-bundle directory and expects the compiled pv
 # in the parent build directory.
 
+# Version 20210312, HvdW, Add version from the pv_version files; use $BINARY more consequent
 # Version 20210306, HvdW, Add version to Info.plist and use version for dmg identification
 
-if [ "$1" = "" ]
-then
-        printf "\n\nYou have to provide the version\n\n"
-        exit
-fi
-
-Version="$1"
-
+Version="$(cat ../pv_version_first).$(cat ../pv_version_second).$(cat ../pv_version_third)"
 
 ############ Variables ######################
 BASE_DIR=$(pwd)
@@ -88,9 +82,9 @@ mkdir -p "${RESOURCES_PATH}"
 printf "* First copy pv, the .ttf, the .icns into our ${APPLICATION_APP_BUNDLE}\n"
 if [ -f ../${BINARY} ];
 then
-  cp ../pv "${APPLICATION_BINDIR}"
+  cp ../$BINARY "${APPLICATION_BINDIR}"
 else
-  printf "\n\n  !!!! The pv binary is not available in the parent build directory !!!!\n"
+  printf "\n\n  !!!! The $BINARY binary is not available in the parent build directory !!!!\n"
   printf "  !!!! I will exit now !!!!\n\n"
   exit 1;
 fi
@@ -101,8 +95,8 @@ printf "* Update the VersionString to $Version and copy Info.plist into our ${AP
 sed -e "s+VersionString+$Version+" Info.plist.base > "${APPLICATION_APP_BUNDLE}/Contents"/Info.plist
 
 
-printf "\n* Now copy the 3rd party libraries and correct the internal rpath in all libraries and in pv\n\n"
-get_libraries ${BASE_DIR}/${APPLICATION_BINDIR}/pv
+printf "\n* Now copy the 3rd party libraries and correct the internal rpath in all libraries and in $BINARY\n\n"
+get_libraries ${BASE_DIR}/${APPLICATION_BINDIR}/$BINARY
 
 
 printf "\n\n* Now we will create the dmg to distribute the app\n\n"
@@ -111,10 +105,10 @@ rm -rf *.dmg
 mkdir -p bundle
 cp ../README.rst bundle/README.txt
 cp ../LICENSE bundle
-cp -a PV.app bundle
+cp -a ${APPLICATION_APP_BUNDLE} bundle
 
 #DATE=$(date +%Y-%m-%d)
 hdiutil create /tmp/tmp.dmg -ov -volname "PV Version ${Version}" -fs HFS+ -srcfolder "./bundle"
 #hdiutil convert /tmp/tmp.dmg -format UDZO -o PV-${DATE}.dmg
 hdiutil convert /tmp/tmp.dmg -format UDZO -o PV-${Version}.dmg
-printf "\n\nDone! You will now find in this folder a \"PV.app\" and a \"PV-${Version}.dmg\"\n\n"
+printf "\n\nDone! You will now find in this folder a \"${APPLICATION_APP_BUNDLE}\" and a \"PV-${Version}.dmg\"\n\n"
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3d561bb..ef37e27 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,5 @@
 #          cmake file for pv
-#          
+#
 #          Copyright Kornel Benko <kornel.be...@berlin.de> 2021
 #                    Kay F. Jahnke <kfjahnke...@gmail.com> 2021
 #
@@ -35,12 +35,23 @@
 # cmake ..
 # make
 
+# prevent in-tree building
+if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+    message(FATAL_ERROR "In-source builds are not allowed.")
+endif()
+
+
 set(ENV{CXX} clang++)
 set(ENV{CC} clang)
 
 set(_pv pv)	# Project name
 project (${_pv})
-cmake_minimum_required(VERSION 3.16) # kfj lowered to 3.16 from 3.18
+cmake_minimum_required(VERSION 3.10) # kfj lowered to 3.16 from 3.18; hvdw lowered to 3.10 for build on Ubunti 18.04 LTS
+
+# prevent in-tree building
+if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+    message(FATAL_ERROR "In-source builds are not allowed.")
+endif()
 
 # here we simply copies some of the source files to
 # different names, which makes it easier for the build logic - the
@@ -116,6 +127,7 @@ add_executable(${_pv} ${pv_sources})
 # it provides a library which has to be linked in. The other libs are both
 # build-time and run-time dependencies.
 
+
 set(LibFound ON)
 foreach(_l pthread Vc vigraimpex sfml-window sfml-graphics sfml-system exiv2)
 	string(TOUPPER ${_l} _UpcaseLib)
@@ -134,7 +146,14 @@ if (NOT LibFound)
 	message(FATAL_ERROR "Missing needed libraries ... aborting cmake configuration")
 endif()
 
-install(TARGETS ${_pv})
+
+if (APPLE)
+        set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules )
+        find_package(EXIV2 REQUIRED)
+        include_directories(${EXIV2_INCLUDE_DIR})
+endif (APPLE)
+
+install(TARGETS ${_pv} DESTINATION bin)
 
 # So good so far - the font is installed to a 'standard' destination,
 # but pv still won't find it unless it's pointed to it, which is a
diff --git a/CMakeModules/FindEXIV2.cmake b/CMakeModules/FindEXIV2.cmake
new file mode 100644
index 0000000..1919339
--- /dev/null
+++ b/CMakeModules/FindEXIV2.cmake
@@ -0,0 +1,115 @@
+# - Try to find the Exiv2 library
+# Once done this will define
+#
+#  EXIV2_FOUND - system has libexiv2
+#  EXIV2_INCLUDE_DIR - the libexiv2 include directory
+#  EXIV2_LIBRARIES - Link these to use libexiv2
+#  EXIV2_DEFINITIONS - Compiler switches required for using libexiv2
+#
+
+if (EXIV2_INCLUDE_DIR AND EXIV2_LIBRARIES)
+
+  # in cache already
+  SET(EXIV2_FOUND TRUE)
+
+else (EXIV2_INCLUDE_DIR AND EXIV2_LIBRARIES)
+  if (NOT WIN32)
+    # use pkg-config to get the directories and then use these values
+    # in the FIND_PATH() and FIND_LIBRARY() calls
+    INCLUDE(UsePkgConfig)
+  
+    PKGCONFIG(exiv2 _EXIV2IncDir _EXIV2LinkDir _EXIV2LinkFlags _EXIV2Cflags)
+
+    if(_EXIV2LinkFlags)
+      # query pkg-config asking for a Exiv2 >= 0.12
+      EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS --atleast-version=0.12 exiv2 RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull )
+      if(_return_VALUE STREQUAL "0")
+        message(STATUS "Found Exiv2 release >= 0.12")
+        set(EXIV2_VERSION_GOOD_FOUND TRUE)
+      else(_return_VALUE STREQUAL "0")
+        message(STATUS "Found Exiv2 release < 0.12")
+      endif(_return_VALUE STREQUAL "0")
+    else(_EXIV2LinkFlags)
+        set(EXIV2_FOUND FALSE)
+        set(EXIV2_VERSION_GOOD_FOUND FALSE)
+        message(STATUS "Cannot find Exiv2 library!")
+    endif(_EXIV2LinkFlags)
+
+  if(EXIV2_VERSION_GOOD_FOUND)
+     set(EXIV2_DEFINITIONS ${_EXIV2Cflags})
+ 
+     FIND_PATH(EXIV2_INCLUDE_DIR exiv2/exif.hpp
+       ${_EXIV2IncDir}
+     )
+  
+     FIND_LIBRARY(EXIV2_LIBRARIES NAMES exiv2 libexiv2
+       PATHS
+       ${_EXIV2LinkDir}
+     )
+  
+     if (EXIV2_INCLUDE_DIR AND EXIV2_LIBRARIES)
+        set(EXIV2_FOUND TRUE)
+     endif (EXIV2_INCLUDE_DIR AND EXIV2_LIBRARIES)
+   endif(EXIV2_VERSION_GOOD_FOUND)
+   if (EXIV2_FOUND)
+      if (NOT EXIV2_FIND_QUIETLY)
+       message(STATUS "Found Exiv2: ${EXIV2_LIBRARIES}")
+      endif (NOT EXIV2_FIND_QUIETLY)
+   else (EXIV2_FOUND)
+     if (EXIV2_FIND_REQUIRED)
+       if (NOT EXIV2_INCLUDE_DIR)
+         message(FATAL_ERROR "Could NOT find Exiv2 header files")
+       endif (NOT EXIV2_INCLUDE_DIR)
+       if (NOT EXIV2_LIBRARIES)
+           message(FATAL_ERROR "Could NOT find Exiv2 library")
+       endif (NOT EXIV2_LIBRARIES)
+     endif (EXIV2_FIND_REQUIRED)
+   endif (EXIV2_FOUND)
+
+  else(NOT WIN32)
+     FIND_PATH(EXIV2_INCLUDE_DIR exiv2/exif.hpp
+               /usr/local/include
+               /usr/include
+               ${SOURCE_BASE_DIR}/exiv2/include
+              )
+
+     include(FindLibraryWithDebug)
+
+     IF(${HUGIN_SHARED})
+       find_library_with_debug(EXIV2_LIBRARIES
+          WIN32_DEBUG_POSTFIX d
+          NAMES exiv2 libexiv2
+          PATHS 
+            ${SOURCE_BASE_DIR}/exiv2/lib
+       )
+
+     ELSE(${HUGIN_SHARED})
+       find_library_with_debug(EXIV2_LIBRARIES
+          WIN32_DEBUG_POSTFIX d
+          NAMES exiv2s exiv2 libexiv2
+          PATHS ${SYSTEM_LIB_DIRS} ${SOURCE_BASE_DIR}/exiv2/lib 
+       )
+
+       # since exiv 0.19, xmpsdk needs explicit linked in static build
+       find_library_with_debug(XMP_LIBRARIES
+          WIN32_DEBUG_POSTFIX d
+          NAMES xmpsdk xmp
+          PATHS 
+                ${SOURCE_BASE_DIR}/exiv2/lib
+       )
+       IF(XMP_LIBRARIES)
+         SET(EXIV2_LIBRARIES ${EXIV2_LIBRARIES} ${XMP_LIBRARIES})
+       ENDIF(XMP_LIBRARIES)
+
+     ENDIF(${HUGIN_SHARED})
+
+     include(FindPackageHandleStandardArgs)
+     find_package_handle_standard_args(EXIV2 DEFAULT_MSG 
+                                       EXIV2_INCLUDE_DIR EXIV2_LIBRARIES)
+
+  endif (NOT WIN32)
+
+  MARK_AS_ADVANCED(EXIV2_INCLUDE_DIR EXIV2_LIBRARIES)
+
+endif (EXIV2_INCLUDE_DIR AND EXIV2_LIBRARIES)
+

Reply via email to