2
2
project(jwm-settings-manager CXX C)
3
3
set(PROJECT_NAME jwm-settings-manager)
7
7
SET(VERSION "${VERMAJ}.${VERMIN}.${VERREV}")
9
9
set(TOOLKITS "nanosvg, pugixml and FLTK")
10
SET(DATE "Nov 17, ${YEAR}")
10
SET(DATE "Jan 16, ${YEAR}")
11
11
INCLUDE(AddFileDependencies)
12
12
INCLUDE(CheckIncludeFiles)
13
13
INCLUDE(FindPkgConfig)
46
46
set(MISCDEPS "\${misc:Depends}")
47
47
set(DEBDEPS "\${source:Version}) , \${shlibs:Depends}, ${MISCDEPS}")
48
48
set(ARGdebug "--debug")
49
if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} )
50
message( FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt." )
52
if(NOT EXISTS "/etc/debian_version")
50
FIND_PACKAGE(FLTK REQUIRED NO_MODULE)
59
## Because Launchpad's build system is really weird!
60
MESSAGE("Using Debian based release")
61
FIND_PACKAGE(FLTK REQUIRED NO_MODULE)
63
FIND_PACKAGE(FLTK REQUIRED)
51
65
FIND_PACKAGE(X11 REQUIRED)
52
IF(NOT EXISTS "${FLTK_FLUID_EXECUTABLE}")
67
#Because NixOS does things differently
68
string(COMPARE EQUAL "${FLTK_FLUID_EXECUTABLE}" "" fluid_result)
69
## Because Launchpad's build system is really weird!
53
71
# Try to detect full path anyway
54
72
EXECUTE_PROCESS(COMMAND which fluid OUTPUT_VARIABLE FLTK_FLUID_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE)
55
73
IF(NOT EXISTS "${FLTK_FLUID_EXECUTABLE}")
56
74
MESSAGE(FATAL_ERROR "Please install the fluid binary which is part of FLTK.")
59
IF(NOT EXISTS "${FLTK_INCLUDE_DIR}")
77
#Because NixOS does things differently
78
string(COMPARE EQUAL "${FLTK_INCLUDE_DIR}" "" fltk_result)
79
## Because Launchpad's build system is really weird!
60
81
# Try to detect full path anyway
61
82
set(FLTK_INCLUDE_DIR "/usr/include")
62
83
IF(NOT EXISTS "${FLTK_INCLUDE_DIR}")
63
MESSAGE(FATAL_ERROR "Please install the fluid binary which is part of FLTK.")
84
MESSAGE(FATAL_ERROR "Please install the FLTK header files which is part of FLTK.")
66
87
# Don't need OpenGL or the Fluid plugin, since I export the source from FLUID
77
98
configure_file("debian/control.in" "debian/control")
78
99
configure_file("debian/jwm-settings-manager-common.install.in" "debian/jwm-settings-manager-common.install")
79
100
configure_file("src/jsm.cpp.in" "src/jsm.cpp")
80
if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} )
81
message( FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt." )
83
101
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -g -fvar-tracking -DDEBUG=true")
84
102
#set(CMAKE_BUILD_TYPE "RELEASE")
85
103
#set(CMAKE_CONFIGURATION_TYPE "RELEASE")
98
116
#set(SVG_DEFINES "-DNANOSVG_IMPLEMENTATION=true -DNANOSVG_ALL_COLOR_KEYWORDS=true -DNANOSVGRAST_IMPLEMENTATION=true")
99
117
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SVG_DEFINES}")
100
118
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Os -finline-small-functions -finline-functions-called-once -fno-unwind-tables -fno-asynchronous-unwind-tables -s")
101
if(EXISTS ${X11_INCLUDE_DIR})
119
#Because NixOS does things differently
120
string(COMPARE EQUAL "${X11_INCLUDE_DIR}" "" x11_result)
122
MESSAGE(FATAL_ERROR "X11 headers are not found")
102
124
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLINUX_COMMON_HAS_X=true")
104
126
set(XML_HEADERS include/pugixml.hpp)
130
154
src/fltkfunctions.cpp
160
find_package(Gettext)
162
file (GLOB PO_FILES ${CMAKE_SOURCE_DIR}/po/*.po)
163
message( "msgfmt: ${GETTEXT_MSGFMT_EXECUTABLE}")
164
message( "msgmerge: ${GETTEXT_MSGMERGE_EXECUTABLE}")
165
GETTEXT_CREATE_TRANSLATIONS(po/${PROJECT_NAME}.pot ALL ${PO_FILES})
138
167
## Turn the source code into a library
139
168
add_library(JSM STATIC ${JSM_SRCS})
169
add_subdirectory(data)
140
170
## make the executable
141
171
add_executable(jwm-settings-manager src/jsm.cpp)
142
172
add_executable(fltk-mouse fltk/jwm-mouse.cxx)
143
173
add_executable(desktop-file-editor fltk/desktop-file-editor.cxx)
144
174
## Linker settings
145
set(ALL_LIBS JSM ${X11_LIBRARIES} ${X11_X11_LIB} ${X11_Xpm_LIB} ${FLTK_LIBRARIES} fltk_SHARED fltk_images_SHARED)
175
set(ALL_LIBS JSM ${X11_LIBRARIES} ${X11_X11_LIB} ${X11_Xpm_LIB} ${FLTK_LIBRARIES})
176
## Because Launchpad's build system is really weird!
178
set(ALL_LIBS ${ALL_LIBS} fltk_SHARED fltk_images_SHARED)
146
181
TARGET_LINK_LIBRARIES(jwm-settings-manager ${ALL_LIBS})
147
182
TARGET_LINK_LIBRARIES(fltk-mouse ${ALL_LIBS})
148
183
TARGET_LINK_LIBRARIES(desktop-file-editor ${ALL_LIBS})