Skip to content

Commit

Permalink
Add the sorting algorithm because it's easy and I didn't even notice …
Browse files Browse the repository at this point in the history
…Morwenn made the issue I'm sorry Morwenn I'm so slow q_q

Vastly clean up the libraries forward definitions
Add a single header generator and clean up the CMake a bit (thanks, Dizzyizzy)
Add some github workflows shenanigans (how does this even work???)
  • Loading branch information
ThePhD committed Apr 2, 2020
1 parent bec0a81 commit 837744a
Show file tree
Hide file tree
Showing 46 changed files with 1,288 additions and 437 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/macosx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Style

on: [push]

env:
CTEST_OUTPUT_ON_FAILURE: 1

jobs:
build:

runs-on: macos-latest

steps:
- uses: actions/checkout@v1

- name: configure
run: cmake -B build/debug
run: cmake -B build/release

- name: build
run: cmake --build build/debug --config Debug
run: cmake --build build/release --config Release

- name: test
run: cmake --build build/debug --config Debug --target test
run: cmake --build build/release --config Release --target test
26 changes: 26 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Ubuntu

on: [push]

env:
CTEST_OUTPUT_ON_FAILURE: 1

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: configure
run: cmake -B build/debug
run: cmake -B build/release

- name: build
run: cmake --build build/debug --config Debug
run: cmake --build build/release --config Release

- name: test
run: cmake --build build/debug --config Debug --target test
run: cmake --build build/release --config Release --target test
26 changes: 26 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Windows

on: [push]

env:
CTEST_OUTPUT_ON_FAILURE: 1

jobs:
build:

runs-on: windows-latest

steps:
- uses: actions/checkout@v1

- name: configure
run: cmake -B build/debug
run: cmake -B build/release

- name: build
run: cmake --build build/debug --config Debug
run: cmake --build build/release --config Release

- name: test
run: cmake --build build/debug --config Debug --target test
run: cmake --build build/release --config Release --target test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.vscode/settings.json
.vscode/c_cpp_properties.json
build/
install/
.vs/
CMakeSettings.json
.mypy_cache/
71 changes: 62 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,15 @@ cmake_minimum_required(VERSION 3.12.0)
# the languages the project is going to use. Required.
project(itsy.bitsy VERSION 1.0.0 DESCRIPTION "Standard bit utilities to supplement the C and C++ standard libraries." LANGUAGES C CXX)

# # Pre-dependencies
# this is for all the deps we may or may not need before-hand to make things right
include(CTest)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)

# # Options
option(ITSY_BITSY_TESTS "Enable build of tests" OFF)
option(ITSY_BITSY_SINGLE "Enable build of tests" ON)
option(ITSY_BITSY_TESTS "Enable build of tests" ${BUILD_TESTING})
option(ITSY_BITSY_BENCHMARKS "Enable build of benchmarks" OFF)

# # Top Level Directories
Expand Down Expand Up @@ -55,23 +62,69 @@ if (ITSY_BITSY_IS_TOP_LEVEL_PROJECT)
else()
set(ITSY_BITSY_CLANG_CL OFF)
endif()
if (ITSY_BITSY_TESTS)
enable_testing()
endif()
endif()


