Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
herumi committed Dec 31, 2022
0 parents commit fb381c5
Show file tree
Hide file tree
Showing 14 changed files with 2,988 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: herumi
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build* # cmake
8 changes: 8 additions & 0 deletions Android.bp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//#################################################
cc_library_headers {
name: "xbyak_headers",
vendor: true,
export_include_dirs: [
"xbyak_riscv"
],
}
55 changes: 55 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
cmake_minimum_required(VERSION 2.6...3.0.2)

project(xbyak_riscv LANGUAGES CXX VERSION 6.68)

file(GLOB headers xbyak_riscv/*.h)

if (DEFINED CMAKE_VERSION AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.0.2)
include(GNUInstallDirs)
add_library(${PROJECT_NAME} INTERFACE)
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})

target_include_directories(
${PROJECT_NAME} INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)

install(
TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}-targets
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
)

include(CMakePackageConfigHelpers)
configure_package_config_file(
cmake/config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
COMPATIBILITY SameMajorVersion
)

install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
DESTINATION
${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)

install(
EXPORT ${PROJECT_NAME}-targets
NAMESPACE ${PROJECT_NAME}::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)
elseif(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR)
set(CMAKE_INSTALL_INCLUDEDIR "include")
endif()

install(
FILES ${headers}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/xbyak_riscv
)
27 changes: 27 additions & 0 deletions COPYRIGHT
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

Copyright (c) 2007 MITSUNARI Shigeo
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
Neither the name of the copyright owner nor the names of its contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
PREFIX?=/usr/local
INSTALL_DIR=$(PREFIX)/include/xbyak_riscv

all:
$(MAKE) -C sample

clean:
$(MAKE) -C sample clean

install:
mkdir -p $(INSTALL_DIR)
cp -pR xbyak_riscv/*.h $(INSTALL_DIR)

uninstall:
rm -i $(INSTALL_DIR)/*.h
rmdir $(INSTALL_DIR)

update:
$(MAKE) -C gen

test:
$(MAKE) -C test test

.PHONY: test update
3 changes: 3 additions & 0 deletions cmake/config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@PACKAGE_INIT@

include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake")
8 changes: 8 additions & 0 deletions cmake/meson-config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@PACKAGE_INIT@

if(NOT TARGET @TARGET_NAME@)
add_library(@TARGET_NAME@ INTERFACE IMPORTED)
set_target_properties(@TARGET_NAME@ PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "@ABSOLUTE_INCLUDE_DIR@"
)
endif()
3 changes: 3 additions & 0 deletions doc/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# History

- 2012/Dec/31 first version
14 changes: 14 additions & 0 deletions doc/install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Install

The following files are necessary. Please add the path to your compile directory.

- xbyak_riscv.h
- xbyak_mnemonic.h

Linux:
```
make install
```

These files are copied into `/usr/local/include/xbyak_riscv`.

12 changes: 12 additions & 0 deletions doc/usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Usage

Inherit `Xbyak_riscv::CodeGenerator` class and make the class method.
```
#include <xbyak_riscv/xbyak_riscv.hpp>
struct Code : Xbyak_riscv::CodeGenerator {
Code(int x)
{
}
};
```
45 changes: 45 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# SPDX-FileCopyrightText: 2021 Andrea Pappacoda
#
# SPDX-License-Identifier: BSD-3-Clause

project(
'xbyak_riscv',
'cpp',
version: '6.68',
license: 'BSD-3-Clause',
default_options: 'b_ndebug=if-release'
)

install_subdir('xbyak_riscv', install_dir: get_option('includedir'))

xbyak_riscv_dep = declare_dependency(include_directories: include_directories('.'))

if meson.version().version_compare('>=0.54.0')
meson.override_dependency(meson.project_name(), xbyak_riscv_dep)
endif

import('pkgconfig').generate(
name: meson.project_name(),
description: 'JIT assembler for RISC-V',
version: meson.project_version(),
url: 'https://github.com/herumi/xbyak_riscv'
)

if meson.version().version_compare('>=0.50.0')
cmake = import('cmake')

cmake.write_basic_package_version_file(
name: meson.project_name(),
version: meson.project_version()
)

cmake_conf = configuration_data()
cmake_conf.set('TARGET_NAME', meson.project_name() + '::' + meson.project_name())
cmake_conf.set('ABSOLUTE_INCLUDE_DIR', get_option('prefix')/get_option('includedir'))

cmake.configure_package_config_file(
name: meson.project_name(),
input: 'cmake'/'meson-config.cmake.in',
configuration: cmake_conf
)
endif
49 changes: 49 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

# Xbyak_riscv 1.00 [![Badge Build]][Build Status]

*A C++ JIT assembler for RISC-V

## Menu

- [Install]
- [Usage]
- [Changelog]

## Abstract

Xbyak_riscv is a C++ header library that enables dynamically to assemble RISC-V instructions.

## Feature

### News


### Supported OS


### Supported Compilers


## License

[BSD-3-Clause License](http://opensource.org/licenses/BSD-3-Clause)

## Author

#### 光成滋生 Mitsunari Shigeo
[GitHub](https://github.com/herumi) | [Website (Japanese)](http://herumi.in.coocan.jp/) | [herumi@nifty.com](mailto:herumi@nifty.com)

## Sponsors welcome
[GitHub Sponsor](https://github.com/sponsors/herumi)

<!----------------------------------------------------------------------------->

[Badge Build]: https://github.com/herumi/xbyak_riscv/actions/workflows/main.yml/badge.svg
[Build Status]: https://github.com/herumi/xbyak_riscv/actions/workflows/main.yml

[License]: COPYRIGHT

[Changelog]: doc/changelog.md
[Install]: doc/install.md
[Usage]: doc/usage.md

Loading

0 comments on commit fb381c5

Please sign in to comment.