-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
85 lines (71 loc) · 2.48 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
cmake_minimum_required(VERSION 2.8)
project(saptapper C CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include_directories(src/3rdparty/include)
if(MSVC)
if(CMAKE_CL_64)
set(MSVC_ARCHITECTURE_NAME x64)
else()
set(MSVC_ARCHITECTURE_NAME win32)
endif()
# Use bundled dependencies
set(ZLIB_ROOT ${CMAKE_SOURCE_DIR}/dependencies/zlib)
set(ZLIB_LIBRARY ${CMAKE_SOURCE_DIR}/dependencies/zlib/lib/${MSVC_ARCHITECTURE_NAME}/zlibstat.lib)
add_definitions(-DZLIB_WINAPI)
endif()
find_package(ZLIB REQUIRED)
if(MSVC)
option(STATIC_CRT "Use static CRT libraries" ON)
# Rewrite command line flags to use /MT if necessary
if(STATIC_CRT)
foreach(flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if(${flag_var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endif(${flag_var} MATCHES "/MD")
endforeach(flag_var)
endif()
# Allow for wildcards in command-line path arguments
# http://msdn.microsoft.com/en-us/library/8bch7bkk.aspx
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} setargv.obj")
# Disable MSVC specific secure error
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
#============================================================================
# saptapper
#============================================================================
set(SRCS
src/main.cpp
src/saptapper/byte_pattern.cpp
src/saptapper/cartridge.cpp
src/saptapper/gsf_writer.cpp
src/saptapper/mp2k_driver.cpp
src/saptapper/psf_writer.cpp
src/saptapper/saptapper.cpp
)
set(HDRS
src/3rdparty/include/args.hxx
src/3rdparty/include/strict_fstream.hpp
src/3rdparty/include/zstr.hpp
src/saptapper/algorithm.hpp
src/saptapper/arm.hpp
src/saptapper/bytes.hpp
src/saptapper/byte_pattern.hpp
src/saptapper/cartridge.hpp
src/saptapper/gsf_header.hpp
src/saptapper/gsf_writer.hpp
src/saptapper/minigsf_driver_param.hpp
src/saptapper/mp2k_driver.hpp
src/saptapper/mp2k_driver_param.hpp
src/saptapper/psf_writer.hpp
src/saptapper/saptapper.hpp
src/saptapper/tabulate.hpp
src/saptapper/types.hpp
)
add_executable(saptapper ${SRCS} ${HDRS})
if(ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIRS})
target_link_libraries(saptapper ${ZLIB_LIBRARIES})
endif(ZLIB_FOUND)