Skip to content

Commit 18bf195

Browse files
committed
Build - fix Windows build
Also clean final references to USE_SYSTEM_LIBS
1 parent f2a467f commit 18bf195

File tree

7 files changed

+30
-34
lines changed

7 files changed

+30
-34
lines changed

app/CMakeLists.txt

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
cmake_minimum_required(VERSION 3.13)
22
set(APP_ROOT ${CMAKE_CURRENT_LIST_DIR})
33

4+
# Different triplet for windows
5+
if (WIN32)
6+
set(VCPKG_TARGET_TRIPLET x64-windows-static-md CACHE STRING "triplet")
7+
endif()
8+
49
# vcpkg toolchain - Must be declared before project
510

6-
if ((WIN32 OR APPLE) AND (NOT USE_SYSTEM_LIBS))
11+
if (WIN32 OR APPLE)
712
set(CMAKE_TOOLCHAIN_FILE ${APP_ROOT}/vcpkg/scripts/buildsystems/vcpkg.cmake CACHE STRING "Vcpkg toolchain file")
813
endif()
914

1015
project(SonicPi)
1116

12-
1317
message(STATUS "CMakeLists: Sonic Pi")
1418

15-
# Different triplet for windows
16-
if (WIN32)
17-
set(VCPKG_TARGET_TRIPLET x64-windows-static-md CACHE STRING "triplet")
18-
endif()
19+
1920

2021
# Sonic Pi Requires a C++ 17 Compiler to build it
2122
set(CMAKE_CXX_STANDARD 17)

app/external/CMakeLists.txt

+11-13
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,14 @@ set(APP_ROOT ${CMAKE_CURRENT_LIST_DIR})
44

55
# vcpkg toolchain - Must be declared before project
66

7-
if ((WIN32 OR APPLE) AND (NOT USE_SYSTEM_LIBS))
7+
if (WIN32 OR APPLE)
88
set(CMAKE_TOOLCHAIN_FILE ${APP_ROOT}/../vcpkg/scripts/buildsystems/vcpkg.cmake CACHE STRING "Vcpkg toolchain file")
99
endif()
1010

1111
message(STATUS "Externals Builder")
1212

1313
project(ExternalsBuilder)
1414

15-
option(USE_SYSTEM_LIBS "Use system libraries instead of bundled libraries when building" OFF)
16-
17-
message(STATUS "USE_SYSTEM_LIBS: ${USE_SYSTEM_LIBS}")
1815

1916
# Set default build type for sp_midi and sp_link
2017
if (NOT CMAKE_BUILD_TYPE)
@@ -36,7 +33,7 @@ ExternalProject_Add(sp_midi
3633
CMAKE_ARGS
3734
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_SOURCE_DIR}/../server/beam/tau/priv
3835
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
39-
-DUSE_SYSTEM_RTMIDI=${USE_SYSTEM_LIBS}
36+
4037
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE}
4138
)
4239

@@ -50,7 +47,7 @@ ExternalProject_Add(sp_link
5047
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE}
5148
)
5249

53-
if(NOT USE_SYSTEM_LIBS)
50+
if (WIN32 OR APPLE)
5451
find_package(SndFile CONFIG REQUIRED)
5552

