Skip to content

Commit

Permalink
windows fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DBraun committed Apr 1, 2024
1 parent 37252b2 commit 006afb4
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 15 deletions.
36 changes: 27 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,18 +192,36 @@ install (
)
endif()

set(SOURCE_DIR "${PACKDIR}/${DST}/Faust.chug")
if (MSVC)
set(DEST_DIR "%USERPROFILE%/Documents/ChucK/chugins/FaucK.chug")
else()
set(DEST_DIR "$ENV{HOME}/.chuck/lib/Faust.chug")
endif()

# Custom install command to copy the directory
install(CODE "
if(MSVC)
set(SOURCE_FILE "${PACKDIR}/${DST}/Faust.chug")
set(DEST_DIR $ENV{USERPROFILE}/Documents/ChucK/chugins)
STRING(REGEX REPLACE "\\\\" "/" DEST_DIR ${DEST_DIR})
install(CODE "
message(\"Copying ${SOURCE_FILE} to ${DEST_DIR}\")
file(MAKE_DIRECTORY ${DEST_DIR})
execute_process(
COMMAND ${CMAKE_COMMAND} -E copy \"${SOURCE_FILE}\" \"${DEST_DIR}\"
)
")
set(SOURCE_DIR "${PACKDIR}/${DST}/faust")
set(DEST_DIR $ENV{USERPROFILE}/Documents/ChucK/chugins/faust)
STRING(REGEX REPLACE "\\\\" "/" DEST_DIR ${DEST_DIR})
install(CODE "
message(\"Copying ${SOURCE_DIR} to ${DEST_DIR}\")
file(MAKE_DIRECTORY ${DEST_DIR})
execute_process(
COMMAND ${CMAKE_COMMAND} -E copy_directory \"${SOURCE_DIR}\" \"${DEST_DIR}\"
)
")
")
else()
set(SOURCE_DIR "${PACKDIR}/${DST}/Faust.chug")
set(DEST_DIR "$ENV{HOME}/.chuck/lib/Faust.chug")
install(CODE "
message(\"Copying ${SOURCE_DIR} to ${DEST_DIR}\")
file(MAKE_DIRECTORY ${DEST_DIR})
execute_process(
COMMAND ${CMAKE_COMMAND} -E copy_directory \"${SOURCE_DIR}\" \"${DEST_DIR}\"
)
")
endif()
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ ifeq ($(UNAME_S), Darwin)
else
LIBFAUST_DIR ?= $(PWD)/thirdparty/libfaust/darwin-x64/Release
endif
else ifeq ($(OS),Windows_NT)
LIBFAUST_DIR ?= thirdparty/libfaust/win64/Release
else
LIBFAUST_DIR ?= $(PWD)/thirdparty/libfaust/ubuntu-x86_64/Release
endif
Expand All @@ -33,17 +35,17 @@ current:
.PHONY: libfaust
libfaust:
@OS="`uname`"; \
if [ "$$OS" = "Windows_NT" ] || [ "$$OS" = "MINGW32_NT" ] || [ "$$OS" = "MINGW64_NT" ]; then \
cd thirdparty/libfaust && call download_libfaust.bat; \
if echo "$$OS" | grep -qE 'CYGWIN_NT|MINGW32_NT|MINGW64_NT'; then \
cd thirdparty/libfaust && cmd /C download_libfaust.bat; \
else \
cd thirdparty/libfaust && sh download_libfaust.sh; \
fi

.PHONY: libsndfile
libsndfile:
@OS="`uname`"; \
if [ "$$OS" = "Windows_NT" ] || [ "$$OS" = "MINGW32_NT" ] || [ "$$OS" = "MINGW64_NT" ]; then \
cd thirdparty && call download_libsndfile.bat; \
if echo "$$OS" | grep -qE 'CYGWIN_NT|MINGW32_NT|MINGW64_NT'; then \
cd thirdparty && cmd /C download_libsndfile.bat; \
else \
cd thirdparty/libsndfile && \
cmake -Bbuild -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_OSX_ARCHITECTURES=$(CMAKE_OSX_ARCHITECTURES) -DCMAKE_C_FLAGS="-fPIC" -DCMAKE_CXX_FLAGS="-fPIC" -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX="./install" && \
Expand All @@ -59,7 +61,7 @@ build-debug: libfaust libsndfile

.PHONY: mac osx linux windows win win32 win64
mac osx linux windows win win32 win64: build-release
cmake --build build-release --target install
cmake --build build-release --config Release --target install

debug: build-debug
cmake --build build-debug
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ Open an `x64 Native Tools Command Prompt for Visual Studio 2022`, navigate to th
make win
```

Navigate to the `package` directory and find the latest `fauck` version such as `fauck-0.0.1`. You should see a file `sndfile.dll`, which you should copy next to wherever `chuck.exe` exists on your computer (likely `C:/Program Files/ChucK/chuck.exe`).
Afterward, the file `Faust.chug` and directory `faust` should be in `%USERPROFILE%/Documents/ChucK/Chugins`.

Navigate to this repository's `package` directory and find the latest `fauck` version such as `fauck-0.0.1`. You should see a file `sndfile.dll`, which you should copy next to wherever `chuck.exe` exists on your computer (likely `C:/Program Files/ChucK/chuck.exe`).

## Using FaucK

Expand Down

0 comments on commit 006afb4

Please sign in to comment.