Skip to content

Commit

Permalink
CMake: Default build flavor, HAVE_LIBPNG define
Browse files Browse the repository at this point in the history
"--flavor"/"-f" flag not specified on the command line: Complain loudly,
print help and exit. The script used to default to "Unix Makefiles".

Add missing "-DHAVE_LIBPNG" compiler command line define when the PNG
library is detected/present for screen capture support.
  • Loading branch information
bscottm committed Dec 4, 2023
1 parent 625b9e8 commit 74f116a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
19 changes: 12 additions & 7 deletions cmake/cmake-builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ showHelp()
cat <<EOF
Configure and build simh simulators on Linux and *nix-like platforms.
Subdirectories:
cmake/build-unix: Makefile-based build simulators
cmake/build-ninja: Ninja build-based simulators
Options:
--------
--clean (-x) Remove the build subdirectory
Expand All @@ -23,7 +19,7 @@ Options:
--testonly Do not build, execute the 'ctest' test cases
--installonly Do not build, install the SIMH simulators
--flavor (-f) Specifies the build flavor. Valid flavors are:
--flavor (-f) [Required] Specifies the build flavor. Valid flavors are:
unix
ninja
xcode
Expand Down Expand Up @@ -57,8 +53,8 @@ generateArgs=
buildArgs=
buildPostArgs=""
buildClean=
buildFlavor="Unix Makefiles"
buildSubdir=build-unix
buildFlavor=
buildSubdir=
buildConfig=Release
testArgs=
notest=no
Expand Down Expand Up @@ -276,6 +272,14 @@ while true; do
esac
done

# Sanity check: buildSubdir should be set, unless the '-f' flag wasn't present.
if [ "x${buildSubdir}" = x ]; then
echo ""
echo "${scriptName}: Build flavor is NOT SET -- see the \"--flavor\"/\"-f\" flag in the help."
echo ""
showHelp
fi

## Determine the SIMH top-level source directory:
simhTopDir=$(${dirname} $(${realpath} $0))
while [ "x${simhTopDir}" != x -a ! -f "${simhTopDir}/CMakeLists.txt" ]; do
Expand All @@ -296,6 +300,7 @@ if [[ x"$buildClean" != x ]]; then
echo "${scriptName}: Cleaning ${buildSubdir}"
rm -rf ${buildSubdir}
fi

if [[ ! -d ${buildSubdir} ]]; then
mkdir ${buildSubdir}
fi
Expand Down
2 changes: 2 additions & 0 deletions cmake/dep-link.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ IF (WITH_VIDEO)
ENDIF ()

IF (PNG_FOUND)
target_compile_definitions(simh_video INTERFACE HAVE_LIBPNG)

if (TARGET PNG::PNG)
target_link_libraries(simh_video INTERFACE PNG::PNG)
list(APPEND VIDEO_PKG_STATUS "interface PNG")
Expand Down

0 comments on commit 74f116a

Please sign in to comment.