Skip to content

Commit

Permalink
Merge pull request #17 from rhattersley/cmake
Browse files Browse the repository at this point in the history
Switch to CMake
  • Loading branch information
pelson committed Sep 1, 2015
2 parents 87e6a77 + 0478390 commit cfcf01d
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 57 deletions.
27 changes: 2 additions & 25 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,28 +1,5 @@
# Editors
*.swp

# Autotools/build artifacts
.deps
.libs

Makefile
Makefile.in

aclocal.m4
ar-lib
autom4te.cache
compile
config.*
configure
depcomp
install-sh
libtool
ltmain.sh
m4
missing
stamp-h1
test-driver

*.la
*.lo
*.o
# Out-of-source build
build
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ addons:
apt:
packages:
- check
script:
# Not sure why this is needed ... works OK locally.
- mkdir m4
- autoreconf --install
- ./configure
install:
- mkdir build
- cd build
- cmake ..
- make
- make check
script:
- ctest
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cmake_minimum_required(VERSION 2.8)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/")
project(libmo_unpack)
enable_testing()
add_subdirectory(src)
add_subdirectory(tests)
27 changes: 27 additions & 0 deletions CMakeModules/FindCheck.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

IF (CHECK_INCLUDE_DIR)
# Already in cache, be silent
SET(CHECK_FIND_QUIETLY TRUE)
ENDIF (CHECK_INCLUDE_DIR)

FIND_PATH(CHECK_INCLUDE_DIR NAMES check.h)

# Look for the library.
FIND_LIBRARY(CHECK_LIBRARY NAMES check)

IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4)
# handle the QUIETLY and REQUIRED arguments and set CHECK_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(Check "Please install 'check' and 'check-devel' packages" CHECK_LIBRARY CHECK_INCLUDE_DIR)
ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4)

IF(CHECK_FOUND)
SET( CHECK_LIBRARIES ${CHECK_LIBRARY} )
ELSE(CHECK_FOUND)
SET( CHECK_LIBRARIES )
ENDIF(CHECK_FOUND)

MARK_AS_ADVANCED(CHECK_INCLUDE_DIR)
MARK_AS_ADVANCED(CHECK_LIBRARY)
2 changes: 0 additions & 2 deletions Makefile.am

This file was deleted.

12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@

The first time you build from a clone of this repo you will need to execute:
```
$ autoreconf --install
$ mkdir build
$ cd build
$ cmake ..
```

The build process itself is then the usual:
The build process itself on Linux is then the usual:
```
$ ./configure
$ make
$ make install
```

To run the tests:
```
$ make test
```
11 changes: 0 additions & 11 deletions configure.ac

This file was deleted.

9 changes: 9 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include_directories(.)

add_library(mo_unpack SHARED convert_float_ibm_to_ieee32.c convert_float_ieee32_to_ibm.c extract_bitmaps.c extract_nbit_words.c extract_wgdos_row.c logerrors.c pack_ppfield.c read_wgdos_bitmaps.ibm.c rlencode.c uascii.c unpack_ppfield.c wgdos_decode_field_parameters.c wgdos_decode_row_parameters.c wgdos_expand_row_to_data.c wgdos_pack.c wgdos_unpack.c)

set_target_properties(mo_unpack PROPERTIES SOVERSION 3)

install(TARGETS mo_unpack DESTINATION lib)
install(FILES src/wgdosstuff.h DESTINATION include)

5 changes: 0 additions & 5 deletions src/Makefile.am

This file was deleted.

8 changes: 8 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
enable_testing()
find_package(Check REQUIRED)
include_directories(${CHECK_INCLUDE_DIRS})
set(LIBS ${LIBS} ${CHECK_LIBRARIES} mo_unpack m rt pthread)
include_directories(. ../src)
add_executable(test_rle check_rle.c)
target_link_libraries(test_rle ${LIBS})
add_test(test_rle ${CMAKE_CURRENT_BINARY_DIR}/test_rle)
5 changes: 0 additions & 5 deletions tests/Makefile.am

This file was deleted.

0 comments on commit cfcf01d

Please sign in to comment.