Skip to content

Commit

Permalink
Change the build system to CMake
Browse files Browse the repository at this point in the history
Signed-off-by: Soroush Rabiei <[email protected]>
  • Loading branch information
Soroush Rabiei committed Jan 20, 2021
1 parent d9b5444 commit 778e6a5
Show file tree
Hide file tree
Showing 72 changed files with 232 additions and 45,902 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -437,3 +437,5 @@ __pycache__/
# should be stored in the .pubxml.user file.

# End of https://www.gitignore.io/api/c,c++,linux,windows,autotools,visualstudio

build/*
2 changes: 1 addition & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Soroush Rabiei <soroush@ametisco.ir>
Soroush Rabiei <soroush[email protected]>
90 changes: 90 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
cmake_minimum_required(VERSION 3.16.0)

project(libcalendars VERSION 1.0.1 LANGUAGES C)

include(CTest)

set(LIBCAL_SOURCES
src/cl-math.h
src/cl-math.c
src/cl-calendars.c
src/cl-gregorian.c
src/cl-julian.c
src/cl-milankovic.c
src/cl-solar-hijri.c
src/cl-islamic-civil.c
src/cl-jewish.c
)

if(WIN32)
list(APPEND LIBCAL_SOURCES win32/libcalendars.rc)
endif()

# Define the library
add_library(${PROJECT_NAME} SHARED ${LIBCAL_SOURCES})

# Mark all public headers
file(GLOB_RECURSE ALL_HEADER_FILES "include/libcalendars/*.h")

# Prepate the target
set_target_properties(${PROJECT_NAME} PROPERTIES
C_STANDARD 11
DEBUG_POSTFIX "_d"
PUBLIC_HEADER "${ALL_HEADER_FILES}"
)

target_include_directories(${PROJECT_NAME}
PUBLIC
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
)

# Testing
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
enable_testing()
add_subdirectory(tests)
endif()

# Generate package config file

include(CMakePackageConfigHelpers)

configure_package_config_file(libcalendars.pc.in libcalendars.pc
INSTALL_DESTINATION ${LIB_INSTALL_DIR}/libcalendars
)

# Installation

include(GNUInstallDirs)

export(TARGETS ${PROJECT_NAME} FILE "${PROJECT_NAME}Targets.cmake")

install(TARGETS ${PROJECT_NAME}
EXPORT "${PROJECT_NAME}Targets"
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libcalendars
)

include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${PROJECT_NAME}ConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)

install(EXPORT "${PROJECT_NAME}Targets"
FILE "${PROJECT_NAME}Targets.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/
)

install(FILES
"cmake/${PROJECT_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/
)

2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at soroush@ametisco.ir. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at soroush[email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

Expand Down
2 changes: 1 addition & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
2017-08-29 Soroush Rabiei <soroush@ametisco.ir>
2017-08-29 Soroush Rabiei <soroush[email protected]>

* *.*: Initial implementation for Solar Hijri calendar added.

Loading

0 comments on commit 778e6a5

Please sign in to comment.