forked from alberthdev/spasm-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
90 lines (80 loc) · 2.61 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
86
87
88
89
90
cmake_minimum_required(VERSION 3.7)
project(spasm-ng
HOMEPAGE_URL https://github.com/alberthdev/spasm-ng
)
add_compile_options(-Wall)
add_executable(
spasm
main.cpp opcodes.cpp pass_one.cpp pass_two.cpp utils.cpp
export.cpp preop.cpp directive.cpp console.cpp expand_buf.cpp
hash.cpp list.cpp parser.cpp storage.cpp errors.cpp bitmap.cpp
modp_ascii.cpp opcodes_ez80.cpp
)
target_link_libraries(spasm m)
# https://github.com/alberthdev/spasm-ng/issues/73
set_property(TARGET spasm PROPERTY CXX_STANDARD 11)
set(ENABLE_APP_SIGNING ON CACHE BOOL "Enable support for signing applications")
if (ENABLE_APP_SIGNING)
find_package(PkgConfig REQUIRED)
pkg_check_modules(gmp REQUIRED IMPORTED_TARGET gmp)
find_package(OpenSSL
REQUIRED
COMPONENTS Crypto)
target_link_libraries(spasm OpenSSL::Crypto PkgConfig::gmp)
else()
add_compile_definitions(NO_APPSIGN)
endif()
set(ENABLE_DEBUG_PRINT OFF CACHE BOOL "Enable additional debug messages")
if (ENABLE_DEBUG_PRINT)
add_compile_definitions(DEBUG_PRINT)
endif()
add_compile_definitions(
USE_REUSABLES
USE_BUILTIN_FCREATE
)
if (NOT WIN32)
add_compile_definitions(UNIXVER)
endif()
# Version generation
find_package(Git)
if (Git_FOUND)
execute_process(
COMMAND "${GIT_EXECUTABLE}" describe --always --dirty
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE res
OUTPUT_VARIABLE GIT_TREE_DESC
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
else()
set(GIT_TREE_DESC "unknown")
endif()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/version.h.in" "${CMAKE_CURRENT_BINARY_DIR}/version.h")
target_include_directories(spasm
PRIVATE "${CMAKE_CURRENT_BINARY_DIR}"
)
# Trick from https://cmake.org/pipermail/cmake/2018-October/068389.html
# to force a reconfigure on git change so the version string is always up to date
set_property(GLOBAL APPEND
PROPERTY CMAKE_CONFIGURE_DEPENDS
"${CMAKE_SOURCE_DIR}/.git/index"
)
# Tests
include(CTest)
add_subdirectory(${PROJECT_SOURCE_DIR}/tests)
# Install target
include(GNUInstallDirs)
install(TARGETS spasm)
install(FILES README.md LICENSE
DESTINATION ${CMAKE_INSTALL_DOCDIR}/spasm
)
file(GLOB include_files "inc/*.inc")
install(FILES ${include_files}
DESTINATION ${CMAKE_INSTALL_DATADIR}/spasm/inc
)
# Distribution packaging
set(CPACK_PACKAGE_VERSION "${GIT_TREE_DESC}")
set(CPACK_PACKAGE_DESCRIPTION "SPASM-ng is a z80 assembler with extra features to support development for TI calculators.")
set(CPACK_PACKAGE_CONTACT "[email protected]")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "zlib1g, libssl1.0.0, libgmp10")
include(CPack)