Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get compilation working on linux #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ cmake_minimum_required(VERSION 3.11)
project(LabSoundGraphToy VERSION 0.1.0 LANGUAGES C CXX)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

include(GNUInstallDirs)
include(CheckIncludeFile)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})

add_subdirectory(third/LabSound)

if (WIN32)
Expand Down Expand Up @@ -167,9 +171,12 @@ elseif(WIN32)
third/nativefiledialog/nfd_win.cpp third/nativefiledialog/nfd_common.c
third/nativefiledialog/nfd_common.h)
else()
find_package(PkgConfig REQUIRED)
find_package(GTK3 REQUIRED gtk+-3.0)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
# nb: there is a zenity variant, but haven't had a call for it yet
set(NFD third/nativefiledialog/include/nfd.h
third/nativefiledialog/nfd_gtk.cpp third/nativefiledialog/nfd_common.c
third/nativefiledialog/nfd_gtk.c third/nativefiledialog/nfd_common.c
third/nativefiledialog/nfd_common.h)
endif()

Expand All @@ -191,6 +198,10 @@ target_compile_definitions(LabSoundGraphToy PRIVATE
SOKOL_WIN32_FORCE_MAIN
)

if (GTK3_FOUND)
target_include_directories(LabSoundGraphToy PUBLIC ${GTK3_INCLUDE_DIRS})
endif ()

target_include_directories(LabSoundGraphToy SYSTEM
PRIVATE third/imgui
PRIVATE third/LabSound/include
Expand Down Expand Up @@ -226,6 +237,13 @@ elseif (APPLE)
"-framework QuartzCore"
)
# endif()
else()
set(PLATFORM_LIBS
${GTK3_LIBRARIES}
"Xi"
"X11"
"Xcursor"
"GL")
endif()

target_link_libraries(LabSoundGraphToy
Expand Down
23 changes: 23 additions & 0 deletions cmake/FindGTK3.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
find_package(PkgConfig REQUIRED)
pkg_check_modules(PC_gtk REQUIRED gtk+-3.0)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GTK3
REQUIRED_VARS PC_gtk_FOUND
)

if (GTK3_FOUND)
add_library(gtk::gtk INTERFACE IMPORTED)
target_link_directories(gtk::gtk
INTERFACE ${PC_gtk_LIBRARY_DIRS}
)
target_include_directories(gtk::gtk
INTERFACE ${PC_gtk_INCLUDE_DIRS}
)
target_link_libraries(gtk::gtk
INTERFACE ${PC_gtk_LIBRARIES}
)
target_compile_options(gtk::gtk
INTERFACE ${PC_gtk_CFLAGS_OTHER}
)
endif ()
4 changes: 2 additions & 2 deletions src/meshula_lab.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#elif defined(ML_APPLE)
# include <mach-o/dyld.h>
#elif defined(ML_NIX)
# include <uinstd.h>
# include <unistd.h>
#endif

struct ml_String {};
Expand Down Expand Up @@ -175,7 +175,7 @@ ml_String* ml_application_executable_path()
s->str = nullptr;
s->len = 0;
char buf[1024] = { 0 };
ssize_t buf_size = readlink("/proc/self/exe", buff, sizeof(buf));
ssize_t buf_size = readlink("/proc/self/exe", buf, sizeof(buf));
if (!buf_size || buf_size == sizeof(buf))
return (ml_String*) s; // return an empty string on failure, or unreasonably long path

Expand Down
2 changes: 1 addition & 1 deletion third/LabMidi
2 changes: 1 addition & 1 deletion third/tinyosc
Submodule tinyosc updated 2 files
+2 −0 tinyosc-net.hpp
+1 −0 tinyosc.hpp