-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
65 lines (55 loc) · 1.92 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
cmake_minimum_required(VERSION 3.10 FATAL_ERROR) # because of c++17
project(kabufuda)
if (NOT MSVC)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
add_library(kabufuda STATIC
include/kabufuda/Constants.hpp
include/kabufuda/AsyncIO.hpp
include/kabufuda/BlockAllocationTable.hpp lib/kabufuda/BlockAllocationTable.cpp
include/kabufuda/Card.hpp lib/kabufuda/Card.cpp
include/kabufuda/Directory.hpp lib/kabufuda/Directory.cpp
include/kabufuda/File.hpp lib/kabufuda/File.cpp
include/kabufuda/Util.hpp lib/kabufuda/Util.cpp
include/kabufuda/SRAM.hpp lib/kabufuda/SRAM.cpp
)
if(WIN32)
if (MSVC)
target_compile_options(kabufuda PRIVATE
# Enforce various standards compliant behavior.
$<$<COMPILE_LANGUAGE:CXX>:/permissive->
# Enable standard volatile semantics.
$<$<COMPILE_LANGUAGE:CXX>:/volatile:iso>
# Reports the proper value for the __cplusplus preprocessor macro.
$<$<COMPILE_LANGUAGE:CXX>:/Zc:__cplusplus>
# Use latest C++ standard.
$<$<COMPILE_LANGUAGE:CXX>:/std:c++latest>
)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# Flags for MSVC (not clang-cl)
target_compile_options(kabufuda PRIVATE
# Allow constexpr variables to have explicit external linkage.
$<$<COMPILE_LANGUAGE:CXX>:/Zc:externConstexpr>
# Assume that new throws exceptions, allowing better code generation.
$<$<COMPILE_LANGUAGE:CXX>:/Zc:throwingNew>
)
endif()
endif()
target_sources(kabufuda PRIVATE
lib/kabufuda/AsyncIOWin32.cpp
)
elseif(NX OR EMSCRIPTEN)
target_sources(kabufuda PRIVATE
lib/kabufuda/AsyncIONX.cpp
)
else()
target_sources(kabufuda PRIVATE
lib/kabufuda/AsyncIOPosix.cpp
)
if(NOT APPLE)
target_link_libraries(kabufuda PUBLIC rt)
endif()
endif()
target_include_directories(kabufuda PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
add_subdirectory(test)