-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
172 lines (118 loc) · 4.57 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
cmake_minimum_required(VERSION 3.10)
project(kssroll LANGUAGES CXX C VERSION 0.5)
# specify the C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s -O3")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s -O3 -Wall")
# Set a default build type if none was specified
set(default_build_type "Release")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
include(GNUInstallDirs)
message(STATUS "executable : " ${CMAKE_INSTALL_FULL_BINDIR} " " ${CMAKE_INSTALL_BINDIR})
message(STATUS "données : " ${CMAKE_INSTALL_FULL_DATADIR}/kssroll)
message(STATUS "locales : " ${CMAKE_INSTALL_FULL_LOCALEDIR}/fr/LC_MESSAGES/kssroll.mo)
message(STATUS "CMAKE_INSTALL_PREFIX : " ${CMAKE_INSTALL_PREFIX})
message(STATUS "CMAKE_STAGING_PREFIX : " ${CMAKE_STAGING_PREFIX})
message(STATUS "CMAKE_SYSTEM_PREFIX_PATH : " ${CMAKE_SYSTEM_PREFIX_PATH})
# config.hpp file
configure_file(
config.hpp.in
${CMAKE_SOURCE_DIR}/src/config.hpp
)
set (SRC
# src/config.cpp
src/loader.cpp
src/kss_tools.cpp
src/ksswindow.cpp
src/resources.c
src/main.cpp
)
add_executable(${PROJECT_NAME}
${SRC}
)
find_package(PkgConfig)
pkg_check_modules(GTKMM gtkmm-3.0 )
# threads
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
pkg_check_modules(MAJIMIX majimix_pa REQUIRED)
if(${MAJIMIX_FOUND})
message(STATUS "MAJIMIX library found")
message(STATUS " include dir : ${MAJIMIX_INCLUDEDIR}")
message(STATUS " name : ${MAJIMIX_LIBRARIES}")
message(STATUS " files : ${MAJIMIX_LINK_LIBRARIES}")
message(STATUS " version : ${MAJIMIX_VERSION}")
target_include_directories(${PROJECT_NAME} PRIVATE ${MAJIMIX_INCLUDEDIR})
endif()
# ]]
# libkss
add_subdirectory(dependencies)
target_link_options(kss PRIVATE "$<$<CONFIG:RELEASE>:${-s}>")
target_link_options(emu2149 PRIVATE "$<$<CONFIG:RELEASE>:${-s}>")
target_link_options(emu2212 PRIVATE "$<$<CONFIG:RELEASE>:${-s}>")
target_link_options(emu2413 PRIVATE "$<$<CONFIG:RELEASE>:${-s}>")
target_link_options(emu8950 PRIVATE "$<$<CONFIG:RELEASE>:${-s}>")
target_link_options(emu76489 PRIVATE "$<$<CONFIG:RELEASE>:${-s}>")
target_link_options(kmz80 PRIVATE "$<$<CONFIG:RELEASE>:${-s}>")
# Setting up Intl
find_package (Intl REQUIRED)
find_package(Gettext REQUIRED)
include_directories(${INTL_INCLUDE_DIRS})
link_directories(${INTL_LIBRARY_DIRS})
FIND_PROGRAM(GETTEXT_MSGFMT_EXECUTABLE msgfmt)
IF(NOT GETTEXT_MSGFMT_EXECUTABLE)
MESSAGE("------
NOTE: msgfmt not found. Translations will *not* be installed
------")
ELSE(NOT GETTEXT_MSGFMT_EXECUTABLE)
SET(catalogname ${PROJECT_NAME})
FILE(GLOB PO_FILES po/*.po)
SET(GMO_FILES)
FOREACH(_poFile ${PO_FILES})
GET_FILENAME_COMPONENT(_poFileName ${_poFile} NAME)
STRING(REGEX REPLACE "^${catalogname}_?" "" _langCode ${_poFileName} )
STRING(REGEX REPLACE "\\.po$" "" _langCode ${_langCode} )
IF( _langCode )
GET_FILENAME_COMPONENT(_lang ${_poFile} NAME_WE)
SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
ADD_CUSTOM_COMMAND(OUTPUT ${_gmoFile}
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_poFile}
DEPENDS ${_poFile})
# INSTALL(FILES ${_gmoFile} DESTINATION ${LOCALE_INSTALL_DIR}/${_langCode}/LC_MESSAGES/ RENAME ${catalogname}.mo)
INSTALL(FILES ${_gmoFile} DESTINATION ${CMAKE_INSTALL_FULL_LOCALEDIR}/${_langCode}/LC_MESSAGES/ RENAME ${catalogname}.mo)
LIST(APPEND GMO_FILES ${_gmoFile})
ENDIF( _langCode )
ENDFOREACH(_poFile ${PO_FILES})
ADD_CUSTOM_TARGET(translations ALL DEPENDS ${GMO_FILES})
ENDIF(NOT GETTEXT_MSGFMT_EXECUTABLE)
#message(${libkss_sources})
target_include_directories(
${PROJECT_NAME}
PRIVATE
${GTKMM_INCLUDE_DIRS}
# ${MAJIMIX_INCLUDE_DIRS}
${libkss_SOURCE_DIR}/src
${libkss_SOURCE_DIR}/modules
# ${libkss_sources}
)
target_link_libraries(${PROJECT_NAME}
${GTKMM_LIBRARIES}
${PORTAUDIO_LIBRARIES}
${MAJIMIX_LIBRARIES}
# ${MAJIMIX_LIB}
# kss emu2149 emu2212 emu2413 emu8950 emu76489 kmz80
# ${libkss_libs}
Threads::Threads
)
install(TARGETS ${PROJECT_NAME}
RUNTIME
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT ${PROJECT_NAME}
)