Skip to content

Commit

Permalink
fix CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
wjr-z committed Jul 2, 2024
1 parent c94779f commit d0208b7
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ project(wjr
LANGUAGES CXX
)

if(NOT(CMAKE_SIZEOF_VOID_P EQUAL 8))
message(FATAL_ERROR "Not support non 64-bit currently, CMake will exit.")
endif()

if(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
set(WJR_X86 TRUE)
else()
set(WJR_X86 FALSE)
endif()

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
Expand All @@ -18,16 +28,21 @@ set(WJR_LIB_DIR ${PROJECT_SOURCE_DIR}/src)

file(GLOB_RECURSE WJR_SRCS ${WJR_LIB_DIR}/*.cpp)

add_library(wjr STATIC ${WJR_SRCS})

target_include_directories(wjr PUBLIC
${WJR_INCLUDE_DIR}
)

set(WJR_PCH PUBLIC ${WJR_INCLUDE_DIR}/wjr/preprocessor.hpp
PUBLIC ${WJR_INCLUDE_DIR}/wjr/assert.hpp
PUBLIC ${WJR_INCLUDE_DIR}/wjr/type_traits.hpp)

if(WJR_X86)
list(APPEND ${WJR_PCH} PUBLIC ${WJR_INCLUDE_DIR}/wjr/x86/simd/intrin.hpp PUBLIC ${WJR_INCLUDE_DIR}/wjr/x86/simd/simd.hpp)
endif()

target_precompile_headers(
wjr
PUBLIC ${WJR_INCLUDE_DIR}/wjr/preprocessor.hpp
PUBLIC ${WJR_INCLUDE_DIR}/wjr/assert.hpp
PUBLIC ${WJR_INCLUDE_DIR}/wjr/type_traits.hpp
PUBLIC ${WJR_INCLUDE_DIR}/wjr/x86/simd/simd.hpp
${WJR_PCH}
)

add_library(wjr STATIC ${WJR_SRCS})

0 comments on commit d0208b7

Please sign in to comment.