# # Targets
file(GLOB_RECURSE itsy_bitsy_sources CONFIGURE_DEPENDS include/itsy/*)
# # itsy.bitsy Target
# Build Target
file(GLOB_RECURSE itsy-bitsy-sources
LIST_DIRECTORIES false
CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/include/itsy/*)

add_library(itsy.bitsy INTERFACE)
target_sources(itsy.bitsy INTERFACE ${itsy_bitsy_sources})
add_library(itsy::bitsy ALIAS itsy.bitsy)
target_include_directories(itsy.bitsy INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_include_directories(itsy.bitsy INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

# # Install Target
# Version configurations
configure_package_config_file(
cmake/itsy.bitsy-config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/cmake/itsy.bitsy-config.cmake"
INSTALL_DESTINATION lib/cmake/itsy.bitsy
NO_CHECK_REQUIRED_COMPONENTS_MACRO)

write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/cmake/itsy.bitsy-config-version.cmake"
COMPATIBILITY AnyNewerVersion)

export(TARGETS itsy.bitsy FILE "${CMAKE_CURRENT_BINARY_DIR}/cmake/itsy.bitsy-targets.cmake")

install(TARGETS itsy.bitsy
EXPORT itsy.bitsy)

install(EXPORT itsy.bitsy
FILE itsy.bitsy-targets.cmake
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/itsy.bitsy")

install(DIRECTORY include/itsy
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")

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

# pkg-config support, except on Windows
if(NOT WIN32 OR NOT CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
set(PKGCONFIG_INSTALL_DIR
"${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig"
CACHE PATH "Path where itsy.bitsy.pc is installed")

configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/itsy.bitsy.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/itsy.bitsy.pc" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/itsy.bitsy.pc" DESTINATION "${PKGCONFIG_INSTALL_DIR}")
endif()

if (ITSY_BITSY_SINGLE)
add_subdirectory(single)
endif()

# # Benchmarks, Tests, Examples
if (ITSY_BITSY_TESTS)
enable_testing()
add_subdirectory(tests)
endif()
if (ITSY_BITSY_EXAMPLES)
Expand Down
1 change: 0 additions & 1 deletion benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ if (MSVC)
/std:c++latest
/EHsc
/utf-8
/experimental:preprocessor
/permissive-
/W4
)
Expand Down
172 changes: 86 additions & 86 deletions benchmarks/results/fresh/sources.json
Original file line number Diff line number Diff line change
@@ -1,86 +1,86 @@
{
"name": "bit",
"scale": {
"type": "relative",
"to": "base"
},
"categories": [
{
"name": "find",
"prefix": "find_",
"suffix": ""
},
{
"name": "count",
"prefix": "count_",
"suffix": ""
},
{
"name": "fill",
"prefix": "fill_",
"suffix": ""
},
{
"name": "copy",
"prefix": "copy_",
"suffix": ""
},
{
"name": "copy_n",
"prefix": "sized_copy_",
"suffix": ""
},
{
"name": "swap_ranges",
"prefix": "swap_ranges_",
"suffix": ""
},
{
"name": "rotate",
"prefix": "rotate_",
"suffix": ""
},
{
"name": "equal",
"prefix": "equal_",
"suffix": ""
}
],
"data_labels": [
{
"ascending": true,
"name": "real_time",
"format": "clock"
},
{
"ascending": true,
"name": "cpu_time",
"format": "clock"
}
],
"remove_suffixes": [
",",
"_"
],
"remove_prefixes": [
",",
"_"
],
"sources": [
{
"prefix": "libc++",
"file": "libc++.itsy.bitsy.benchmarks.json",
"required": false
},
{
"prefix": "libstdc++",
"file": "libstdc++.itsy.bitsy.benchmarks.json",
"required": false
},
{
"prefix": "vc++",
"file": "vc++.itsy.bitsy.benchmarks.json",
"required": false
}
]
}
{
"name": "bit",
"scale": {
"type": "relative",
"to": "base"
},
"categories": [
{
"name": "find",
"prefix": "find_",
"suffix": ""
},
{
"name": "count",
"prefix": "count_",
"suffix": ""
},
{
"name": "fill",
"prefix": "fill_",
"suffix": ""
},
{
"name": "copy",
"prefix": "copy_",
"suffix": ""
},
{
"name": "copy_n",
"prefix": "sized_copy_",
"suffix": ""
},
{
"name": "swap_ranges",
"prefix": "swap_ranges_",
"suffix": ""
},
{
"name": "rotate",
"prefix": "rotate_",
"suffix": ""
},
{
"name": "equal",
"prefix": "equal_",
"suffix": ""
}
],
"data_labels": [
{
"ascending": true,
"name": "real_time",
"format": "clock"
},
{
"ascending": true,
"name": "cpu_time",
"format": "clock"
}
],
"remove_suffixes": [
",",
"_"
],
"remove_prefixes": [
",",
"_"
],
"sources": [
{
"prefix": "libc++",
"file": "libc++.itsy.bitsy.benchmarks.json",
"required": false
},
{
"prefix": "libstdc++",
"file": "libstdc++.itsy.bitsy.benchmarks.json",
"required": false
},
{
"prefix": "vc++",
"file": "vc++.itsy.bitsy.benchmarks.json",
"required": false
}
]
}
29 changes: 29 additions & 0 deletions cmake/itsy.bitsy-config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# itsy.bitsy
#
# Copyright ⓒ 2019-present ThePhD.
#
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# See https://github.com/ThePhD/itsy_bitsy#using-the-library for documentation.

@PACKAGE_INIT@

include("${CMAKE_CURRENT_LIST_DIR}/sol2-targets.cmake")

MESSAGE(STATUS ${CMAKE_CURRENT_LIST_DIR})

if (TARGET sol2)
get_target_property(SOL2_INCLUDE_DIRS
sol2 INTERFACE_INCLUDE_DIRECTORIES)
set_and_check(SOL2_INCLUDE_DIRS "${SOL2_INCLUDE_DIRS}")
set(SOL2_LIBRARIES sol2)
endif()

if(TARGET sol2_single)
get_target_property(SOL2_SINGLE_INCLUDE_DIRS
sol2_single INTERFACE_INCLUDE_DIRECTORIES)
set_and_check(SOL2_INCLUDE_DIRS "${SOL2_SINGLE_INCLUDE_DIRS}")
set(SOL2_LIBRARIES_SINGLE sol2_single)
endif()
Loading

1 comment on commit 837744a

@Morwenn
Copy link

@Morwenn Morwenn commented on 837744a Apr 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you implemented it in the hours after you noticed it you're actually the opposite of slow, don't worry about that ❤️

You really need to work on commit separation at some point though, be it only to turn revert and cherry pick into usable tools x)

Please sign in to comment.