@@ -16,3 +16,66 @@ include(cmake/aurora_vi.cmake)
1616if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
1717 add_subdirectory (examples)
1818endif ()
19+
20+ if (NOT MSVC )
21+ set (CMAKE_CXX_STANDARD 20)
22+ set (CMAKE_CXX_STANDARD_REQUIRED ON )
23+ endif ()
24+
25+ add_library (kabufuda STATIC
26+ include /kabufuda/Constants.hpp
27+ include /kabufuda/AsyncIO.hpp
28+ include /kabufuda/BlockAllocationTable.hpp lib/kabufuda/BlockAllocationTable.cpp
29+ include /kabufuda/Card.hpp lib/kabufuda/Card.cpp
30+ include /kabufuda/Directory .hpp lib/kabufuda/Directory .cpp
31+ include /kabufuda/File.hpp lib/kabufuda/File.cpp
32+ include /kabufuda/Util.hpp lib/kabufuda/Util.cpp
33+ include /kabufuda/SRAM.hpp lib/kabufuda/SRAM.cpp
34+ )
35+
36+ if (WIN32 )
37+ if (MSVC )
38+ target_compile_options (kabufuda PRIVATE
39+ # Enforce various standards compliant behavior.
40+ $<$<COMPILE_LANGUAGE:CXX>:/permissive->
41+
42+ # Enable standard volatile semantics.
43+ $<$<COMPILE_LANGUAGE:CXX>:/volatile:iso>
44+
45+ # Reports the proper value for the __cplusplus preprocessor macro.
46+ $<$<COMPILE_LANGUAGE:CXX>:/Zc:__cplusplus>
47+
48+ # Use latest C++ standard.
49+ $<$<COMPILE_LANGUAGE:CXX>:/std:c++latest>
50+ )
51+ if ("${CMAKE_CXX_COMPILER_ID} " STREQUAL "MSVC" )
52+ # Flags for MSVC (not clang-cl)
53+ target_compile_options (kabufuda PRIVATE
54+ # Allow constexpr variables to have explicit external linkage.
55+ $<$<COMPILE_LANGUAGE:CXX>:/Zc:externConstexpr>
56+
57+ # Assume that new throws exceptions, allowing better code generation.
58+ $<$<COMPILE_LANGUAGE:CXX>:/Zc:throwingNew>
59+ )
60+ endif ()
61+ endif ()
62+
63+ target_sources (kabufuda PRIVATE
64+ lib/kabufuda/AsyncIOWin32.cpp
65+ )
66+ elseif (NX OR EMSCRIPTEN)
67+ target_sources (kabufuda PRIVATE
68+ lib/kabufuda/AsyncIONX.cpp
69+ )
70+ else ()
71+ target_sources (kabufuda PRIVATE
72+ lib/kabufuda/AsyncIOPosix.cpp
73+ )
74+ if (NOT APPLE )
75+ target_link_libraries (kabufuda PUBLIC rt)
76+ endif ()
77+ endif ()
78+
79+ target_include_directories (kabufuda PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /include >)
80+
81+ add_subdirectory (test )
0 commit comments