From 3d2ae7f90edf17b67c8844f8311436703c2adf97 Mon Sep 17 00:00:00 2001 From: Martin Beseda <martin.beseda@vsb.cz> Date: Sun, 6 Jan 2019 09:31:03 +0100 Subject: [PATCH] ENH: Added SRC_DIR to include folders of ExprtkWrapper. Improved code formatting. --- CMakeLists.txt | 2 +- src/CMakeLists.txt | 135 +++++++++++++++++++++++---------------------- 2 files changed, 69 insertions(+), 68 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c10de69a..5b47fad3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,7 +47,7 @@ if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" ) elseif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W0 /bigobj") add_compile_options("/D _SCL_SECURE_NO_WARNINGS") - add_compile_options("/D_CRT_SECURE_NO_WARNINGS") + add_compile_options("/D _CRT_SECURE_NO_WARNINGS") elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MINGW") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mbig-obj") else() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4995799f..bce60ecf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,117 +1,118 @@ if ("${BUILD_TESTS}" STREQUAL "yes") - add_subdirectory(tests unit-tests) + add_subdirectory(tests unit-tests) endif () if ("${BUILD_EXAMPLES}" STREQUAL "yes") - add_subdirectory(examples examples) + add_subdirectory(examples examples) endif () if ("${BUILD_LIB}" STREQUAL "yes") - set(LIB_TYPE "STATIC") - if(DEPENDENCIES_LINK_TYPE STREQUAL "shared") - set(LIB_TYPE "SHARED") - endif() + set(LIB_TYPE "STATIC") + if (DEPENDENCIES_LINK_TYPE STREQUAL "shared") + set(LIB_TYPE "SHARED") + endif () add_library( - exprtk_wrap + exprtk_wrap - ${LIB_TYPE} + ${LIB_TYPE} - General/ExprtkWrapper.cpp + General/ExprtkWrapper.cpp ) target_include_directories( - exprtk_wrap + exprtk_wrap + + PRIVATE + ${EXPRTK_INCLUDE_DIR} + ${Boost_INCLUDE_DIRS} + ${SRC_DIR} + ) - PRIVATE - ${EXPRTK_INCLUDE_DIR} - ${Boost_INCLUDE_DIRS} + target_link_libraries( + exprtk_wrap + + PRIVATE + ${Boost_LIBRARIES} ) - target_link_libraries( - exprtk_wrap - - PRIVATE - ${Boost_LIBRARIES} - ) - - add_library( - lib4neuro - - ${LIB_TYPE} - - Neuron/Neuron.cpp - Neuron/NeuronBinary.cpp - Neuron/NeuronConstant.cpp - Neuron/NeuronLinear.cpp - Neuron/NeuronLogistic.cpp - Network/NeuralNetwork.cpp - Network/NeuralNetworkSum.cpp - NetConnection/ConnectionFunctionGeneral.cpp - NetConnection/ConnectionFunctionIdentity.cpp - LearningMethods/ParticleSwarm.cpp - LearningMethods/GradientDescent.cpp - DataSet/DataSet.cpp - ErrorFunction/ErrorFunctions.cpp - Solvers/DESolver.cpp - CSVReader/CSVReader.cpp - CrossValidator/CrossValidator.cpp - NormalizationStrategy/NormalizationStrategy.cpp - ) + add_library( + lib4neuro + + ${LIB_TYPE} + + Neuron/Neuron.cpp + Neuron/NeuronBinary.cpp + Neuron/NeuronConstant.cpp + Neuron/NeuronLinear.cpp + Neuron/NeuronLogistic.cpp + Network/NeuralNetwork.cpp + Network/NeuralNetworkSum.cpp + NetConnection/ConnectionFunctionGeneral.cpp + NetConnection/ConnectionFunctionIdentity.cpp + LearningMethods/ParticleSwarm.cpp + LearningMethods/GradientDescent.cpp + DataSet/DataSet.cpp + ErrorFunction/ErrorFunctions.cpp + Solvers/DESolver.cpp + CSVReader/CSVReader.cpp + CrossValidator/CrossValidator.cpp + NormalizationStrategy/NormalizationStrategy.cpp + ) # FileSystem C++ library - has to be linked manually in GCC-8 - set(CXX_FILESYSTEM_LIB "") - if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set(CXX_FILESYSTEM_LIB "stdc++fs") - endif() + set(CXX_FILESYSTEM_LIB "") + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(CXX_FILESYSTEM_LIB "stdc++fs") + endif () target_link_libraries( - lib4neuro + lib4neuro - PRIVATE + PRIVATE exprtk_wrap ${Boost_LIBRARIES} - ${CXX_FILESYSTEM_LIB} + ${CXX_FILESYSTEM_LIB} ) - target_include_directories( - lib4neuro + target_include_directories( + lib4neuro - PUBLIC + PUBLIC ${ROOT_DIR}/include - PRIVATE + PRIVATE ${EXPRTK_INCLUDE_DIR} ${SRC_DIR} ${Boost_INCLUDE_DIRS} ) set_target_properties( - lib4neuro + lib4neuro - PROPERTIES + PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib" LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib" RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin" ) set(PREFIX "") -# if(WIN32) -# set(PREFIX "lib") -# endif() - if(WIN32 AND "${DEPENDENCIES_LINK_TYPE}" STREQUAL "shared") - add_library(${PREFIX}boost_unit_test STATIC boost_test_lib_dummy.cpp) - elseif("${DEPENDENCIES_LINK_TYPE}" STREQUAL "static") - add_library(${PREFIX}boost_unit_test STATIC boost_test_lib_dummy.cpp) - elseif("${DEPENDENCIES_LINK_TYPE}" STREQUAL "shared") + # if(WIN32) + # set(PREFIX "lib") + # endif() + if (WIN32 AND "${DEPENDENCIES_LINK_TYPE}" STREQUAL "shared") + add_library(${PREFIX}boost_unit_test STATIC boost_test_lib_dummy.cpp) + elseif ("${DEPENDENCIES_LINK_TYPE}" STREQUAL "static") + add_library(${PREFIX}boost_unit_test STATIC boost_test_lib_dummy.cpp) + elseif ("${DEPENDENCIES_LINK_TYPE}" STREQUAL "shared") add_library(${PREFIX}boost_unit_test SHARED boost_test_lib_dummy.cpp) - endif() + endif () target_include_directories( - ${PREFIX}boost_unit_test + ${PREFIX}boost_unit_test - PRIVATE + PRIVATE ${Boost_INCLUDE_DIRS} ) -- GitLab