cmake_minimum_required(VERSION 3.8.0)
project(mdd_lib)

add_library(${PROJECT_NAME} SHARED
	include/Connector.h
	include/Generator.h
        include/HandlerModule
	include/IConnection.h
	include/IGenerator.h
        include/IInput.h
        include/IModule.h
        include/Input.h
	include/IOptimizable.h
	include/IOptimizer.h
        include/IOutput.h
        include/IProcessor.h
	include/IProperty.h
	include/IState.h
        include/IUnique.h
        include/ModuleBase.h
	include/ModuleMerge.h
	include/ModuleParameter.h
	include/ModuleSplitt.h
        include/ModuleSQL.h
        include/ModuleSwitch.h
	include/OptimizerBase.h
	include/OptimizerEvolutionary.h
        include/Output.h
        include/ProcessorBase.h
        include/ProcessorEvolution.h
	include/ProcessorStandard.h
	include/Property.h
	include/state.h

	src/Connector.cpp
	src/Generator.cpp
        src/Input.cpp
        src/ModuleBase.cpp
        src/ModuleHTTP.cpp
        src/ModuleMath.cpp
	src/ModuleMerge.cpp
	src/ModuleParameter.cpp
	src/ModuleSplitt.cpp
        src/ModuleSQL.cpp
        src/ModuleSwitch.cpp
	src/OptimizerBase.cpp
	src/OptimizerEvolutionary.cpp
        src/Output.cpp
        src/ProcessorBase.cpp
	src/ProcessorEvolution.cpp
        src/ProcessorStandard.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(WIN32)
	target_compile_options(${PROJECT_NAME} PRIVATE /bigobj)
endif(WIN32)

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>")


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