Skip to content

Commit

Permalink
CMakeLists points Xcode to the proper Mac dynamic library
Browse files Browse the repository at this point in the history
  • Loading branch information
wormyrocks committed May 16, 2020
1 parent f74e848 commit 1455489
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions ExampleProject/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,23 @@ target_link_libraries(main PRIVATE libglew_static)
add_subdirectory(lib/glm EXCLUDE_FROM_ALL)
target_link_libraries(main PRIVATE glm)

set(DLL_DIR "linux")

if(WIN32)
set(WIN_ARCH "Win64")
set(DLL_DIR "Win64")
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
set(WIN_ARCH "Win32")
set(DLL_DIR "Win32")
endif()
set(HOLOPLAY_CORE_DLL_LOCATION "${HOLOPLAY_CORE_BASE_PATH}/dylib/${WIN_ARCH}/HoloPlayCore.dll")
set(HOLOPLAY_CORE_DLL_LOCATION "${HOLOPLAY_CORE_BASE_PATH}/dylib/${DLL_DIR}/HoloPlayCore.dll")
add_custom_command(TARGET main POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HOLOPLAY_CORE_DLL_LOCATION}" $<TARGET_FILE_DIR:main>)
endif(WIN32)

if(APPLE)
set(DLL_DIR "macos")
endif(APPLE)

# holoplaycore
target_include_directories(main PRIVATE "${HOLOPLAY_CORE_BASE_PATH}/include")
find_library(HOLOPLAY_CORE_LOCATION HoloPlayCore PATHS "${HOLOPLAY_CORE_BASE_PATH}/dylib" PATH_SUFFIXES "linux" "macos" ${WIN_ARCH})
find_library(HOLOPLAY_CORE_LOCATION HoloPlayCore PATHS "${HOLOPLAY_CORE_BASE_PATH}/dylib" PATH_SUFFIXES ${DLL_DIR})
target_link_libraries(main PRIVATE ${HOLOPLAY_CORE_LOCATION})

0 comments on commit 1455489

Please sign in to comment.