~israeldahl/jwm-settings-manager/trunk

« back to all changes in this revision

Viewing changes to CMakeLists.txt

  • Committer: Israel Dahl
  • Date: 2018-01-16 14:17:27 UTC
  • Revision ID: israeldahl@gmail.com-20180116141727-1eqofcuc0c5ukzdw
Update main branch to be current

* Windows
  - configure button actions
 * Desktop
   - file manager preferences
 * Themes
   - parse directories and ignore non-xml files

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
project(jwm-settings-manager CXX C)
3
3
set(PROJECT_NAME jwm-settings-manager)
4
4
set(VERMAJ "2")
5
 
set(VERMIN "0")
 
5
set(VERMIN "4")
6
6
set(VERREV "0")
7
7
SET(VERSION "${VERMAJ}.${VERMIN}.${VERREV}")
8
 
set(YEAR "2016")
 
8
set(YEAR "2018")
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." )
 
51
endif()
 
52
if(NOT EXISTS "/etc/debian_version")
 
53
        set(result false)
 
54
else()
 
55
        set(result true)
 
56
endif()
49
57
# Packages we need
50
 
FIND_PACKAGE(FLTK REQUIRED NO_MODULE)
 
58
if(result)
 
59
        ## Because Launchpad's build system is really weird!
 
60
    MESSAGE("Using Debian based release")
 
61
        FIND_PACKAGE(FLTK REQUIRED NO_MODULE)
 
62
else()
 
63
         FIND_PACKAGE(FLTK REQUIRED)
 
64
endif()
51
65
FIND_PACKAGE(X11 REQUIRED)
52
 
IF(NOT EXISTS "${FLTK_FLUID_EXECUTABLE}")
 
66
 
 
67
#Because NixOS does things differently
 
68
string(COMPARE EQUAL "${FLTK_FLUID_EXECUTABLE}" "" fluid_result)
 
69
## Because Launchpad's build system is really weird!
 
70
IF(fluid_result)
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.")
57
75
    ENDIF()
58
76
ENDIF()
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!
 
80
IF( fltk_result)
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.")
64
85
    ENDIF()
65
86
ENDIF()
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." )
82
 
endif()
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)
 
121
if( x11_result )
 
122
    MESSAGE(FATAL_ERROR "X11 headers are not found")
 
123
else()
102
124
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLINUX_COMMON_HAS_X=true")
103
125
endif()
104
126
set(XML_HEADERS include/pugixml.hpp)
119
141
)
120
142
### ALL the source code
121
143
set(JSM_SRCS
 
144
        src/ui.cpp
 
145
        ${FLTK_SRCS2}
122
146
    src/menu.cpp
123
147
        src/autostart.cpp
124
148
        src/common.cpp
130
154
        src/fltkfunctions.cpp
131
155
        src/panel.cpp
132
156
        src/themes.cpp
133
 
        src/ui.cpp
134
157
        src/window.cpp
135
158
        ${XML_SOURCES}
136
 
        ${FLTK_SRCS2}
137
159
)
 
160
find_package(Gettext)
 
161
if(GETTEXT_FOUND)
 
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})
 
166
endif()
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!
 
177
if(result)
 
178
        set(ALL_LIBS ${ALL_LIBS} fltk_SHARED fltk_images_SHARED)
 
179
endif()
 
180
## link them up!
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})