Skip to content

Code generation with preprocessor metaprogramming #163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
ae1865e
Slicing operator now accepts any number of arguments (governed by BLI…
vukics Jul 3, 2018
03108f1
Merge branch 'master' of https://github.com/blitzpp/blitz
Apr 24, 2020
001d408
gitignore
Apr 24, 2020
4f5db0f
Merge branch 'master' of https://github.com/blitzpp/blitz
May 25, 2020
3d18c90
Enable serialization is not an option now, it gets enabled if Boost.S…
vukics Sep 1, 2020
a39b77e
Greatly simplified the content of the package, making configuration/b…
vukics Sep 7, 2020
a57fcc9
The compiler-dependent config mechanism is completely obsolate.
vukics Oct 2, 2020
d7dd82f
Adopted “modern cmake” – configuration now works and compilation also…
vukics Oct 5, 2020
2479054
_bz_typename => typename throughout
vukics Oct 6, 2020
254967f
set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) removes some boilerplate
vukics Oct 6, 2020
149f014
Pruned project tree
vukics Oct 6, 2020
6a3906e
Testing/installation/packaging off for the moment.
vukics Oct 6, 2020
d718f8d
BZ_DEBUG is now part of the interface in debug mode
vukics Oct 7, 2020
df1bffb
Testsuite now only if configured as self-standing project.
vukics Oct 8, 2020
3f5676d
Cleaner treatment of generated headers.
vukics Oct 9, 2020
e53c13e
git hash query now works
vukics Oct 12, 2020
84bef2f
Everyone just includes from the top directory.
vukics Oct 12, 2020
744da9b
Cleaner check for Boost::serialization
vukics Oct 14, 2020
22e6944
Added very simple install mechanism.
vukics Nov 13, 2020
89563d5
Switched to newest version of GetGitRevisionDescription
vukics Feb 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Build dir
/build*

# Kdev files
*.kdev4

# Compiled Object files
*.slo
*.lo
Expand Down
72 changes: 0 additions & 72 deletions .travis.yml

This file was deleted.

129 changes: 73 additions & 56 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
cmake_minimum_required(VERSION 3.12) # FindPython
cmake_policy(VERSION 3.1)

set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
cmake_minimum_required(VERSION 3.16) # FindPython

# Blitz version and release date.

Expand All @@ -11,76 +8,96 @@ set(blitz_PATCH 3)
set(blitz_VERSION ${blitz_MAJOR}.${blitz_MINOR}.${blitz_PATCH})
set(BZ_PACKAGE_STRING "${CMAKE_PROJECT_NAME} ${blitz_MAJOR}.${blitz_MINOR}")

# Set the project
# Set the project

project(blitz VERSION ${blitz_VERSION} LANGUAGES CXX)
project(blitz VERSION ${blitz_VERSION}
LANGUAGES CXX
DESCRIPTION "A multi-array library -- fork by András Vukics"
HOMEPAGE_URL "https://github.com/vukics/blitz")

option(BUILD_DOC "Build documentation" OFF)
option(BUILD_TESTING "Build tests, examples and benchmarks" OFF)
# Ubuntu 20.04LTS versions for compilers

# Packaging
set(GCC_MINIMAL 9.3)
set(CLANG_MINIMAL 10.0)

