Skip to content

Commit

Permalink
Cleanup CMakeLists.txt
Browse files Browse the repository at this point in the history
Signed-off-by: yamacir-kit <[email protected]>
  • Loading branch information
yamacir-kit committed Nov 24, 2024
1 parent b190b2a commit 79a229f
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 104 deletions.
39 changes: 23 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,17 @@ install( # /usr/share/meevax/meevax-config-version.cmake
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake
DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})

# ---- TARGET uninstall --------------------------------------------------------

add_custom_target(uninstall
COMMAND sudo rm -rf ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/${PROJECT_NAME}
COMMAND sudo rm -rf ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
COMMAND sudo rm -rf ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}*
COMMAND sudo rm -rf ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})

# ---- TARGET package ----------------------------------------------------------

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Tatsuya Yamasaki")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
Expand All @@ -176,35 +184,34 @@ endif()

enable_testing()

if(CMAKE_SYSTEM_NAME STREQUAL Linux)
find_program(${PROJECT_NAME}_MEMORY_CHECK_COMMAND valgrind)
set(${PROJECT_NAME}_MEMORY_CHECK ${${PROJECT_NAME}_MEMORY_CHECK_COMMAND} --error-exitcode=1 --leak-check=full --quiet --show-leak-kinds=all)
find_program(${PROJECT_NAME}_VALGRIND valgrind)

if(${PROJECT_NAME}_VALGRIND STREQUAL ${PROJECT_NAME}_VALGRIND-NOTFOUND)
set(${PROJECT_NAME}_TEST "")
else()
set(${PROJECT_NAME}_MEMORY_CHECK "")
set(${PROJECT_NAME}_TEST ${${PROJECT_NAME}_VALGRIND} --error-exitcode=1 --leak-check=full --quiet --show-leak-kinds=all)
endif()

