diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 6044c79..6810819 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -7,12 +7,10 @@ add_subdirectory(qwt) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -file(GLOB_RECURSE ui "ui/*.[hc]pp") -file(GLOB_RECURSE ui_ui "ui/*.ui") +file(GLOB_RECURSE ui "ui/*") set(PROJECT_SOURCES ${ui} - ${ui_ui} helpers.cpp helpers.hpp IterableEnum.hpp @@ -29,31 +27,35 @@ set(PROJECT_SOURCES web_socket_wrapper.hpp ) -file(GLOB_RECURSE sims "simulators/*.cpp") +if (NOT EMSCRIPTEN) + file(GLOB_RECURSE sims "simulators/*.cpp") + # Loop through each .cpp file and create a library for it + foreach(sim ${sims}) + # Extract the base name of the file (without the directory and extension) + get_filename_component(LIB_NAME ${sim} NAME_WE) -# Loop through each .cpp file and create a library for it -foreach(sim ${sims}) - # Extract the base name of the file (without the directory and extension) - get_filename_component(LIB_NAME ${sim} NAME_WE) + # Create a library for each .cpp file + add_library(ui_${LIB_NAME} SHARED ${CMAKE_CURRENT_SOURCE_DIR}/simulators/${LIB_NAME}.hpp ${CMAKE_CURRENT_SOURCE_DIR}/simulators/${LIB_NAME}.cpp ${CMAKE_CURRENT_SOURCE_DIR}/simulators/${LIB_NAME}.ui) + target_link_libraries(ui_${LIB_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Widgets magic_enum::magic_enum nlohmann_json::nlohmann_json) + target_include_directories(ui_${LIB_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/ui ${CMAKE_SOURCE_DIR}/external/qwt/src ${CMAKE_SOURCE_DIR}/external/spdlog/include ${PROJECT_BINARY_DIR}/) - # Create a library for each .cpp file - add_library(ui_${LIB_NAME} SHARED ${CMAKE_CURRENT_SOURCE_DIR}/simulators/${LIB_NAME}.hpp ${CMAKE_CURRENT_SOURCE_DIR}/simulators/${LIB_NAME}.cpp ${CMAKE_CURRENT_SOURCE_DIR}/simulators/${LIB_NAME}.ui) - target_link_libraries(ui_${LIB_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Widgets magic_enum::magic_enum nlohmann_json::nlohmann_json) - target_include_directories(ui_${LIB_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/ui ${CMAKE_SOURCE_DIR}/external/qwt/src ${CMAKE_SOURCE_DIR}/external/spdlog/include ${PROJECT_BINARY_DIR}/) - - set_target_properties( - ui_${LIB_NAME} - PROPERTIES - AUTOUIC ON - AUTOMOC ON - AUTORCC ON - ) -endforeach() + set_target_properties( + ui_${LIB_NAME} + PROPERTIES + AUTOUIC ON + AUTOMOC ON + AUTORCC ON + ) + endforeach() +else() + file(GLOB_RECURSE sims "simulators/*") +endif() if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) qt_add_executable(Simulator-CVS_I10 MANUAL_FINALIZATION ${PROJECT_SOURCES} + $<$:${sims}> ) # Define target properties for Android with Qt 6 as: # set_property(TARGET Simulator - CVS_I10 APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR