speed-dreams-code/cmake/packagemaker-nsis.cmake
xavi92 6d7ca06e02 String trailing whitespaces
The following shell script was used:

while read f
do
        sed -Ei 's/[[:space:]]+$//g' "$f"
done <<EOF
$(svn ls -R | grep \
        -e '.\cpp$' \
        -e '\.cmake$' \
        -e '\.txt$' \
        -e '\.cppcheck$' \
        -e '\.frag$' \
        -e '\.h$' \
        -e '\.hpp$' \
        -e '\.vert$' \
        -e '\.xml$' \
        -e '\.java$' \
        -e '\.c$')
EOF

As a side effect, this has also converted some files from CRLF line
endings to LF.

File extensions such as .ac or .osg were intentionally left out because
those usually are very large files generated by tools.



git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9507 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 6c1e5ab34415982ec77fc92a77e1b1c149518eca
Former-commit-id: c6cf9480ae7c1d2f9a999eb6c6b976eef8bae3ba
2024-07-30 21:45:07 +00:00

124 lines
No EOL
5.9 KiB
CMake

#==============================================================================
#
# file : .cmake
# copyright : (C) 2019 Joe Thompson
# email : beaglejoe@users.sourceforge.net
# web : www.speed-dreams.org
# version : $Id:$
#
#==============================================================================
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#==============================================================================
FIND_PACKAGE(NSIS)
Message(STATUS "NSIS_FOUND = ${NSIS_FOUND}")
Message(STATUS "NSIS_MAKE_EXE = ${NSIS_MAKE_EXE}")
Message(STATUS "NSIS_INET_PLUGIN = ${NSIS_INET_PLUGIN}")
if(NSIS_FOUND AND NSIS_MAKE_EXE AND NSIS_INET_PLUGIN)
FILE(TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_PREFIX}" NSIS_INSTALL_DIR)
CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/packaging/windows/readme_for_user.txt"
"${CMAKE_BINARY_DIR}/packaging/readme_for_user.txt" COPYONLY)
CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/packaging/windows/speed-dreams.ini"
"${CMAKE_BINARY_DIR}/packaging/speed-dreams.ini" COPYONLY)
CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/packaging/windows/speed-dreams.nsh.in"
"${CMAKE_BINARY_DIR}/packaging/speed-dreams.nsh" @ONLY)
CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/packaging/windows/speed-dreams-base.nsi"
"${CMAKE_BINARY_DIR}/packaging/speed-dreams-base.nsi" @ONLY)
CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/packaging/windows/speed-dreams-hq-cars-and-tracks.nsi"
"${CMAKE_BINARY_DIR}/packaging/speed-dreams-hq-cars-and-tracks.nsi" @ONLY)
CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/packaging/windows/speed-dreams-more-hq-cars-and-tracks.nsi"
"${CMAKE_BINARY_DIR}/packaging/speed-dreams-more-hq-cars-and-tracks.nsi" @ONLY)
CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/packaging/windows/speed-dreams-wip-cars-and-tracks.nsi"
"${CMAKE_BINARY_DIR}/packaging/speed-dreams-wip-cars-and-tracks.nsi" @ONLY)
CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/packaging/windows/speed-dreams-unmaintained.nsi"
"${CMAKE_BINARY_DIR}/packaging/speed-dreams-unmaintained.nsi" @ONLY)
#ADD_CUSTOM_TARGET(PACKAGE_BASE DEPENDS INSTALL)
# can't depend on built-in target INSTALL, so we ADD_CUSTOM_COMMAND
# below to make sure INSTALL is done
ADD_CUSTOM_TARGET(PACKING_INSTALL)
ADD_CUSTOM_TARGET(PACKAGE_ALL DEPENDS PACKAGE_BASE
PACKAGE_HQ
PACKAGE_MORE_HQ
PACKAGE_WIP
PACKAGE_UNMAINTAINED)
ADD_CUSTOM_TARGET(PACKAGE_BASE DEPENDS PACKING_INSTALL PACKAGE_MKDIR)
ADD_CUSTOM_TARGET(PACKAGE_HQ DEPENDS PACKING_INSTALL PACKAGE_MKDIR)
ADD_CUSTOM_TARGET(PACKAGE_MORE_HQ DEPENDS PACKING_INSTALL PACKAGE_MKDIR)
ADD_CUSTOM_TARGET(PACKAGE_WIP DEPENDS PACKING_INSTALL PACKAGE_MKDIR)
ADD_CUSTOM_TARGET(PACKAGE_UNMAINTAINED DEPENDS PACKING_INSTALL PACKAGE_MKDIR)
ADD_CUSTOM_TARGET(PACKAGE_MKDIR)
ADD_CUSTOM_COMMAND(TARGET PACKING_INSTALL
COMMAND "${CMAKE_COMMAND}" --build . --target INSTALL --config $<CONFIG>
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Building INSTALL...")
ADD_CUSTOM_COMMAND(TARGET PACKAGE_BASE
COMMAND ${NSIS_MAKE_EXE} packaging/speed-dreams-base.nsi
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Building base package...")
ADD_CUSTOM_COMMAND(TARGET PACKAGE_HQ
COMMAND ${NSIS_MAKE_EXE} packaging/speed-dreams-hq-cars-and-tracks.nsi
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Building HQ package...")
ADD_CUSTOM_COMMAND(TARGET PACKAGE_MORE_HQ
COMMAND ${NSIS_MAKE_EXE} packaging/speed-dreams-more-hq-cars-and-tracks.nsi
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Building More HQ package...")
ADD_CUSTOM_COMMAND(TARGET PACKAGE_WIP
COMMAND ${NSIS_MAKE_EXE} packaging/speed-dreams-wip-cars-and-tracks.nsi
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Building WIP package...")
ADD_CUSTOM_COMMAND(TARGET PACKAGE_UNMAINTAINED
COMMAND ${NSIS_MAKE_EXE} packaging/speed-dreams-unmaintained.nsi
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Building unmaintained package...")
# Make sure that SD_PACKAGEDIR is not empty or PACKAGE_MKDIR will fail.
# Treat empty string as current directory
if(SD_PACKAGEDIR STREQUAL "")
set(SD_PACKAGEDIR "." CACHE PATH "Location for the created installers" FORCE)
endif(SD_PACKAGEDIR STREQUAL "")
ADD_CUSTOM_COMMAND(TARGET PACKAGE_MKDIR
COMMAND "${CMAKE_COMMAND}" -E make_directory ${SD_PACKAGEDIR}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Create ${SD_PACKAGEDIR} directory for Packages dir")
else(NSIS_FOUND AND NSIS_MAKE_EXE AND NSIS_INET_PLUGIN)
if(NOT NSIS_FOUND)
Message(WARNING "NSIS NOT FOUND Packaging targets NOT added.")
elseif(NOT NSIS_INET_PLUGIN)
Message(WARNING "INetC.dll NOT FOUND Packaging targets NOT added.")
endif(NOT NSIS_FOUND)
endif()