aboutsummaryrefslogtreecommitdiff
path: root/vendor.cmake
blob: 27d98937f9e71c47f80c78bd90b04d856158ae15 (plain)
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
## Build configuration
# Feel free to copy this file and change settings as you need. To use your own
# variant, use -DVENDOR=<path to your vendor.cmake> when generating the build
# script.

## Naming
# Executable name
set(poi_exe poi)
# Application name
set(poi_name "smolbote")

## Configuration paths, used in lib/configuration/defaults.h.in
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
    set(ConfigPath "smolbote.ini")

    set(FilterPath "hosts")
    set(PluginsPath "plugins")
    set(ProfilesPath "profiles")

    set(BookmarksPath "bookmarks.xbel")
    set(DownloadsPath "~/Downloads")
else()
    set(ConfigPath "~/.config/smolbote/smolbote.cfg")

    set(FilterPath "~/.config/smolbote/hosts.d")
    set(PluginsPath "~/.config/smolbote/plugins.d")
    set(ProfilesPath "~/.config/smolbote/profiles.d")

    set(BookmarksPath "~/.config/smolbote/bookmarks.xbel")
    set(DownloadsPath "~/Downloads")
endif()


## Install Paths
# Binaries will be installed to ${CMAKE_INSTALL_PREFIX}/${installPath_bin}
set(installPath_bin bin)

# Plugins will be installed to ${CMAKE_INSTALL_PREFIX}/${installPath_plugin}
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
    set(installPath_plugin bin/plugins)
else()
    set(installPath_plugin lib/smolbote)
endif()

## Version information, used in src/version.h.in
if (EXISTS "${PROJECT_SOURCE_DIR}/.git")
    execute_process(COMMAND git rev-list --count HEAD       WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerRevision OUTPUT_STRIP_TRAILING_WHITESPACE)
    execute_process(COMMAND git rev-parse --short HEAD      WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerShortId  OUTPUT_STRIP_TRAILING_WHITESPACE)
    set(VerTag      "r${VerRevision}")
    set(VerDescribe "r${VerRevision}-${VerShortId}")
    execute_process(COMMAND git rev-parse HEAD              WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerCommit   OUTPUT_STRIP_TRAILING_WHITESPACE)
    execute_process(COMMAND git rev-parse --abbrev-ref HEAD WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerBranch   OUTPUT_STRIP_TRAILING_WHITESPACE)
else()
    message(FATAL_ERROR "Cannot find repository metadata. Please set version information in vendor.cmake")
    #set(VerTag      "0.2.2")
    #set(VerDescribe "0.2.2-unknown")
    #set(VerCommit   "00000000")
    #set(VerBranch   "unknown")
endif()

if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -O2")

elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -O2 -march=native")

elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")

endif()