Add CMakeLists.txt part 5. Fix compilte error.

master
fengqiangguo 2023-08-26 16:44:30 +08:00
parent 00569378c4
commit 14ace8c3f9
16 changed files with 97 additions and 14 deletions

View File

@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.15)
project(BuilderPattern)
set(SRC_LIST main.cpp)
get_filename_component(FOLDER_NAME ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
get_filename_component(FOLDER_NAME ${FOLDER_NAME} NAME)
set(EXECUTABLE_OUTPUT_PATH ${OUTPUT_DIR}/${FOLDER_NAME})
add_executable(app14 ${SRC_LIST})

View File

@ -1,10 +1,8 @@
cmake_minimum_required(VERSION 3.17)
project(Command)
cmake_minimum_required(VERSION 3.15)
project(BuilderPattern)
set(SRC_LIST main.cpp)
message(STATUS "start building......")
set(OUT_DIR ../)
set(EXECUTABLE_OUTPUT_PATH ${OUT_DIR}/bin)
file(GLOB SRC_LIST ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
add_executable(app ${SRC_LIST})
get_filename_component(FOLDER_NAME ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
get_filename_component(FOLDER_NAME ${FOLDER_NAME} NAME)
set(EXECUTABLE_OUTPUT_PATH ${OUTPUT_DIR}/${FOLDER_NAME})
add_executable(app15 ${SRC_LIST})

View File

@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.15)
project(BuilderPattern)
set(SRC_LIST main.cpp)
get_filename_component(FOLDER_NAME ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
get_filename_component(FOLDER_NAME ${FOLDER_NAME} NAME)
set(EXECUTABLE_OUTPUT_PATH ${OUTPUT_DIR}/${FOLDER_NAME})
add_executable(app16 ${SRC_LIST})

View File

@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.15)
project(BuilderPattern)
file(GLOB SRC_LIST ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
get_filename_component(FOLDER_NAME ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
get_filename_component(FOLDER_NAME ${FOLDER_NAME} NAME)
set(EXECUTABLE_OUTPUT_PATH ${OUTPUT_DIR}/${FOLDER_NAME})
add_executable(app18 ${SRC_LIST})

View File

@ -2,6 +2,7 @@
#define __COLLEAGUE_H__
#include "common.h"
#include <string>
using namespace std;
// 前向声明

View File

@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.15)
project(BuilderPattern)
file(GLOB SRC_LIST ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
get_filename_component(FOLDER_NAME ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
get_filename_component(FOLDER_NAME ${FOLDER_NAME} NAME)
set(EXECUTABLE_OUTPUT_PATH ${OUTPUT_DIR}/${FOLDER_NAME})
add_executable(app19 ${SRC_LIST})

View File

@ -35,14 +35,14 @@ AllyCenterController::AllyCenterController(){
void AllyCenterController::notify(INFO_TYPE infoType, std::string name){
switch (infoType){
case RESOURCE:
for each (Observer* obs in playerList){
for (Observer* obs : playerList){
if (obs->getName() != name){
((Player*)obs)->come();
}
}
break;
case HELP:
for each (Observer* obs in playerList){
for (Observer* obs : playerList){
if (obs->getName() != name){
((Player*)obs)->help();
}

View File

@ -3,6 +3,7 @@
#include "common.h"
#include <vector>
#include <string>
// 前向声明
class Observer;

View File

@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.15)
project(BuilderPattern)
file(GLOB SRC_LIST ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
get_filename_component(FOLDER_NAME ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
get_filename_component(FOLDER_NAME ${FOLDER_NAME} NAME)
set(EXECUTABLE_OUTPUT_PATH ${OUTPUT_DIR}/${FOLDER_NAME})
add_executable(app20 ${SRC_LIST})

View File

@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.15)
project(BuilderPattern)
file(GLOB SRC_LIST ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
get_filename_component(FOLDER_NAME ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
get_filename_component(FOLDER_NAME ${FOLDER_NAME} NAME)
set(EXECUTABLE_OUTPUT_PATH ${OUTPUT_DIR}/${FOLDER_NAME})
add_executable(app21 ${SRC_LIST})

View File

@ -1,6 +1,6 @@
#include "GameAccount.h"
#include "Level.h"
#include <Windows.h>
// #include <Windows.h>
#include <time.h>
#define random(x) (rand()%x)
@ -40,7 +40,7 @@ string GameAccount::getName(){
void GameAccount::playCard(){
this->level->playCard();
Sleep(100);
// Sleep(100);
srand((int)time(0));
int res = random(2);
if (res % 2 == 0){

View File

@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.15)
project(BuilderPattern)
file(GLOB SRC_LIST ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
get_filename_component(FOLDER_NAME ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
get_filename_component(FOLDER_NAME ${FOLDER_NAME} NAME)
set(EXECUTABLE_OUTPUT_PATH ${OUTPUT_DIR}/${FOLDER_NAME})
add_executable(app22 ${SRC_LIST})

View File

@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.15)
project(BuilderPattern)
file(GLOB SRC_LIST ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
get_filename_component(FOLDER_NAME ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
get_filename_component(FOLDER_NAME ${FOLDER_NAME} NAME)
set(EXECUTABLE_OUTPUT_PATH ${OUTPUT_DIR}/${FOLDER_NAME})
add_executable(app23 ${SRC_LIST})

View File

@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.15)
project(BuilderPattern)
file(GLOB SRC_LIST ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
get_filename_component(FOLDER_NAME ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
get_filename_component(FOLDER_NAME ${FOLDER_NAME} NAME)
set(EXECUTABLE_OUTPUT_PATH ${OUTPUT_DIR}/${FOLDER_NAME})
add_executable(app24 ${SRC_LIST})

View File

@ -1,7 +1,7 @@
#include "Element.h"
#include "Visitor.h"
#include "ShoppingCart.h"
#include <Windows.h>
// #include <Windows.h>
int main()
{

View File

@ -17,4 +17,14 @@ add_subdirectory(10.DecoratorPattern/2.Code/)
add_subdirectory(11.FacadePattern/2.Code/)
add_subdirectory(12.FlyweightPattern/2.Code/)
add_subdirectory(13.ProxyPattern/2.Code/)
add_subdirectory(14.ChainOfResponsibility/2.Code/)
add_subdirectory(15.CommandPattern/2.Code/)
add_subdirectory(16.InterpreterPattern/2.Code/)
add_subdirectory(17.IteratorPattern/2.Code/)
add_subdirectory(18.MediatorPattern/2.Code/)
add_subdirectory(19.MementoPattern/2.Code/)
add_subdirectory(20.ObserverPattern/2.Code/)
add_subdirectory(21.StatePattern/2.Code/)
add_subdirectory(22.StrategyPattern/2.Code/)
add_subdirectory(23.TemplateMethodPattern/2.Code/)
add_subdirectory(24.VisitorPattern/2.Code/)