Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

experimental CMAKE_HEADER_ONLY flag, refs #2114 #2129

Merged
1 commit merged into from
May 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ set(HWY_CMAKE_RVV ON CACHE BOOL "Set copts for RISCV with RVV?")
# arise due to compiler/platform changes. Enable this in CI/tests.
set(HWY_WARNINGS_ARE_ERRORS OFF CACHE BOOL "Add -Werror flag?")

# Experimental support for header-only builds
set(HWY_CMAKE_HEADER_ONLY OFF CACHE BOOL "Change to header-only?")

set(HWY_ENABLE_CONTRIB ON CACHE BOOL "Include contrib/")
set(HWY_ENABLE_EXAMPLES ON CACHE BOOL "Build examples")
set(HWY_ENABLE_INSTALL ON CACHE BOOL "Install library")
Expand Down Expand Up @@ -137,9 +140,7 @@ list(APPEND HWY_CONTRIB_SOURCES
endif() # HWY_ENABLE_CONTRIB

set(HWY_SOURCES
hwy/abort.cc
hwy/abort.h
hwy/aligned_allocator.cc
hwy/aligned_allocator.h
hwy/base.h
hwy/cache_control.h
Expand All @@ -148,7 +149,6 @@ set(HWY_SOURCES
hwy/foreach_target.h
hwy/highway_export.h
hwy/highway.h
hwy/nanobenchmark.cc
hwy/nanobenchmark.h
hwy/ops/arm_neon-inl.h
hwy/ops/arm_sve-inl.h
Expand All @@ -164,20 +164,28 @@ set(HWY_SOURCES
hwy/ops/x86_128-inl.h
hwy/ops/x86_256-inl.h
hwy/ops/x86_512-inl.h
hwy/per_target.cc
hwy/per_target.h
hwy/print-inl.h
hwy/print.cc
hwy/print.h
hwy/profiler.h
hwy/robust_statistics.h
hwy/targets.cc
hwy/targets.h
hwy/timer-inl.h
hwy/timer.cc
hwy/timer.h
)

if (HWY_CMAKE_HEADER_ONLY)
list(APPEND HWY_SOURCES
hwy/abort.cc
hwy/aligned_allocator.cc
hwy/nanobenchmark.cc
hwy/per_target.cc
hwy/print.cc
hwy/targets.cc
hwy/timer.cc
)
endif()

set(HWY_TEST_SOURCES
hwy/tests/hwy_gtest.h
hwy/tests/test_util-inl.h
Expand Down Expand Up @@ -367,6 +375,10 @@ else()

endif() # !MSVC

if (HWY_CMAKE_HEADER_ONLY)
list(APPEND HWY_FLAGS -DHWY_HEADER_ONLY)
endif()

include(CheckIncludeFile)
check_include_file(sys/auxv.h HAVE_SYS_AUXV_H)
check_include_file(asm/hwcap.h HAVE_ASM_HWCAP_H)
Expand Down
Loading