5653
ExternalProject_Add(aubio-project
@@ -71,21 +68,22 @@ endif()
7168
add_executable(aubio_onset
7269
${CMAKE_CURRENT_LIST_DIR}/aubio/aubioonset.c
7370
${CMAKE_CURRENT_LIST_DIR}/aubio/utils.c)
74-
if(USE_SYSTEM_LIBS)
75-
find_package(PkgConfig REQUIRED)
76-
pkg_check_modules(aubio REQUIRED IMPORTED_TARGET aubio)
77-
target_link_libraries(aubio_onset
78-
PRIVATE
79-
PkgConfig::aubio)
80-
else()
71+
if (WIN32 OR APPLE)
8172
add_dependencies(aubio_onset aubio-project)
8273
target_include_directories(aubio_onset PRIVATE ${CMAKE_BINARY_DIR}/aubio-package/include)
8374
target_link_directories(aubio_onset PRIVATE ${CMAKE_BINARY_DIR}/aubio-package/lib)
8475
target_link_libraries(aubio_onset
8576
PRIVATE
8677
aubio
8778
SndFile::sndfile)
79+
else()
80+
find_package(PkgConfig REQUIRED)
81+
pkg_check_modules(aubio REQUIRED IMPORTED_TARGET aubio)
82+
target_link_libraries(aubio_onset
83+
PRIVATE
84+
PkgConfig::aubio)
8885
endif()
86+
8987
if(UNIX)
9088
target_link_libraries(aubio_onset
9189
PRIVATE

app/gui/CMakeLists.txt

+9-7
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,12 @@ endif()
6060

6161
find_package(Threads REQUIRED)
6262

63-
if(USE_SYSTEM_LIBS)
63+
if(NOT (APPLE OR WIN32))
6464
# Try to find the system-installed QScintilla without immediately failing
6565
find_package(QScintilla QUIET)
6666
endif()
6767

68-
# If QScintilla wasn’t found (either because USE_SYSTEM_LIBS wasn’t set or the system install is missing),
69-
# use the vendored version.
68+
# If QScintilla wasn’t found use the vendored version.
7069
if(NOT QScintilla_FOUND)
7170
message(STATUS "System QScintilla not found. Falling back to bundled QScintilla.")
7271
add_subdirectory(QScintilla_src-2.14.1)
@@ -202,9 +201,8 @@ SET(TS_FILES
202201
${QTAPP_ROOT}/lang/sonic-pi_zh.ts
203202
)
204203

205-
# Enable tracy profiler on debug and rel with debug builds
206204
if(WIN32)
207-
SET (SOURCES ${SOURCES} ${APP_ROOT}/external/tracy/TracyClient.cpp)
205+
# do nothing
208206
elseif(APPLE)
209207
SET (SOURCES ${SOURCES} ${QTAPP_ROOT}/platform/macos.mm)
210208
SET (SOURCES ${SOURCES} ${QTAPP_ROOT}/platform/macos.h)
@@ -359,8 +357,6 @@ endif()
359357
if(WIN32)
360358
# Workaround Qt + MSVC 19 compile issue in release build.
361359
target_compile_options(${APP_NAME} PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/wd4005 /W3 /D_CRT_SECURE_NO_WARNINGS /D_WINSOCK_DEPRECATED_NO_WARNINGS /DBOOST_DATE_TIME_NO_LIB>)
362-
target_compile_options(${APP_NAME} PRIVATE "$<$<CONFIG:DEBUG>:-DTRACY_ENABLE=1>")
363-
target_compile_options(${APP_NAME} PRIVATE "$<$<CONFIG:RELWITHDEBINFO>:-DTRACY_ENABLE=1>")
364360
elseif(${CMAKE_SYSTEM_NAME} MATCHES Linux)
365361
# Link librt
366362
target_link_libraries(${APP_NAME} PRIVATE rt)
@@ -373,6 +369,12 @@ if(WIN32)
373369
include(InstallRequiredSystemLibraries)
374370
file(COPY ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Release)
375371

372+
# Copy kissfft.dll from the API build directory to the GUI executable directory
373+
add_custom_command(TARGET ${APP_NAME} POST_BUILD
374+
COMMAND ${CMAKE_COMMAND} -E copy_if_different
375+
"${CMAKE_SOURCE_DIR}/build/api/vendor/kissfft-131.1.0/Release/kissfft-float.dll"
376+
$<TARGET_FILE_DIR:${APP_NAME}>)
377+
376378
# Run winddeployqt if it can be found, to ensure installed dependencies
377379
add_custom_command(TARGET ${APP_NAME} POST_BUILD
378380
COMMAND ${CMAKE_PREFIX_PATH}/bin/windeployqt $<TARGET_FILE:${APP_NAME}>)

app/linux-config.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ trap cleanup_function EXIT
1111

1212
args=("$@")
1313
config="Release"
14-
system_libs=false
1514

1615
# extract options and their arguments into variables.
1716
while [ -n "$1" ]; do
@@ -40,5 +39,5 @@ mkdir -p "${SCRIPT_DIR}/build"
4039
echo "Generating makefiles..."
4140
cd "${SCRIPT_DIR}/build"
4241

43-
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="$config" -DUSE_SYSTEM_LIBS=ON ..
42+
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="$config"
4443

app/server/beam/tau/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ message(STATUS "External NIF Builder")
1212

1313
project(ExternalsBuilder)
1414

15-
option(USE_SYSTEM_LIBS "Use system libraries instead of bundled libraries when building" OFF)
16-
17-
message(STATUS "USE_SYSTEM_LIBS: ${USE_SYSTEM_LIBS}")
18-
1915
include(GNUInstallDirs)
2016
include(ExternalProject)
2117

app/win-config.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ cd build
1616
@REM explicitly, but as we also pass it in here it will be used by the cmake
1717
@REM build files for app/external
1818

19-
cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=%CONFIG% ..\
19+
cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=%CONFIG% -DKISSFFT_TOOLS=OFF -DKISSFFT_PKGCONFIG=OFF ..\
2020
if %ERRORLEVEL% neq 0 (
2121
cd %WORKING_DIR%
2222
exit /b %ERRORLEVEL%

app/win-pre-vcpkg.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ cd %~dp0
55
REM Build vcpkg
66
if not exist "vcpkg\" (
77
echo Cloning vcpkg
8-
git clone --depth 1 --branch 2024.12.16 https://github.com/microsoft/vcpkg.git vcpkg
8+
git clone --depth 1 --branch 2025.02.14 https://github.com/microsoft/vcpkg.git vcpkg
99
)
1010

1111
set VCPKG_ROOT=%~dp0/vcpkg

0 commit comments

Comments
 (0)