diff options
Diffstat (limited to 'host/lib')
-rw-r--r-- | host/lib/convert/CMakeLists.txt | 89 |
1 files changed, 48 insertions, 41 deletions
diff --git a/host/lib/convert/CMakeLists.txt b/host/lib/convert/CMakeLists.txt index e6e8ec088..3eea49eae 100644 --- a/host/lib/convert/CMakeLists.txt +++ b/host/lib/convert/CMakeLists.txt @@ -22,11 +22,45 @@ INCLUDE(CheckIncludeFileCXX) MESSAGE(STATUS "") ######################################################################## +# Look for Orc support +######################################################################## +FIND_PACKAGE(PkgConfig) +IF(PKG_CONFIG_FOUND) +PKG_CHECK_MODULES(ORC "orc-0.4") +ENDIF(PKG_CONFIG_FOUND) + +FIND_PROGRAM(ORCC_EXECUTABLE orcc) + +IF(ORC_FOUND AND ORCC_EXECUTABLE) + SET(ORC_SUPPORT_ENABLED TRUE) + INCLUDE_DIRECTORIES(${ORC_INCLUDE_DIRS}) + LINK_DIRECTORIES(${ORC_LIBRARY_DIRS}) + ENABLE_LANGUAGE(C) + + SET(orcc_src ${CMAKE_CURRENT_SOURCE_DIR}/convert_orc.orc) + + GET_FILENAME_COMPONENT(orc_file_name_we ${orcc_src} NAME_WE) + SET(orcc_gen ${CMAKE_CURRENT_BINARY_DIR}/${orc_file_name_we}.c) + MESSAGE(STATUS "Orc found, enabling Orc support") + ADD_CUSTOM_COMMAND( + COMMAND ${ORCC_EXECUTABLE} --implementation -o ${orcc_gen} ${orcc_src} + DEPENDS ${orcc_src} OUTPUT ${orcc_gen} + ) + LIBUHD_APPEND_SOURCES(${orcc_gen}) + LIBUHD_APPEND_SOURCES( + ${CMAKE_CURRENT_SOURCE_DIR}/convert_with_orc.cpp + ) + LIBUHD_APPEND_LIBS(${ORC_LIBRARIES}) +ELSE() + SET(ORC_SUPPORT_ENABLED FALSE) + MESSAGE(STATUS "Orc not found, disabling orc support...") +ENDIF(ORC_FOUND AND ORCC_EXECUTABLE) + +######################################################################## # Check for SSE2 SIMD headers ######################################################################## IF(CMAKE_COMPILER_IS_GNUCXX) SET(EMMINTRIN_FLAGS -msse2) - SET(NEON_FLAGS "-mfloat-abi=softfp -mfpu=neon") ELSEIF(MSVC) SET(EMMINTRIN_FLAGS /arch:SSE2) ENDIF() @@ -50,11 +84,18 @@ ENDIF(HAVE_EMMINTRIN_H) ######################################################################## # Check for NEON SIMD headers ######################################################################## -SET(CMAKE_REQUIRED_FLAGS ${NEON_FLAGS}) -CHECK_INCLUDE_FILE_CXX(arm_neon.h HAVE_ARM_NEON_H) -UNSET(CMAKE_REQUIRED_FLAGS) -if(HAVE_ARM_NEON_H) - MESSAGE(STATUS "Enabling NEON support") +IF(CMAKE_COMPILER_IS_GNUCXX) + SET(NEON_FLAGS "-mfloat-abi=softfp -mfpu=neon") + SET(CMAKE_REQUIRED_FLAGS ${NEON_FLAGS}) + CHECK_INCLUDE_FILE_CXX(arm_neon.h HAVE_ARM_NEON_H) + UNSET(CMAKE_REQUIRED_FLAGS) +ENDIF(CMAKE_COMPILER_IS_GNUCXX) + +IF(HAVE_ARM_NEON_H AND ORC_SUPPORT_ENABLED) + #prefer orc support, its faster than the current intrinsic implementations + MESSAGE(STATUS "Enabled conversion support with ORC.") +ELSEIF(HAVE_ARM_NEON_H) + MESSAGE(STATUS "Enabled conversion support with NEON intrinsics.") SET_SOURCE_FILES_PROPERTIES( ${CMAKE_CURRENT_SOURCE_DIR}/convert_with_neon.cpp PROPERTIES COMPILE_FLAGS "${NEON_FLAGS}" @@ -62,41 +103,7 @@ if(HAVE_ARM_NEON_H) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/convert_with_neon.cpp ) -else(HAVE_ARM_NEON_H) - MESSAGE(STATUS "Disabling NEON support") -endif(HAVE_ARM_NEON_H) -######################################################################## -# Look for Orc support -######################################################################## -FIND_PACKAGE(PkgConfig) -IF(PKG_CONFIG_FOUND) -PKG_CHECK_MODULES(ORC "orc-0.4") -ENDIF(PKG_CONFIG_FOUND) - -FIND_PROGRAM(ORCC_EXECUTABLE orcc) - -IF(ORC_FOUND AND ORCC_EXECUTABLE) - INCLUDE_DIRECTORIES(${ORC_INCLUDE_DIRS}) - LINK_DIRECTORIES(${ORC_LIBRARY_DIRS}) - ENABLE_LANGUAGE(C) - - SET(orcc_src ${CMAKE_CURRENT_SOURCE_DIR}/convert_orc.orc) - - GET_FILENAME_COMPONENT(orc_file_name_we ${orcc_src} NAME_WE) - SET(orcc_gen ${CMAKE_CURRENT_BINARY_DIR}/${orc_file_name_we}.c) - MESSAGE(STATUS "Orc found, enabling Orc support") - ADD_CUSTOM_COMMAND( - COMMAND ${ORCC_EXECUTABLE} --implementation -o ${orcc_gen} ${orcc_src} - DEPENDS ${orcc_src} OUTPUT ${orcc_gen} - ) - LIBUHD_APPEND_SOURCES(${orcc_gen}) - LIBUHD_APPEND_SOURCES( - ${CMAKE_CURRENT_SOURCE_DIR}/convert_with_orc.cpp - ) - LIBUHD_APPEND_LIBS(${ORC_LIBRARIES}) -ELSE() - MESSAGE(STATUS "Orc not found, disabling orc support...") -ENDIF(ORC_FOUND AND ORCC_EXECUTABLE) +ENDIF() ######################################################################## # Convert types generation |