Skip to content

Commit

Permalink
Merge pull request #6 from JohanMabille/rename
Browse files Browse the repository at this point in the history
Rename and license
  • Loading branch information
JohanMabille authored Feb 21, 2024
2 parents ccafa63 + 09b557e commit bb4d1a1
Show file tree
Hide file tree
Showing 13 changed files with 2,408 additions and 146 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ jobs:

- name: Build
working-directory: build
run: cmake --build . --target test_xparrow_lib --parallel 8
run: cmake --build . --target test_sparrow_lib --parallel 8

- name: Run tests
working-directory: build
run: ./test/test_xparrow_lib
run: ./test/test_sparrow_lib
4 changes: 2 additions & 2 deletions .github/workflows/osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ jobs:

- name: Build
working-directory: build
run: cmake --build . --target test_xparrow_lib --parallel 8
run: cmake --build . --target test_sparrow_lib --parallel 8

- name: Run tests
working-directory: build
run: ./test/test_xparrow_lib
run: ./test/test_sparrow_lib
4 changes: 2 additions & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ jobs:

- name: Build
working-directory: build
run: cmake --build . --target test_xparrow_lib --parallel 8
run: cmake --build . --target test_sparrow_lib --parallel 8

- name: Run tests
working-directory: build
run: ./test/test_xparrow_lib
run: ./test/test_sparrow_lib
78 changes: 42 additions & 36 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,53 +1,59 @@
############################################################################
# Copyright (c) QuantStack #
# #
# Distributed under the terms of the BSD 3-Clause License. #
# #
# The full license is in the file LICENSE, distributed with this software. #
############################################################################
# Copyright 2024 Man Group Operations Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required(VERSION 3.8)
project(xparrow CXX)
project(sparrow CXX)

set(XPARROW_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
set(SPARROW_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)

# Versionning
# ===========

file(STRINGS "${XPARROW_INCLUDE_DIR}/xparrow/xparrow_version.hpp" xparrow_version_defines
REGEX "#define XPARROW_VERSION_(MAJOR|MINOR|PATCH)")
foreach(ver ${xparrow_version_defines})
if(ver MATCHES "#define XPARROW_VERSION_(MAJOR|MINOR|PATCH) +([^ ]+)$")
set(XPARROW_VERSION_${CMAKE_MATCH_1} "${CMAKE_MATCH_2}" CACHE INTERNAL "")
file(STRINGS "${SPARROW_INCLUDE_DIR}/sparrow/sparrow_version.hpp" sparrow_version_defines
REGEX "#define SPARROW_VERSION_(MAJOR|MINOR|PATCH)")
foreach(ver ${sparrow_version_defines})
if(ver MATCHES "#define SPARROW_VERSION_(MAJOR|MINOR|PATCH) +([^ ]+)$")
set(SPARROW_VERSION_${CMAKE_MATCH_1} "${CMAKE_MATCH_2}" CACHE INTERNAL "")
endif()
endforeach()
set(${PROJECT_NAME}_VERSION
${XPARROW_VERSION_MAJOR}.${XPARROW_VERSION_MINOR}.${XPARROW_VERSION_PATCH})
message(STATUS "Building xparrow v${${PROJECT_NAME}_VERSION}")
${SPARROW_VERSION_MAJOR}.${SPARROW_VERSION_MINOR}.${SPARROW_VERSION_PATCH})
message(STATUS "Building sparrow v${${PROJECT_NAME}_VERSION}")

# Build options
# =============

OPTION(BUILD_TESTS "xparrow test suite" OFF)
OPTION(BUILD_TESTS "sparrow test suite" OFF)

# Dependencies
# ============

# Build
# =====

set(XPARROW_HEADERS
${XPARROW_INCLUDE_DIR}/xparrow/xbuffer.hpp
${XPARROW_INCLUDE_DIR}/xparrow/xparrow_version.hpp
set(SPARROW_HEADERS
${SPARROW_INCLUDE_DIR}/sparrow/spbuffer.hpp
${SPARROW_INCLUDE_DIR}/sparrow/sparrow_version.hpp
)

add_library(xparrow INTERFACE)
add_library(sparrow INTERFACE)

target_include_directories(xparrow INTERFACE
$<BUILD_INTERFACE:${XPARROW_INCLUDE_DIR}>
target_include_directories(sparrow INTERFACE
$<BUILD_INTERFACE:${SPARROW_INCLUDE_DIR}>
$<INSTALL_INTERFACE:include>)

target_compile_features(xparrow INTERFACE cxx_std_20)
target_compile_features(sparrow INTERFACE cxx_std_20)

if (BUILD_TESTS)
add_subdirectory(test)
Expand All @@ -59,36 +65,36 @@ endif ()
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)

install(TARGETS xparrow
install(TARGETS sparrow
EXPORT ${PROJECT_NAME}-targets)

# Makes the project importable from the build directory
export(EXPORT ${PROJECT_NAME}-targets
FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake")

install(FILES ${XPARROW_HEADERS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/xparrow)
install(FILES ${SPARROW_HEADERS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sparrow)

set(XPARROW_CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/cmake/${PROJECT_NAME}" CACHE
STRING "install path for xparrowConfig.cmake")
set(SPARROW_CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/cmake/${PROJECT_NAME}" CACHE
STRING "install path for sparrowConfig.cmake")

configure_package_config_file(${PROJECT_NAME}Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION ${XPARROW_CMAKECONFIG_INSTALL_DIR})
INSTALL_DESTINATION ${SPARROW_CMAKECONFIG_INSTALL_DIR})

# xparrow is header-only and does not depend on the architecture.
# Remove CMAKE_SIZEOF_VOID_P from xparrowConfigVersion.cmake so that an xparrowConfig.cmake
# sparrow is header-only and does not depend on the architecture.
# Remove CMAKE_SIZEOF_VOID_P from sparrowConfigVersion.cmake so that an sparrowConfig.cmake
# generated for a 64 bit target can be used for 32 bit targets and vice versa.
set(_XPARROW_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
set(_SPARROW_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
unset(CMAKE_SIZEOF_VOID_P)
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
VERSION ${${PROJECT_NAME}_VERSION}
COMPATIBILITY AnyNewerVersion)
set(CMAKE_SIZEOF_VOID_P ${_XPARROW_CMAKE_SIZEOF_VOID_P})
set(CMAKE_SIZEOF_VOID_P ${_SPARROW_CMAKE_SIZEOF_VOID_P})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
DESTINATION ${XPARROW_CMAKECONFIG_INSTALL_DIR})
DESTINATION ${SPARROW_CMAKECONFIG_INSTALL_DIR})
install(EXPORT ${PROJECT_NAME}-targets
FILE ${PROJECT_NAME}Targets.cmake
DESTINATION ${XPARROW_CMAKECONFIG_INSTALL_DIR})
DESTINATION ${SPARROW_CMAKECONFIG_INSTALL_DIR})

Loading

0 comments on commit bb4d1a1

Please sign in to comment.