cmake_minimum_required(VERSION 3.8.0)
project(mdd_lib)

add_library(${PROJECT_NAME} STATIC
	include/Connector.h
	include/ModuleGenerator.h
	include/IConnection.h
	include/IModuleGenerator.h
    include/IInput.h
    include/IInteractive.h
    include/IManager.h
    include/IModule.h
    include/Input.h
	include/IOptimizable.h
	include/IOptimizer.h
	include/IOptimizerGenerator.h
    include/IOutput.h
    include/IProcessor.h
	include/IProcessorGenerator.h
	include/IState.h
    include/IUnique.h
    include/ModuleBase.h
	include/OptimizerBase.h
	include/OptimizerEvolutionary.h
	include/OptimizerGenerator.h
    include/Output.h
	include/Parameter.h
    include/ProcessorBase.h
	include/ProcessorGenerator.h
	include/ProcessorStandard.h
	include/Registration.h
	include/state.h

	src/Connector.cpp
    src/Input.cpp
    src/ModuleBase.cpp
    src/ModuleHTTP.cpp
    src/ModuleMath.cpp
	src/ModuleMerge.cpp
	src/ModuleSplitt.cpp
    src/ModuleSQL.cpp
    src/ModuleSwitch.cpp
	src/OptimizerBase.cpp
	src/OptimizerEvolutionary.cpp
    src/Output.cpp
	src/Parameter.cpp
    src/ProcessorBase.cpp
    src/ProcessorStandard.cpp
	src/Registration.cpp
)

target_include_directories(${PROJECT_NAME} PUBLIC
        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
        $<INSTALL_INTERFACE:include>)

target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} sqlite3)

set_target_properties( ${PROJECT_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON )
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
	target_compile_options(${PROJECT_NAME} PRIVATE /bigobj)
elseif(UNIX)
	target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} dl)
endif()

install(DIRECTORY include DESTINATION .)

install(TARGETS ${PROJECT_NAME} DESTINATION lib/$<CONFIG> EXPORT targets)
install(EXPORT targets DESTINATION cmake)

#[[

add_custom_command(TARGET mdd_lib POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy
	"$<TARGET_FILE:mdd_lib>"
	"${CMAKE_BINARY_DIR}/lib/test/$<CONFIGURATION>")

add_custom_command(TARGET mdd_lib POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy
	"$<TARGET_FILE:mdd_lib>"
	"${CMAKE_BINARY_DIR}/lib/test")

]]


if(${TESTS_ENABLED})
    add_subdirectory(test)
endif()