Skip to content

Commit

Permalink
update imgui and fixed build
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeWinAdmin committed Dec 22, 2023
1 parent 3941ba8 commit 21f598e
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 16 deletions.
2 changes: 1 addition & 1 deletion imgui
Submodule imgui updated from 8aa4c2 to feef23
63 changes: 48 additions & 15 deletions libmidi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,60 @@ find_package(PkgConfig)
find_package(Curses REQUIRED)
pkg_search_module(SDL2 REQUIRED sdl2)

# Apple try to find openmp if we using clang
if (APPLE)
message(STATUS "libmidi(Apple) Use OpenMP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xpreprocessor -fopenmp")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Xpreprocessor -fopenmp")
set(LINK_LIBS ${LINK_LIBS} -L/usr/local/lib -lomp pthread)
else()
find_package(OpenMP)
if(NOT TARGET OpenMP::OpenMP_CXX)
set_property(TARGET OpenMP::OpenMP_CXX
PROPERTY INTERFACE_LINK_LIBRARIES ${OpenMP_CXX_FLAGS} Threads::Threads)
if(CMAKE_C_COMPILER_ID MATCHES "Clang\$")
set(OpenMP_C_FLAGS "-Xpreprocessor -fopenmp")
set(OpenMP_C_LIB_NAMES "omp")
if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
set(OpenMP_C_INCLUDE_DIR "/opt/homebrew/opt/libomp/include")
set(OpenMP_omp_LIBRARY -L/opt/homebrew/opt/libomp/lib ${OpenMP_C_LIB_NAMES})
else()
set(OpenMP_C_INCLUDE_DIR "/usr/local/opt/libomp/include")
set(OpenMP_omp_LIBRARY -L/usr/local/opt/libomp/lib ${OpenMP_C_LIB_NAMES})
endif()
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang\$")
set(OpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp")
set(OpenMP_CXX_LIB_NAMES "omp")
if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
set(OpenMP_CXX_INCLUDE_DIR "/opt/homebrew/opt/libomp/include")
set(OpenMP_omp_LIBRARY -L/opt/homebrew/opt/libomp/lib ${OpenMP_CXX_LIB_NAMES})
else()
set(OpenMP_CXX_INCLUDE_DIR "/usr/local/opt/libomp/include")
set(OpenMP_omp_LIBRARY -L/usr/local/opt/libomp/lib ${OpenMP_CXX_LIB_NAMES})
endif()
endif()
endif()

find_package(OpenMP)
if (APPLE AND OPENMP_FOUND)
message(STATUS "libmidi(Apple) Use OpenMP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
include_directories(${OpenMP_CXX_INCLUDE_DIR})
set(LINK_LIBS ${LINK_LIBS} ${OpenMP_omp_LIBRARY})
elseif(OPENMP_FOUND)
if(WIN32 OR MINGW)
message(STATUS "libmidi(Windows) Use OpenMP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(LINK_LIBS ${LINK_LIBS} gmp pthread)
if (NOT IMGUI_STATIC)
message(STATUS "libmidi(Windows) Use OpenMP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(LINK_LIBS ${LINK_LIBS} omp pthread)
else ()
set(LINK_LIBS ${LINK_LIBS} gomp pthread)
endif ()
endif()
else()
message(STATUS "libmidi Use OpenMP")
message(STATUS "imlibmidigui Use OpenMP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(LINK_LIBS ${LINK_LIBS} gmp pthread)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(LINK_LIBS ${LINK_LIBS} omp pthread)
else ()
set(LINK_LIBS ${LINK_LIBS} gomp pthread)
endif ()
endif()
endif()

Expand Down
1 change: 1 addition & 0 deletions test/immidi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <imgui_internal.h>
#include <imgui_helper.h>
#include <imgui_extra_widget.h>
#include <imgui_fft.h>
#include <dir_iterate.h>
#include <ImGuiTabWindow.h>
#include <ImGuiFileDialog.h>
Expand Down

0 comments on commit 21f598e

Please sign in to comment.