2017-11-13 18:53:04 -10:00
|
|
|
cmake_minimum_required(VERSION 3.10 FATAL_ERROR) # because of c++17
|
2016-03-26 11:34:03 -07:00
|
|
|
project(kabufuda)
|
2016-06-26 21:28:48 -07:00
|
|
|
|
2020-04-10 19:01:21 -10:00
|
|
|
if (NOT MSVC)
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
endif()
|
2016-06-26 21:28:48 -07:00
|
|
|
|
2016-03-26 11:34:03 -07:00
|
|
|
add_library(kabufuda STATIC
|
2016-06-28 11:53:37 -07:00
|
|
|
include/kabufuda/Constants.hpp
|
2018-02-05 23:34:01 -10:00
|
|
|
include/kabufuda/AsyncIO.hpp
|
2016-06-28 11:53:37 -07:00
|
|
|
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
|
2019-08-13 02:04:21 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
if(WIN32)
|
2019-08-30 10:42:05 -04:00
|
|
|
if (MSVC)
|
|
|
|
target_compile_options(kabufuda PRIVATE
|
|
|
|
# Enforce various standards compliant behavior.
|
2020-04-10 19:01:21 -10:00
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:/permissive->
|
2019-08-30 10:42:05 -04:00
|
|
|
|
|
|
|
# Enable standard volatile semantics.
|
2020-04-10 19:01:21 -10:00
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:/volatile:iso>
|
2019-08-30 10:42:05 -04:00
|
|
|
|
|
|
|
# Reports the proper value for the __cplusplus preprocessor macro.
|
2020-04-10 19:01:21 -10:00
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:/Zc:__cplusplus>
|
2019-08-30 10:42:05 -04:00
|
|
|
|
2020-04-10 19:01:21 -10:00
|
|
|
# Use latest C++ standard.
|
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:/std:c++latest>
|
2019-08-30 10:42:05 -04:00
|
|
|
)
|
2020-04-10 19:01:21 -10:00
|
|
|
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()
|
2019-08-30 10:42:05 -04:00
|
|
|
endif()
|
|
|
|
|
2019-08-13 02:04:21 -04:00
|
|
|
target_sources(kabufuda PRIVATE
|
|
|
|
lib/kabufuda/AsyncIOWin32.cpp
|
|
|
|
)
|
2022-08-03 18:11:08 -04:00
|
|
|
elseif(NX OR EMSCRIPTEN)
|
2020-10-21 00:45:02 -04:00
|
|
|
target_sources(kabufuda PRIVATE
|
|
|
|
lib/kabufuda/AsyncIONX.cpp
|
|
|
|
)
|
2019-08-13 02:04:21 -04:00
|
|
|
else()
|
|
|
|
target_sources(kabufuda PRIVATE
|
|
|
|
lib/kabufuda/AsyncIOPosix.cpp
|
|
|
|
)
|
2020-10-07 20:11:05 -04:00
|
|
|
if(NOT APPLE)
|
|
|
|
target_link_libraries(kabufuda PUBLIC rt)
|
|
|
|
endif()
|
2019-08-13 02:04:21 -04:00
|
|
|
endif()
|
|
|
|
|
2019-06-11 16:04:15 -10:00
|
|
|
target_include_directories(kabufuda PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
|
2016-03-25 21:26:51 -07:00
|
|
|
|
2016-06-30 02:53:13 -07:00
|
|
|
add_subdirectory(test)
|