Skip to content

Commit

Permalink
Merge pull request #692 from matty0ung/3.0.X
Browse files Browse the repository at this point in the history
More tweaks to Mac build
  • Loading branch information
matty0ung committed Dec 23, 2022
2 parents c5e4354 + 8ff7465 commit ca49f05
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 19 deletions.
15 changes: 15 additions & 0 deletions CHANGES.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ format therein).

* We'll list new features here...

## v3.0.5
Minor bug fixes for the 3.0.4 release (ie bugs in 3.0.5 are fixed in this 3.0.5 release).

### New Features

* None

### Bug Fixes
* macOS release v3.0.3 is damaged [#679](https://github.com/Brewtarget/brewtarget/issues/679)
* Boil Time not saved when you edit a copied recipe [#688](https://github.com/Brewtarget/brewtarget/issues/688)
* Imported recipes are inconsistent and inaccurate [#689](https://github.com/Brewtarget/brewtarget/issues/689)

### Release Timestamp
Tue, 20 Dec 2022 09:03:12 +0100

## v3.0.4
Minor bug fixes for the 3.0.3 release (ie bugs in 3.0.3 are fixed in this 3.0.4 release).

Expand Down
64 changes: 45 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,25 @@ cmake_policy(VERSION 3.16)
# numbers via it (rather than manually setting individual major/minor/patch vars).
cmake_policy(SET CMP0048 NEW)

#=======================================================================================================================
#================================================ Other preliminaries =================================================
#=======================================================================================================================
# Set the target binary architecture for targets on macOS
if(APPLE AND NOT CMAKE_OSX_ARCHITECTURES)
# Per https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_ARCHITECTURES.html, "the value of this variable should
# be set prior to the first project() or enable_language() command invocation because it may influence configuration
# of the toolchain and flags".
set(CMAKE_OSX_ARCHITECTURES x86_64) # Build intel 64-bit binary.
#set(CMAKE_OSX_ARCHITECTURES i386 x86_64) # Build intel binary.
#set(CMAKE_OSX_ARCHITECTURES ppc i386 ppc64 x86_64) # Build universal binary.
endif()

#=======================================================================================================================
#============================================== Project name and Version ===============================================
#=======================================================================================================================
# It's simplest to keep the project name all lower-case as it means we can use a lot more of the default settings for
# Linux packaging (where directory names etc are expected to be all lower-case)
project(brewtarget VERSION 3.0.4 LANGUAGES CXX)
project(brewtarget VERSION 3.0.5 LANGUAGES CXX)
message(STATUS "Building ${PROJECT_NAME} version ${PROJECT_VERSION}")
message(STATUS "PROJECT_SOURCE_DIR is ${PROJECT_SOURCE_DIR}")
# Sometimes we do need the capitalised version of the project name
Expand Down Expand Up @@ -215,6 +228,11 @@ set(fileName_unitTestRunner "${PROJECT_NAME}_tests")
#=======================================================================================================================
# This is needed to enable the add_test() command
enable_testing()
if (APPLE)
# On Mac we ask CMake to try to find static libraries when available -- because it's so painful shipping dynamic
# libraries in a Bundle.
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif()

#=======================================================================================================================
#=============================================== Installation Components ===============================================
Expand Down Expand Up @@ -288,13 +306,6 @@ if(WIN32)
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static")
endif()

# Mac-specific compilation settings
if(APPLE AND NOT CMAKE_OSX_ARCHITECTURES)
set(CMAKE_OSX_ARCHITECTURES x86_64) # Build intel 64-bit binary.
#set(CMAKE_OSX_ARCHITECTURES i386 x86_64) # Build intel binary.
#set(CMAKE_OSX_ARCHITECTURES ppc i386 ppc64 x86_64) # Build universal binary.
endif()

if(APPLE)
# As explained at https://stackoverflow.com/questions/5582211/what-does-define-gnu-source-imply, defining _GNU_SOURCE
# gives access to various non-standard GNU/Linux extension functions and changes the behaviour of some POSIX
Expand Down Expand Up @@ -461,15 +472,15 @@ if(WIN32)
#================================================= Windows Qt Stuff =================================================
#====================================================================================================================
# .:TBD:. Not sure whether/why we need these additional Qt components on Windows
find_package(Qt5MultimediaWidgets REQUIRED)
find_package(Qt5OpenGL REQUIRED)
#find_package(Qt5MultimediaWidgets REQUIRED)
#find_package(Qt5OpenGL REQUIRED)

# get_target_property(QtMultimediaWidgets_location Qt5::MultimediaWidgets LOCATION_${CMAKE_BUILD_TYPE})
# get_target_property(QtOpenGL_location Qt5::OpenGL LOCATION_${CMAKE_BUILD_TYPE})
get_target_property(QtCore_location Qt5::Core LOCATION_${CMAKE_BUILD_TYPE})
get_target_property(QtGui_location Qt5::Gui LOCATION_${CMAKE_BUILD_TYPE})
get_target_property(QtMultimedia_location Qt5::Multimedia LOCATION_${CMAKE_BUILD_TYPE})
get_target_property(QtMultimediaWidgets_location Qt5::MultimediaWidgets LOCATION_${CMAKE_BUILD_TYPE})
get_target_property(QtNetwork_location Qt5::Network LOCATION_${CMAKE_BUILD_TYPE})
get_target_property(QtOpenGL_location Qt5::OpenGL LOCATION_${CMAKE_BUILD_TYPE})
get_target_property(QtPrintSupport_location Qt5::PrintSupport LOCATION_${CMAKE_BUILD_TYPE})
get_target_property(QtQgif_location Qt5::QGifPlugin LOCATION_${CMAKE_BUILD_TYPE})
get_target_property(QtQico_location Qt5::QICOPlugin LOCATION_${CMAKE_BUILD_TYPE})
Expand All @@ -488,9 +499,9 @@ if(WIN32)
set(Qt_DLLs ${QtCore_location}
${QtGui_location}
${QtMultimedia_location}
${QtMultimediaWidgets_location}
# ${QtMultimediaWidgets_location}
${QtNetwork_location}
${QtOpenGL_location}
# ${QtOpenGL_location}
${QtPrintSupport_location}
${QtSql_location}
${QtSvg_location}
Expand Down Expand Up @@ -665,16 +676,21 @@ message("Backtrace libs " ${DL_LIBRARY} " | " ${Backtrace_LIBRARIES} " | " ${Boo
find_package(XercesC REQUIRED)
include_directories(${XercesC_INCLUDE_DIRS})
# Uncomment the next two lines if you want to find where Xerces headers and DLLs are on your system
#message("Xerces-C++ include directories: " ${XercesC_INCLUDE_DIRS})
#message("Xerces-C++ libraries: " ${XercesC_LIBRARIES})
message("Xerces-C++ include directories: ${XercesC_INCLUDE_DIRS}")
message("Xerces-C++ libraries: ${XercesC_LIBRARIES}")

#==================================================== Find Xalan-C++ ===================================================
# Same comments apply here as for Xerces above
find_package(XalanC REQUIRED)
include_directories(${XalanC_INCLUDE_DIRS})
# Uncomment the next two lines if you want to find where Xalan headers and DLLs are on your system
#message("Xalan-C++ include directories: " ${XalanC_INCLUDE_DIRS})
#message("Xalan-C++ libraries: " ${XalanC_LIBRARIES})
message("Xalan-C++ include directories: ${XalanC_INCLUDE_DIRS}")
message("Xalan-C++ libraries: ${XalanC_LIBRARIES}")

if(APPLE)
# TBD: Is this also needed when static linking Xerces on MacOS?
find_package(CURL REQUIRED)
endif()

#========================================= Find MinGW (only needed on Windows) =========================================
if(WIN32)
Expand Down Expand Up @@ -1104,6 +1120,17 @@ set(appAndTestCommonLibraries
${XalanC_LIBRARIES}
${XercesC_LIBRARIES}
)
if(APPLE)
# Static linking Xerces and Xalan on MacOS means we have to explicitly say what libraries and frameworks they in turn
# depend on. It would be neat to find some automated tool that does this for us.
list(APPEND appAndTestCommonLibraries CURL::libcurl
"-framework CoreFoundation"
"-framework CoreServices"
"-framework Carbon"
"-framework Foundation"
"-framework Cocoa"
"-framework ApplicationServices")
endif()
foreach(qtComponent IN LISTS qtCommonComponents)
list(APPEND appAndTestCommonLibraries "Qt5::${qtComponent}")
endforeach()
Expand All @@ -1115,7 +1142,6 @@ target_link_libraries(${fileName_executable} ${appAndTestCommonLibraries})
# files in there (see below).
add_executable(${fileName_unitTestRunner}
${repoDir}/src/unitTests/Testing.cpp
${testing_MOC_SRCS}
$<TARGET_OBJECTS:btobjlib>)
set_target_properties(${fileName_unitTestRunner} PROPERTIES RUNTIME_OUTPUT_DIRECTORY bin)

Expand Down

0 comments on commit ca49f05

Please sign in to comment.