From eae3a7e898856cb1752c93d5be5af124aebbd5a0 Mon Sep 17 00:00:00 2001 From: DrErickson <77122859+DrErickson@users.noreply.github.com> Date: Tue, 20 Aug 2024 05:34:52 -0700 Subject: [PATCH 01/18] Created proof of concept CMake driven build of Welcome program. --- CMakeLists.txt | 140 +++++++++++++++++++++++++++++++++++++ Library/private/build.h.in | 14 +++- 2 files changed, 151 insertions(+), 3 deletions(-) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..e2744993 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,140 @@ +cmake_minimum_required(VERSION 3.17) +project(Welcome) + +# MinGW compiler lags, be conservative and use C++11 on all platforms +# rather than special case +set(CMAKE_CXX_STANDARD 11) + +# Need latest version of MinGW. +# You may need to specify the direct path. +# You can get MinGW from here: https://winlibs.com/ +#set(CMAKE_PREFIX_PATH "C:/PATH_TO_MINGW") +set(CMAKE_PREFIX_PATH "C:/Qt6/6.2.4/mingw_64") +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +# Special sauce to get qt resources to work +find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Quick QuickControls2 Widgets Qt6QuickCompiler REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Quick QuickControls2 Widgets REQUIRED) + + +# Include all the cs106 library folders +include_directories("Library") +include_directories("Library/collections") +include_directories("Library/console") +include_directories("Library/graphics") +include_directories("Library/io") +include_directories("Library/private") +include_directories("Library/resources") +include_directories("Library/system") +include_directories("Library/util") +include_directories("Library/testing") +include_directories("Welcome") + +# Used in build.h.in file to generate build.h file +set (SPL_VERSION "2023.1") +string(TIMESTAMP TODAY "%d/%m/%Y") +set (SPL_BUILD_DATE ${TODAY}) + +# Find user from environment variable +# Environment variable is either USERNAME or USER +if ("$ENV{USER}" STREQUAL "") + set (SPL_BUILD_USER $ENV{USERNAME}) +else () + set (SPL_BUILD_USER "$ENV{USER}") +endif () + +# Generate build.h file +add_definitions(-DSPL_CMAKE_BUILD) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Library/private/build.h.in + ${CMAKE_CURRENT_SOURCE_DIR}/Library/private/build.h @ONLY) + +# Create list of source files +file(GLOB LIBRARY_SRC CONFIGURE_DEPENDS + "Library/collections/*.cpp" + "Library/console/*.cpp" + "Library/graphics/*.cpp" + "Library/io/*.cpp" + "Library/system/*.cpp" + "Library/util/*.cpp" + "Library/testing/*.cpp" + "Library/private/*.cpp" + ) + +# Remove to avoid extra redefinitions +list(REMOVE_ITEM LIBRARY_SRC "${CMAKE_CURRENT_SOURCE_DIR}/Library/private/filelibwindows.cpp") +list(REMOVE_ITEM LIBRARY_SRC "${CMAKE_CURRENT_SOURCE_DIR}/Library/private/filelibunix.cpp") + +file(GLOB QT_RESOURCES Library/images.qrc) + +# We need to say what libraries we need from Qt6 +# Qt is very picky about the compiler version. +# Make sure you check to make sure your compiler +# is up to date. You have been warned! +set(QT_VERSION 6) +set(REQUIRED_LIBS Core Gui Widgets Network) +set(REQUIRED_LIBS_QUALIFIED Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Network) + +qt_add_resources(RCC_SOURCES ${QT_RESOURCES}) + +# https://doc.qt.io/qt-6/cmake-get-started.html +## Create static library +qt_add_library(CS106_library STATIC + ${LIBRARY_SRC} + ${PRIVATE_SRC} + ${LIBRARY_HEADER} + ${PRIVATE_HEADER} + ${RCC_SOURCES} +) + +# Link CS106 library to required Qt libraries +target_link_libraries(CS106_library PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Network) + +add_executable(${PROJECT_NAME} + Welcome/Welcome.cpp +) + +# link exe to CS106 library +target_link_libraries(${PROJECT_NAME} CS106_library) + +# student writes ordinary main() function, but it must be called within a +# wrapper main() that handles library setup/teardown. Rename student's +# to distinguish between the two main() functions and avoid symbol clash +# Ask Julie if you are curious why main->qMain->studentMain +target_compile_definitions(${PROJECT_NAME} PRIVATE main=qMain) +target_compile_definitions(${PROJECT_NAME} PRIVATE qMain=studentMain) + +if (NOT CMAKE_PREFIX_PATH) + message(WARNING "CMAKE_PREFIX_PATH is not defined, you may need to set it " + "(-DCMAKE_PREFIX_PATH=\"path/to/Qt/lib/cmake\" or -DCMAKE_PREFIX_PATH=/usr/include/{host}/qt{version}/ on Ubuntu)") +endif () + +find_package(Qt${QT_VERSION} COMPONENTS ${REQUIRED_LIBS} REQUIRED) +target_link_libraries(${PROJECT_NAME} ${REQUIRED_LIBS_QUALIFIED}) + +if (WIN32) + set(DEBUG_SUFFIX) + set(QT_INSTALL_PATH "${CMAKE_PREFIX_PATH}") + if (NOT EXISTS "${QT_INSTALL_PATH}/bin") + set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..") + if (NOT EXISTS "${QT_INSTALL_PATH}/bin") + set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..") + endif () + endif () + if (EXISTS "${QT_INSTALL_PATH}/plugins/platforms/qwindows${DEBUG_SUFFIX}.dll") + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory + "$/plugins/platforms/") + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + "${QT_INSTALL_PATH}/plugins/platforms/qwindows${DEBUG_SUFFIX}.dll" + "$/plugins/platforms/") + endif () + foreach (QT_LIB ${REQUIRED_LIBS}) + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + "${QT_INSTALL_PATH}/bin/Qt${QT_VERSION}${QT_LIB}${DEBUG_SUFFIX}.dll" + "$") + endforeach (QT_LIB) +endif () diff --git a/Library/private/build.h.in b/Library/private/build.h.in index 894476f1..cbeb12c7 100644 --- a/Library/private/build.h.in +++ b/Library/private/build.h.in @@ -1,8 +1,16 @@ #ifndef SPL_BUILD_H #define SPL_BUILD_H -#define SPL_VERSION \"$$SPL_VERSION\" -#define SPL_BUILD_DATE \"$$_DATE_\" -#define SPL_BUILD_USER \"$$(USER)\" +#ifndef SPL_CMAKE_BUILD + // Building from pro file + #define SPL_VERSION \"$$SPL_VERSION\" + #define SPL_BUILD_DATE \"$$_DATE_\" + #define SPL_BUILD_USER \"$$(USER)\" +#else + // Building from CMake + #define SPL_VERSION "@SPL_VERSION@" + #define SPL_BUILD_DATE "@SPL_BUILD_DATE@" + #define SPL_BUILD_USER "@SPL_BUILD_USER@" +#endif #endif \ No newline at end of file From 011bfe064e2166782b006db3880952532c8b4b0a Mon Sep 17 00:00:00 2001 From: DrErickson <77122859+DrErickson@users.noreply.github.com> Date: Thu, 22 Aug 2024 10:10:55 -0700 Subject: [PATCH 02/18] Moved filelib_isDirectory to before filelib_createDirectory fix scope issue --- Library/private/filelibwindows.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Library/private/filelibwindows.cpp b/Library/private/filelibwindows.cpp index e6ecb170..40817f4a 100644 --- a/Library/private/filelibwindows.cpp +++ b/Library/private/filelibwindows.cpp @@ -33,6 +33,11 @@ namespace platform { +bool filelib_isDirectory(const std::string& filename) { + DWORD attr = GetFileAttributesA(filename.c_str()); + return attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY); +} + void filelib_createDirectory(const std::string& path) { std::string pathStr = path; if (endsWith(path, "\\")) { @@ -101,11 +106,6 @@ std::string filelib_getTempDirectory() { return std::string(path, n); } -bool filelib_isDirectory(const std::string& filename) { - DWORD attr = GetFileAttributesA(filename.c_str()); - return attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY); -} - // https://msdn.microsoft.com/en-us/library/windows/desktop/gg258117(v=vs.85).aspx bool filelib_isFile(const std::string& filename) { DWORD attr = GetFileAttributesA(filename.c_str()); From 0d0818a2cc56dbf167ea51240384d8249c4045a9 Mon Sep 17 00:00:00 2001 From: DrErickson <77122859+DrErickson@users.noreply.github.com> Date: Thu, 22 Aug 2024 10:27:18 -0700 Subject: [PATCH 03/18] Moved filelib_isDirectory to before filelib_createDirectory fix scope issue --- Library/private/filelibunix.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Library/private/filelibunix.cpp b/Library/private/filelibunix.cpp index aca94cb2..baaf8b8c 100644 --- a/Library/private/filelibunix.cpp +++ b/Library/private/filelibunix.cpp @@ -33,6 +33,14 @@ #include "strlib.h" namespace platform { + +bool filelib_isDirectory(const std::string& filename) { + struct stat fileInfo; + if (stat(filename.c_str(), &fileInfo) != 0) { + return false; + } + return S_ISDIR(fileInfo.st_mode) != 0; +} void filelib_createDirectory(const std::string& path) { std::string pathStr = path; @@ -132,14 +140,6 @@ std::string filelib_getTempDirectory() { return dir; } -bool filelib_isDirectory(const std::string& filename) { - struct stat fileInfo; - if (stat(filename.c_str(), &fileInfo) != 0) { - return false; - } - return S_ISDIR(fileInfo.st_mode) != 0; -} - bool filelib_isFile(const std::string& filename) { struct stat fileInfo; if (stat(filename.c_str(), &fileInfo) != 0) { From 772c26284e1f4c5fdafebf3c3404540c28e83246 Mon Sep 17 00:00:00 2001 From: DrErickson <77122859+DrErickson@users.noreply.github.com> Date: Thu, 22 Aug 2024 15:39:23 -0700 Subject: [PATCH 04/18] Created CMakeLists.txt for each "Project". Verified "Welcome", "SPL-unit-tests", and "SimpleTestGuide" working for Windows, MinGW, Qt6.2.4 --- CMakeLists.txt | 123 ++++++------------ RandomClientTests/BugFixes/CMakeLists.txt | 58 +++++++++ RandomClientTests/CompileFlags/CMakeLists.txt | 58 +++++++++ RandomClientTests/ShadowTest/CMakeLists.txt | 60 +++++++++ SPL-unit-tests/CMakeLists.txt | 58 +++++++++ SimpleTestGuide/CMakeLists.txt | 60 +++++++++ Welcome/CMakeLists.txt | 61 +++++++++ 7 files changed, 397 insertions(+), 81 deletions(-) create mode 100644 RandomClientTests/BugFixes/CMakeLists.txt create mode 100644 RandomClientTests/CompileFlags/CMakeLists.txt create mode 100644 RandomClientTests/ShadowTest/CMakeLists.txt create mode 100644 SPL-unit-tests/CMakeLists.txt create mode 100644 SimpleTestGuide/CMakeLists.txt create mode 100644 Welcome/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index e2744993..6d4829be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,14 +1,16 @@ cmake_minimum_required(VERSION 3.17) -project(Welcome) +project(stanford-cpp-library) # MinGW compiler lags, be conservative and use C++11 on all platforms # rather than special case set(CMAKE_CXX_STANDARD 11) -# Need latest version of MinGW. -# You may need to specify the direct path. -# You can get MinGW from here: https://winlibs.com/ -#set(CMAKE_PREFIX_PATH "C:/PATH_TO_MINGW") +set(CS106_LIB_PATH "./Library") + +# Make sure you have an updated version of MinGW +# set(CMAKE_PREFIX_PATH "C:/PATH_TO_COMPILER") +# Alternatively it can also be MSVC compiler (not tested) +# set(CMAKE_PREFIX_PATH "C:/Qt6/6.2.4/msvc2019_64") set(CMAKE_PREFIX_PATH "C:/Qt6/6.2.4/mingw_64") set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) @@ -18,19 +20,17 @@ set(CMAKE_AUTOUIC ON) find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Quick QuickControls2 Widgets Qt6QuickCompiler REQUIRED) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Quick QuickControls2 Widgets REQUIRED) - # Include all the cs106 library folders -include_directories("Library") -include_directories("Library/collections") -include_directories("Library/console") -include_directories("Library/graphics") -include_directories("Library/io") -include_directories("Library/private") -include_directories("Library/resources") -include_directories("Library/system") -include_directories("Library/util") -include_directories("Library/testing") -include_directories("Welcome") +include_directories("${CS106_LIB_PATH}") +include_directories("${CS106_LIB_PATH}/collections") +include_directories("${CS106_LIB_PATH}/console") +include_directories("${CS106_LIB_PATH}/graphics") +include_directories("${CS106_LIB_PATH}/io") +include_directories("${CS106_LIB_PATH}/private") +include_directories("${CS106_LIB_PATH}/resources") +include_directories("${CS106_LIB_PATH}/system") +include_directories("${CS106_LIB_PATH}/util") +include_directories("${CS106_LIB_PATH}/testing") # Used in build.h.in file to generate build.h file set (SPL_VERSION "2023.1") @@ -47,26 +47,25 @@ endif () # Generate build.h file add_definitions(-DSPL_CMAKE_BUILD) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Library/private/build.h.in - ${CMAKE_CURRENT_SOURCE_DIR}/Library/private/build.h @ONLY) +configure_file( + ${CS106_LIB_PATH}/private/build.h.in + ${CS106_LIB_PATH}/private/build.h + @ONLY +) # Create list of source files file(GLOB LIBRARY_SRC CONFIGURE_DEPENDS - "Library/collections/*.cpp" - "Library/console/*.cpp" - "Library/graphics/*.cpp" - "Library/io/*.cpp" - "Library/system/*.cpp" - "Library/util/*.cpp" - "Library/testing/*.cpp" - "Library/private/*.cpp" - ) - -# Remove to avoid extra redefinitions -list(REMOVE_ITEM LIBRARY_SRC "${CMAKE_CURRENT_SOURCE_DIR}/Library/private/filelibwindows.cpp") -list(REMOVE_ITEM LIBRARY_SRC "${CMAKE_CURRENT_SOURCE_DIR}/Library/private/filelibunix.cpp") - -file(GLOB QT_RESOURCES Library/images.qrc) + "${CS106_LIB_PATH}/collections/*.cpp" + "${CS106_LIB_PATH}/console/*.cpp" + "${CS106_LIB_PATH}/graphics/*.cpp" + "${CS106_LIB_PATH}/io/*.cpp" + "${CS106_LIB_PATH}/system/*.cpp" + "${CS106_LIB_PATH}/util/*.cpp" + "${CS106_LIB_PATH}/testing/*.cpp" + "${CS106_LIB_PATH}/private/*.cpp" +) + +file(GLOB QT_RESOURCES ${CS106_LIB_PATH}/images.qrc) # We need to say what libraries we need from Qt6 # Qt is very picky about the compiler version. @@ -79,7 +78,7 @@ set(REQUIRED_LIBS_QUALIFIED Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Network) qt_add_resources(RCC_SOURCES ${QT_RESOURCES}) # https://doc.qt.io/qt-6/cmake-get-started.html -## Create static library +# Create static library qt_add_library(CS106_library STATIC ${LIBRARY_SRC} ${PRIVATE_SRC} @@ -91,50 +90,12 @@ qt_add_library(CS106_library STATIC # Link CS106 library to required Qt libraries target_link_libraries(CS106_library PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Network) -add_executable(${PROJECT_NAME} - Welcome/Welcome.cpp -) +# Call CMakeLists.txt files of subdirectories +add_subdirectory(Welcome) +add_subdirectory(SPL-unit-tests) +add_subdirectory(SimpleTestGuide) -# link exe to CS106 library -target_link_libraries(${PROJECT_NAME} CS106_library) - -# student writes ordinary main() function, but it must be called within a -# wrapper main() that handles library setup/teardown. Rename student's -# to distinguish between the two main() functions and avoid symbol clash -# Ask Julie if you are curious why main->qMain->studentMain -target_compile_definitions(${PROJECT_NAME} PRIVATE main=qMain) -target_compile_definitions(${PROJECT_NAME} PRIVATE qMain=studentMain) - -if (NOT CMAKE_PREFIX_PATH) - message(WARNING "CMAKE_PREFIX_PATH is not defined, you may need to set it " - "(-DCMAKE_PREFIX_PATH=\"path/to/Qt/lib/cmake\" or -DCMAKE_PREFIX_PATH=/usr/include/{host}/qt{version}/ on Ubuntu)") -endif () - -find_package(Qt${QT_VERSION} COMPONENTS ${REQUIRED_LIBS} REQUIRED) -target_link_libraries(${PROJECT_NAME} ${REQUIRED_LIBS_QUALIFIED}) - -if (WIN32) - set(DEBUG_SUFFIX) - set(QT_INSTALL_PATH "${CMAKE_PREFIX_PATH}") - if (NOT EXISTS "${QT_INSTALL_PATH}/bin") - set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..") - if (NOT EXISTS "${QT_INSTALL_PATH}/bin") - set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..") - endif () - endif () - if (EXISTS "${QT_INSTALL_PATH}/plugins/platforms/qwindows${DEBUG_SUFFIX}.dll") - add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E make_directory - "$/plugins/platforms/") - add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy - "${QT_INSTALL_PATH}/plugins/platforms/qwindows${DEBUG_SUFFIX}.dll" - "$/plugins/platforms/") - endif () - foreach (QT_LIB ${REQUIRED_LIBS}) - add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy - "${QT_INSTALL_PATH}/bin/Qt${QT_VERSION}${QT_LIB}${DEBUG_SUFFIX}.dll" - "$") - endforeach (QT_LIB) -endif () +# TODO: These need to be fixed/tested +# add_subdirectory(RandomClientTests/BugFixes) +# add_subdirectory(RandomClientTests/CompileFlags) +# add_subdirectory(RandomClientTests/ShadowTest) diff --git a/RandomClientTests/BugFixes/CMakeLists.txt b/RandomClientTests/BugFixes/CMakeLists.txt new file mode 100644 index 00000000..0af21aad --- /dev/null +++ b/RandomClientTests/BugFixes/CMakeLists.txt @@ -0,0 +1,58 @@ +cmake_minimum_required(VERSION 3.17) +project(BugFixes) + +# Need the relative path to Library +set(CS106_LIB_PATH "../../Library") + +# Create the project executable +add_executable(${PROJECT_NAME} + bugfixes.cpp +) + +# link exe to CS106 library +target_link_libraries(${PROJECT_NAME} CS106_library) + +# student writes ordinary main() function, but it must be called within a +# wrapper main() that handles library setup/teardown. Rename student's +# to distinguish between the two main() functions and avoid symbol clash +# Ask Julie if you are curious why main->qMain->studentMain +target_compile_definitions(${PROJECT_NAME} PRIVATE main=qMain) +target_compile_definitions(${PROJECT_NAME} PRIVATE qMain=studentMain) + +if (NOT CMAKE_PREFIX_PATH) + message(WARNING "CMAKE_PREFIX_PATH is not defined, you may need to set it " + "(-DCMAKE_PREFIX_PATH=\"path/to/Qt/lib/cmake\" or -DCMAKE_PREFIX_PATH=/usr/include/{host}/qt{version}/ on Ubuntu)") +endif () + +find_package(Qt${QT_VERSION} COMPONENTS ${REQUIRED_LIBS} REQUIRED) +target_link_libraries(${PROJECT_NAME} ${REQUIRED_LIBS_QUALIFIED}) + +if (WIN32) + if (CMAKE_BUILD_TYPE MATCHES "Debug") + set(EXTENSION "debug") + else () + set(EXTENSION "dll") + endif () + set(QT_INSTALL_PATH "${CMAKE_PREFIX_PATH}") + if (NOT EXISTS "${QT_INSTALL_PATH}/bin") + set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..") + if (NOT EXISTS "${QT_INSTALL_PATH}/bin") + set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..") + endif () + endif () + if (EXISTS "${QT_INSTALL_PATH}/plugins/platforms/qwindows.dll") + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory + "$/plugins/platforms/") + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + "${QT_INSTALL_PATH}/plugins/platforms/qwindows.${EXTENSION}" + "$/plugins/platforms/") + endif () + foreach (QT_LIB ${REQUIRED_LIBS}) + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + "${QT_INSTALL_PATH}/bin/Qt${QT_VERSION}${QT_LIB}.${EXTENSION}" + "$") + endforeach (QT_LIB) +endif () \ No newline at end of file diff --git a/RandomClientTests/CompileFlags/CMakeLists.txt b/RandomClientTests/CompileFlags/CMakeLists.txt new file mode 100644 index 00000000..88ee8f79 --- /dev/null +++ b/RandomClientTests/CompileFlags/CMakeLists.txt @@ -0,0 +1,58 @@ +cmake_minimum_required(VERSION 3.17) +project(CompileFlags) + +# Need the relative path to Library +set(CS106_LIB_PATH "../../Library") + +# Create the project executable +add_executable(${PROJECT_NAME} + compile.cpp +) + +# link exe to CS106 library +target_link_libraries(${PROJECT_NAME} CS106_library) + +# student writes ordinary main() function, but it must be called within a +# wrapper main() that handles library setup/teardown. Rename student's +# to distinguish between the two main() functions and avoid symbol clash +# Ask Julie if you are curious why main->qMain->studentMain +target_compile_definitions(${PROJECT_NAME} PRIVATE main=qMain) +target_compile_definitions(${PROJECT_NAME} PRIVATE qMain=studentMain) + +if (NOT CMAKE_PREFIX_PATH) + message(WARNING "CMAKE_PREFIX_PATH is not defined, you may need to set it " + "(-DCMAKE_PREFIX_PATH=\"path/to/Qt/lib/cmake\" or -DCMAKE_PREFIX_PATH=/usr/include/{host}/qt{version}/ on Ubuntu)") +endif () + +find_package(Qt${QT_VERSION} COMPONENTS ${REQUIRED_LIBS} REQUIRED) +target_link_libraries(${PROJECT_NAME} ${REQUIRED_LIBS_QUALIFIED}) + +if (WIN32) + if (CMAKE_BUILD_TYPE MATCHES "Debug") + set(EXTENSION "debug") + else () + set(EXTENSION "dll") + endif () + set(QT_INSTALL_PATH "${CMAKE_PREFIX_PATH}") + if (NOT EXISTS "${QT_INSTALL_PATH}/bin") + set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..") + if (NOT EXISTS "${QT_INSTALL_PATH}/bin") + set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..") + endif () + endif () + if (EXISTS "${QT_INSTALL_PATH}/plugins/platforms/qwindows.dll") + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory + "$/plugins/platforms/") + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + "${QT_INSTALL_PATH}/plugins/platforms/qwindows.${EXTENSION}" + "$/plugins/platforms/") + endif () + foreach (QT_LIB ${REQUIRED_LIBS}) + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + "${QT_INSTALL_PATH}/bin/Qt${QT_VERSION}${QT_LIB}.${EXTENSION}" + "$") + endforeach (QT_LIB) +endif () \ No newline at end of file diff --git a/RandomClientTests/ShadowTest/CMakeLists.txt b/RandomClientTests/ShadowTest/CMakeLists.txt new file mode 100644 index 00000000..98f9c844 --- /dev/null +++ b/RandomClientTests/ShadowTest/CMakeLists.txt @@ -0,0 +1,60 @@ +cmake_minimum_required(VERSION 3.17) +project(ShadowTest) + +# Need the relative path to Library +set(CS106_LIB_PATH "../../Library") + +# Create the project executable +add_executable(${PROJECT_NAME} + main.cpp + strlib.cpp + strlib.h +) + +# link exe to CS106 library +target_link_libraries(${PROJECT_NAME} CS106_library) + +# student writes ordinary main() function, but it must be called within a +# wrapper main() that handles library setup/teardown. Rename student's +# to distinguish between the two main() functions and avoid symbol clash +# Ask Julie if you are curious why main->qMain->studentMain +target_compile_definitions(${PROJECT_NAME} PRIVATE main=qMain) +target_compile_definitions(${PROJECT_NAME} PRIVATE qMain=studentMain) + +if (NOT CMAKE_PREFIX_PATH) + message(WARNING "CMAKE_PREFIX_PATH is not defined, you may need to set it " + "(-DCMAKE_PREFIX_PATH=\"path/to/Qt/lib/cmake\" or -DCMAKE_PREFIX_PATH=/usr/include/{host}/qt{version}/ on Ubuntu)") +endif () + +find_package(Qt${QT_VERSION} COMPONENTS ${REQUIRED_LIBS} REQUIRED) +target_link_libraries(${PROJECT_NAME} ${REQUIRED_LIBS_QUALIFIED}) + +if (WIN32) + if (CMAKE_BUILD_TYPE MATCHES "Debug") + set(EXTENSION "debug") + else () + set(EXTENSION "dll") + endif () + set(QT_INSTALL_PATH "${CMAKE_PREFIX_PATH}") + if (NOT EXISTS "${QT_INSTALL_PATH}/bin") + set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..") + if (NOT EXISTS "${QT_INSTALL_PATH}/bin") + set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..") + endif () + endif () + if (EXISTS "${QT_INSTALL_PATH}/plugins/platforms/qwindows.dll") + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory + "$/plugins/platforms/") + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + "${QT_INSTALL_PATH}/plugins/platforms/qwindows.${EXTENSION}" + "$/plugins/platforms/") + endif () + foreach (QT_LIB ${REQUIRED_LIBS}) + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + "${QT_INSTALL_PATH}/bin/Qt${QT_VERSION}${QT_LIB}.${EXTENSION}" + "$") + endforeach (QT_LIB) +endif () \ No newline at end of file diff --git a/SPL-unit-tests/CMakeLists.txt b/SPL-unit-tests/CMakeLists.txt new file mode 100644 index 00000000..03ef2631 --- /dev/null +++ b/SPL-unit-tests/CMakeLists.txt @@ -0,0 +1,58 @@ +cmake_minimum_required(VERSION 3.17) +project(SPL-unit-tests) + +# Need the relative path to Library +set(CS106_LIB_PATH "../Library") + +# Create the project executable +add_executable(${PROJECT_NAME} + main.cpp +) + +# link exe to CS106 library +target_link_libraries(${PROJECT_NAME} CS106_library) + +# student writes ordinary main() function, but it must be called within a +# wrapper main() that handles library setup/teardown. Rename student's +# to distinguish between the two main() functions and avoid symbol clash +# Ask Julie if you are curious why main->qMain->studentMain +target_compile_definitions(${PROJECT_NAME} PRIVATE main=qMain) +target_compile_definitions(${PROJECT_NAME} PRIVATE qMain=studentMain) + +if (NOT CMAKE_PREFIX_PATH) + message(WARNING "CMAKE_PREFIX_PATH is not defined, you may need to set it " + "(-DCMAKE_PREFIX_PATH=\"path/to/Qt/lib/cmake\" or -DCMAKE_PREFIX_PATH=/usr/include/{host}/qt{version}/ on Ubuntu)") +endif () + +find_package(Qt${QT_VERSION} COMPONENTS ${REQUIRED_LIBS} REQUIRED) +target_link_libraries(${PROJECT_NAME} ${REQUIRED_LIBS_QUALIFIED}) + +if (WIN32) + if (CMAKE_BUILD_TYPE MATCHES "Debug") + set(EXTENSION "debug") + else () + set(EXTENSION "dll") + endif () + set(QT_INSTALL_PATH "${CMAKE_PREFIX_PATH}") + if (NOT EXISTS "${QT_INSTALL_PATH}/bin") + set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..") + if (NOT EXISTS "${QT_INSTALL_PATH}/bin") + set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..") + endif () + endif () + if (EXISTS "${QT_INSTALL_PATH}/plugins/platforms/qwindows.dll") + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory + "$/plugins/platforms/") + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + "${QT_INSTALL_PATH}/plugins/platforms/qwindows.${EXTENSION}" + "$/plugins/platforms/") + endif () + foreach (QT_LIB ${REQUIRED_LIBS}) + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + "${QT_INSTALL_PATH}/bin/Qt${QT_VERSION}${QT_LIB}.${EXTENSION}" + "$") + endforeach (QT_LIB) +endif () \ No newline at end of file diff --git a/SimpleTestGuide/CMakeLists.txt b/SimpleTestGuide/CMakeLists.txt new file mode 100644 index 00000000..bcee2be2 --- /dev/null +++ b/SimpleTestGuide/CMakeLists.txt @@ -0,0 +1,60 @@ +cmake_minimum_required(VERSION 3.17) +project(SimpleTestGuide) + +# Need the relative path to Library +set(CS106_LIB_PATH "../Library") + +# Create the project executable +add_executable(${PROJECT_NAME} + main.cpp + simpletestguide.cpp + unittest.cpp +) + +# link exe to CS106 library +target_link_libraries(${PROJECT_NAME} CS106_library) + +# student writes ordinary main() function, but it must be called within a +# wrapper main() that handles library setup/teardown. Rename student's +# to distinguish between the two main() functions and avoid symbol clash +# Ask Julie if you are curious why main->qMain->studentMain +target_compile_definitions(${PROJECT_NAME} PRIVATE main=qMain) +target_compile_definitions(${PROJECT_NAME} PRIVATE qMain=studentMain) + +if (NOT CMAKE_PREFIX_PATH) + message(WARNING "CMAKE_PREFIX_PATH is not defined, you may need to set it " + "(-DCMAKE_PREFIX_PATH=\"path/to/Qt/lib/cmake\" or -DCMAKE_PREFIX_PATH=/usr/include/{host}/qt{version}/ on Ubuntu)") +endif () + +find_package(Qt${QT_VERSION} COMPONENTS ${REQUIRED_LIBS} REQUIRED) +target_link_libraries(${PROJECT_NAME} ${REQUIRED_LIBS_QUALIFIED}) + +if (WIN32) + if (CMAKE_BUILD_TYPE MATCHES "Debug") + set(EXTENSION "debug") + else () + set(EXTENSION "dll") + endif () + set(QT_INSTALL_PATH "${CMAKE_PREFIX_PATH}") + if (NOT EXISTS "${QT_INSTALL_PATH}/bin") + set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..") + if (NOT EXISTS "${QT_INSTALL_PATH}/bin") + set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..") + endif () + endif () + if (EXISTS "${QT_INSTALL_PATH}/plugins/platforms/qwindows.dll") + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory + "$/plugins/platforms/") + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + "${QT_INSTALL_PATH}/plugins/platforms/qwindows.${EXTENSION}" + "$/plugins/platforms/") + endif () + foreach (QT_LIB ${REQUIRED_LIBS}) + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + "${QT_INSTALL_PATH}/bin/Qt${QT_VERSION}${QT_LIB}.${EXTENSION}" + "$") + endforeach (QT_LIB) +endif () \ No newline at end of file diff --git a/Welcome/CMakeLists.txt b/Welcome/CMakeLists.txt new file mode 100644 index 00000000..4ff7e168 --- /dev/null +++ b/Welcome/CMakeLists.txt @@ -0,0 +1,61 @@ +cmake_minimum_required(VERSION 3.17) +project(Welcome) + +# Need the relative path to Library +set(CS106_LIB_PATH "../Library") + +# Link CS106 library to required Qt libraries +target_link_libraries(CS106_library PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Network) + +# Create the project executable +add_executable(${PROJECT_NAME} + Welcome.cpp +) + +# link exe to CS106 library +target_link_libraries(${PROJECT_NAME} CS106_library) + +# student writes ordinary main() function, but it must be called within a +# wrapper main() that handles library setup/teardown. Rename student's +# to distinguish between the two main() functions and avoid symbol clash +# Ask Julie if you are curious why main->qMain->studentMain +target_compile_definitions(${PROJECT_NAME} PRIVATE main=qMain) +target_compile_definitions(${PROJECT_NAME} PRIVATE qMain=studentMain) + +if (NOT CMAKE_PREFIX_PATH) + message(WARNING "CMAKE_PREFIX_PATH is not defined, you may need to set it " + "(-DCMAKE_PREFIX_PATH=\"path/to/Qt/lib/cmake\" or -DCMAKE_PREFIX_PATH=/usr/include/{host}/qt{version}/ on Ubuntu)") +endif () + +find_package(Qt${QT_VERSION} COMPONENTS ${REQUIRED_LIBS} REQUIRED) +target_link_libraries(${PROJECT_NAME} ${REQUIRED_LIBS_QUALIFIED}) + +if (WIN32) + if (CMAKE_BUILD_TYPE MATCHES "Debug") + set(EXTENSION "debug") + else () + set(EXTENSION "dll") + endif () + set(QT_INSTALL_PATH "${CMAKE_PREFIX_PATH}") + if (NOT EXISTS "${QT_INSTALL_PATH}/bin") + set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..") + if (NOT EXISTS "${QT_INSTALL_PATH}/bin") + set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..") + endif () + endif () + if (EXISTS "${QT_INSTALL_PATH}/plugins/platforms/qwindows.dll") + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory + "$/plugins/platforms/") + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + "${QT_INSTALL_PATH}/plugins/platforms/qwindows.${EXTENSION}" + "$/plugins/platforms/") + endif () + foreach (QT_LIB ${REQUIRED_LIBS}) + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + "${QT_INSTALL_PATH}/bin/Qt${QT_VERSION}${QT_LIB}.${EXTENSION}" + "$") + endforeach (QT_LIB) +endif () \ No newline at end of file From 46f9bbf18a05694998d525f19ca4d8cbdd753c92 Mon Sep 17 00:00:00 2001 From: DrErickson <77122859+DrErickson@users.noreply.github.com> Date: Fri, 23 Aug 2024 12:03:43 -0700 Subject: [PATCH 05/18] Fixed path issue with build.h generation --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d4829be..e9f67a38 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,16 @@ cmake_minimum_required(VERSION 3.17) project(stanford-cpp-library) +# This CMake provides an example of how to use CMake to build the +# Stanford cpp library rather than a pro file. +# This allows the use of other IDE's such as CLion, VSC, etc. for +# development. + # MinGW compiler lags, be conservative and use C++11 on all platforms # rather than special case set(CMAKE_CXX_STANDARD 11) -set(CS106_LIB_PATH "./Library") +set(CS106_LIB_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Library") # Make sure you have an updated version of MinGW # set(CMAKE_PREFIX_PATH "C:/PATH_TO_COMPILER") @@ -49,10 +54,11 @@ endif () add_definitions(-DSPL_CMAKE_BUILD) configure_file( ${CS106_LIB_PATH}/private/build.h.in - ${CS106_LIB_PATH}/private/build.h + ${CS106_LIB_PATH}/private/build.h @ONLY ) + # Create list of source files file(GLOB LIBRARY_SRC CONFIGURE_DEPENDS "${CS106_LIB_PATH}/collections/*.cpp" From a0babbddd3cf5e23b34bf8e24f2b0698702235f0 Mon Sep 17 00:00:00 2001 From: DrErickson <77122859+DrErickson@users.noreply.github.com> Date: Fri, 23 Aug 2024 12:27:15 -0700 Subject: [PATCH 06/18] Fixed header globbing --- CMakeLists.txt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e9f67a38..ac4f57a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,6 +71,18 @@ file(GLOB LIBRARY_SRC CONFIGURE_DEPENDS "${CS106_LIB_PATH}/private/*.cpp" ) +# Create list of header files +file(GLOB LIBRARY_HEADER CONFIGURE_DEPENDS + "${CS106_LIB_PATH}/collections/*.h" + "${CS106_LIB_PATH}/console/*.h" + "${CS106_LIB_PATH}/graphics/*.h" + "${CS106_LIB_PATH}/io/*.h" + "${CS106_LIB_PATH}/system/*.h" + "${CS106_LIB_PATH}/util/*.h" + "${CS106_LIB_PATH}/testing/*.h" + "${CS106_LIB_PATH}/private/*.h" +) + file(GLOB QT_RESOURCES ${CS106_LIB_PATH}/images.qrc) # We need to say what libraries we need from Qt6 @@ -87,9 +99,7 @@ qt_add_resources(RCC_SOURCES ${QT_RESOURCES}) # Create static library qt_add_library(CS106_library STATIC ${LIBRARY_SRC} - ${PRIVATE_SRC} ${LIBRARY_HEADER} - ${PRIVATE_HEADER} ${RCC_SOURCES} ) From bfe6d12990744601fa92909da890263105babd89 Mon Sep 17 00:00:00 2001 From: DrErickson <77122859+DrErickson@users.noreply.github.com> Date: Sat, 24 Aug 2024 08:41:12 -0700 Subject: [PATCH 07/18] Use dll libraries by default. --- SPL-unit-tests/CMakeLists.txt | 15 +++++++++------ SimpleTestGuide/CMakeLists.txt | 15 +++++++++------ Welcome/CMakeLists.txt | 15 +++++++++------ 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/SPL-unit-tests/CMakeLists.txt b/SPL-unit-tests/CMakeLists.txt index 03ef2631..59d11e87 100644 --- a/SPL-unit-tests/CMakeLists.txt +++ b/SPL-unit-tests/CMakeLists.txt @@ -28,11 +28,11 @@ find_package(Qt${QT_VERSION} COMPONENTS ${REQUIRED_LIBS} REQUIRED) target_link_libraries(${PROJECT_NAME} ${REQUIRED_LIBS_QUALIFIED}) if (WIN32) - if (CMAKE_BUILD_TYPE MATCHES "Debug") - set(EXTENSION "debug") - else () - set(EXTENSION "dll") - endif () + + # If the debug library versions do not exist, + # consider using the dll library version instead + set(EXTENSION "dll") + # set(EXTENSION "debug") set(QT_INSTALL_PATH "${CMAKE_PREFIX_PATH}") if (NOT EXISTS "${QT_INSTALL_PATH}/bin") set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..") @@ -46,10 +46,13 @@ if (WIN32) "$/plugins/platforms/") add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy - "${QT_INSTALL_PATH}/plugins/platforms/qwindows.${EXTENSION}" + "${QT_INSTALL_PATH}/plugins/platforms/qwindows.dll" "$/plugins/platforms/") endif () foreach (QT_LIB ${REQUIRED_LIBS}) + if (NOT EXISTS "${QT_INSTALL_PATH}/bin/Qt${QT_VERSION}${QT_LIB}.${EXTENSION}") + message("${QT_INSTALL_PATH}/bin/Qt${QT_VERSION}${QT_LIB}.${EXTENSION} does not exist") + endif () add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${QT_INSTALL_PATH}/bin/Qt${QT_VERSION}${QT_LIB}.${EXTENSION}" diff --git a/SimpleTestGuide/CMakeLists.txt b/SimpleTestGuide/CMakeLists.txt index bcee2be2..78f4d022 100644 --- a/SimpleTestGuide/CMakeLists.txt +++ b/SimpleTestGuide/CMakeLists.txt @@ -30,11 +30,11 @@ find_package(Qt${QT_VERSION} COMPONENTS ${REQUIRED_LIBS} REQUIRED) target_link_libraries(${PROJECT_NAME} ${REQUIRED_LIBS_QUALIFIED}) if (WIN32) - if (CMAKE_BUILD_TYPE MATCHES "Debug") - set(EXTENSION "debug") - else () - set(EXTENSION "dll") - endif () + + # If the debug library versions do not exist, + # consider using the dll library version instead + set(EXTENSION "dll") + # set(EXTENSION "debug") set(QT_INSTALL_PATH "${CMAKE_PREFIX_PATH}") if (NOT EXISTS "${QT_INSTALL_PATH}/bin") set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..") @@ -48,10 +48,13 @@ if (WIN32) "$/plugins/platforms/") add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy - "${QT_INSTALL_PATH}/plugins/platforms/qwindows.${EXTENSION}" + "${QT_INSTALL_PATH}/plugins/platforms/qwindows.dll" "$/plugins/platforms/") endif () foreach (QT_LIB ${REQUIRED_LIBS}) + if (NOT EXISTS "${QT_INSTALL_PATH}/bin/Qt${QT_VERSION}${QT_LIB}.${EXTENSION}") + message("${QT_INSTALL_PATH}/bin/Qt${QT_VERSION}${QT_LIB}.${EXTENSION} does not exist") + endif () add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${QT_INSTALL_PATH}/bin/Qt${QT_VERSION}${QT_LIB}.${EXTENSION}" diff --git a/Welcome/CMakeLists.txt b/Welcome/CMakeLists.txt index 4ff7e168..2eaa8316 100644 --- a/Welcome/CMakeLists.txt +++ b/Welcome/CMakeLists.txt @@ -31,11 +31,11 @@ find_package(Qt${QT_VERSION} COMPONENTS ${REQUIRED_LIBS} REQUIRED) target_link_libraries(${PROJECT_NAME} ${REQUIRED_LIBS_QUALIFIED}) if (WIN32) - if (CMAKE_BUILD_TYPE MATCHES "Debug") - set(EXTENSION "debug") - else () - set(EXTENSION "dll") - endif () + + # If the debug library versions do not exist, + # consider using the dll library version instead + set(EXTENSION "dll") + # set(EXTENSION "debug") set(QT_INSTALL_PATH "${CMAKE_PREFIX_PATH}") if (NOT EXISTS "${QT_INSTALL_PATH}/bin") set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..") @@ -49,10 +49,13 @@ if (WIN32) "$/plugins/platforms/") add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy - "${QT_INSTALL_PATH}/plugins/platforms/qwindows.${EXTENSION}" + "${QT_INSTALL_PATH}/plugins/platforms/qwindows.dll" "$/plugins/platforms/") endif () foreach (QT_LIB ${REQUIRED_LIBS}) + if (NOT EXISTS "${QT_INSTALL_PATH}/bin/Qt${QT_VERSION}${QT_LIB}.${EXTENSION}") + message("${QT_INSTALL_PATH}/bin/Qt${QT_VERSION}${QT_LIB}.${EXTENSION} does not exist") + endif () add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${QT_INSTALL_PATH}/bin/Qt${QT_VERSION}${QT_LIB}.${EXTENSION}" From c3a5bfe32ff936382ab5db7ac44ef6becff88775 Mon Sep 17 00:00:00 2001 From: DrErickson <77122859+DrErickson@users.noreply.github.com> Date: Sun, 25 Aug 2024 16:23:58 -0700 Subject: [PATCH 08/18] Fixed unit tests to include ALL test files. --- SPL-unit-tests/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SPL-unit-tests/CMakeLists.txt b/SPL-unit-tests/CMakeLists.txt index 59d11e87..6574648b 100644 --- a/SPL-unit-tests/CMakeLists.txt +++ b/SPL-unit-tests/CMakeLists.txt @@ -4,9 +4,13 @@ project(SPL-unit-tests) # Need the relative path to Library set(CS106_LIB_PATH "../Library") +file(GLOB TEST_SRC CONFIGURE_DEPENDS + "*.cpp" +) + # Create the project executable add_executable(${PROJECT_NAME} - main.cpp + ${TEST_SRC} ) # link exe to CS106 library From fa1708924c22b44cee9c883cd56be2a5426a4c4c Mon Sep 17 00:00:00 2001 From: Varick Erickson Date: Fri, 30 Aug 2024 16:54:06 -0700 Subject: [PATCH 09/18] Cleaned up find_package call Updated CMAKE_PREFIX_PATH to look at most likely install path based on OS --- CMakeLists.txt | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ac4f57a5..d4241c74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,18 +12,27 @@ set(CMAKE_CXX_STANDARD 11) set(CS106_LIB_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Library") -# Make sure you have an updated version of MinGW -# set(CMAKE_PREFIX_PATH "C:/PATH_TO_COMPILER") -# Alternatively it can also be MSVC compiler (not tested) -# set(CMAKE_PREFIX_PATH "C:/Qt6/6.2.4/msvc2019_64") -set(CMAKE_PREFIX_PATH "C:/Qt6/6.2.4/mingw_64") -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) -set(CMAKE_AUTOUIC ON) - -# Special sauce to get qt resources to work -find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Quick QuickControls2 Widgets Qt6QuickCompiler REQUIRED) -find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Quick QuickControls2 Widgets REQUIRED) +# We try to make a best guess based on the OS, but you may +# need to manually specify the path to the qt CMake. +if (WIN32) + # I recommend using MinGW for Windows + set(CMAKE_PREFIX_PATH "C:/Qt/6.7.2/mingw_64") + + # Alternatively it can use MSVC 2019 compiler (Not tested) + # set(CMAKE_PREFIX_PATH "C:/Qt/6.7.2/msvc2019_64") +elseif (APPLE) + # Not tested + set(CMAKE_PREFIX_PATH "~/Qt/6.7.2/macos") +else () + # UNIX/Linux case + set(CMAKE_PREFIX_PATH "~/Qt6/6.7.2/gcc_64") +endif () + +set(CMAKE_AUTOMOC ON) # Automatic handling of the Qt Meta-Object Compiler (MOC) +set(CMAKE_AUTORCC ON) # Automatic handling of the Qt Resource compiler +set(CMAKE_AUTOUIC ON) # Automatic handling of the Qt UI code generator + +find_package(Qt6 COMPONENTS Core Quick Gui Widgets REQUIRED) # Include all the cs106 library folders include_directories("${CS106_LIB_PATH}") From e1f8aae7415773e27fee2a70c93c5d59a76df022 Mon Sep 17 00:00:00 2001 From: Varick Erickson Date: Fri, 30 Aug 2024 16:56:34 -0700 Subject: [PATCH 10/18] Fixed odd issue with gif icons. QPixmap does not support gif by default. In some rare cases, Windows does not load the gif icons. Converted icons to png and updated images.qrc ensure compatibility. https://doc.qt.io/qt-6/qimagewriter.html#supportedImageFormats --- Library/images.qrc | 40 +++++++++--------- Library/resources/about.png | Bin 0 -> 880 bytes Library/resources/background_color.png | Bin 0 -> 367 bytes Library/resources/clear_console.png | Bin 0 -> 368 bytes Library/resources/compare_output.png | Bin 0 -> 760 bytes Library/resources/copy.png | Bin 0 -> 624 bytes Library/resources/cut.png | Bin 0 -> 632 bytes Library/resources/font.png | Bin 0 -> 511 bytes Library/resources/load_input_script.png | Bin 0 -> 767 bytes Library/resources/{ => old_gif}/about.gif | Bin .../{ => old_gif}/background_color.gif | Bin .../resources/{ => old_gif}/clear_console.gif | Bin .../{ => old_gif}/compare_output.gif | Bin Library/resources/{ => old_gif}/copy.gif | Bin Library/resources/{ => old_gif}/cut.gif | Bin Library/resources/{ => old_gif}/font.gif | Bin .../{ => old_gif}/load_input_script.gif | Bin Library/resources/{ => old_gif}/paste.gif | Bin Library/resources/{ => old_gif}/print.gif | Bin Library/resources/{ => old_gif}/quit.gif | Bin Library/resources/{ => old_gif}/save.gif | Bin Library/resources/{ => old_gif}/save_as.gif | Bin .../resources/{ => old_gif}/select_all.gif | Bin .../resources/{ => old_gif}/text_color.gif | Bin Library/resources/paste.png | Bin 0 -> 766 bytes Library/resources/print.png | Bin 0 -> 826 bytes Library/resources/quit.png | Bin 0 -> 368 bytes Library/resources/save.png | Bin 0 -> 688 bytes Library/resources/save_as.png | Bin 0 -> 688 bytes Library/resources/select_all.png | Bin 0 -> 320 bytes Library/resources/text_color.png | Bin 0 -> 367 bytes 31 files changed, 19 insertions(+), 21 deletions(-) create mode 100644 Library/resources/about.png create mode 100644 Library/resources/background_color.png create mode 100644 Library/resources/clear_console.png create mode 100644 Library/resources/compare_output.png create mode 100644 Library/resources/copy.png create mode 100644 Library/resources/cut.png create mode 100644 Library/resources/font.png create mode 100644 Library/resources/load_input_script.png rename Library/resources/{ => old_gif}/about.gif (100%) rename Library/resources/{ => old_gif}/background_color.gif (100%) rename Library/resources/{ => old_gif}/clear_console.gif (100%) rename Library/resources/{ => old_gif}/compare_output.gif (100%) rename Library/resources/{ => old_gif}/copy.gif (100%) rename Library/resources/{ => old_gif}/cut.gif (100%) rename Library/resources/{ => old_gif}/font.gif (100%) rename Library/resources/{ => old_gif}/load_input_script.gif (100%) rename Library/resources/{ => old_gif}/paste.gif (100%) rename Library/resources/{ => old_gif}/print.gif (100%) rename Library/resources/{ => old_gif}/quit.gif (100%) rename Library/resources/{ => old_gif}/save.gif (100%) rename Library/resources/{ => old_gif}/save_as.gif (100%) rename Library/resources/{ => old_gif}/select_all.gif (100%) rename Library/resources/{ => old_gif}/text_color.gif (100%) create mode 100644 Library/resources/paste.png create mode 100644 Library/resources/print.png create mode 100644 Library/resources/quit.png create mode 100644 Library/resources/save.png create mode 100644 Library/resources/save_as.png create mode 100644 Library/resources/select_all.png create mode 100644 Library/resources/text_color.png diff --git a/Library/images.qrc b/Library/images.qrc index 01368cf1..da79acf9 100644 --- a/Library/images.qrc +++ b/Library/images.qrc @@ -1,22 +1,20 @@ - - resources/splicon-large.png - - resources/about.gif - resources/background_color.gif - resources/clear_console.gif - resources/compare_output.gif - resources/copy.gif - resources/cut.gif - resources/font.gif - resources/load_input_script.gif - resources/paste.gif - resources/print.gif - resources/quit.gif - resources/save.gif - resources/save_as.gif - resources/select_all.gif - resources/text_color.gif - - - \ No newline at end of file + + resources/about.png + resources/background_color.png + resources/clear_console.png + resources/compare_output.png + resources/copy.png + resources/cut.png + resources/font.png + resources/load_input_script.png + resources/paste.png + resources/print.png + resources/quit.png + resources/save.png + resources/save_as.png + resources/select_all.png + resources/splicon-large.png + resources/text_color.png + + diff --git a/Library/resources/about.png b/Library/resources/about.png new file mode 100644 index 0000000000000000000000000000000000000000..dd92a95a6557b24e3a6c934925598db638539631 GIT binary patch literal 880 zcmV-$1CRWPP)004R>004l5008;`004mK004C`008P>0026e000+ooVrmw0004` zP)t-s|NsBM*!RBI_Po{fxzqE#*7e-!`Q7OD+U4`y=k?a)^{mM2xYF|9>i5vz?x(@y ziLTg&tk;~o-N)AJ+2-?~zT>mb@7?M4#@OtEtk;^m+~e%_;_UUV$mDyc(z?#()#CAy zv)k0;^v&GweyG)VpwRXB`}O$zfvC}Yq|d|E>cZ6Oqrv9c<@27q-*uqRa-PlO>-DtD zCxcq$k^zdwbMFmr$2D2JZ-2t zYo|A9rT_o`LEY0P00001bW%=J06^y0W&i*H0b)x>L;#2d9Y_EG00(qQO+^Rj2p$(4 z6V27}Q~&?~yh%hsR2b7^V89L-nV4CSxU6jK92}fn+%P^5FCV{vppdYLD1DPP*PS=RZ~}2)6mq?2Jv-t_4Ex4jf_o9&CD$r7L}XNSOiXNCd_rOp$dKfe)R>sG^o)$mtZc9?Ik|cH z1%-tfMa3nh5QmhNS5#J2*VNY4!<^dC*wozI(%OdPoA!>*E*$;_0A9Z+rMvaeng9R* zC3HntbYx+4WjbSWWnpw>05UK#G%YYVEi*7wF*!OjGCDOhD=;uRFfcJB#3ld$03~!q zSaf7zbY(hiZ)9m^c>ppnGBhnPI4v_UR53I~IqW5#zOL*qION1-gwJ06 z7y=aX@^oA5Y%kArJ=g~{Rkg%5q9i4;B-JXp zC>2OC7#SFu=o(n)8XJTdnpl}wS{a#Z8yHv_7|i(>xdKH)ZhlH;S|x4`Zx=rl0cv3I MboFyt=akR{0EQ!WH~;_u literal 0 HcmV?d00001 diff --git a/Library/resources/clear_console.png b/Library/resources/clear_console.png new file mode 100644 index 0000000000000000000000000000000000000000..ff10a317a41e6ef452685073cdede76f406a328b GIT binary patch literal 368 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPFohcqqnD0+eGc3GxeOaCmkj4a7^mS!_!67Fu zBYgJi#}J^9tEY=&2*>s01O_HWSJgy;vny1VWN-)zIEV?faPDwmb#awdWLnsm*ObtB zA;6H4LwS#&i*ZMLSOcqs#A!t)hh!EB4hDupcR4PcJ(+a`XrO9|YeY#(Vo9o1a#1Rf zVlXl=GSM}#&^0y)F*LC=&fXV?G$ literal 0 HcmV?d00001 diff --git a/Library/resources/compare_output.png b/Library/resources/compare_output.png new file mode 100644 index 0000000000000000000000000000000000000000..f99ef89d131aa6f2d44dafc28925d7ff8bbffb0b GIT binary patch literal 760 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJOS+@4BLl<6e(pbstU$g(vPY0F z14ES>14Ba#1H&(%P{RubhEf9thF1v;3|2E37{m+a>G zGjj8ny?gUXMYT@Huqg1`w!o`dQLoX;*OAbg_G;_zP_zOqBT2q zUUBv8|MK;#zHyhnNvFI@OHlZX*u*(1njMNNO}FnnJ8|Nswn2Mw#j5}R|K7j<-otx> zkKdFVH=o^q@XpS$``x>bx9+^UbLZ8YH=i6`dT-o({^|1Y!<)Bdi+~*V5>H=O_7@y-;xfW#uYL>x z3T^XraSV~ToSfjm;HH+wmU7_GsbhUg2M(TOU9_XJ;^&W_KUrB?TU=d^HZVOBniO>D zlF_E3Ph4GIryLkXLro0=u3rebe2Is*|w~*Z+v}z=duDs&GfR?<-L=emu0{xyI^75J-dAzjKQX+_Wv0+_!<~rxx%Cv z)*Q;hy857_hem*cj*XHK)1pPmNsUZ}A2~Y(CQO+#>C^!R2K7HGzZ1*boPj=2Epd$~ zNl7e8wMs5Z1yT$~21X{j1{S);1|fzfRwkBKM&{ZE237_JbN)rHK+%w!pOTqYiCe?l T#ScY*8W=oX{an^LB{Ts5`Xxwt literal 0 HcmV?d00001 diff --git a/Library/resources/copy.png b/Library/resources/copy.png new file mode 100644 index 0000000000000000000000000000000000000000..a1a5fa367e5c3c7cd0991acf9204015521ed12fe GIT binary patch literal 624 zcmZ`!VMtR^6uwbYF-*yUAr&Jqq+#6FK(|sh-EgCnr6VR0J<~Z0%U7(>f_jyS7TJR+ z2AbUzY7o`6poUmoDq^cfFHD*ibS0G~1y`X+F>lwO{piQ}zVn@PKF&Fvp33r!^xSj+ zK!)4ps1lsD6lu!^<`-mE3tADdSJ(jlfN&cHN#%Yo%VFnw?Q0y}b6BOlYgejQHh$6z|5Q9EE^ztKH z8WvuvVy-2aq*8+i$sw_e5{+pIfs{n4f~Xv#9z`>_5Oj$XM50O^nx};rY^qHbsB9|k zJ}w?v7ObkQ2DYh0!;;v)qufylBaw0;QiJXaXKFHSea_nK_{fY`l=|HcyLZj-`S_lk zGd6wu_})v!6XvVojtylOdQvQZ_znM5-?hnCC+EI5-_2m%x4sS9bN4Bxv8EAZgrBY- z)}{QKfBRrvfDV@F^hYM<9*ya~cD7~Rewg2D^d(}eiR0<)XzpTAJ+>5a62m<_e!O+e*ujo8pr?u literal 0 HcmV?d00001 diff --git a/Library/resources/cut.png b/Library/resources/cut.png new file mode 100644 index 0000000000000000000000000000000000000000..7508ebc9b4e63b96f264479b29a173bdb531c07c GIT binary patch literal 632 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJOS+@4BLl<6e(pbstU$g(vPY0F z14ES>14Ba#1H&(%P{RubhEf9thF1v;3|2E37{m+a>qxumi#qr5dBqhZ6AeHX4i>stCIpy5INtZM-k z7b5E}b}qcWW&e$HR~~0feIL>Gz%ya7ThdI=vV#s82Rdi%satYCpyPo<#s-6c2^qC3 zE?>L5eCyd0=kFdpedWZtTeFw$HgG67cIL*?^`{I18nU{NI3#Q^a7fVBw#w?dXzr7+ zc;g8x$8>GS^hxtKF5Yn5HDiXAW7?!y8*aw%><4<5u_VYZn8D%MjWiG^$=lt<;or@e z8$b?wiKnkC`wI>^aT(#WS3iaTh1xw`977~7Cnp?WlbG4SV$AK-FtvAXV`HMB3npyfnAD&#d&UlyO)Doo+H)vKa&V2g1{QbAc^X*1`J z>WV7E2P_QjuXxsdE>GhGI!U#}HKHUXu_V14Ba#1H&(%P{RubhEf9thF1v;3|2E37{m+a>7y!YBb!)twJc9xQ-P~MPEnOBL5x0Byw%t3o#YMy( zJ-Xk@$|^P{IxsLmK|>)uCp9KIYX82Sn>MfAwt3^BeR~Wv3}OWoVbke*{dHzfI``xE{-7*my;6|#0-oUavE&ju!w8Jh7Aip+_bdVxnm-0 zg+#^99}|B3Vd80uiE-j!OcZ2e3)C}gVOYLn#}19@EOYcVRdtoM)%6!L2n(=I?(#Y% zu&!&>EUO8Z0wzsp=*q~-Y}C-r&CN}!;beH?&f0n^^imzrTGbNQh?11Vl2ohYqEsNo zU}RuqqHAEGYitl=XkukzX=P-tZD3$!U@+%j14Ba#1H&(%P{RubhEf9thF1v;3|2E37{m+a>L&KI&l8}op;x-y}5kx<>&W*(^GSg z9X&pG&YXk$PHft^x4U!7>EqXL-F|WX>f6hwpFh6$>Bg1&Ru=XR^$o9I|G0be&D9I9 zFP(e-;P#iN4?mqfds|mWKRYA)-t9M+&%V5Q39^1EX z+q7v@a8THv-~WAlf&=}-c5UC0lbyS7|6x`pjzb3z?AX5Z;e&@g3%7U!L!7ZB$S;_| z;n|He5GTpo-6cCHbty3D8Q4oaeO=jKaL9?v2%o+BF$5^I$kW9!MB;LCLIZ=FTACP} z%7IhI&K>ML@;vGBvxiTeKm5GO!qVE}`k*Gz%&?HtQ!`UiBR9Jeo3ZUOs*M`1Nyn zhRx~|bTuqgOmt)(PU6^hV#Nyy7JD;2J4HjzgZ_S=zTW2@zD1{nmGLoiojBXPk>QK7 zguvU+f%k!~RV{IiC`m~yNwrEYN(E93Mg~SEx&{`y#s(pVCRQevRz~L91_o9J26O&J gu0YX{o1c=IR*74~+rfEpM)UHx3vIVCg!0OLAibpQYW literal 0 HcmV?d00001 diff --git a/Library/resources/about.gif b/Library/resources/old_gif/about.gif similarity index 100% rename from Library/resources/about.gif rename to Library/resources/old_gif/about.gif diff --git a/Library/resources/background_color.gif b/Library/resources/old_gif/background_color.gif similarity index 100% rename from Library/resources/background_color.gif rename to Library/resources/old_gif/background_color.gif diff --git a/Library/resources/clear_console.gif b/Library/resources/old_gif/clear_console.gif similarity index 100% rename from Library/resources/clear_console.gif rename to Library/resources/old_gif/clear_console.gif diff --git a/Library/resources/compare_output.gif b/Library/resources/old_gif/compare_output.gif similarity index 100% rename from Library/resources/compare_output.gif rename to Library/resources/old_gif/compare_output.gif diff --git a/Library/resources/copy.gif b/Library/resources/old_gif/copy.gif similarity index 100% rename from Library/resources/copy.gif rename to Library/resources/old_gif/copy.gif diff --git a/Library/resources/cut.gif b/Library/resources/old_gif/cut.gif similarity index 100% rename from Library/resources/cut.gif rename to Library/resources/old_gif/cut.gif diff --git a/Library/resources/font.gif b/Library/resources/old_gif/font.gif similarity index 100% rename from Library/resources/font.gif rename to Library/resources/old_gif/font.gif diff --git a/Library/resources/load_input_script.gif b/Library/resources/old_gif/load_input_script.gif similarity index 100% rename from Library/resources/load_input_script.gif rename to Library/resources/old_gif/load_input_script.gif diff --git a/Library/resources/paste.gif b/Library/resources/old_gif/paste.gif similarity index 100% rename from Library/resources/paste.gif rename to Library/resources/old_gif/paste.gif diff --git a/Library/resources/print.gif b/Library/resources/old_gif/print.gif similarity index 100% rename from Library/resources/print.gif rename to Library/resources/old_gif/print.gif diff --git a/Library/resources/quit.gif b/Library/resources/old_gif/quit.gif similarity index 100% rename from Library/resources/quit.gif rename to Library/resources/old_gif/quit.gif diff --git a/Library/resources/save.gif b/Library/resources/old_gif/save.gif similarity index 100% rename from Library/resources/save.gif rename to Library/resources/old_gif/save.gif diff --git a/Library/resources/save_as.gif b/Library/resources/old_gif/save_as.gif similarity index 100% rename from Library/resources/save_as.gif rename to Library/resources/old_gif/save_as.gif diff --git a/Library/resources/select_all.gif b/Library/resources/old_gif/select_all.gif similarity index 100% rename from Library/resources/select_all.gif rename to Library/resources/old_gif/select_all.gif diff --git a/Library/resources/text_color.gif b/Library/resources/old_gif/text_color.gif similarity index 100% rename from Library/resources/text_color.gif rename to Library/resources/old_gif/text_color.gif diff --git a/Library/resources/paste.png b/Library/resources/paste.png new file mode 100644 index 0000000000000000000000000000000000000000..c12af8d1a480be95310a723a9ab4b39757ddbc76 GIT binary patch literal 766 zcmZ{ge`t+S7{{O4X501a`q6C6+%mJQ@$N^=O*(hoafjWV&26sXc4jtH!%3GAIwUS7 z=MU+{tb=g>(Dkx^7O^);Z!LOt+uV>|k}jd+A0fGpKmFm%f!&ZNU+ib@+x!_9@kb%Sw(#RO%7?Bj%TnIh7{($q5Q zea}cKowUTg3=^it$P|+nl0$AsfG|uEH*H6nmW?oxaj;WTF%DA{zz88}QAe3N7^aOh z4`K>gpn5caJXLGF)P{@TnFfVs^>3kS+mODk$vyl6$N?Grsl@Hbbjf~ zlIc%IzlM}G(&YDrijrN#bQKk!*E{|5#Q7@@#x0QD+_O4FHa;ci-KwP+vM1@(PT2Y9%Bs(itfxVzNlX~zcJjg z;U&wB_I>`;{A5l^$)*0yn~sdz`K9#RK%{W;>(?tDBo6r6CGurL#+TE=LYP6cVDy_b%Rtr_vdFz&WYnE1Onpe~Me{YEY6WFn9 Z>-L`g{||h=`eud-KvQGTpJ*UQ{{V2=N__wT literal 0 HcmV?d00001 diff --git a/Library/resources/print.png b/Library/resources/print.png new file mode 100644 index 0000000000000000000000000000000000000000..ace6b0c76e3aed084c8a7a759eeaeb41066273cb GIT binary patch literal 826 zcmZ`%TTIe%82ve9nq6$^X6tTc)0{>~t5^@2kh+qUvX*uO@zz|{3La{;RQ{TpPDL|J zGRREC4TL}@j47I-Aff__padCLwWzeVF4Et}9(wq`vvaod@SXEjo+Bi04A~X}0N9wC zf=h>S^V$R>;2j+ongK&#eqvf80K(e!zsX3L@1dlmrvY&9006}h06$@=*bM*;1%Q_X z0G0_r#4VQW{0RU8E}uI~#QXjI{r!58Sfw1C9G{#sTO3x~LbqseVd0Z{%(k%nXYsq= z?)~xJ?qPFe8ne%`NOeVcv?{c}UR;$C|7#SH+tJQUNbu%+FMx)Ve zHtTdcgTXL9KK|rcLsfNUeSN)1B+_cN)6>)Noo#Jxt*xysEiJXRwGHxzj~Jy42E*s` zb#!#p)YMc}Rq^@!>gsB@+pSP2%FD}3N=leara&N|)9GwBTd7piXb;Hbyt1;guC6Y* zTs}NJ+|<+rK~QPwV>>DMm-W6eK4kr%S%KWa*tpnVj70FvaGz1NV>9*@*p!T zEF0+&T%Zh^m?8A!jJZK;Xd@&p5-qq-$H{opf_y_ z2!VLz9;gtH^WIHv{*{bCzNDrNW@pzR4D%ntwlwrl?eAdnPPe~q&o8)?e`*Kg$IwC*b&}NTq)P>4TwG literal 0 HcmV?d00001 diff --git a/Library/resources/quit.png b/Library/resources/quit.png new file mode 100644 index 0000000000000000000000000000000000000000..966fbde735d901bc017159a6462a738983d95836 GIT binary patch literal 368 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPF#{9NFKn08?L4Lsu4$p3+fjCLt?k)@+tg;?J4tt5GuPgft4moid;j>pi zh5&`UJzX3_IIbrrG%!0FBqSt+m=!WMF|fHA@Fwlh*lDrSK|;$bE1_-jq#&so4;L+& z#w6UR6&Bp2?)F zK#IZ0z{o_`z(Uv9AjHtb%EZ#j$XwgNz{nC}Q!>*kacg+H_@M|;1B0il KpUXO@geCx9MQw2a literal 0 HcmV?d00001 diff --git a/Library/resources/save.png b/Library/resources/save.png new file mode 100644 index 0000000000000000000000000000000000000000..0e659cba9b3ac3b0a8a02f6ca3980dee97245684 GIT binary patch literal 688 zcmZ`!ZAep57(Ove(<~urBSZ#$V8-J3h3issCL7){w~lk<27TPAn^Ouewr~~EEy7HQ zZXd{g7+p+Zg~YLlrhQ%fAw{J(N|3<1{Yi_o6Gl{ox8u)#^m5L5c%H-aJm;LpzM9_2z7+uJEC9cmB+UVE z6aw&B0DwyZU>5sE>vpk=SzH@%8NeWEN(dz>swh-R>awiM-MS>{QbH5i5;avdWZ7Ut ze;PQb3PB=wQ#J^z5DGX*loZwHD8xic=ol+vLf57#R%Lw*Zqy+)hWp@;WjZGMz^GUE#}X%92CdJeO?#{xA8VF~ivH zdvWdS!pVs#_vWSE+KzoadvdB*MUGgcO~1z4UBx{Ii-vbJ+^Uc`$IxKc5TFCkMyJM0 z23ALB>h4)G`iB>Oe6K=LSa6|r@YUWETm{gYODkIV@m}A&<<8>GPwECw+k-;1c44Az z=Ix>Voo3U!N%?M7!QhoAize{gIqR_;XzzS~$_XYLymeO}hZByxN5*vn6jSrL`cPvA z`^1*GD;RGM$0J-*M}z?=g{9>-Xt$NYKuI}QzLP7h+zufJVc$|H^^f6jdvj~_*#8al RH$LPu18}>1&fC?(nZFpbA6EbX literal 0 HcmV?d00001 diff --git a/Library/resources/save_as.png b/Library/resources/save_as.png new file mode 100644 index 0000000000000000000000000000000000000000..0e659cba9b3ac3b0a8a02f6ca3980dee97245684 GIT binary patch literal 688 zcmZ`!ZAep57(Ove(<~urBSZ#$V8-J3h3issCL7){w~lk<27TPAn^Ouewr~~EEy7HQ zZXd{g7+p+Zg~YLlrhQ%fAw{J(N|3<1{Yi_o6Gl{ox8u)#^m5L5c%H-aJm;LpzM9_2z7+uJEC9cmB+UVE z6aw&B0DwyZU>5sE>vpk=SzH@%8NeWEN(dz>swh-R>awiM-MS>{QbH5i5;avdWZ7Ut ze;PQb3PB=wQ#J^z5DGX*loZwHD8xic=ol+vLf57#R%Lw*Zqy+)hWp@;WjZGMz^GUE#}X%92CdJeO?#{xA8VF~ivH zdvWdS!pVs#_vWSE+KzoadvdB*MUGgcO~1z4UBx{Ii-vbJ+^Uc`$IxKc5TFCkMyJM0 z23ALB>h4)G`iB>Oe6K=LSa6|r@YUWETm{gYODkIV@m}A&<<8>GPwECw+k-;1c44Az z=Ix>Voo3U!N%?M7!QhoAize{gIqR_;XzzS~$_XYLymeO}hZByxN5*vn6jSrL`cPvA z`^1*GD;RGM$0J-*M}z?=g{9>-Xt$NYKuI}QzLP7h+zufJVc$|H^^f6jdvj~_*#8al RH$LPu18}>1&fC?(nZFpbA6EbX literal 0 HcmV?d00001 diff --git a/Library/resources/select_all.png b/Library/resources/select_all.png new file mode 100644 index 0000000000000000000000000000000000000000..dcba19c702eaff476577e4bb5f4aae4cbb691099 GIT binary patch literal 320 zcmeAS@N?(olHy`uVBq!ia0vp^0wBx*Bp9q_EZ7UASkfJR9T^xl_H+M9WCijSl0AZa z85pY67#JE_7#My5g&JNkFq9fFFuY0t>0)3IFPO6{&;}^MR1)MD%&pIuLrz>q`0Uk>AwVH3PZ!4!iOb1<&Npz)kl^4n_~Y(;hL^Yg zo2-*l&wt5@y{UiBA2|@voa4kRe7HVDI8wsnnp2Op$2S><`IC+O{j-+@15Hsaag8WR zNi0dVN-jzTQVd20Mkcxj7P`g;A%-SaCYDx4=Gq1ZRt5%h{za}p(U6;;l9^VCTf^JM S4@H0)7(8A5T-G@yGywo&S6T!B literal 0 HcmV?d00001 diff --git a/Library/resources/text_color.png b/Library/resources/text_color.png new file mode 100644 index 0000000000000000000000000000000000000000..ac910f2cefb3a2fda8d166e50736bf31adb9fa3a GIT binary patch literal 367 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPF~IqW5#zOL*qION1-gwJ06 z7y=aX@^oA5Y%kArJ=g~{Rkg%5q9i4;B-JXp zC>2OC7#SFu=o(n)8XJTdnpl}wS{a#Z8yHv_7|i(>xdKH)ZhlH;S|x4`Zx=rl0cv3I MboFyt=akR{0EQ!WH~;_u literal 0 HcmV?d00001 From 657d578c8aa47677400d5683958518b5bf240fd5 Mon Sep 17 00:00:00 2001 From: DrErickson <77122859+DrErickson@users.noreply.github.com> Date: Mon, 2 Sep 2024 13:26:41 -0700 Subject: [PATCH 11/18] Moved CMAKE_PREFIX_PATH warning to library CMakeLists.txt --- RandomClientTests/BugFixes/CMakeLists.txt | 5 ----- RandomClientTests/CompileFlags/CMakeLists.txt | 5 ----- RandomClientTests/ShadowTest/CMakeLists.txt | 5 ----- SPL-unit-tests/CMakeLists.txt | 5 ----- SimpleTestGuide/CMakeLists.txt | 5 ----- Welcome/CMakeLists.txt | 5 ----- 6 files changed, 30 deletions(-) diff --git a/RandomClientTests/BugFixes/CMakeLists.txt b/RandomClientTests/BugFixes/CMakeLists.txt index 0af21aad..94852f8d 100644 --- a/RandomClientTests/BugFixes/CMakeLists.txt +++ b/RandomClientTests/BugFixes/CMakeLists.txt @@ -19,11 +19,6 @@ target_link_libraries(${PROJECT_NAME} CS106_library) target_compile_definitions(${PROJECT_NAME} PRIVATE main=qMain) target_compile_definitions(${PROJECT_NAME} PRIVATE qMain=studentMain) -if (NOT CMAKE_PREFIX_PATH) - message(WARNING "CMAKE_PREFIX_PATH is not defined, you may need to set it " - "(-DCMAKE_PREFIX_PATH=\"path/to/Qt/lib/cmake\" or -DCMAKE_PREFIX_PATH=/usr/include/{host}/qt{version}/ on Ubuntu)") -endif () - find_package(Qt${QT_VERSION} COMPONENTS ${REQUIRED_LIBS} REQUIRED) target_link_libraries(${PROJECT_NAME} ${REQUIRED_LIBS_QUALIFIED}) diff --git a/RandomClientTests/CompileFlags/CMakeLists.txt b/RandomClientTests/CompileFlags/CMakeLists.txt index 88ee8f79..819cafb8 100644 --- a/RandomClientTests/CompileFlags/CMakeLists.txt +++ b/RandomClientTests/CompileFlags/CMakeLists.txt @@ -19,11 +19,6 @@ target_link_libraries(${PROJECT_NAME} CS106_library) target_compile_definitions(${PROJECT_NAME} PRIVATE main=qMain) target_compile_definitions(${PROJECT_NAME} PRIVATE qMain=studentMain) -if (NOT CMAKE_PREFIX_PATH) - message(WARNING "CMAKE_PREFIX_PATH is not defined, you may need to set it " - "(-DCMAKE_PREFIX_PATH=\"path/to/Qt/lib/cmake\" or -DCMAKE_PREFIX_PATH=/usr/include/{host}/qt{version}/ on Ubuntu)") -endif () - find_package(Qt${QT_VERSION} COMPONENTS ${REQUIRED_LIBS} REQUIRED) target_link_libraries(${PROJECT_NAME} ${REQUIRED_LIBS_QUALIFIED}) diff --git a/RandomClientTests/ShadowTest/CMakeLists.txt b/RandomClientTests/ShadowTest/CMakeLists.txt index 98f9c844..58573420 100644 --- a/RandomClientTests/ShadowTest/CMakeLists.txt +++ b/RandomClientTests/ShadowTest/CMakeLists.txt @@ -21,11 +21,6 @@ target_link_libraries(${PROJECT_NAME} CS106_library) target_compile_definitions(${PROJECT_NAME} PRIVATE main=qMain) target_compile_definitions(${PROJECT_NAME} PRIVATE qMain=studentMain) -if (NOT CMAKE_PREFIX_PATH) - message(WARNING "CMAKE_PREFIX_PATH is not defined, you may need to set it " - "(-DCMAKE_PREFIX_PATH=\"path/to/Qt/lib/cmake\" or -DCMAKE_PREFIX_PATH=/usr/include/{host}/qt{version}/ on Ubuntu)") -endif () - find_package(Qt${QT_VERSION} COMPONENTS ${REQUIRED_LIBS} REQUIRED) target_link_libraries(${PROJECT_NAME} ${REQUIRED_LIBS_QUALIFIED}) diff --git a/SPL-unit-tests/CMakeLists.txt b/SPL-unit-tests/CMakeLists.txt index 6574648b..6dc4ceed 100644 --- a/SPL-unit-tests/CMakeLists.txt +++ b/SPL-unit-tests/CMakeLists.txt @@ -23,11 +23,6 @@ target_link_libraries(${PROJECT_NAME} CS106_library) target_compile_definitions(${PROJECT_NAME} PRIVATE main=qMain) target_compile_definitions(${PROJECT_NAME} PRIVATE qMain=studentMain) -if (NOT CMAKE_PREFIX_PATH) - message(WARNING "CMAKE_PREFIX_PATH is not defined, you may need to set it " - "(-DCMAKE_PREFIX_PATH=\"path/to/Qt/lib/cmake\" or -DCMAKE_PREFIX_PATH=/usr/include/{host}/qt{version}/ on Ubuntu)") -endif () - find_package(Qt${QT_VERSION} COMPONENTS ${REQUIRED_LIBS} REQUIRED) target_link_libraries(${PROJECT_NAME} ${REQUIRED_LIBS_QUALIFIED}) diff --git a/SimpleTestGuide/CMakeLists.txt b/SimpleTestGuide/CMakeLists.txt index 78f4d022..5fc1a458 100644 --- a/SimpleTestGuide/CMakeLists.txt +++ b/SimpleTestGuide/CMakeLists.txt @@ -21,11 +21,6 @@ target_link_libraries(${PROJECT_NAME} CS106_library) target_compile_definitions(${PROJECT_NAME} PRIVATE main=qMain) target_compile_definitions(${PROJECT_NAME} PRIVATE qMain=studentMain) -if (NOT CMAKE_PREFIX_PATH) - message(WARNING "CMAKE_PREFIX_PATH is not defined, you may need to set it " - "(-DCMAKE_PREFIX_PATH=\"path/to/Qt/lib/cmake\" or -DCMAKE_PREFIX_PATH=/usr/include/{host}/qt{version}/ on Ubuntu)") -endif () - find_package(Qt${QT_VERSION} COMPONENTS ${REQUIRED_LIBS} REQUIRED) target_link_libraries(${PROJECT_NAME} ${REQUIRED_LIBS_QUALIFIED}) diff --git a/Welcome/CMakeLists.txt b/Welcome/CMakeLists.txt index 2eaa8316..7daa6778 100644 --- a/Welcome/CMakeLists.txt +++ b/Welcome/CMakeLists.txt @@ -22,11 +22,6 @@ target_link_libraries(${PROJECT_NAME} CS106_library) target_compile_definitions(${PROJECT_NAME} PRIVATE main=qMain) target_compile_definitions(${PROJECT_NAME} PRIVATE qMain=studentMain) -if (NOT CMAKE_PREFIX_PATH) - message(WARNING "CMAKE_PREFIX_PATH is not defined, you may need to set it " - "(-DCMAKE_PREFIX_PATH=\"path/to/Qt/lib/cmake\" or -DCMAKE_PREFIX_PATH=/usr/include/{host}/qt{version}/ on Ubuntu)") -endif () - find_package(Qt${QT_VERSION} COMPONENTS ${REQUIRED_LIBS} REQUIRED) target_link_libraries(${PROJECT_NAME} ${REQUIRED_LIBS_QUALIFIED}) From 05c625e46b8ab151b8419fd28884667f0ec33341 Mon Sep 17 00:00:00 2001 From: DrErickson <77122859+DrErickson@users.noreply.github.com> Date: Mon, 2 Sep 2024 13:56:52 -0700 Subject: [PATCH 12/18] Library assumes resources are installed in a user writable data location. Modified the library CMakeLists.txt to copy resources folder into per-user writable data location from QtStandardPaths. --- CMakeLists.txt | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d4241c74..39b97580 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,19 +15,26 @@ set(CS106_LIB_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Library") # We try to make a best guess based on the OS, but you may # need to manually specify the path to the qt CMake. if (WIN32) - # I recommend using MinGW for Windows + # MinGW is recommended for Windows. Please note that + # Qt is very picky about the MinGW compiler. Be sure + # you are using the most up to date version of MinGW. set(CMAKE_PREFIX_PATH "C:/Qt/6.7.2/mingw_64") - # Alternatively it can use MSVC 2019 compiler (Not tested) - # set(CMAKE_PREFIX_PATH "C:/Qt/6.7.2/msvc2019_64") + # Alternatively MSVC 2019 compiler can be used (Not tested) + # set(CMAKE_PREFIX_PATH "C:/Qt6/6.7.2/msvc2019_64") elseif (APPLE) - # Not tested set(CMAKE_PREFIX_PATH "~/Qt/6.7.2/macos") else () # UNIX/Linux case set(CMAKE_PREFIX_PATH "~/Qt6/6.7.2/gcc_64") endif () +# Verify CMAKE_PREFIX_PATH exists +if (NOT EXISTS ${CMAKE_PREFIX_PATH}) + message(WARNING "The path ${CMAKE_PREFIX_PATH} does not exist" + "please verify the path to your Qt installation") +endif () + set(CMAKE_AUTOMOC ON) # Automatic handling of the Qt Meta-Object Compiler (MOC) set(CMAKE_AUTORCC ON) # Automatic handling of the Qt Resource compiler set(CMAKE_AUTOUIC ON) # Automatic handling of the Qt UI code generator @@ -46,6 +53,24 @@ include_directories("${CS106_LIB_PATH}/system") include_directories("${CS106_LIB_PATH}/util") include_directories("${CS106_LIB_PATH}/testing") + +# Copy resources folder into per-user writable data location from QtStandardPaths +if (WIN32) + set(QTP_EXE "qtpaths6.exe") +else() + set(QTP_EXE "qtpaths6") +endif () + +set (QT_INSTALL_BINS "${CMAKE_PREFIX_PATH}/bin") + +# Find writable data directory +execute_process(COMMAND "${QT_INSTALL_BINS}/${QTP_EXE}" "--writable-path" "GenericDataLocation" + OUTPUT_VARIABLE USER_DATA_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) + +# Copy resources folder into data directory +set (SPL_DIR "${USER_DATA_DIR}/cs106") +file(COPY "${CS106_LIB_PATH}/resources" DESTINATION "${SPL_DIR}") + # Used in build.h.in file to generate build.h file set (SPL_VERSION "2023.1") string(TIMESTAMP TODAY "%d/%m/%Y") From 51bbc778c7e73e44f0cf9a03c4a81c792de66f26 Mon Sep 17 00:00:00 2001 From: DrErickson Date: Tue, 3 Sep 2024 08:00:58 -0700 Subject: [PATCH 13/18] Fixed user path issue for finding GenericDataLocation for mac and linux --- CMakeLists.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 39b97580..7d98d020 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,10 +23,10 @@ if (WIN32) # Alternatively MSVC 2019 compiler can be used (Not tested) # set(CMAKE_PREFIX_PATH "C:/Qt6/6.7.2/msvc2019_64") elseif (APPLE) - set(CMAKE_PREFIX_PATH "~/Qt/6.7.2/macos") + set(CMAKE_PREFIX_PATH "$ENV{HOME}/Qt/6.7.2/macos") else () # UNIX/Linux case - set(CMAKE_PREFIX_PATH "~/Qt6/6.7.2/gcc_64") + set(CMAKE_PREFIX_PATH "$ENV{HOME}/Qt6/6.7.2/gcc_64") endif () # Verify CMAKE_PREFIX_PATH exists @@ -39,7 +39,7 @@ set(CMAKE_AUTOMOC ON) # Automatic handling of the Qt Meta-Object Compiler (MOC) set(CMAKE_AUTORCC ON) # Automatic handling of the Qt Resource compiler set(CMAKE_AUTOUIC ON) # Automatic handling of the Qt UI code generator -find_package(Qt6 COMPONENTS Core Quick Gui Widgets REQUIRED) +find_package(Qt6 COMPONENTS Core Gui Widgets Network REQUIRED) # Include all the cs106 library folders include_directories("${CS106_LIB_PATH}") @@ -92,7 +92,6 @@ configure_file( @ONLY ) - # Create list of source files file(GLOB LIBRARY_SRC CONFIGURE_DEPENDS "${CS106_LIB_PATH}/collections/*.cpp" From 91b32bad103d6dc422ac3f905fcbd873adedbfb0 Mon Sep 17 00:00:00 2001 From: Varick Date: Tue, 3 Sep 2024 08:12:47 -0700 Subject: [PATCH 14/18] Fixed small issue with Welcome CMakeLists.txt (Welcome.cpp vs welcome.cpp) --- CMakeLists.txt | 2 +- Welcome/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d98d020..ad1f200b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ elseif (APPLE) set(CMAKE_PREFIX_PATH "$ENV{HOME}/Qt/6.7.2/macos") else () # UNIX/Linux case - set(CMAKE_PREFIX_PATH "$ENV{HOME}/Qt6/6.7.2/gcc_64") + set(CMAKE_PREFIX_PATH "$ENV{HOME}/Qt/6.7.2/gcc_64") endif () # Verify CMAKE_PREFIX_PATH exists diff --git a/Welcome/CMakeLists.txt b/Welcome/CMakeLists.txt index 7daa6778..cb94a58e 100644 --- a/Welcome/CMakeLists.txt +++ b/Welcome/CMakeLists.txt @@ -9,7 +9,7 @@ target_link_libraries(CS106_library PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets Qt6: # Create the project executable add_executable(${PROJECT_NAME} - Welcome.cpp + welcome.cpp ) # link exe to CS106 library From c98ef3b7feb17592cd55bce7fc2249c6a35cf4dc Mon Sep 17 00:00:00 2001 From: Varick Date: Tue, 3 Sep 2024 08:21:13 -0700 Subject: [PATCH 15/18] Minor cosmetic changes. --- CMakeLists.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ad1f200b..7b4e0ab6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,9 +2,8 @@ cmake_minimum_required(VERSION 3.17) project(stanford-cpp-library) # This CMake provides an example of how to use CMake to build the -# Stanford cpp library rather than a pro file. -# This allows the use of other IDE's such as CLion, VSC, etc. for -# development. +# Stanford cpp library rather than a pro file. This allows the use +# of other IDE's such as CLion, VSC, etc. for development. # MinGW compiler lags, be conservative and use C++11 on all platforms # rather than special case @@ -13,7 +12,7 @@ set(CMAKE_CXX_STANDARD 11) set(CS106_LIB_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Library") # We try to make a best guess based on the OS, but you may -# need to manually specify the path to the qt CMake. +# need to manually specify the path to the Qt library. if (WIN32) # MinGW is recommended for Windows. Please note that # Qt is very picky about the MinGW compiler. Be sure @@ -23,9 +22,12 @@ if (WIN32) # Alternatively MSVC 2019 compiler can be used (Not tested) # set(CMAKE_PREFIX_PATH "C:/Qt6/6.7.2/msvc2019_64") elseif (APPLE) + # Note that execute_process cannot expand ~/ for the home path. + # We instead find the home directory using the environment variable set(CMAKE_PREFIX_PATH "$ENV{HOME}/Qt/6.7.2/macos") else () # UNIX/Linux case + # Same issue with expanding the home path set(CMAKE_PREFIX_PATH "$ENV{HOME}/Qt/6.7.2/gcc_64") endif () @@ -53,7 +55,6 @@ include_directories("${CS106_LIB_PATH}/system") include_directories("${CS106_LIB_PATH}/util") include_directories("${CS106_LIB_PATH}/testing") - # Copy resources folder into per-user writable data location from QtStandardPaths if (WIN32) set(QTP_EXE "qtpaths6.exe") @@ -85,7 +86,7 @@ else () endif () # Generate build.h file -add_definitions(-DSPL_CMAKE_BUILD) +add_compile_definitions(SPL_CMAKE_BUILD) configure_file( ${CS106_LIB_PATH}/private/build.h.in ${CS106_LIB_PATH}/private/build.h From b92eb3e8b579ad7fd051f8788e6f63b959947dff Mon Sep 17 00:00:00 2001 From: DrErickson <77122859+DrErickson@users.noreply.github.com> Date: Thu, 12 Sep 2024 14:54:42 -0700 Subject: [PATCH 16/18] Fixed path for msvc --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b4e0ab6..f3dc338f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ if (WIN32) set(CMAKE_PREFIX_PATH "C:/Qt/6.7.2/mingw_64") # Alternatively MSVC 2019 compiler can be used (Not tested) - # set(CMAKE_PREFIX_PATH "C:/Qt6/6.7.2/msvc2019_64") + # set(CMAKE_PREFIX_PATH "C:/Qt/6.7.2/msvc2019_64") elseif (APPLE) # Note that execute_process cannot expand ~/ for the home path. # We instead find the home directory using the environment variable From db4fac51f7edb6e47c7dd01b371b209651b4054a Mon Sep 17 00:00:00 2001 From: DrErickson <77122859+DrErickson@users.noreply.github.com> Date: Fri, 13 Sep 2024 09:30:18 -0700 Subject: [PATCH 17/18] Update CMakeLists.txt Updated CMakeLists.txt to include Qt6::Multimedia. Needed for changes to sounds library. --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f3dc338f..296f040f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,7 @@ set(CMAKE_AUTOMOC ON) # Automatic handling of the Qt Meta-Object Compiler (MOC) set(CMAKE_AUTORCC ON) # Automatic handling of the Qt Resource compiler set(CMAKE_AUTOUIC ON) # Automatic handling of the Qt UI code generator -find_package(Qt6 COMPONENTS Core Gui Widgets Network REQUIRED) +find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets Network Multimedia) # Include all the cs106 library folders include_directories("${CS106_LIB_PATH}") @@ -124,8 +124,8 @@ file(GLOB QT_RESOURCES ${CS106_LIB_PATH}/images.qrc) # Make sure you check to make sure your compiler # is up to date. You have been warned! set(QT_VERSION 6) -set(REQUIRED_LIBS Core Gui Widgets Network) -set(REQUIRED_LIBS_QUALIFIED Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Network) +set(REQUIRED_LIBS Core Gui Widgets Network Multimedia) +set(REQUIRED_LIBS_QUALIFIED Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Network Qt6::Multimedia) qt_add_resources(RCC_SOURCES ${QT_RESOURCES}) @@ -138,7 +138,7 @@ qt_add_library(CS106_library STATIC ) # Link CS106 library to required Qt libraries -target_link_libraries(CS106_library PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Network) +target_link_libraries(CS106_library PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Network Qt6::Multimedia) # Call CMakeLists.txt files of subdirectories add_subdirectory(Welcome) From 595113862d0242718e24fdc23ae12bce7e2e4c03 Mon Sep 17 00:00:00 2001 From: Varick Erickson Date: Wed, 17 Sep 2025 12:36:34 -0700 Subject: [PATCH 18/18] Modified to automatically find the correct director of Qt install based on version number. --- CMakeLists.txt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 296f040f..307622fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,29 +11,36 @@ set(CMAKE_CXX_STANDARD 11) set(CS106_LIB_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Library") +find_package(Qt6 COMPONENTS Core REQUIRED) + +message(STATUS "Qt6 version: ${Qt6_VERSION}") + # We try to make a best guess based on the OS, but you may # need to manually specify the path to the Qt library. if (WIN32) + +# find_qt_mingw64(QT_MINGW64_DIR) +# message("${QT_MINGW64_DIR}") # MinGW is recommended for Windows. Please note that # Qt is very picky about the MinGW compiler. Be sure # you are using the most up to date version of MinGW. - set(CMAKE_PREFIX_PATH "C:/Qt/6.7.2/mingw_64") + set(CMAKE_PREFIX_PATH "C:/Qt/${Qt6_VERSION}/mingw_64") # Alternatively MSVC 2019 compiler can be used (Not tested) # set(CMAKE_PREFIX_PATH "C:/Qt/6.7.2/msvc2019_64") elseif (APPLE) # Note that execute_process cannot expand ~/ for the home path. # We instead find the home directory using the environment variable - set(CMAKE_PREFIX_PATH "$ENV{HOME}/Qt/6.7.2/macos") + set(CMAKE_PREFIX_PATH "$ENV{HOME}/Qt/${Qt6_VERSION}/macos") else () # UNIX/Linux case # Same issue with expanding the home path - set(CMAKE_PREFIX_PATH "$ENV{HOME}/Qt/6.7.2/gcc_64") + set(CMAKE_PREFIX_PATH "$ENV{HOME}/Qt/${Qt6_VERSION}/gcc_64") endif () # Verify CMAKE_PREFIX_PATH exists if (NOT EXISTS ${CMAKE_PREFIX_PATH}) - message(WARNING "The path ${CMAKE_PREFIX_PATH} does not exist" + message(WARNING "The path ${CMAKE_PREFIX_PATH} does not exist " "please verify the path to your Qt installation") endif ()