diff --git a/CMakeLists.txt b/CMakeLists.txt index 214e293a6df66fc39c74e79bdecdb969d751b670..006c316b7ef7412d6cedc7ef3fa3532bf769c2f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,8 @@ cmake_minimum_required(VERSION 3.20) -project(ehigeneratorsa) +project(eisgenerator) set(SRC_FILES - main.cpp componant.cpp cap.cpp resistor.cpp @@ -14,12 +13,33 @@ set(SRC_FILES paralellseriel.cpp ) -find_package(PkgConfig REQUIRED) -pkg_check_modules(SPICE REQUIRED ngspice) +set(API_HEADERS + eisgenerator/componant.h + eisgenerator/cap.h + eisgenerator/resistor.h + eisgenerator/constantphase.h + eisgenerator/warburg.h + eisgenerator/model.h + eisgenerator/tokenize.h + eisgenerator/paralellseriel.h +) -add_executable(${PROJECT_NAME} ${SRC_FILES}) -target_link_libraries(${PROJECT_NAME} ${SPICE_LIBRARIES}) -target_include_directories(${PROJECT_NAME} PUBLIC ${SPICE_CFLAGS} .) +add_library(${PROJECT_NAME} SHARED ${SRC_FILES}) +target_link_libraries(${PROJECT_NAME} ${LIBS}) +target_include_directories(${PROJECT_NAME} PUBLIC eisgenerator) set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-std=c++20 -Wall -O3 -march=native -g" LINK_FLAGS "-flto") -install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin) +set(CMAKE_INSTALL_PREFIX "/usr") +install(TARGETS ${PROJECT_NAME} DESTINATION lib) +install(FILES ${API_HEADERS} DESTINATION include/${PROJECT_NAME}) + +link_directories(${CMAKE_CURRENT_BINARY_DIR}) +set(SRC_FILES_TEST_APP main.cpp) +set(LIBS_TEST -l${PROJECT_NAME}) +add_executable(${PROJECT_NAME}_test ${SRC_FILES_TEST_APP}) +add_dependencies(${PROJECT_NAME}_test ${PROJECT_NAME}) +target_link_libraries(${PROJECT_NAME}_test ${LIBS_TEST}) +target_include_directories(${PROJECT_NAME}_test PUBLIC eisgenerator) +set_target_properties(${PROJECT_NAME}_test PROPERTIES COMPILE_FLAGS "-std=c++20 -Wall -O3 -march=native -g" LINK_FLAGS "-flto") + +install(TARGETS ${PROJECT_NAME}_test DESTINATION bin) diff --git a/cap.h b/eisgenerator/cap.h similarity index 100% rename from cap.h rename to eisgenerator/cap.h diff --git a/componant.h b/eisgenerator/componant.h similarity index 100% rename from componant.h rename to eisgenerator/componant.h diff --git a/constantphase.h b/eisgenerator/constantphase.h similarity index 100% rename from constantphase.h rename to eisgenerator/constantphase.h diff --git a/model.h b/eisgenerator/model.h similarity index 100% rename from model.h rename to eisgenerator/model.h diff --git a/paralellseriel.h b/eisgenerator/paralellseriel.h similarity index 100% rename from paralellseriel.h rename to eisgenerator/paralellseriel.h diff --git a/resistor.h b/eisgenerator/resistor.h similarity index 100% rename from resistor.h rename to eisgenerator/resistor.h diff --git a/tokenize.h b/eisgenerator/tokenize.h similarity index 100% rename from tokenize.h rename to eisgenerator/tokenize.h diff --git a/warburg.h b/eisgenerator/warburg.h similarity index 100% rename from warburg.h rename to eisgenerator/warburg.h diff --git a/main.cpp b/main.cpp index 055d9cfda9a0c8fac0e061b65afa049862bc2349..4c554b8789d64a4c88800d152ba0f457a35a9034 100644 --- a/main.cpp +++ b/main.cpp @@ -77,6 +77,6 @@ void runSweep() int main(int argc, char** argv) { runSingle(); - //runSweep(); + runSweep(); return 0; } diff --git a/model.cpp b/model.cpp index 604ffbf85885302c3b5cfa9f0da747c30b56bf4b..7b7bfb854c8b72f682ba38be7ddbba4413fd351a 100644 --- a/model.cpp +++ b/model.cpp @@ -258,7 +258,7 @@ bool Model::sweepParams(const std::vector<Range>& componantRanges, const Range& { if(componantRanges[i].count == 0 || (componantRanges[i].count < 2 && componantRanges[i].start != componantRanges[i].end)) { - std::cout<<"Error: paramter range must specify at least one paramter point if only one paramer point is specified star and end must be the same\n"; + std::cout<<"Error: paramter range must specify at least one paramter point if only one paramer point is specified start and end must be the same\n"; return false; } else if(componantRanges[i].start > componantRanges[i].end)