Skip to content

Commit

Permalink
Add Linux support
Browse files Browse the repository at this point in the history
  • Loading branch information
kyv001 authored and FangCunWuChang committed Nov 23, 2024
1 parent 0a99b94 commit 34ec366
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 7 deletions.
34 changes: 27 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ endif (WIN32)

if (WIN32)
set (COMPILE_SYS_DEF "WIN32=1")
set (COPY_COMMAND "copy")
elseif (UNIX AND NOT APPLE)
set (COMPILE_SYS_DEF "LINUX=1")
set (COPY_COMMAND "cp")
elseif (APPLE)
set (COMPILE_SYS_DEF "DARWIN=1")
set (COPY_COMMAND "cp")
endif ()

# Packages
Expand All @@ -34,6 +37,9 @@ find_package (Lua REQUIRED)
find_package (cmake-lame CONFIG REQUIRED)
find_package (vsp4 CONFIG REQUIRED)
find_package (flowui CONFIG REQUIRED)
if (UNIX AND NOT APPLE)
find_package (Fontconfig REQUIRED)
endif ()

set (OUTPUT_DIR "${CMAKE_BINARY_DIR}/bin")
set (ENGINES_DIR "${OUTPUT_DIR}/synth-engines")
Expand All @@ -50,7 +56,7 @@ foreach (ITEM ${APP_CONFIG_SRC})

add_custom_command (
OUTPUT ${ITEM_TARGET}
COMMAND copy ${ITEM_INPUT} ${ITEM_OUTPUT}
COMMAND ${COPY_COMMAND} ${ITEM_INPUT} ${ITEM_OUTPUT}
DEPENDS ${ITEM}
COMMENT "Copying application config file: ${ITEM}"
VERBATIM)
Expand All @@ -72,7 +78,7 @@ foreach (ITEM ${REMIXICON_SRC})

add_custom_command (
OUTPUT ${ITEM_TARGET}
COMMAND copy ${ITEM_INPUT} ${ITEM_OUTPUT}
COMMAND ${COPY_COMMAND} ${ITEM_INPUT} ${ITEM_OUTPUT}
DEPENDS ${ITEM}
COMMENT "Copying icon file: ${ITEM}"
VERBATIM)
Expand Down Expand Up @@ -112,7 +118,7 @@ foreach (ITEM ${ENGINE_LIST})

add_custom_command (
OUTPUT ${ITEM_TARGET}
COMMAND copy ${ITEM_INPUT} ${ITEM_OUTPUT}
COMMAND ${COPY_COMMAND} ${ITEM_INPUT} ${ITEM_OUTPUT}
DEPENDS ${ITEM}
COMMENT "Copying engine file: ${ITEM}"
VERBATIM)
Expand Down Expand Up @@ -155,7 +161,7 @@ foreach (ITEM ${LAME_LIST})

add_custom_command (
OUTPUT ${ITEM_TARGET}
COMMAND copy ${ITEM_INPUT} ${ITEM_OUTPUT}
COMMAND ${COPY_COMMAND} ${ITEM_INPUT} ${ITEM_OUTPUT}
DEPENDS ${ITEM}
COMMENT "Copying lame executable file: ${ITEM}"
VERBATIM)
Expand Down Expand Up @@ -185,7 +191,12 @@ if (NOT MSVC)
target_compile_options (PluginSearcher PRIVATE -g)
endif (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
endif (NOT MSVC)
target_link_libraries (PluginSearcher PRIVATE juce-host-dev-kit::juce-full)
if (WIN32)
target_link_libraries (PluginSearcher PRIVATE juce-host-dev-kit::juce-full)
else ()
target_link_libraries (PluginSearcher PRIVATE Fontconfig::Fontconfig)
target_link_libraries (PluginSearcher PRIVATE juce-host-dev-kit::juce-full-static)
endif ()
if (MSVC)
target_link_options (PluginSearcher PRIVATE /SUBSYSTEM:WINDOWS)
elseif (("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") AND WIN32)
Expand All @@ -212,6 +223,9 @@ if (NOT MSVC)
endif (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
endif (NOT MSVC)
target_link_libraries (FileRegistrar PRIVATE juce-host-dev-kit::juce-core)
if (UNIX AND NOT APPLE)
target_link_libraries (FileRegistrar PRIVATE Fontconfig::Fontconfig)
endif ()
if (MSVC)
target_link_options (FileRegistrar PRIVATE /SUBSYSTEM:WINDOWS)
elseif (("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") AND WIN32)
Expand All @@ -235,6 +249,9 @@ target_link_libraries (VocalShaper PRIVATE
${LUA_LIBRARIES}
vsp4::vsp4
)
if (UNIX AND NOT APPLE)
target_link_libraries (VocalShaper PRIVATE Fontconfig::Fontconfig)
endif ()
if (NOT MSVC)
target_compile_options (VocalShaper PRIVATE -pthread)
if (NOT (("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") AND WIN32))
Expand All @@ -244,10 +261,13 @@ if (NOT MSVC)
target_compile_options (VocalShaper PRIVATE -g)
endif (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
endif (NOT MSVC)
target_link_libraries (VocalShaper PRIVATE juce-host-dev-kit::juce-full)
if (WIN32)
target_link_libraries (VocalShaper PRIVATE juce-host-dev-kit::juce-full)
target_link_libraries (VocalShaper PRIVATE Dbghelp)
endif (WIN32)
else ()
target_link_libraries (VocalShaper PRIVATE juce-host-dev-kit::juce-full-static)
target_link_libraries (VocalShaper PRIVATE Fontconfig::Fontconfig)
endif ()
if (MSVC)
target_link_options (VocalShaper PRIVATE /SUBSYSTEM:WINDOWS)
elseif (("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") AND WIN32)
Expand Down
23 changes: 23 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,22 @@
"CMAKE_CXX_COMPILER": "clang++",
"CMAKE_RC_COMPILER": "llvm-rc"
}
},
{
"name": "Ninja Release Linux LLVM",
"displayName": "Ninja Release Linux LLVM",
"description": "Ninja Release Linux LLVM",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/ninja-release-linux-llvm",
"installDir": "${sourceDir}/install/ninja-release-linux-llvm",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake",
"VCPKG_TARGET_TRIPLET": "x64-linux",
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++",
"CMAKE_RC_COMPILER": "llvm-rc"
}
}
],
"buildPresets": [
Expand Down Expand Up @@ -99,6 +115,13 @@
"description": "Ninja Release Win64 LLVM",
"configurePreset": "Ninja Release Win64 LLVM",
"jobs": 16
},
{
"name": "Ninja Release Linux LLVM",
"displayName": "Ninja Release Linux LLVM",
"description": "Ninja Release Linux LLVM",
"configurePreset": "Ninja Release Linux LLVM",
"jobs": 16
}
]
}

0 comments on commit 34ec366

Please sign in to comment.