-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
109 lines (93 loc) · 3.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
cmake_minimum_required(VERSION "3.3")
project(Minicomputer VERSION "1.41" LANGUAGES C CXX)
set(PROJECT_VENDOR "Linuxmao.org contributors")
set(PROJECT_CONTACT "Linuxmao.org contributors <http://linuxmao.org/>")
set(PROJECT_HOMEPAGE "https://github.com/linuxmao-org/Minicomputer.git")
set(GETTEXT_TRANSLATIONS "fr")
include(GNUInstallDirs)
include(FindPkgConfig)
set(FLTK_SKIP_OPENGL ON)
set(FLTK_SKIP_FORMS ON)
set(FLTK_SKIP_IMAGES ON)
set(FLTK_SKIP_FLUID ON)
find_package(FLTK REQUIRED)
set(CMAKE_CXX_STANDARD "11")
if(CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang)$")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffast-math")
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang)$")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
endif()
function(target_link_pkgconfig TARGET VAR NAME VISIBILITY)
pkg_check_modules("${VAR}" "${NAME}" REQUIRED)
target_include_directories("${TARGET}" "${VISIBILITY}" ${${VAR}_INCLUDE_DIRS})
target_link_libraries("${TARGET}" "${VISIBILITY}" ${${VAR}_LIBRARIES})
endfunction()
add_executable(minicomputer
"editor/main.cpp"
"editor/Memory.cpp"
"editor/syntheditor.cxx"
"cpu/cpu.cpp"
"cpu/main.cpp")
target_link_pkgconfig(minicomputer JACK "jack" PRIVATE)
target_include_directories(minicomputer PRIVATE "${FLTK_INCLUDE_DIR}")
target_link_libraries(minicomputer PRIVATE ${FLTK_LIBRARIES})
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_library(MATH_LIBRARY "m")
target_link_libraries(minicomputer PRIVATE "${MATH_LIBRARY}")
find_library(DL_LIBRARY "dl")
target_link_libraries(minicomputer PRIVATE "${DL_LIBRARY}")
endif()
set(ENABLE_OSC "" CACHE STRING "Enable OSC")
if(ENABLE_OSC STREQUAL "")
pkg_check_modules(LIBLO "liblo")
if(LIBLO_FOUND)
set(ENABLE_OSC "ON" CACHE STRING "Enable OSC" FORCE)
endif()
endif()
if(ENABLE_OSC)
target_link_pkgconfig(minicomputer LIBLO "liblo" PRIVATE)
target_compile_definitions(minicomputer PRIVATE "MINICOMPUTER_OSC=1")
endif()
include(FindThreads)
target_link_libraries(minicomputer PRIVATE "${CMAKE_THREAD_LIBS_INIT}")
target_compile_definitions(minicomputer PRIVATE "MINICOMPUTER_LOCALEDIR=\"${CMAKE_INSTALL_FULL_LOCALEDIR}\"")
install(TARGETS minicomputer DESTINATION "${CMAKE_INSTALL_BINDIR}")
set(ENABLE_GETTEXT "" CACHE STRING "Enable gettext")
if(ENABLE_GETTEXT STREQUAL "")
find_package(Intl)
find_package(Gettext)
if(Intl_FOUND AND GETTEXT_FOUND)
set(ENABLE_GETTEXT "ON" CACHE STRING "Enable gettext" FORCE)
endif()
endif()
if(ENABLE_GETTEXT)
find_package(Intl REQUIRED)
find_package(Gettext REQUIRED)
endif()
if(ENABLE_GETTEXT)
target_compile_definitions(minicomputer PRIVATE "MINICOMPUTER_I18N=1")
target_include_directories(minicomputer PRIVATE ${Intl_INCLUDE_DIRS})
target_link_libraries(minicomputer PRIVATE ${Intl_LIBRARIES})
foreach(translation ${GETTEXT_TRANSLATIONS})
gettext_process_po_files("${translation}" ALL INSTALL_DESTINATION "${CMAKE_INSTALL_LOCALEDIR}" PO_FILES
"po/${translation}/minicomputer.po")
endforeach()
endif()
install(FILES "minicomputer.xpm" DESTINATION "${CMAKE_INSTALL_DATADIR}/pixmaps")
install(FILES "minicomputer.desktop" DESTINATION "${CMAKE_INSTALL_DATADIR}/applications")
message("!! Feature summary:")
macro(print_feature NAME VAR)
if(${VAR})
message("!! ${NAME}: YES")
else()
message("!! ${NAME}: NO")
endif()
endmacro()
print_feature("OSC" ENABLE_OSC)
print_feature("gettext" ENABLE_GETTEXT)
include(CPackLists.txt)