#!/usr/bin/cmake cmake_minimum_required (VERSION 3.18) # ------------------------------------------------------------------------------------------------- project( Highway VERSION 0.12.0 DESCRIPTION "Wrapper and emulator library for runtime-selected SSE + AVX intrinsics" ) include("../../BuildSystem/cmake/cplusplus.cmake") # ------------------------------------------------------------------------------------------------- if(NOT EXISTS ${PROJECT_SOURCE_DIR}/downloads/0.12.0.tar.gz) message(STATUS "Downloading Highway sources") file( DOWNLOAD https://github.com/google/highway/archive/refs/tags/0.12.0.tar.gz ${PROJECT_SOURCE_DIR}/downloads/0.12.0.tar.gz SHOW_PROGRESS EXPECTED_HASH SHA256=7013042ec0fd23cc5ae2364022379e1151c5029a11cf91e5295a5933cfc821a3 ) endif() # ------------------------------------------------------------------------------------------------- if(NOT EXISTS ${PROJECT_SOURCE_DIR}/build) message(STATUS "Extracting Highway sources") file( ARCHIVE_EXTRACT INPUT ${PROJECT_SOURCE_DIR}/downloads/0.12.0.tar.gz DESTINATION ${CMAKE_BINARY_DIR}/extract ) file( RENAME ${CMAKE_BINARY_DIR}/extract/highway-0.12.0 ${PROJECT_SOURCE_DIR}/build ) endif() # ------------------------------------------------------------------------------------------------- set( sourceFiles "build/hwy/nanobenchmark.cc" "build/hwy/aligned_allocator.cc" "build/hwy/targets.cc" ) set( headerFiles "build/hwy/aligned_allocator.h" "build/hwy/base.h" "build/hwy/cache_control.h" "build/hwy/examples/skeleton-inl.h" "build/hwy/examples/skeleton.h" "build/hwy/foreach_target.h" "build/hwy/highway.h" "build/hwy/nanobenchmark.h" "build/hwy/ops/arm_neon-inl.h" "build/hwy/ops/rvv-inl.h" "build/hwy/ops/scalar-inl.h" "build/hwy/ops/set_macros-inl.h" "build/hwy/ops/shared-inl.h" "build/hwy/ops/wasm_128-inl.h" "build/hwy/ops/x86_128-inl.h" "build/hwy/ops/x86_256-inl.h" "build/hwy/ops/x86_512-inl.h" "build/hwy/targets.h" "build/hwy/tests/test_util-inl.h" ) #/usr/bin/c++ -I/mnt/devel/GameDev/Videl/ThirdParty/highway/build -O3 -DNDEBUG -fPIC -Wno-builtin-macro-redefined -D__DATE__=\"redacted\" -D__TIMESTAMP__=\"redacted\" -D__TIME__=\"redacted\" -fmerge-all-constants -Wall -Wextra -Wformat-security -Wno-unused-function -Wnon-virtual-dtor -Woverloaded-virtual -Wvla -fmath-errno -fno-exceptions -std=c++11 -o CMakeFiles/hwy.dir/hwy/nanobenchmark.cc.o -c /mnt/devel/GameDev/Videl/ThirdParty/highway/build/hwy/nanobenchmark.cc #/usr/bin/c++ -I/mnt/devel/GameDev/Videl/ThirdParty/highway/build -O3 -DNDEBUG -fPIC -Wno-builtin-macro-redefined -D__DATE__=\"redacted\" -D__TIMESTAMP__=\"redacted\" -D__TIME__=\"redacted\" -fmerge-all-constants -Wall -Wextra -Wformat-security -Wno-unused-function -Wnon-virtual-dtor -Woverloaded-virtual -Wvla -fmath-errno -fno-exceptions -std=c++11 -o CMakeFiles/hwy.dir/hwy/aligned_allocator.cc.o -c /mnt/devel/GameDev/Videl/ThirdParty/highway/build/hwy/aligned_allocator.cc #/usr/bin/c++ -I/mnt/devel/GameDev/Videl/ThirdParty/highway/build -O3 -DNDEBUG -fPIC -Wno-builtin-macro-redefined -D__DATE__=\"redacted\" -D__TIMESTAMP__=\"redacted\" -D__TIME__=\"redacted\" -fmerge-all-constants -Wall -Wextra -Wformat-security -Wno-unused-function -Wnon-virtual-dtor -Woverloaded-virtual -Wvla -fmath-errno -fno-exceptions -std=c++11 -o CMakeFiles/hwy.dir/hwy/targets.cc.o -c /mnt/devel/GameDev/Videl/ThirdParty/highway/build/hwy/targets.cc #[ 18%] Linking CXX static library libhwy.a #/usr/bin/cmake -P CMakeFiles/hwy.dir/cmake_clean_target.cmake #/usr/bin/cmake -E cmake_link_script CMakeFiles/hwy.dir/link.txt --verbose=1 #/usr/bin/ar qc libhwy.a CMakeFiles/hwy.dir/contrib/image/image.cc.o CMakeFiles/hwy.dir/hwy/aligned_allocator.cc.o CMakeFiles/hwy.dir/hwy/nanobenchmark.cc.o CMakeFiles/hwy.dir/hwy/targets.cc.o #/usr/bin/ranlib libhwy.a # ------------------------------------------------------------------------------------------------- add_library(Highway STATIC) add_library(Highway::Static ALIAS Highway) if(${CMAKE_PROJECT_NAME} STREQUAL "Highway") enable_target_compiler_warnings(Highway) else() disable_target_compiler_warnings(Highway) endif() #add_custom_command( # TARGET Highway PRE_BUILD # COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/build/jconfig.txt" "${PROJECT_SOURCE_DIR}/build/jconfig.h" #) #__DATE__=\"redacted\" -D__TIMESTAMP__=\"redacted\" -D__TIME__=\"redacted\" if(NOT WIN32) target_compile_options(Highway PRIVATE -fexceptions) endif() target_include_directories( Highway PUBLIC "build" ) target_sources( Highway PUBLIC ${headerFiles} PRIVATE ${sourceFiles} ) #set_target_properties(Highway PROPERTIES PREFIX "") set_target_properties(Highway PROPERTIES OUTPUT_NAME "highway") # ------------------------------------------------------------------------------------------------- install( DIRECTORY build/hwy DESTINATION ${PROJECT_SOURCE_DIR}/Include FILES_MATCHING PATTERN "*.h" ) install( TARGETS Highway ARCHIVE DESTINATION ${PROJECT_SOURCE_DIR}/bin/${CMAKE_COMPILER_TAG} ) # ------------------------------------------------------------------------------------------------- file( WRITE "${PROJECT_SOURCE_DIR}/HighwayConfig.cmake" "#!/usr/bin/cmake # Configuration to include Highway in a CMake-based project. If you want to # reference Highway as an externally compiled static library, do this: # # set(Highway_DIR \"../ThirdParty/highway\") # find_package(Highway REQUIRED CONFIG) # # target_link_libraries( # MyAwesomeProject # PRIVATE Highway::Static # ) # # Alternatively, if you want to build Highway together with your project, # use the normal CMakeLists.txt with CMake's add_subdirectory() command: # # add_subdirectory( # \"\${PROJECT_SOURCE_DIR}/../ThirdParty/highway\" # \"\${CMAKE_BINARY_DIR}/highway\" # ) # # target_link_libraries( # MyAwesomeProject # PRIVATE Highway # ) # # ------------------------------------------------------------------------------------------------- if(NOT DEFINED NUCLEX_COMPILER_TAG) message( FATAL_ERROR \"NUCLEX_COMPILER_TAG not defined! Include cplusplus.cmake before importing this package \\ in order to generate a tag identifying the platform/compiler/architecture/variant!\" ) endif() # ------------------------------------------------------------------------------------------------- if(NOT EXISTS \"\${CMAKE_CURRENT_LIST_DIR}/bin/\${NUCLEX_COMPILER_TAG}\") # TODO: Warn and link release build when compiling in debug mode # TODO: Warn and link build for older compiler version if found message( FATAL_ERROR \"Directory '\${CMAKE_CURRENT_LIST_DIR}/bin/\${NUCLEX_COMPILER_TAG}' not found. \\ Please either build and install this project before importing it via \\ find_package() or use this project's main CMakeFiles.txt via add_subdirectory()!\" ) endif() # ------------------------------------------------------------------------------------------------- add_library(Highway::Static STATIC IMPORTED) # This may cause warnings on recent GCC versions (10.0.0+?) with LTO because GCC detects # that the headers used during build (residing in build/) are not the same used when # linking the library (copies resising in Include/). # # CMake doesn't run the install step during build, so the only way to get the headers # in place before building would be by copying them rather than installing them. set_target_properties( Highway::Static PROPERTIES INTERFACE_INCLUDE_DIRECTORIES \"\${CMAKE_CURRENT_LIST_DIR}/Include\" IMPORTED_LINK_INTERFACE_LANGUAGES \"C\" ) if(WIN32) set_target_properties( Highway::Static PROPERTIES IMPORTED_LOCATION \"\${CMAKE_CURRENT_LIST_DIR}/bin/\${NUCLEX_COMPILER_TAG}/highway.lib\" COMPILE_DEFINITIONS OS_LINUX ) else() set_target_properties( Highway::Static PROPERTIES IMPORTED_LOCATION \"\${CMAKE_CURRENT_LIST_DIR}/bin/\${NUCLEX_COMPILER_TAG}/libhighway.a\" ) endif() message(STATUS \"Imported Highway targets with binaries in '\${CMAKE_CURRENT_LIST_DIR}'\")" ) # -------------------------------------------------------------------------------------------------