uSTL_2.3/CMakeLists.txt

68 lines
2.3 KiB
CMake

# libustl: build system
cmake_minimum_required(VERSION 3.16)
project(libustl VERSION 2.3 LANGUAGES CXX)
# Libraries that libexample depends on
find_package(Gint 2.7 REQUIRED)
set(USTL_NAME "ustl")
set(USTL_STRING "ustl v2.3")
set(USTL_VERSION "0x230")
set(USTL_BUGREPORT "Mike Sharov <msharov@users.sourceforge.net>")
# Turn include/config.h.in into a proper config.h where the @VAR@ have
# been replaced; this is how version numbers are maintained. libexample_VERSION
# is set to "1.0" by the project() command.
# Note that the input (config.h.in) is relative to the source dir, but the
# output (config.h) is in the build dir, so it doesn't pollute the Git repo.
configure_file(./config.h.in include/config.h)
set(SOURCES
src/cmemlink.cc
src/fstream.cc
src/memblock.cc
src/memlink.cc
src/mistream.cc
src/ofstream.cc
src/sistream.cc
src/sostream.cc
src/ualgobase.cc
src/ubitset.cc
src/unew.cc
src/ustring.cc
)
include_directories(
"${PROJECT_SOURCE_DIR}/include"
"${PROJECT_BINARY_DIR}/include"
"${FXSDK_COMPILER_INSTALL}/include"
"${FXSDK_COMPILER_INSTALL}/include/openlibm")
add_compile_options(-Os -mb -m4a-nofpu -mhitachi -std=c++11 -fno-rtti -fno-use-cxa-atexit -fno-exceptions)
# Target name is "ustl", output file is "libustl.a" (by default)
add_library(ustl STATIC ${SOURCES})
# After building, install the target (that is, libustl.a) in the compiler
install(TARGETS ustl
DESTINATION "${FXSDK_COMPILER_INSTALL}")
# Also install the headers (our include folder gets merged with the existing
# one in the compiler's install folder). Only install files matching *.h to
# exclude config.h.in.
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include"
DESTINATION "${FXSDK_COMPILER_INSTALL}"
FILES_MATCHING PATTERN "*")
# Slyvtt : replaced "*.h" with "*" as some headers are in the C++ style, without .h extension
# So to avoid a "non-volontary" copy of config.h.in in the compiler's include folder,
# I decided to move config.h.in at the root of the project and set the copy line above accordingly
# Install config.h from the build dir
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/include/config.h"
DESTINATION "${FXSDK_COMPILER_INSTALL}/include")
# Install FindLibUstl.cmake so that users can do find_package(Libustl)
install(FILES cmake/FindUstl.cmake
DESTINATION "${FXSDK_CMAKE_MODULE_PATH}")