add basic CMakeLists

This commit is contained in:
Christopher Degawa 2020-05-04 12:00:15 +00:00 committed by Christian R. Helmrich
parent c7de6bb97e
commit e5657c8561
4 changed files with 150 additions and 1 deletions

48
CMakeLists.txt Normal file
View File

@ -0,0 +1,48 @@
# CMakeLists.txt - Main CMake file that defines how cmake should process and generate the necessary build files
# written by C. D. Degawa, last modified in 2020 - see License.htm for legal notices
#
# The copyright in this software is being made available under a Modified BSD-Style License
# and comes with ABSOLUTELY NO WARRANTY. This software may be subject to other third-
# party rights, including patent rights. No such rights are granted under this License.
#
# Copyright (c) 2018-2020 Christian R. Helmrich, project ecodis. All rights reserved.
#
cmake_minimum_required(VERSION 3.5) # Default version of cmake on ubuntu 16.04
if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
message(FATAL_ERROR "Building in the source tree is not supported.\n"
"Please re-run cmake from a build folder.")
endif()
project(exhale VERSION 1.0.3 LANGUAGES CXX)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE Release
CACHE
STRING "Build type: Debug, Release, RelWithDebInfo or MinSizeRel"
FORCE)
endif()
set(CMAKE_THREAD_PREFER_PTHREAD true)
find_package(Threads) # For Threads::Threads
include(GNUInstallDirs)
set(CMAKE_POSITION_INDEPENDENT_CODE true)
set(CXX_STANDARD 11)
if(MSVC)
set(CMAKE_CXX_FLAGS_DEBUG "/WX /D_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}")
else()
set(CMAKE_CXX_FLAGS "-Wall -Wshadow ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "-Wuninitialized ${CMAKE_CXX_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_DEBUG "-Werror -D_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}")
endif()
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
add_definitions(-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64)
endif()
add_subdirectory(src/lib)
add_subdirectory(src/app)

44
src/app/CMakeLists.txt Normal file
View File

@ -0,0 +1,44 @@
# CMakeLists.txt - CMake file that defines the build for the app folder, works in conjunction with the main CMakeLists.txt
# written by C. D. Degawa, last modified in 2020 - see License.htm for legal notices
#
# The copyright in this software is being made available under a Modified BSD-Style License
# and comes with ABSOLUTELY NO WARRANTY. This software may be subject to other third-
# party rights, including patent rights. No such rights are granted under this License.
#
# Copyright (c) 2018-2020 Christian R. Helmrich, project ecodis. All rights reserved.
#
add_executable(exhaleApp
exhaleAppPch.h
loudnessEstim.cpp
basicMP4Writer.cpp
basicMP4Writer.h
exhaleApp.cpp
loudnessEstim.h
exhaleApp.ico
exhaleApp.rc
basicWavReader.h
basicWavReader.cpp
exhaleAppPch.cpp
${PROJECT_SOURCE_DIR}/include/exhaleDecl.h
${PROJECT_SOURCE_DIR}/include/version.h)
set_target_properties(exhaleApp PROPERTIES OUTPUT_NAME exhale)
if(TARGET Threads::Threads)
target_link_libraries(exhaleApp PRIVATE Threads::Threads)
endif()
if(CMAKE_DL_LIBS)
target_link_libraries(exhaleApp PRIVATE ${CMAKE_DL_LIBS})
endif()
target_link_libraries(exhaleApp PRIVATE exhaleLib)
target_include_directories(exhaleApp PRIVATE ${PROJECT_SOURCE_DIR}/include)
# PCH requires at least 3.16
# I actually don't know if this works or not
if(CMAKE_VERSION VERSION_GREATER "3.16.0")
target_precompile_headers(exhaleApp PUBLIC ${PROJECT_SOURCE_DIR}/src/lib/exhaleLibPch.h)
endif()
install(TARGETS exhaleApp
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})

View File

@ -9,7 +9,7 @@
*/
#include "..\..\include\version.h" // for EXHALELIB_VERSION_... strings
#include "winres.h"
#include <windows.h>
0 ICON "exhaleApp.ico"
VS_VERSION_INFO VERSIONINFO

57
src/lib/CMakeLists.txt Normal file
View File

@ -0,0 +1,57 @@
# CMakeLists.txt - CMake file that defines the build for the lib folder, works in conjunction with the main CMakeLists.txt
# written by C. D. Degawa, last modified in 2020 - see License.htm for legal notices
#
# The copyright in this software is being made available under a Modified BSD-Style License
# and comes with ABSOLUTELY NO WARRANTY. This software may be subject to other third-
# party rights, including patent rights. No such rights are granted under this License.
#
# Copyright (c) 2018-2020 Christian R. Helmrich, project ecodis. All rights reserved.
#
add_library(exhaleLib
lappedTransform.cpp
exhaleLibPch.cpp
bitStreamWriter.cpp
quantization.cpp
stereoProcessing.h
exhaleLibPch.h
entropyCoding.cpp
tempAnalysis.cpp
bitAllocation.cpp
stereoProcessing.cpp
bitAllocation.h
bitStreamWriter.h
specAnalysis.h
specAnalysis.cpp
lappedTransform.h
specGapFilling.cpp
specGapFilling.h
linearPrediction.h
quantization.h
entropyCoding.h
exhaleEnc.cpp
tempAnalysis.h
linearPrediction.cpp
exhaleEnc.h
${PROJECT_SOURCE_DIR}/include/exhaleDecl.h
${PROJECT_SOURCE_DIR}/include/version.h)
set_target_properties(exhaleLib PROPERTIES OUTPUT_NAME exhale)
if(TARGET Threads::Threads)
target_link_libraries(exhaleLib PRIVATE Threads::Threads)
endif()
if(CMAKE_DL_LIBS)
target_link_libraries(exhaleLib PRIVATE ${CMAKE_DL_LIBS})
endif()
target_include_directories(exhaleLib PRIVATE ${PROJECT_SOURCE_DIR}/include)
# PCH requires at least 3.16
# I actually don't know if this works or not
if(CMAKE_VERSION VERSION_GREATER "3.16.0")
target_precompile_headers(exhaleLib PUBLIC ${PROJECT_SOURCE_DIR}/src/lib/exhaleLibPch.h)
endif()
install(TARGETS exhaleLib
ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})