Bläddra i källkod

Switched shell scripts to use sh, fixed some CMake bugs and added build types.

Dalton Nell 10 år sedan
förälder
incheckning
ce9a0ca84a
3 ändrade filer med 32 tillägg och 14 borttagningar
  1. 30
    12
      CMakeLists.txt
  2. 1
    1
      README.md
  3. 1
    1
      generateReadme.sh

+ 30
- 12
CMakeLists.txt Visa fil

@@ -3,20 +3,27 @@ cmake_minimum_required( VERSION 2.8 )
3 3
 project( "slop" )
4 4
 set( slop_VERSION_MAJOR 3 )
5 5
 set( slop_VERSION_MINOR 1 )
6
-set( slop_VERSION_PATCH 13 )
6
+set( slop_VERSION_PATCH 14 )
7 7
 
8 8
 set( BIN_TARGET     "${PROJECT_NAME}" )
9 9
 set( CMAKE_INSTALL_PREFIX "/usr/bin" )
10 10
 
11
+if( NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE )
12
+   set( CMAKE_BUILD_TYPE RelWithDebInfo )
13
+endif()
14
+
11 15
 # Linux compiler initialization.
12 16
 if ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR
13 17
      "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR
14 18
      "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" )
15
-    set( CMAKE_CXX_FLAGS
16
-         "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -pedantic-errors -Wno-unused-parameter" )
19
+     set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unused-parameter" )
20
+     set( CMAKE_CXX_FLAGS_DEBUG "-Wextra -pedantic-errors -O0 -g" )
21
+     set( CMAKE_CXX_FLAGS_RELEASE "-O2" )
22
+     set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g" )
17 23
          # -Wall:   Enable all warnings.
18 24
          # -Wextra: Enable some more warnings.
19 25
          # -Werror: Have errors on warnings.
26
+         # -pedantic-errors: Even more errors.
20 27
          # -Wno-unused-parameter: Prevent unused variable warning. (Several functions are required to have unecessary variables because X11.)
21 28
 else()
22 29
     message( FATAL_ERROR "Your operating system isn't supported yet! CMake will now exit." )
@@ -56,8 +63,8 @@ endif()
56 63
 
57 64
 # By default our src/options.ggo has our cmake versions variables for
58 65
 # the 'version ""' line. We replace them here.
59
-configure_file( "src/cmdline.in"
60
-                "src/cmdline.h" )
66
+# The ${CMAKE_SOURCE_DIR} is there to fix problems with OpenBSD's out-of-source build black magic.
67
+configure_file( "src/cmdline.in" "${CMAKE_SOURCE_DIR}/src/cmdline.h" )
61 68
 
62 69
 # This allows for "make README.md" to be ran to update the README's help
63 70
 # section automatically. We don't add it to ALL because running arbitrary
@@ -85,18 +92,29 @@ set( CMAKE_CXX_FLAGS
85 92
      "${CMAKE_CXX_FLAGS} ${CMAKE_IMLIB2_CXX_FLAGS}" )
86 93
 
87 94
 # Includes
88
-include_directories( ${X11_INCLUDE_DIR}
89
-                     ${XEXT_INCLUDE_DIR}
90
-                     ${RT_INCLUDE_DIR} )
95
+if ( RT_INCLUDE_DIR )
96
+    include_directories( ${X11_INCLUDE_DIR}
97
+                         ${XEXT_INCLUDE_DIR}
98
+                         ${RT_INCLUDE_DIR} )
99
+else()
100
+    include_directories( ${X11_INCLUDE_DIR}
101
+                         ${XEXT_INCLUDE_DIR} )
102
+endif()
91 103
 
92 104
 # Executable
93 105
 add_executable( "${BIN_TARGET}" ${source} )
94 106
 
95 107
 # Libraries
96
-target_link_libraries( "${BIN_TARGET}"
97
-                       ${X11_LIBRARIES}
98
-                       "${XEXT_LIBRARY}"
99
-                       "${RT_LIBRARY}" )
108
+if ( RT_LIBRARY )
109
+    target_link_libraries( "${BIN_TARGET}"
110
+                           ${X11_LIBRARIES}
111
+                           "${XEXT_LIBRARY}"
112
+                           "${RT_LIBRARY}" )
113
+else()
114
+    target_link_libraries( "${BIN_TARGET}"
115
+                           ${X11_LIBRARIES}
116
+                           "${XEXT_LIBRARY}" )
117
+endif()
100 118
 
101 119
 install( TARGETS ${BIN_TARGET}
102 120
          DESTINATION  ${CMAKE_INSTALL_PREFIX} )

+ 1
- 1
README.md Visa fil

@@ -84,7 +84,7 @@ Make sure to check out and install [maim](https://github.com/naelstrof/maim) too
84 84
 help
85 85
 ----
86 86
 ```text
87
-slop v3.1.13
87
+slop v3.1.14
88 88
 
89 89
 Copyright (C) 2014 Dalton Nell, Slop Contributors
90 90
 (https://github.com/naelstrof/slop/graphs/contributors)

+ 1
- 1
generateReadme.sh Visa fil

@@ -1,4 +1,4 @@
1
-#!/bin/bash
1
+#!/bin/sh
2 2
 # generateReadme.sh: Regenerates the help section of the README.md using output from ./slop --help.
3 3
 
4 4
 # Remove help section