-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0d9f803
Showing
7 changed files
with
162 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
cmake_minimum_required(VERSION 3.20) | ||
|
||
include(CMakePrintHelpers) | ||
|
||
# | ||
# Change default CMake options for convenience | ||
# | ||
|
||
# Change default build type | ||
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Build type") | ||
|
||
# Build .so by default | ||
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libs") | ||
|
||
# Build tests by default | ||
set(BUILD_TESTING ON CACHE BOOL "Build tests") | ||
|
||
# Build -fPIC by default (even static) by default | ||
set(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "Position independent code") | ||
|
||
# Silent some install messages by default | ||
set(CMAKE_INSTALL_MESSAGE "LAZY" CACHE STRING "") | ||
|
||
# Add rpaths of external dependencies by default | ||
if (NOT DEFINED CMAKE_INSTALL_RPATH_USE_LINK_PATH) | ||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON) # not CACHE, only for our project | ||
endif() | ||
|
||
# | ||
# Read the version from version.txt | ||
# | ||
|
||
file(READ "version.txt" version_txt) | ||
string(REGEX REPLACE "^[ \t\n]+|[ \t\n]+$" "" version_txt "${version_txt}") # Strip | ||
|
||
# | ||
# | ||
# | ||
|
||
project(MachineTypes | ||
LANGUAGES C | ||
VERSION "${version_txt}" | ||
DESCRIPTION "Simple C numeric types definitions") | ||
|
||
cmake_print_variables(MachineTypes_VERSION) | ||
|
||
# (after project() is important here:) | ||
include(GNUInstallDirs) | ||
|
||
# Global PRIVATE compilation flags | ||
add_compile_options(-Wall -Wextra) | ||
|
||
add_subdirectory(machinetypes) | ||
add_subdirectory(cmake) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Simple C numeric types definitions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
include(CMakePackageConfigHelpers) | ||
|
||
configure_package_config_file(MachineTypesConfig.cmake.in | ||
${CMAKE_CURRENT_BINARY_DIR}/MachineTypesConfig.cmake | ||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/MachineTypes/cmake) | ||
|
||
write_basic_package_version_file( | ||
${CMAKE_CURRENT_BINARY_DIR}/MachineTypesConfigVersion.cmake | ||
COMPATIBILITY SameMinorVersion # AnyNewerVersion|SameMajorVersion|SameMinorVersion|ExactVersion | ||
VERSION "${MachineTypes_VERSION}") | ||
|
||
install(FILES | ||
${CMAKE_CURRENT_BINARY_DIR}/MachineTypesConfig.cmake | ||
${CMAKE_CURRENT_BINARY_DIR}/MachineTypesConfigVersion.cmake | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/MachineTypes/cmake) | ||
|
||
install(EXPORT MachineTypesTargets | ||
NAMESPACE MachineTypes:: | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/MachineTypes/cmake) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
set(MachineTypes_VERSION "@MachineTypes_VERSION@") | ||
|
||
@PACKAGE_INIT@ | ||
|
||
# | ||
# Expose cmake options used at install | ||
# | ||
|
||
set(MachineTypes_DUMMY_OPTION "@MachineTypes_DUMMY_OPTION@") | ||
|
||
# | ||
# Dependencies | ||
# | ||
|
||
#include(CMakeFindDependencyMacro) | ||
#find_dependency(Threads) | ||
#find_dependency(SomeConfigDep PATHS "@SomeConfigDep_DIR@") | ||
|
||
# | ||
# MachineTypes Exported Targets | ||
# | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/MachineTypesTargets.cmake") | ||
|
||
# | ||
# Message and detect multiple, different, find_package | ||
# | ||
|
||
set(_details "${MachineTypes_DIR}") | ||
if(NOT DEFINED _MachineTypes_FOUND_MESSAGE_DETAILS) | ||
set(_MachineTypes_FOUND_MESSAGE_DETAILS "${_details}" CACHE INTERNAL "") | ||
message(STATUS "Found MachineTypes: ${MachineTypes_DIR} (${MachineTypes_VERSION})") | ||
elseif(NOT _MachineTypes_FOUND_MESSAGE_DETAILS STREQUAL _details) | ||
message(WARNING "Different MachineTypes were find_package: | ||
- ${_MachineTypes_FOUND_MESSAGE_DETAILS} | ||
- ${_details}") | ||
endif() | ||
|
||
# | ||
# Final check | ||
# | ||
check_required_components(MachineTypes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
set(INC_FILES inc/machine_types.h) | ||
|
||
add_library(MachineTypes INTERFACE) | ||
add_library(MachineTypes::MachineTypes ALIAS MachineTypes) | ||
|
||
target_include_directories(MachineTypes INTERFACE | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc> | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/inc> | ||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> | ||
) | ||
|
||
# target_link_libraries(mytestlib | ||
# PUBLIC Some_Lib_Used_in_Public_Headers | ||
# PRIVATE Some_Lib_Used_Internaly | ||
# ) | ||
|
||
#install(DIRECTORY | ||
# ${CMAKE_CURRENT_SOURCE_DIR}/inc/ | ||
# ${CMAKE_CURRENT_BINARY_DIR}/inc/ | ||
# DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
# FILES_MATCHING PATTERN "*.h" | ||
# ) | ||
install(FILES | ||
${INC_FILES} | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
) | ||
|
||
|
||
install(TARGETS MachineTypes | ||
EXPORT MachineTypesTargets | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#ifndef MACHINE_TYPES_H | ||
#define MACHINE_TYPES_H | ||
|
||
// This header was manufactured specifically for smooth3d/magix3d | ||
|
||
// it can be called from C code so we do not use cstdint | ||
#include <stdint.h> | ||
|
||
typedef int64_t int_type; | ||
typedef double float_type; | ||
|
||
#endif // MACHINE_TYPES_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2.0.0 |