set(CPACK_GENERATOR "TGZ")
set(CPACK_PACKAGE_VERSION_MAJOR ${blitz_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${blitz_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${blitz_PATCH})
set(CPACK_SOURCE_GENERATOR "TBZ2")
set(CPACK_SOURCE_PACKAGE_FILE_NAME blitz-${blitz_VERSION})
set(CPACK_SOURCE_IGNORE_FILES ".*.swp$" ".*.swo$" "~$" ".bz2$" ".gz$")
if (${CMAKE_CXX_COMPILER_ID} STREQUAL GNU AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS ${GCC_MINIMAL})
message(FATAL_ERROR "GCC g++ version >= ${GCC_MINIMAL} needed.")
endif ()

include(CPack)
include(UnitTests)
include(BlitzConfigFileName)
include(Win32Compat)
include(CreatePkgConfig)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
if (${CMAKE_CXX_COMPILER_ID} STREQUAL Clang AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS ${CLANG_MINIMAL})
message(FATAL_ERROR "Clang version >= ${CLANG_MINIMAL} needed.")
endif ()

include_directories(BEFORE SYSTEM ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

add_custom_target(generated-headers ALL)
# Packaging

set(PKGCONFIG_LIBS -lblitz)
#set(CPACK_GENERATOR "TGZ")
#set(CPACK_PACKAGE_VERSION_MAJOR ${blitz_MAJOR})
#set(CPACK_PACKAGE_VERSION_MINOR ${blitz_MINOR})
#set(CPACK_PACKAGE_VERSION_PATCH ${blitz_PATCH})
#set(CPACK_SOURCE_GENERATOR "TBZ2")
#set(CPACK_SOURCE_PACKAGE_FILE_NAME blitz-${blitz_VERSION})
#set(CPACK_SOURCE_IGNORE_FILES ".*.swp$" ".*.swo$" "~$" ".bz2$" ".gz$")

#include(CPack)
#include(UnitTests)
#include(GNUInstallDirs)
#include(CreatePkgConfig)
#include(CMakePackageConfigHelpers)

add_subdirectory(blitz)
add_subdirectory(random)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")

include(GetGitRevisionDescription)
get_git_head_revision(BLITZ_GIT_REFSPEC BLITZ_GIT_SHA1)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/blitzGitSHA1.cc.in" "${CMAKE_CURRENT_BINARY_DIR}/blitzGitSHA1.cc" @ONLY)

add_library(blitzGitSHA1 OBJECT "${CMAKE_CURRENT_BINARY_DIR}/blitzGitSHA1.cc")


add_subdirectory(src)
if (BUILD_DOC)
add_subdirectory(doc)
endif()

if (BUILD_TESTING)
add_subdirectory(testsuite)
add_subdirectory(examples)
add_subdirectory(benchmarks)
endif()
add_library(Blitz SHARED $<TARGET_OBJECTS:Blitz::BlitzSrc> $<TARGET_OBJECTS:blitzGitSHA1>)
add_library(Blitz::Blitz ALIAS Blitz)

# Add a custom target to mimic autotools "make lib"
target_link_libraries(Blitz PUBLIC Blitz::BlitzHeaders)

set_target_properties(Blitz PROPERTIES
VERSION ${blitz_VERSION}
SOVERSION 0
CLEAN_DIRECT_OUTPUT 1)


if (CMAKE_PROJECT_NAME STREQUAL "blitz") # check whether the current file is top-level CMakeLists.txt
add_subdirectory(testsuite)
endif()

add_custom_target(lib DEPENDS blitz)
install(TARGETS Blitz DESTINATION lib)

# Configuration files.

CreatePkgConfigInfo(blitz "")
CreatePkgConfigInfo(blitz-static static)
#CreatePkgConfigInfo(blitz "")
#CreatePkgConfigInfo(blitz-static static)

write_basic_package_version_file(
cmake/${PROJECT_NAME}ConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion)
configure_package_config_file(
cmake/${PROJECT_NAME}Config.cmake.in
cmake/${PROJECT_NAME}Config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/)
#write_basic_package_version_file(
#cmake/${PROJECT_NAME}ConfigVersion.cmake
#VERSION ${PROJECT_VERSION}
#COMPATIBILITY AnyNewerVersion)
#configure_package_config_file(
#cmake/${PROJECT_NAME}Config.cmake.in
#cmake/${PROJECT_NAME}Config.cmake
#INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/)

# Installation

install(EXPORT ${PROJECT_NAME}Targets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
install(FILES
${CMAKE_BINARY_DIR}/blitz.pc
${CMAKE_BINARY_DIR}/blitz-static.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/)
#install(EXPORT ${PROJECT_NAME}Targets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
#install(FILES
#${CMAKE_BINARY_DIR}/blitz.pc
#${CMAKE_BINARY_DIR}/blitz-static.pc
#DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
#install(FILES
#${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}Config.cmake
#${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake
#DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/)
Loading