From e5657c8561828cde16976c3b6324aab8283bf863 Mon Sep 17 00:00:00 2001 From: Christopher Degawa Date: Mon, 4 May 2020 12:00:15 +0000 Subject: [PATCH] add basic CMakeLists --- CMakeLists.txt | 48 +++++++++++++++++++++++++++++++++++ src/app/CMakeLists.txt | 44 ++++++++++++++++++++++++++++++++ src/app/exhaleApp.rc | 2 +- src/lib/CMakeLists.txt | 57 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 CMakeLists.txt create mode 100644 src/app/CMakeLists.txt create mode 100644 src/lib/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..f49a762 --- /dev/null +++ b/CMakeLists.txt @@ -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) diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt new file mode 100644 index 0000000..3898b3f --- /dev/null +++ b/src/app/CMakeLists.txt @@ -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}) diff --git a/src/app/exhaleApp.rc b/src/app/exhaleApp.rc index 1973164..877bc52 100644 --- a/src/app/exhaleApp.rc +++ b/src/app/exhaleApp.rc @@ -9,7 +9,7 @@ */ #include "..\..\include\version.h" // for EXHALELIB_VERSION_... strings -#include "winres.h" +#include 0 ICON "exhaleApp.ico" VS_VERSION_INFO VERSIONINFO diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt new file mode 100644 index 0000000..add4bef --- /dev/null +++ b/src/lib/CMakeLists.txt @@ -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})