Skip to content

Commit

Permalink
Merge pull request #416 from trittsv/fix-ios-build
Browse files Browse the repository at this point in the history
fix ios build
  • Loading branch information
fador authored Sep 6, 2024
2 parents 5cc93dc + a918260 commit 7e4447f
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ option(BUILD_TESTS "Build tests" ON)

option(USE_CRYPTO "Use crypto library" OFF)

option(BUILD_KVAZAAR_BINARY "Build kvazaar-bin" ON) # To build only the lib, useful for iOS-builds

include(GNUInstallDirs) #Helps to define correct distro specific install directories
set(DEFERRED "@")

Expand Down Expand Up @@ -213,18 +215,22 @@ if(MSVC)
list(APPEND CLI_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/extras/getopt.c ${CMAKE_CURRENT_SOURCE_DIR}/src/threadwrapper/src/pthread.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/threadwrapper/src/semaphore.cpp)
endif()

add_executable(kvazaar-bin ${CLI_SOURCES})
if(BUILD_KVAZAAR_BINARY)
add_executable(kvazaar-bin ${CLI_SOURCES})

set_target_properties(kvazaar-bin PROPERTIES OUTPUT_NAME kvazaar)
set_target_properties(kvazaar-bin PROPERTIES RUNTIME_OUTPUT_NAME kvazaar)
set_target_properties(kvazaar-bin PROPERTIES OUTPUT_NAME kvazaar)
set_target_properties(kvazaar-bin PROPERTIES RUNTIME_OUTPUT_NAME kvazaar)

target_link_libraries(kvazaar-bin PUBLIC kvazaar)
target_link_libraries(kvazaar-bin PUBLIC kvazaar)
endif()

if(MSVC)
target_include_directories(kvazaar PUBLIC src/threadwrapper/include)
set_property( SOURCE ${LIB_SOURCES_STRATEGIES_AVX2} APPEND PROPERTY COMPILE_FLAGS "/arch:AVX2" )
else()
set_target_properties(kvazaar-bin PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src)
if(BUILD_KVAZAAR_BINARY)
set_target_properties(kvazaar-bin PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src)
endif()
set_target_properties(kvazaar PROPERTIES SOVERSION "7" VERSION "7.4.0")
list(APPEND ALLOW_AVX2 "x86_64" "AMD64")
if(${CMAKE_SYSTEM_PROCESSOR} IN_LIST ALLOW_AVX2)
Expand Down Expand Up @@ -256,7 +262,9 @@ else()
endif ()

target_link_libraries(kvazaar PUBLIC ${EXTRA_LIBS})
target_link_libraries(kvazaar-bin PUBLIC ${EXTRA_LIBS} )
if(BUILD_KVAZAAR_BINARY)
target_link_libraries(kvazaar-bin PUBLIC ${EXTRA_LIBS} )
endif()
endif()


Expand Down Expand Up @@ -308,7 +316,9 @@ source_group( "" FILES ${SOURCE_GROUP_TOPLEVEL})
install(CODE "configure_file(\"${PROJECT_SOURCE_DIR}/src/kvazaar.pc.temp\" \"${PROJECT_SOURCE_DIR}/src/kvazaar.pc\" @ONLY)")

install(FILES ${PROJECT_SOURCE_DIR}/src/kvazaar.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(TARGETS kvazaar-bin DESTINATION ${CMAKE_INSTALL_BINDIR})
if(BUILD_KVAZAAR_BINARY)
install(TARGETS kvazaar-bin DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
install(TARGETS kvazaar
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
Expand Down

0 comments on commit 7e4447f

Please sign in to comment.