diff --git a/imgui b/imgui index 8aa4c2e..feef23c 160000 --- a/imgui +++ b/imgui @@ -1 +1 @@ -Subproject commit 8aa4c2e9ce349a2201e1355dceee90e2e84fa74d +Subproject commit feef23c5a746503cbcd57fd0cfea5b74174e31df diff --git a/libmidi/CMakeLists.txt b/libmidi/CMakeLists.txt index 54ecc63..46ca838 100755 --- a/libmidi/CMakeLists.txt +++ b/libmidi/CMakeLists.txt @@ -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() diff --git a/test/immidi.cpp b/test/immidi.cpp index 99e7acd..31ad1df 100644 --- a/test/immidi.cpp +++ b/test/immidi.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include