file(GLOB ${PROJECT_NAME}_TEST_SS ${CMAKE_CURRENT_SOURCE_DIR}/test/*.ss)

foreach(EACH IN LISTS ${PROJECT_NAME}_TEST_SS)
get_filename_component(FILENAME ${EACH} NAME_WE)
add_test(NAME ${FILENAME} COMMAND ${${PROJECT_NAME}_MEMORY_CHECK} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/meevax ${EACH})
endforeach()

file(GLOB ${PROJECT_NAME}_TEST_CPP ${CMAKE_CURRENT_SOURCE_DIR}/test/*.cpp)
file(GLOB ${PROJECT_NAME}_TEST_SH ${CMAKE_CURRENT_SOURCE_DIR}/test/*.sh)
file(GLOB ${PROJECT_NAME}_TEST_SS ${CMAKE_CURRENT_SOURCE_DIR}/test/*.ss)

foreach(EACH IN LISTS ${PROJECT_NAME}_TEST_CPP)
get_filename_component(FILENAME ${EACH} NAME_WE)
add_executable(test_${FILENAME} ${EACH})
target_link_libraries(test_${FILENAME} PRIVATE basis kernel)
target_compile_options(test_${FILENAME} PUBLIC -Wno-deprecated-declarations)
add_test(NAME test/${FILENAME} COMMAND ${${PROJECT_NAME}_MEMORY_CHECK} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_${FILENAME})
add_test(NAME test/${FILENAME} COMMAND ${${PROJECT_NAME}_TEST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_${FILENAME})
endforeach()

file(GLOB ${PROJECT_NAME}_TEST_SH ${CMAKE_CURRENT_SOURCE_DIR}/test/*.sh)

foreach(EACH IN LISTS ${PROJECT_NAME}_TEST_SH)
get_filename_component(FILENAME ${EACH} NAME_WE)
add_test(NAME ${FILENAME} COMMAND ${${PROJECT_NAME}_MEMORY_CHECK} ${EACH} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/meevax)
add_test(NAME ${FILENAME} COMMAND ${${PROJECT_NAME}_TEST} ${EACH} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/meevax)
endforeach()

foreach(EACH IN LISTS ${PROJECT_NAME}_TEST_SS)
get_filename_component(FILENAME ${EACH} NAME_WE)
add_test(NAME ${FILENAME} COMMAND ${${PROJECT_NAME}_TEST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/meevax ${EACH})
endforeach()

# ---- TARGET continuous-integration -------------------------------------------
Expand Down
48 changes: 12 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ library is installed as a CMake package for [easy
linking](./example/CMakeLists.txt), and [any C++ classes can be used from
Lisp-1 scripts](./example/example.ss) [via simple stubs](example/example.cpp).

### Releases

Latest release is [here](https://github.com/yamacir-kit/meevax/releases).

### Features

- Traditional SECD machine [[2](#Landin-1964)].
Expand Down Expand Up @@ -84,48 +80,28 @@ Procedures for each standard are provided by the following R7RS-style libraries:
- [GNU Binutils](https://www.gnu.org/software/binutils/)
- [GNU Multiple Precision Arithmetic Library (GMP)](https://gmplib.org/)

### Install
### Releases

``` bash
cmake -B build -DCMAKE_BUILD_TYPE=Release
cd build
make package
sudo apt install build/meevax_0.5.273_amd64.deb
```
Latest release is [here](https://github.com/yamacir-kit/meevax/releases).

or
### Instruction

First, generate a Makefile using CMake with the following command:

``` bash
cmake -B build -DCMAKE_BUILD_TYPE=Release
cd build
make install
```

### Uninstall

If you installed with `sudo apt install`,

``` bash
sudo apt remove meevax
```

or if you installed with `make install`,

``` bash
sudo rm -rf /usr/local/bin/meevax
sudo rm -rf /usr/local/include/meevax
sudo rm -rf /usr/local/lib/libmeevax*
sudo rm -rf /usr/local/share/meevax
```

### CMake targets
Then, select one of the following targets and `make` it according to your purpose. In most cases, `make install` will be the one you choose.

| Target Name | Description
| Target | Description
|-------------|-------------
| `all` | Build shared-library `libmeevax.0.5.273.so` and executable `meevax`
| `test` | Test executable `meevax`
| `package` | Generate debian package `meevax_0.5.273_amd64.deb`
| `install` | Copy files into `/usr/local` directly
| `all` | Build shared-library `libmeevax.0.5.274.so` and executable `meevax`.
| `install` | Copy files into `/usr/local` directly.
| `package` | Generate debian package `meevax_0.5.274_amd64.deb` (only Ubuntu). The generated package can be installed by `sudo apt install build/meevax_0.5.274_amd64.deb`.
| `test` | Test executable `meevax`. This target requires Valgrind to be installed.
| `uninstall` | Remove files copied to `/usr/local` directly by target `install`.

## Usage

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.273
0.5.274
48 changes: 12 additions & 36 deletions configure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ library is installed as a CMake package for [easy
linking](./example/CMakeLists.txt), and [any C++ classes can be used from
Lisp-1 scripts](./example/example.ss) [via simple stubs](example/example.cpp).

### Releases

Latest release is [here](https://github.com/yamacir-kit/meevax/releases).

### Features

- Traditional SECD machine [[2](#Landin-1964)].
Expand Down Expand Up @@ -84,48 +80,28 @@ Procedures for each standard are provided by the following R7RS-style libraries:
- [GNU Binutils](https://www.gnu.org/software/binutils/)
- [GNU Multiple Precision Arithmetic Library (GMP)](https://gmplib.org/)

### Install
### Releases

``` bash
cmake -B build -DCMAKE_BUILD_TYPE=Release
cd build
make package
sudo apt install build/${PROJECT_NAME}_${PROJECT_VERSION}_amd64.deb
```
Latest release is [here](https://github.com/yamacir-kit/meevax/releases).

or
### Instruction

First, generate a Makefile using CMake with the following command:

``` bash
cmake -B build -DCMAKE_BUILD_TYPE=Release
cd build
make install
```

### Uninstall

If you installed with `sudo apt install`,

``` bash
sudo apt remove meevax
```

or if you installed with `make install`,

``` bash
sudo rm -rf ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/${PROJECT_NAME}
sudo rm -rf ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
sudo rm -rf ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}*
sudo rm -rf ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}
```

### CMake targets
Then, select one of the following targets and `make` it according to your purpose. In most cases, `make install` will be the one you choose.

| Target Name | Description
| Target | Description
|-------------|-------------
| `all` | Build shared-library `libmeevax.${PROJECT_VERSION}.so` and executable `meevax`
| `test` | Test executable `meevax`
| `package` | Generate debian package `meevax_${PROJECT_VERSION}_amd64.deb`
| `install` | Copy files into `${CMAKE_INSTALL_PREFIX}` directly
| `all` | Build shared-library `libmeevax.${PROJECT_VERSION}.so` and executable `meevax`.
| `install` | Copy files into `${CMAKE_INSTALL_PREFIX}` directly.
| `package` | Generate debian package `meevax_${PROJECT_VERSION}_amd64.deb` (only Ubuntu). The generated package can be installed by `sudo apt install build/${PROJECT_NAME}_${PROJECT_VERSION}_amd64.deb`.
| `test` | Test executable `meevax`. This target requires Valgrind to be installed.
| `uninstall` | Remove files copied to `${CMAKE_INSTALL_PREFIX}` directly by target `install`.

## Usage

Expand Down
8 changes: 4 additions & 4 deletions include/meevax/memory/integer_set.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace meevax::inline memory
{
using value_type = T;

using difference_type = std::ptrdiff_t;
using difference_type = std::ptrdiff_t;

using pointer = T *;

Expand Down Expand Up @@ -136,7 +136,7 @@ namespace meevax::inline memory

auto operator ++() noexcept -> auto &
{
if (++iter; not iter)
if (not ++iter)
{
++i;
increment_unless_truthy();
Expand All @@ -151,7 +151,7 @@ namespace meevax::inline memory
{
decrement_unless_truthy();
}
else if (--iter; not iter)
else if (not --iter)
{
--i;
decrement_unless_truthy();
Expand Down Expand Up @@ -318,7 +318,7 @@ namespace meevax::inline memory
{
using value_type = T;

using difference_type = std::ptrdiff_t;
using difference_type = std::ptrdiff_t;

using pointer = T *;

Expand Down
10 changes: 0 additions & 10 deletions script/repl.sh

This file was deleted.

1 change: 0 additions & 1 deletion script/setup-ubuntu-20.04.sh

This file was deleted.

0 comments on commit 79a229f

Please sign in to comment.