Skip to content

Commit

Permalink
rename cmake to Libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesneimog committed Jul 21, 2024
1 parent 405039b commit 04b1c2c
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "Sources/cmake/pd.cmake"]
path = Sources/cmake/pd.cmake
[submodule "Sources/Libraries/pd.cmake"]
path = Sources/Libraries/pd.cmake
url = https://github.com/pure-data/pd.cmake

Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ Sources:
GITHUB_RELEASES: "https://api.github.com/repos/{}/{}/releases"
GITHUB_TAGS: "https://api.github.com/repos/{}/{}/tags"
GITHUB: "https://github.com/{}/{}"

Libraries:
- Name: else # Name of the pd library
Source: GITHUB_TAGS # source
Developer: porres # user name of the dev
Repository: pd-else # Repository Name
Version: v.1.0-rc11 # Release or Tag
Unsupported: ["sfz~", "sfont~"] # Unsupported Objecs

- Name: earplug
Source: GITHUB_TAGS
Developer: pd-externals
Repository: earplug
Version: 0.3.0
File renamed without changes.
21 changes: 21 additions & 0 deletions Sources/Libraries/earplug.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
cmake_minimum_required(VERSION 3.25)

set(PDCMAKE_DIR
${CMAKE_CURRENT_SOURCE_DIR}/Resources/pd.cmake
CACHE PATH "Path to pd.cmake")

message(STATUS "PDCMAKE_DIR: ${PDCMAKE_DIR}")
include(${PDCMAKE_DIR}/pd.cmake)

set(LIB_DIR
${CMAKE_CURRENT_SOURCE_DIR}/Pd4Web/Externals/else
CACHE STRING "PATH where is ROOT of else folder")

include_directories(${LIB_DIR}/Code_source/shared/aubio/src)
include_directories(${LIB_DIR}/Code_source/shared)

project(earplug)

set(ENABLE_TILDE_TARGET_WARNING off)

pd_add_external(knob "${LIB_DIR}/Code_source/Compiled/control/knob.c")
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion Sources/cmake/pd.cmake
Submodule pd.cmake deleted from b60dba
1 change: 1 addition & 0 deletions Sources/pd4web.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ void Pd4Web::Init() {
Alert("Failed to open patch | Please Report!\n");
return;
}
libpd_add_to_search_path("Libs/");

m_PdInit = true;
ResumeAudio();
Expand Down
10 changes: 6 additions & 4 deletions Sources/pd4web/Builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ def CopyCppFilesToProject(self):
self.Pd4Web.PROJECT_ROOT + "/Pd4Web/",
)
shutil.copy(
self.Pd4Web.PD4WEB_ROOT + "/../cmake/pd.cmake/pd.cmake",
self.Pd4Web.PD4WEB_ROOT + "/../Libraries/pd.cmake/pd.cmake",
self.Pd4Web.PROJECT_ROOT + "/Pd4Web/Externals/pd.cmake",
)
shutil.copy(
self.Pd4Web.PD4WEB_ROOT + "/../cmake/libpd.cmake",
self.Pd4Web.PD4WEB_ROOT + "/../Libraries/libpd.cmake",
self.Pd4Web.PROJECT_ROOT + "/Pd4Web/libpd.cmake",
)

Expand Down Expand Up @@ -322,8 +322,10 @@ def BuildExternalsObjects(self):
target = pdobject.replace("~", "_tilde")
externalsTargets.append(target)

CMAKE_LIB_FILE = os.path.normpath(os.path.join(
self.Pd4Web.PD4WEB_ROOT, "..", "cmake", f"{library}.cmake"))
CMAKE_LIB_FILE = os.path.normpath(
os.path.join(self.Pd4Web.PD4WEB_ROOT, "..",
"Libraries", f"{library}.cmake")
)
shutil.copy(CMAKE_LIB_FILE, self.Pd4Web.PROJECT_ROOT +
"/Pd4Web/Externals/")
self.cmakeFile.append(f"include(Pd4Web/Externals/{library}.cmake)")
Expand Down
9 changes: 4 additions & 5 deletions Sources/pd4web/Libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def GetSupportedLibraries(self):
It reads yaml file and get all supported libraries.
"""
self.LibraryScriptDir = os.path.dirname(os.path.realpath(__file__))
externalFile = os.path.join(self.LibraryScriptDir, "Libraries.yaml")
externalFile = os.path.join(
self.LibraryScriptDir, "../Libraries/Libraries.yaml")
self.DynamicLibraries = []
with open(externalFile) as file:
supportedLibraries = yaml.load(file, Loader=yaml.FullLoader)
Expand Down Expand Up @@ -106,15 +107,13 @@ def GetLinkForDownload(self):
return self.downloadLink.format(self.dev, self.repo)
else:
raise Exception(
f"Error: {self.name} doesn't have a download source"
)
f"Error: {self.name} doesn't have a download source")
else:
return self.directLink

def GetLibrary(self, LibraryName):
Library = next(
(lib for lib in self.SupportedLibraries if lib["Name"] == LibraryName), None
)
(lib for lib in self.SupportedLibraries if lib["Name"] == LibraryName), None)
Library = self.LibraryClass(Library, self.DownloadSources)
return Library

Expand Down

0 comments on commit 04b1c2c

Please sign in to comment.