mczachurski / wallpapper

:computer: Console application for creating dynamic wallpapers for macOS Mojave and newer
MIT License
3.32k stars 137 forks source link

Maybe a way of compiling with swiftc only #51

Closed zzzqiuchan closed 3 years ago

zzzqiuchan commented 3 years ago

I get an error xcrun: error: unable to find utility "xctest", not a developer tool or in PATH during swift build --configuration release. The Xcode is too large for me, so I tried to compile wallpapper with swiftc. Finally, I made it with Apple Swift version 5.4 (swiftlang-1205.0.26.9 clang-1205.0.19.55). Here is the detail of my build script.

echo "create work dir build"

mkdir build
cd build

mkdir Wallpapper.Objects
mkdir WallpapperExif.Objects
mkdir WallpapperLib.Objects

SRC_PATH=../../Sources

# compile WallpapperLib
cd WallpapperLib.Objects

echo "compile WallpapperLib"

swiftc -c \
    ${SRC_PATH}/WallpapperLib/*.swift \
    ${SRC_PATH}/WallpapperLib/*/*.swift \
    ${SRC_PATH}/WallpapperLib/*/*/*.swift \
    -parse-as-library \
    -module-name WallpapperLib

swiftc \
    ${SRC_PATH}/WallpapperLib/*.swift \
    ${SRC_PATH}/WallpapperLib/*/*.swift \
    ${SRC_PATH}/WallpapperLib/*/*/*.swift \
    -emit-module \
    -module-name WallpapperLib

cd ..

# compile Wallpapper
cd Wallpapper.Objects

echo "compile Wallpapper"

swiftc -c \
    ${SRC_PATH}/Wallpapper/*.swift \
    -I../WallpapperLib.Objects \
    -module-name wallpapper

cd ..

swiftc -emit-executable \
    WallpapperLib.Objects/*.o \
    Wallpapper.Objects/*.o \
    -o wallpapper

# compile WallpapperExif
cd WallpapperExif.Objects

echo "compile WallpapperExif"

swiftc -c \
    ${SRC_PATH}/WallpapperExif/*.swift \
    -I../WallpapperLib.Objects \
    -module-name wallpapper_exif

cd ..

swiftc -emit-executable \
    WallpapperLib.Objects/*.o \
    WallpapperExif.Objects/*.o \
    -o wallpapper-exif

# all done, now we have wallpapper and wallpapper-exif in build/
cd ..
echo "all done"

ls -lG build/wallpapper build/wallpapper-exif

hope this script will help others as well

mczachurski commented 3 years ago

I added code to ./build.sh script with simple description in README.md file. Thank you.