Skip to content

Commit 584e089

Browse files
committed
Modularized bitsets
1 parent 9e4c230 commit 584e089

18 files changed

+105
-29
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ if(NOT DEFINED CMAKE_MAXIMUM_RANK)
4949
set(CMAKE_MAXIMUM_RANK 4 CACHE STRING "Maximum array rank for generated procedures")
5050
endif()
5151

52+
option(WITH_BITSETS "Compile STDLIB BITSETS" ON)
53+
5254
option(FIND_BLAS "Find external BLAS and LAPACK" ON)
5355

5456
# --- find external BLAS and LAPACK
@@ -118,6 +120,7 @@ endif()
118120

119121
list(
120122
APPEND fyppFlags
123+
"-DWITH_BITSETS=$<BOOL:${WITH_BITSETS}>"
121124
"-DWITH_CBOOL=$<BOOL:${WITH_CBOOL}>"
122125
"-DWITH_QP=$<BOOL:${WITH_QP}>"
123126
"-DWITH_XDP=$<BOOL:${WITH_XDP}>"

example/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ endmacro(ADD_EXAMPLE)
99
add_subdirectory(ansi)
1010
add_subdirectory(array)
1111
add_subdirectory(ascii)
12-
add_subdirectory(bitsets)
12+
if (WITH_BITSETS)
13+
add_subdirectory(bitsets)
14+
endif()
1315
add_subdirectory(constants)
1416
add_subdirectory(error)
1517
add_subdirectory(hashmaps)

example/math/example_math_swap.f90

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,4 @@ program example_math_swap
4343
call swap(x,y)
4444
end block
4545

46-
block
47-
use stdlib_bitsets
48-
type(bitset_64) :: x, y
49-
call x%from_string('0000')
50-
call y%from_string('1111')
51-
call swap(x,y)
52-
end block
53-
54-
end program example_math_swap
46+
end program example_math_swap

example/sorting/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ ADD_EXAMPLE(sort)
33
ADD_EXAMPLE(sort_adjoint)
44
ADD_EXAMPLE(sort_index)
55
ADD_EXAMPLE(radix_sort)
6+
if (WITH_BITSETS)
67
ADD_EXAMPLE(sort_bitset)
8+
endif()

include/common.fypp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
#:set WITH_XDP = False
1919
#:endif
2020

21+
#! Support for bitsets
22+
#:if not defined("WITH_BITSETS")
23+
#:set WITH_CBOOL = True
24+
#:endif
25+
2126
#! Support for linear algebra with 64-bit integer sizes
2227
#:if not defined("WITH_ILP64")
2328
#:set WITH_ILP64 = False

src/CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
if (WITH_BITSETS)
2+
add_subdirectory(bitsets)
3+
endif()
4+
15
add_subdirectory(blas)
26
add_subdirectory(lapack)
37

48
set(fppFiles
59
stdlib_ascii.fypp
6-
stdlib_bitsets.fypp
7-
stdlib_bitsets_64.fypp
8-
stdlib_bitsets_large.fypp
910
stdlib_codata_type.fypp
1011
stdlib_constants.fypp
1112
stdlib_error.fypp
@@ -121,4 +122,7 @@ set(f90Files
121122

122123
configure_stdlib_target(${PROJECT_NAME} f90Files fppFiles cppFiles)
123124

124-
target_link_libraries(${PROJECT_NAME} PUBLIC blas lapack)
125+
target_link_libraries(${PROJECT_NAME} PUBLIC
126+
$<$<BOOL:${WITH_BITSETS}>:bitsets>
127+
blas lapack)
128+

src/bitsets/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
set(bitsets_fppFiles
2+
../stdlib_kinds.fypp
3+
../stdlib_optval.fypp
4+
stdlib_bitsets.fypp
5+
stdlib_bitsets_64.fypp
6+
stdlib_bitsets_large.fypp
7+
)
8+
9+
configure_stdlib_target(bitsets "" bitsets_fppFiles "")
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)