add progress bar when ordered parallel, and cleanup repository
This commit is contained in:
@@ -1,53 +0,0 @@
|
|||||||
CC=nvcc
|
|
||||||
LDFLAGS=-lgtest -lpthread
|
|
||||||
ROOT_DIR=$(shell pwd)
|
|
||||||
INCLUDE_DIR=$(ROOT_DIR)
|
|
||||||
CFLAGS=-I$(INCLUDE_DIR)
|
|
||||||
SRC_DIR=$(ROOT_DIR)/src
|
|
||||||
SRC=$(wildcard src/*/*.c*) $(wildcard src/*/*/*.c*)
|
|
||||||
OBJPP=$(SRC:.cpp=.o)
|
|
||||||
OBJS=$(OBJPP:.cu=.o)
|
|
||||||
#HEADS=$(OBJS:.o=.h)
|
|
||||||
TEST_DIR=$(ROOT_DIR)/test
|
|
||||||
EXEC=$(TEST_DIR)/isgood
|
|
||||||
PERMSRC=$(wildcard src/*/*perm*.cpp)
|
|
||||||
PERMSRC_O=$(PERMSRC:.cpp=.o)
|
|
||||||
DIMSRC=$(wildcard src/*/*dim*.cpp)
|
|
||||||
DIMSRC_O=$(DIMSRC:.cpp=.o)
|
|
||||||
TENSRCPP=$(wildcard src/*/*/tens*.cpp)
|
|
||||||
TENSRCPP_O=$(TENSRCPP:.cpp=.o)
|
|
||||||
TENSRCU=$(wildcard src/*/*/tens*.cu)
|
|
||||||
TENSRCU_O=$(TENSRCU:.cu=.o)
|
|
||||||
DTENSRCU=$(wildcard src/*/*/d_tens*.cu)
|
|
||||||
DTENSRCU_O=$(DTENSRCU:.cu=.o)
|
|
||||||
|
|
||||||
|
|
||||||
TENSRC=$(TENSRCPP) $(TENSRCU)
|
|
||||||
all: $(EXEC)
|
|
||||||
|
|
||||||
$(EXEC): $(EXEC).cu $(OBJS)
|
|
||||||
$(CC) -o $@ $^ -I$(INCLUDE_DIR) $(LDFLAGS)
|
|
||||||
|
|
||||||
$(DIMSRC_O): $(DIMSRC) $(PERMSRC_O)
|
|
||||||
$(CC) -o $@ -c $< $(CFLAGS)
|
|
||||||
|
|
||||||
$(TENSRCPP_O): $(TENSRCPP) $(DIMSRC_O)
|
|
||||||
$(CC) -o $@ -c $< $(CFLAGS)
|
|
||||||
|
|
||||||
$(TENSRCU_O): $(TENSRCU) $(DTENSRCU_O) $(DIMSRC_O)
|
|
||||||
$(CC) -o $@ -c $< $(CFLAGS)
|
|
||||||
|
|
||||||
$(PERMSRC_O): $(PERMSRC)
|
|
||||||
$(CC) -o $@ -c $< $(CFLAGS)
|
|
||||||
|
|
||||||
$(DTENSRCU_O) : $(DTENSRCU)
|
|
||||||
$(CC) -o $@ -c $< $(CFLAGS)
|
|
||||||
|
|
||||||
.PHONY: clean mrproper
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f $(OBJS)
|
|
||||||
|
|
||||||
mrproper: clean
|
|
||||||
rm -f $(EXEC)
|
|
||||||
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
nvcc isgood.cu tensor.cu cudatensor.cu ../permutation/permutation.cpp -o isgood -lgtest -lpthread -g --relocatable-device-code=true
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
make "$@"
|
|
||||||
compute-sanitizer --tool memcheck ./test/isgood
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
compute-sanitizer --tool memcheck ./build/isgood
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
|
|
||||||
#include "src/set_theoric/set_theoric.h"
|
|
||||||
|
|
||||||
set_theoric * create_set_theoric(unsigned int id)
|
|
||||||
{
|
|
||||||
if(id == 0) return NULL;
|
|
||||||
|
|
||||||
set_theoric *ret_set = malloc(sizeof(set_theoric));
|
|
||||||
ret_set.set=malloc(id*sizeof(unsigned int));
|
|
||||||
ret_set.id = id;
|
|
||||||
for(int i = 0; i < id; ++i)
|
|
||||||
ret_set.set[i] = i;
|
|
||||||
|
|
||||||
return ret_set;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool is_set_theoric(set_theoric *st)
|
|
||||||
{
|
|
||||||
if(st == NULL) return true;
|
|
||||||
|
|
||||||
for(int i = 0; i < st->id; ++i)
|
|
||||||
if(st->set[i] != i) return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
#ifndef __SET_THEORIC_C__H
|
|
||||||
#define __SET_THEORIC_C__H
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "src/tools/tools.h"
|
|
||||||
|
|
||||||
struct set_theoric
|
|
||||||
{
|
|
||||||
unsigned int id;
|
|
||||||
unsigned int *set;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef set_theoric set_theoric;
|
|
||||||
|
|
||||||
set_theoric * create_set_theoric(unsigned int id);
|
|
||||||
|
|
||||||
bool is_set_theoric(set_theoric *st);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /*__SET_THEORIC_C__H*/
|
|
||||||
+35
-15
@@ -84,6 +84,7 @@ struct failed_lists{
|
|||||||
#define default_unicolour 0
|
#define default_unicolour 0
|
||||||
#define default_removelog 0
|
#define default_removelog 0
|
||||||
#define default_parallel_nb 1
|
#define default_parallel_nb 1
|
||||||
|
#define default_width 1
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -103,6 +104,8 @@ char *timeunit="ms";
|
|||||||
char *savelog=NULL;
|
char *savelog=NULL;
|
||||||
char *default_timeunit="ms";
|
char *default_timeunit="ms";
|
||||||
char *default_savelog="log_all_tests";
|
char *default_savelog="log_all_tests";
|
||||||
|
|
||||||
|
size_t width = 80;
|
||||||
/*
|
/*
|
||||||
* number of threads
|
* number of threads
|
||||||
*/
|
*/
|
||||||
@@ -113,6 +116,7 @@ size_t parallel_nb = 0;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
bool is_parallel_nb = 0;
|
bool is_parallel_nb = 0;
|
||||||
|
bool is_width=0;
|
||||||
bool progress = false;
|
bool progress = false;
|
||||||
|
|
||||||
FILE **f_ou_th;
|
FILE **f_ou_th;
|
||||||
@@ -226,7 +230,7 @@ long int id_of_thread_executed(void){
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* format name of TEST(name_f) is: 'TEST_name_f____NUM',
|
* format name of TEST(name_f) is: 'TEST_name_f____NUM|',
|
||||||
* and name attribute is 'TEST(name_f): test N° NUM!' (! at the end is random):
|
* and name attribute is 'TEST(name_f): test N° NUM!' (! at the end is random):
|
||||||
* we extract NUM here
|
* we extract NUM here
|
||||||
* to have hash_table of the count when parallel test!
|
* to have hash_table of the count when parallel test!
|
||||||
@@ -235,7 +239,8 @@ size_t extract_num__f(const char *name_f){
|
|||||||
size_t len = strlen(name_f);
|
size_t len = strlen(name_f);
|
||||||
size_t val = 0, p = 1;
|
size_t val = 0, p = 1;
|
||||||
for(long i= len-1; i>=0; --i){
|
for(long i= len-1; i>=0; --i){
|
||||||
PRINT_DEBUG(" name_f[%ld] = %c\n",i,name_f[i]);
|
PRINT_DEBUG(" name_f(%s)[%ld] = %c\n",name_f,i,name_f[i]);
|
||||||
|
if(name_f[i]=='|') val = 0;
|
||||||
if(name_f[i] >= '0' && name_f[i] <= '9'){
|
if(name_f[i] >= '0' && name_f[i] <= '9'){
|
||||||
val += p * (name_f[i]-'0');
|
val += p * (name_f[i]-'0');
|
||||||
p *= 10;
|
p *= 10;
|
||||||
@@ -254,7 +259,8 @@ void usage(int argc, char **argv){
|
|||||||
printf("\t -u , --unicolour\n\t\tby default, the result is colored, if you choice this option, it prints with default color\n\n");
|
printf("\t -u , --unicolour\n\t\tby default, the result is colored, if you choice this option, it prints with default color\n\n");
|
||||||
printf("\t -o, --ordered\n\t\tthis option is usefull if you choose to use parallel tests,\n\t\tby default, each thread share the screen to print results,\n\t\tthis option create file to record log of each thread on file,\n\t\tand print on screen all results at the end of all tests\n\n");
|
printf("\t -o, --ordered\n\t\tthis option is usefull if you choose to use parallel tests,\n\t\tby default, each thread share the screen to print results,\n\t\tthis option create file to record log of each thread on file,\n\t\tand print on screen all results at the end of all tests\n\n");
|
||||||
printf("\t -r , --remove\n\t\tif the option ordered is choosen if parallel tests,\n\t\tthis option remove the file logs of each thread after all tests.\n\n");
|
printf("\t -r , --remove\n\t\tif the option ordered is choosen if parallel tests,\n\t\tthis option remove the file logs of each thread after all tests.\n\n");
|
||||||
printf("\t -s <file>, --savelog <file>, -s=file, --savelog=file\n\t\tthis option save the global ordered result in 'file',\n\t\this option active the option -o or --ordered. \n\n");
|
printf("\t -s <file>, --savelog <file>, -s=file, --savelog=file\n\t\tthis option save the global ordered result in 'file',\n\t\tthis option active the option -o or --ordered. \n\n");
|
||||||
|
printf("\t -w <WID>, --width <WID>, -w=WID, --savelog=WID\n\t\tthis option change the width of the progress bar to WID,\n\t\tex: -w100, or --width=100 or -wi 100\n\n");
|
||||||
|
|
||||||
if(some_thing_wrong){
|
if(some_thing_wrong){
|
||||||
printf("invalid argument\n");
|
printf("invalid argument\n");
|
||||||
@@ -371,6 +377,7 @@ void parse_options(int argc, char **argv){
|
|||||||
PRINT_DEBUG("argc=%d, argv[%d]=%s\n",argc,i,argv[i]);
|
PRINT_DEBUG("argc=%d, argv[%d]=%s\n",argc,i,argv[i]);
|
||||||
IF_OPTION_NO_ARG(help)
|
IF_OPTION_NO_ARG(help)
|
||||||
IF_OPTION_WITH_ARG_NUM(parallel_nb)
|
IF_OPTION_WITH_ARG_NUM(parallel_nb)
|
||||||
|
IF_OPTION_WITH_ARG_NUM(width)
|
||||||
IF_OPTION_WITH_ARG_STR(savelog)
|
IF_OPTION_WITH_ARG_STR(savelog)
|
||||||
IF_OPTION_WITH_ARG_STR(timeunit)
|
IF_OPTION_WITH_ARG_STR(timeunit)
|
||||||
IF_OPTION_NO_ARG(ordered)
|
IF_OPTION_NO_ARG(ordered)
|
||||||
@@ -875,8 +882,9 @@ void end_execute_func_parallel(char *fun_ame, struct timespec start_t, size_t id
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 1
|
unsigned sleep(unsigned x) { time_t t0=time(0); while (difftime(time(0),t0)<x); return 0; }
|
||||||
void progress_test_(int max_colon){
|
|
||||||
|
void progress_test_(){
|
||||||
struct func *tmp;
|
struct func *tmp;
|
||||||
size_t num_test=0;
|
size_t num_test=0;
|
||||||
int cur = 0, len;
|
int cur = 0, len;
|
||||||
@@ -885,32 +893,44 @@ void progress_test_(int max_colon){
|
|||||||
char prgss[]="/ | --";
|
char prgss[]="/ | --";
|
||||||
len=strlen(prgss);
|
len=strlen(prgss);
|
||||||
do{
|
do{
|
||||||
LOCK(mut_current_test);
|
//LOCK(mut_current_test);
|
||||||
tmp = current_fn;
|
tmp = current_fn;
|
||||||
UNLOCK(mut_current_test);
|
//UNLOCK(mut_current_test);
|
||||||
if(tmp)
|
if(tmp)
|
||||||
num_test = extract_num__f(tmp->name);
|
num_test = extract_num__f(tmp->name);
|
||||||
gotoxy(13,0);
|
//gotoxy(13,0);
|
||||||
for(int i=0; i<(num_test*max_colon/count_tests); ++i) printf("#");
|
printf("\r[");
|
||||||
|
for(int i=0; i< width; ++i) {
|
||||||
|
if(i<=(num_test+1)*width/count_tests){
|
||||||
|
//usleep(20000);
|
||||||
|
printf("#");
|
||||||
|
}
|
||||||
|
else printf(" ");
|
||||||
|
}
|
||||||
|
printf("|%ld%%, test N° %ld/%ld]",(num_test+1)*100/count_tests,num_test,count_tests-1);
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
|
|
||||||
//printf("%c",prgss[cur]);
|
//printf("%c",prgss[cur]);
|
||||||
printf("\33[2K\r"); /* remove current line and go to begin of the current line */
|
//printf("\33[2K\r"); // remove current line and go to begin of the current line
|
||||||
if(cur<len-1) ++cur;
|
if(cur<len-1) ++cur;
|
||||||
else cur=0;
|
else cur=0;
|
||||||
//printf("\n");
|
//printf("\n");
|
||||||
//sleep(1);
|
//sleep(1);
|
||||||
//usleep(50000);
|
//usleep(500000);
|
||||||
}while(tmp);
|
}while(tmp);
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void*
|
void*
|
||||||
run_progress_tests(void *max_d)
|
run_progress_tests(void *max_d)
|
||||||
{
|
{
|
||||||
int max_col = 180; //*(int*)max_d;
|
int max_col = 80; //*(int*)max_d;
|
||||||
//progress_test_(max_col);
|
progress_test_(max_col);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void execute_test_parallel(size_t id_thrd){
|
void execute_test_parallel(size_t id_thrd){
|
||||||
|
|
||||||
@@ -951,7 +971,7 @@ run_parallel_tests(void *id)
|
|||||||
void
|
void
|
||||||
init_parallel_test_()
|
init_parallel_test_()
|
||||||
{
|
{
|
||||||
progress = PROGRESS;
|
progress = ordered;
|
||||||
|
|
||||||
is_parallel_nb = 1;
|
is_parallel_nb = 1;
|
||||||
|
|
||||||
|
|||||||
+47
-80
@@ -46,34 +46,10 @@
|
|||||||
#define GE >=
|
#define GE >=
|
||||||
#define NE !=
|
#define NE !=
|
||||||
|
|
||||||
#define DESCRIPTION_EQ "equality"
|
|
||||||
#define DESCRIPTION_LT "less than"
|
|
||||||
#define DESCRIPTION_GT "greate than"
|
|
||||||
#define DESCRIPTION_LE "less than or equality"
|
|
||||||
#define DESCRIPTION_GE "greate than or equality"
|
|
||||||
#define DESCRIPTION_NE "inequality"
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
#ifndef unicolour
|
|
||||||
#define unicolour 0
|
|
||||||
#endif /* unicolour */
|
|
||||||
|
|
||||||
#ifndef PARALLEL
|
|
||||||
#define PARALLEL 1
|
|
||||||
#define LOCK(mut)
|
|
||||||
#define UNLOCK(mut)
|
|
||||||
#else /*PARALLEL defined*/
|
|
||||||
#define LOCK(mutex_var) pthread_mutex_lock(&mutex_var);
|
|
||||||
#define UNLOCK(mutex_var) pthread_mutex_unlock(&mutex_var);
|
|
||||||
#define is_parallel_nb 1
|
|
||||||
#endif
|
|
||||||
#endif /* 0 */
|
|
||||||
|
|
||||||
extern FILE **f_ou_th;
|
extern FILE **f_ou_th;
|
||||||
extern bool unicolour;
|
extern bool unicolour;
|
||||||
|
extern bool ordered;
|
||||||
// ===================== rec not in file
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef SAVE_LOG
|
#ifndef SAVE_LOG
|
||||||
@@ -85,86 +61,78 @@ extern bool unicolour;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef ORDER_LOG
|
|
||||||
|
|
||||||
#define PRINT_LOC(fmt, ...) \
|
|
||||||
fprintf(F_OUT, "%s:%d:%s(): " fmt, __FILE__, \
|
|
||||||
__LINE__, __func__, __VA_ARGS__)
|
|
||||||
|
|
||||||
#define PRINTF( ...) \
|
|
||||||
fprintf(F_OUT, __VA_ARGS__)
|
|
||||||
/*
|
|
||||||
* print [ HK_NAME ] with color
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define PRINT_HK_C(color,hk,...)\
|
|
||||||
do{ if(!unicolour) fprintf(F_OUT, color hk DEFAULT_K __VA_ARGS__); \
|
|
||||||
else fprintf(F_OUT, hk __VA_ARGS__); } while(0)
|
|
||||||
|
|
||||||
/* =================================== end no file */
|
|
||||||
#else /* ORDER_LOG */
|
|
||||||
/* ====================== rec in file */
|
|
||||||
|
|
||||||
#define PRINT_LOC(fmt, ...) \
|
#define PRINT_LOC(fmt, ...) \
|
||||||
do{ \
|
do{ \
|
||||||
if(is_parallel_nb){\
|
if(ordered){\
|
||||||
size_t id_thread=id_of_thread_executed();\
|
if(is_parallel_nb){\
|
||||||
if(id_thread < 0){\
|
size_t id_thread=id_of_thread_executed();\
|
||||||
fprintf(F_OUT, "%s:%d:%s(): " fmt, __FILE__, \
|
if(id_thread < 0){\
|
||||||
__LINE__, __func__, __VA_ARGS__);\
|
fprintf(F_OUT, "%s:%d:%s(): " fmt, __FILE__, \
|
||||||
}\
|
__LINE__, __func__, __VA_ARGS__);\
|
||||||
|
}\
|
||||||
|
else{\
|
||||||
|
fprintf(f_ou_th[id_thread], "%s:%d:%s(): " fmt, __FILE__, \
|
||||||
|
__LINE__, __func__, __VA_ARGS__);\
|
||||||
|
}\
|
||||||
|
} \
|
||||||
else{\
|
else{\
|
||||||
fprintf(f_ou_th[id_thread], "%s:%d:%s(): " fmt, __FILE__, \
|
fprintf(F_OUT, "%s:%d:%s(): " fmt, __FILE__, \
|
||||||
__LINE__, __func__, __VA_ARGS__);\
|
__LINE__, __func__, __VA_ARGS__);\
|
||||||
}\
|
}\
|
||||||
} \
|
}\
|
||||||
else{\
|
else{\
|
||||||
fprintf(F_OUT, "%s:%d:%s(): " fmt, __FILE__, \
|
fprintf(F_OUT, "%s:%d:%s(): " fmt, __FILE__, \
|
||||||
__LINE__, __func__, __VA_ARGS__);\
|
__LINE__, __func__, __VA_ARGS__);\
|
||||||
}\
|
}\
|
||||||
}while(0)
|
}while(0)
|
||||||
|
|
||||||
#define PRINTF( ...) \
|
#define PRINTF( ...) \
|
||||||
do{ \
|
do{ \
|
||||||
if(is_parallel_nb){\
|
if(ordered){\
|
||||||
size_t id_thread=id_of_thread_executed();\
|
if(is_parallel_nb){\
|
||||||
if(id_thread < 0){\
|
size_t id_thread=id_of_thread_executed();\
|
||||||
fprintf(F_OUT,__VA_ARGS__);\
|
if(id_thread < 0){\
|
||||||
}\
|
fprintf(F_OUT,__VA_ARGS__);\
|
||||||
|
}\
|
||||||
|
else{\
|
||||||
|
fprintf(f_ou_th[id_thread], __VA_ARGS__);\
|
||||||
|
}\
|
||||||
|
} \
|
||||||
else{\
|
else{\
|
||||||
fprintf(f_ou_th[id_thread], __VA_ARGS__);\
|
fprintf(F_OUT, __VA_ARGS__);\
|
||||||
}\
|
}\
|
||||||
} \
|
}\
|
||||||
else{\
|
else{\
|
||||||
fprintf(F_OUT, __VA_ARGS__);\
|
fprintf(F_OUT, __VA_ARGS__);\
|
||||||
}\
|
}\
|
||||||
}while(0)
|
}while(0)
|
||||||
|
|
||||||
#define PRINT_HK_C(color,hk,...)\
|
#define PRINT_HK_C(color,hk,...)\
|
||||||
do{ \
|
do{ \
|
||||||
if(is_parallel_nb){\
|
if(ordered){\
|
||||||
size_t id_thread=id_of_thread_executed();\
|
if(is_parallel_nb){\
|
||||||
if(id_thread < 0){\
|
size_t id_thread=id_of_thread_executed();\
|
||||||
|
if(id_thread < 0){\
|
||||||
|
if(!unicolour) fprintf(F_OUT, color hk DEFAULT_K __VA_ARGS__); \
|
||||||
|
else fprintf(F_OUT, hk __VA_ARGS__); \
|
||||||
|
}\
|
||||||
|
else{\
|
||||||
|
if(!unicolour) fprintf(f_ou_th[id_thread], color hk DEFAULT_K __VA_ARGS__); \
|
||||||
|
else fprintf(f_ou_th[id_thread], hk __VA_ARGS__); \
|
||||||
|
}\
|
||||||
|
} \
|
||||||
|
else{\
|
||||||
if(!unicolour) fprintf(F_OUT, color hk DEFAULT_K __VA_ARGS__); \
|
if(!unicolour) fprintf(F_OUT, color hk DEFAULT_K __VA_ARGS__); \
|
||||||
else fprintf(F_OUT, hk __VA_ARGS__); \
|
else fprintf(F_OUT, hk __VA_ARGS__); \
|
||||||
}\
|
}\
|
||||||
else{\
|
}\
|
||||||
if(!unicolour) fprintf(f_ou_th[id_thread], color hk DEFAULT_K __VA_ARGS__); \
|
|
||||||
else fprintf(f_ou_th[id_thread], hk __VA_ARGS__); \
|
|
||||||
}\
|
|
||||||
} \
|
|
||||||
else{\
|
else{\
|
||||||
if(!unicolour) fprintf(F_OUT, color hk DEFAULT_K __VA_ARGS__); \
|
if(!unicolour) fprintf(F_OUT, color hk DEFAULT_K __VA_ARGS__); \
|
||||||
else fprintf(F_OUT, hk __VA_ARGS__); \
|
else fprintf(F_OUT, hk __VA_ARGS__); \
|
||||||
}\
|
}\
|
||||||
}while(0)
|
}while(0)
|
||||||
|
|
||||||
#endif /* ORDER_LOG */
|
|
||||||
|
|
||||||
// ====================== = end rec log in file
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -426,7 +394,6 @@ do{ \
|
|||||||
#define EXPECT_LT(var1, var2) HANDLE_OP_EXPECT_ASSERT(LT, TYPE_L_INT,var1, var2, 0)
|
#define EXPECT_LT(var1, var2) HANDLE_OP_EXPECT_ASSERT(LT, TYPE_L_INT,var1, var2, 0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ============== ASERT =====================
|
// ============== ASERT =====================
|
||||||
|
|
||||||
#define ASSERT_LT_TYPE_CHAR(var1, var2) HANDLE_OP_EXPECT_ASSERT(LT, TYPE_CHAR,var1, var2, 1)
|
#define ASSERT_LT_TYPE_CHAR(var1, var2) HANDLE_OP_EXPECT_ASSERT(LT, TYPE_CHAR,var1, var2, 1)
|
||||||
@@ -651,7 +618,7 @@ do{
|
|||||||
void CONCAT(TEST_##name_f##____,count)(void); \
|
void CONCAT(TEST_##name_f##____,count)(void); \
|
||||||
__attribute__((constructor)) \
|
__attribute__((constructor)) \
|
||||||
void CONCAT(append_test_##name_f,count)(void){ \
|
void CONCAT(append_test_##name_f,count)(void){ \
|
||||||
append_func(CONCAT(TEST_##name_f##____,count),STRFY(TEST(name_f): test N° count )); \
|
append_func(CONCAT(TEST_##name_f##____,count),STRFY(TEST(name_f): test N° count|)); \
|
||||||
} \
|
} \
|
||||||
void CONCAT(TEST_##name_f##____,count)(void)
|
void CONCAT(TEST_##name_f##____,count)(void)
|
||||||
|
|
||||||
|
|||||||
@@ -1,144 +0,0 @@
|
|||||||
#include "src/tools/tools.h"
|
|
||||||
|
|
||||||
int
|
|
||||||
compare_int(void* a, void* b)
|
|
||||||
{
|
|
||||||
return (*(int*)a - *(int*)b);
|
|
||||||
}
|
|
||||||
int
|
|
||||||
compare_unsigned_int(void* a, void* b)
|
|
||||||
{
|
|
||||||
return ((unsigned int*)a-*(unsigned int*)b);
|
|
||||||
}
|
|
||||||
int
|
|
||||||
compare_float(void *a, void *b)
|
|
||||||
{
|
|
||||||
if (*(float*)a == *(float*)b) return 0;
|
|
||||||
if (*(float*)a > *(float*)b) return 1;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
int
|
|
||||||
compare_double(void *a, void *b)
|
|
||||||
{
|
|
||||||
if (*(double*)a == *(double*)b) return 0;
|
|
||||||
if (*(double*)a > *(double*)b) return 1;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
int
|
|
||||||
compare_string(void *a, void *b)
|
|
||||||
{
|
|
||||||
return strcmp((char*)a, (char*)b);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
max_array_int(int * arr, size_t sz)
|
|
||||||
{
|
|
||||||
if(sz == 0) return 0;
|
|
||||||
int mx = arr[0];
|
|
||||||
for(size_t i = 1; i < sz; ++i)
|
|
||||||
if(mx < arr[i]) mx = arr[i];
|
|
||||||
|
|
||||||
return mx;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int
|
|
||||||
max_array_unsigned_int(unsigned int *arr, size_t sz)
|
|
||||||
{
|
|
||||||
if(sz == 0) return 0;
|
|
||||||
unsigned int mx = arr[0];
|
|
||||||
for(size_t i = 1; i < sz; ++i)
|
|
||||||
if(mx < arr[i]) mx = arr[i];
|
|
||||||
|
|
||||||
return mx;
|
|
||||||
}
|
|
||||||
int
|
|
||||||
min_array_int(int * arr, size_t sz)
|
|
||||||
{
|
|
||||||
if(sz == 0) return 0;
|
|
||||||
int mn = arr[0];
|
|
||||||
for(size_t i = 1; i < sz; ++i)
|
|
||||||
if(mn > arr[i]) mn = arr[i];
|
|
||||||
|
|
||||||
return mn;
|
|
||||||
}
|
|
||||||
unsigned int
|
|
||||||
min_array_unsigned_int(unsigned int *arr, size_t sz)
|
|
||||||
{
|
|
||||||
if(sz == 0) return 0;
|
|
||||||
unsigned int mn = arr[0];
|
|
||||||
for(size_t i = 1; i < sz; ++i)
|
|
||||||
if(mn > arr[i]) mn = arr[i];
|
|
||||||
|
|
||||||
return mn;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t
|
|
||||||
arg_max_array_int(int * arr, size_t sz)
|
|
||||||
{
|
|
||||||
if(sz == 0) return 0;
|
|
||||||
size_t i_mx = 0;
|
|
||||||
for(size_t i = 1; i < sz; ++i)
|
|
||||||
if(arr[i_mx] < arr[i]) i_mx = i;
|
|
||||||
|
|
||||||
return i_mx;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t
|
|
||||||
arg_max_array_unsigned_int(unsigned int *arr, size_t sz)
|
|
||||||
{
|
|
||||||
if(sz == 0) return 0;
|
|
||||||
size_t i_mx = 0;
|
|
||||||
for(size_t i = 1; i < sz; ++i)
|
|
||||||
if(arr[i_mx] < arr[i]) i_mx = i;
|
|
||||||
|
|
||||||
return i_mx;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t
|
|
||||||
arg_min_array_int(int * arr, size_t sz)
|
|
||||||
{
|
|
||||||
if(sz == 0) return 0;
|
|
||||||
size_t i_mn = 0;
|
|
||||||
for(size_t i = 1; i < sz; ++i)
|
|
||||||
if(arr[i_mn] > arr[i]) i_mn = i;
|
|
||||||
|
|
||||||
return i_mn;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t
|
|
||||||
arg_min_array_unsigned_int(unsigned int *arr, size_t sz)
|
|
||||||
{
|
|
||||||
if(sz == 0) return 0;
|
|
||||||
size_t i_mn = 0;
|
|
||||||
for(size_t i = 1; i < sz; ++i)
|
|
||||||
if(arr[i_mn] > arr[i]) i_mn = i;
|
|
||||||
|
|
||||||
return i_mn;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_array_unsigned_int(unsigned int *dst, const unsigned int *src, size_t size)
|
|
||||||
{
|
|
||||||
for(size_t i=0; i< size; ++i)
|
|
||||||
dst[i]=src[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
bool is_less_eq_than_i(int a, int b) { return a <= b; }
|
|
||||||
bool is_less_than_i(int a, int b) { return a < b; }
|
|
||||||
bool is_great_eq_than_i(int a, int b) { return a >= b; }
|
|
||||||
bool is_great_than_i(int a, int b) { return a > b; }
|
|
||||||
*/
|
|
||||||
int incr_i(int i) { return i + 1; }
|
|
||||||
int decr_i(int i) { return i - 1; }
|
|
||||||
|
|
||||||
/*
|
|
||||||
bool is_less_eq_than_u(unsigned int a, unsigned int b) { return a <= b; }
|
|
||||||
bool is_less_than_u(unsigned int a, unsigned int b) { return a < b; }
|
|
||||||
bool is_great_eq_than_u(unsigned int a, unsigned int b) { return a >= b; }
|
|
||||||
bool is_great_than_u(unsigned int a, unsigned int b) { return a > b; }
|
|
||||||
*/
|
|
||||||
unsigned int incr_u(unsigned int i) { return i + 1; }
|
|
||||||
unsigned int decr_u(unsigned int i) { return i - 1; }
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
#ifndef __TOOLS_C_H__
|
|
||||||
#define __TOOLS_C_H__
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#define FREE(x) { free((x)); (x) = NULL;}
|
|
||||||
|
|
||||||
int compare_int(void* a, void* b);
|
|
||||||
int compare_unsigned_int(void* a, void* b);
|
|
||||||
int compare_float(void *a, void *b);
|
|
||||||
int compare_double(void *a, void *b);
|
|
||||||
int compare_string(void *a, void *b);
|
|
||||||
|
|
||||||
int max_array_int(int *arr, size_t sz);
|
|
||||||
unsigned int max_array_unsigned_int(unsigned int *arr, size_t sz);
|
|
||||||
int min_array_int(int *arr, size_t sz);
|
|
||||||
unsigned int min_array_unsigned_int(unsigned int *arr, size_t sz);
|
|
||||||
|
|
||||||
size_t arg_max_array_int(int *arr, size_t sz);
|
|
||||||
size_t arg_max_array_unsigned_int(unsigned int *arr, size_t sz);
|
|
||||||
size_t arg_min_array_int(int *arr, size_t sz);
|
|
||||||
size_t arg_min_array_unsigned_int(unsigned int *arr, size_t sz);
|
|
||||||
|
|
||||||
void copy_array_unsigned_int(unsigned int *dst, const unsigned int *src, size_t size);
|
|
||||||
|
|
||||||
/*
|
|
||||||
bool is_less_eq_than_i(int a, int b); // { return a <= b; }
|
|
||||||
bool is_less_than_i(int a, int b); // { return a < b; }
|
|
||||||
bool is_great_eq_than_i(int a, int b); // { return a >= b; }
|
|
||||||
bool is_great_than_i(int a, int b); // { return a > b; }
|
|
||||||
*/
|
|
||||||
int incr_i(int i); // { return i + 1; }
|
|
||||||
int decr_i(int i); // { return i - 1; }
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
bool is_less_eq_than_u(unsigned int a, unsigned int b); // { return a <= b; }
|
|
||||||
bool is_less_than_u(unsigned int a, unsigned int b); // { return a < b; }
|
|
||||||
bool is_great_eq_than_u(unsigned int a, unsigned int b); // { return a >= b; }
|
|
||||||
bool is_great_than_u(unsigned int a, unsigned int b); // { return a > b; }
|
|
||||||
*/
|
|
||||||
unsigned int incr_u(unsigned int i); // { return i + 1; }
|
|
||||||
unsigned int decr_u(unsigned int i); // { return i - 1; }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /*__TOOLS_C_H__*/
|
|
||||||
@@ -171,14 +171,17 @@ GENERATE_FUNCTION_ALL(TYPE_STRING)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
double diff_timespec_seconds(struct timespec time_stop, struct timespec time_start){
|
double diff_timespec_seconds(struct timespec time_stop, struct timespec time_start){
|
||||||
|
//PRINT_DEBUG("\n\nstop.sec:%ld, start.sec:%ld, stop.nsec:%ld, start.nsec:%ld\n\n", time_stop.tv_sec , time_start.tv_sec, time_stop.tv_nsec , time_start.tv_nsec);
|
||||||
return (time_stop.tv_sec - time_start.tv_sec) + 1.0e-9 * (time_stop.tv_nsec - time_start.tv_nsec);
|
return (time_stop.tv_sec - time_start.tv_sec) + 1.0e-9 * (time_stop.tv_nsec - time_start.tv_nsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
double diff_timespec_milliseconds(struct timespec time_stop, struct timespec time_start){
|
double diff_timespec_milliseconds(struct timespec time_stop, struct timespec time_start){
|
||||||
return 1.0e3 * (time_stop.tv_sec - time_start.tv_sec) + 1.0e-3 * (time_stop.tv_nsec - time_start.tv_nsec);
|
//PRINT_DEBUG("\n\nstop.sec:%ld, start.sec:%ld, stop.nsec:%ld, start.nsec:%ld\n\n", time_stop.tv_sec , time_start.tv_sec, time_stop.tv_nsec , time_start.tv_nsec);
|
||||||
|
return 1.0e3 * (time_stop.tv_sec - time_start.tv_sec) + 1.0e-6 * (time_stop.tv_nsec - time_start.tv_nsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
long diff_timespec_nanoseconds(struct timespec time_stop, struct timespec time_start){
|
long diff_timespec_nanoseconds(struct timespec time_stop, struct timespec time_start){
|
||||||
|
//PRINT_DEBUG("\n\nstop.sec:%ld, start.sec:%ld, stop.nsec:%ld, start.nsec:%ld\n\n", time_stop.tv_sec , time_start.tv_sec, time_stop.tv_nsec , time_start.tv_nsec);
|
||||||
return 1.0e9 * (time_stop.tv_sec - time_start.tv_sec) + (time_stop.tv_nsec - time_start.tv_nsec);
|
return 1.0e9 * (time_stop.tv_sec - time_start.tv_sec) + (time_stop.tv_nsec - time_start.tv_nsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#ifndef SECOND
|
#ifndef SECOND
|
||||||
#define SECOND 0
|
#define SECOND 0
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
#cmake_minimum_required(VERSION 3.2)
|
|
||||||
cmake_minimum_required(VERSION 3.18)
|
|
||||||
|
|
||||||
project(ptens0neD)
|
|
||||||
|
|
||||||
include(FetchContent)
|
|
||||||
FetchContent_Declare(googletest
|
|
||||||
GIT_REPOSITORY https://github.com/google/googletest
|
|
||||||
GIT_TAG release-1.12.1
|
|
||||||
)
|
|
||||||
FetchContent_GetProperties(googletest)
|
|
||||||
|
|
||||||
if(NOT googletest_POPULATED)
|
|
||||||
FetchContent_Populate(googletest)
|
|
||||||
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BUILD_DIR})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#add_library(add STATIC add.cu)
|
|
||||||
add_library(permutation STATIC src/permutation/permutation.cpp)
|
|
||||||
add_library(dimension STATIC src/dimension/dimension.cpp)
|
|
||||||
add_library(tens0ne STATIC src/tens0ne/tens0ne.cpp)
|
|
||||||
add_library(cutens0ne STATIC src/cutens0ne/cutens0ne.cu)
|
|
||||||
add_library(d_cutens0ne STATIC src/cutens0ne/d_cutens0ne.cu)
|
|
||||||
|
|
||||||
#find_package(CUDA REQUIRED)
|
|
||||||
enable_language(CUDA)
|
|
||||||
#cuda_add_library(add STATIC add.cu)
|
|
||||||
#add_library(permutation STATIC ../permutation/permutation.cu)
|
|
||||||
|
|
||||||
#cuda_add_executable( )
|
|
||||||
add_executable(isgood isgood.cu device.cuh ../tensor/tensor.cpp ../permutation/permutation.cpp)
|
|
||||||
#cuda_add_executable(isgood isgood.cpp add.cu )
|
|
||||||
#target_link_libraries(isgood add gtest_main gmock_main pthread)
|
|
||||||
target_link_libraries(isgood gtest_main gmock_main pthread)
|
|
||||||
|
|
||||||
enable_testing()
|
|
||||||
add_test(Tester isgood)
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
#cmake_minimum_required(VERSION 3.20)
|
|
||||||
#cmake_minimum_required(VERSION 3.18)
|
|
||||||
cmake_minimum_required(VERSION 3.0.0)
|
|
||||||
|
|
||||||
set(F0_PROJECT_NAME projectF0)
|
|
||||||
|
|
||||||
set(F0_LIBRARIES
|
|
||||||
permutation
|
|
||||||
dimension
|
|
||||||
tens0neD
|
|
||||||
)
|
|
||||||
set(F0_CUDA_LIBRARIES
|
|
||||||
tensCuda
|
|
||||||
d_tensCuda
|
|
||||||
)
|
|
||||||
|
|
||||||
set(F0_SOURCE_DIR
|
|
||||||
src
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
project(${F0_PROJECT_NAME})
|
|
||||||
|
|
||||||
include(FetchContent)
|
|
||||||
FetchContent_Declare(googletest
|
|
||||||
GIT_REPOSITORY https://github.com/google/googletest
|
|
||||||
GIT_TAG release-1.12.1
|
|
||||||
)
|
|
||||||
FetchContent_GetProperties(googletest)
|
|
||||||
|
|
||||||
if(NOT googletest_POPULATED)
|
|
||||||
FetchContent_Populate(googletest)
|
|
||||||
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BUILD_DIR})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
#add_library(add STATIC add.cu)
|
|
||||||
|
|
||||||
foreach(libvarcu ${F0_CUDA_LIBRARIES})
|
|
||||||
list(APPEND F0_SOURCES_CU ${F0_SOURCE_DIR}/tensor/tensCuda/${libvarcu}.cu)
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
foreach(libvar ${F0_LIBRARIES})
|
|
||||||
if( ${libvar} STREQUAL "tens0neD" )
|
|
||||||
list(APPEND F0_SOURCES_CPP ${F0_SOURCE_DIR}/tensor/${libvar}/${libvar}.cpp)
|
|
||||||
else()
|
|
||||||
list(APPEND F0_SOURCES_CPP ${F0_SOURCE_DIR}/${libvar}/${libvar}.cpp)
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
||||||
|
|
||||||
#find_package(CUDA REQUIRED) # no need
|
|
||||||
enable_language(CUDA)
|
|
||||||
|
|
||||||
#if version < 3.18
|
|
||||||
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
|
|
||||||
set(CMAKE_CUDA_ARCHITECTURES 75)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_library(${F0_PROJECT_NAME} STATIC ${F0_SOURCES_CPP} ${F0_SOURCES_CU}) # no need if add sources in executable
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
add_executable(isgood test/isgood.cu) # if library set, no need of ${F0_SOURCES_CPP} ${F0_SOURCES_CU}) but if not you nedd to add theses files src
|
|
||||||
|
|
||||||
target_link_libraries(isgood gtest_main gmock_main pthread ${F0_PROJECT_NAME}) # no need if no local library set
|
|
||||||
|
|
||||||
enable_testing()
|
|
||||||
add_test(Tester isgood)
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 3.0.0)
|
|
||||||
|
|
||||||
set(FOO_PROJECT_NAME
|
|
||||||
Foo
|
|
||||||
)
|
|
||||||
set(FOO_SOURCE_DIR
|
|
||||||
src
|
|
||||||
)
|
|
||||||
set(FOO_SOURCE
|
|
||||||
${FOO_SOURCE_DIR}/main.cpp
|
|
||||||
)
|
|
||||||
set(FOO_LIBRARIES_DIR
|
|
||||||
libs
|
|
||||||
)
|
|
||||||
set(FOO_LIBRARIES
|
|
||||||
A
|
|
||||||
B
|
|
||||||
)
|
|
||||||
|
|
||||||
project(${FOO_PROJECT_NAME})
|
|
||||||
|
|
||||||
#########
|
|
||||||
# GTest #
|
|
||||||
#########
|
|
||||||
enable_testing()
|
|
||||||
add_subdirectory(libs/gtest-1.7.0)
|
|
||||||
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
|
|
||||||
|
|
||||||
###########
|
|
||||||
# Project #
|
|
||||||
###########
|
|
||||||
add_executable(${FOO_PROJECT_NAME} ${FOO_SOURCE})
|
|
||||||
|
|
||||||
foreach(LIBRARY ${FOO_LIBRARIES})
|
|
||||||
add_subdirectory("${FOO_LIBRARIES_DIR}/${LIBRARY}")
|
|
||||||
endforeach(LIBRARY)
|
|
||||||
target_link_libraries(${FOO_PROJECT_NAME} ${FOO_LIBRARIES})
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 3.18)
|
|
||||||
|
|
||||||
project(ptens0neD VERSION 2023.0
|
|
||||||
LANGUAGES CXX
|
|
||||||
HOMEPAGE_URL "https://github.com/fanasina/ptens0neD")
|
|
||||||
|
|
||||||
#####################################################################
|
|
||||||
# DEPENDENCIES
|
|
||||||
#####################################################################
|
|
||||||
|
|
||||||
find_package(Threads REQUIRED)
|
|
||||||
find_package(Boost REQUIRED)
|
|
||||||
|
|
||||||
include(FetchContent)
|
|
||||||
|
|
||||||
FetchContent_Declare(
|
|
||||||
googletest
|
|
||||||
GIT_REPOSITORY https://github.com/google/googletest.git
|
|
||||||
GIT_TAG release-1.10.0)
|
|
||||||
|
|
||||||
FetchContent_GetProperties(googletest)
|
|
||||||
if(NOT googletest_POPULATED)
|
|
||||||
FetchContent_Populate(googletest)
|
|
||||||
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR}
|
|
||||||
EXCLUDE_FROM_ALL)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#####################################################################
|
|
||||||
# LIBRARY
|
|
||||||
#####################################################################
|
|
||||||
|
|
||||||
add_library(${PROJECT_NAME}
|
|
||||||
src/ptens0neD/implementation.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
|
|
||||||
|
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
|
||||||
VERSION ${PROJECT_VERSION})
|
|
||||||
|
|
||||||
target_include_directories(${PROJECT_NAME}
|
|
||||||
PUBLIC include
|
|
||||||
PRIVATE src)
|
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME}
|
|
||||||
PUBLIC Threads::Threads
|
|
||||||
PRIVATE Boost::boost)
|
|
||||||
|
|
||||||
target_compile_options(${PROJECT_NAME}
|
|
||||||
PRIVATE -Wall -Wextra -pedantic -Werror)
|
|
||||||
|
|
||||||
target_compile_features(${PROJECT_NAME}
|
|
||||||
PRIVATE cxx_std_17)
|
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
|
|
||||||
install(TARGETS ${PROJECT_NAME}
|
|
||||||
EXPORT ptens0neDTargets
|
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
|
||||||
|
|
||||||
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
||||||
|
|
||||||
#####################################################################
|
|
||||||
# UNIT TESTS
|
|
||||||
#####################################################################
|
|
||||||
|
|
||||||
add_executable(${PROJECT_NAME}-tests
|
|
||||||
test/test-myclass.cpp)
|
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME}-tests
|
|
||||||
PRIVATE gtest_main Threads::Threads ${PROJECT_NAME}::${PROJECT_NAME})
|
|
||||||
|
|
||||||
target_compile_options(${PROJECT_NAME}-tests
|
|
||||||
PRIVATE -Wall -Wextra -pedantic -Werror)
|
|
||||||
|
|
||||||
target_compile_features(${PROJECT_NAME}
|
|
||||||
PRIVATE cxx_std_17)
|
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 3.20)
|
|
||||||
project(geometries LANGUAGES CXX)
|
|
||||||
|
|
||||||
add_executable(app)
|
|
||||||
target_sources(app PRIVATE "app.cpp")
|
|
||||||
target_include_directories(app PRIVATE "${PROJECT_SOURCE_DIR}")
|
|
||||||
add_subdirectory("shape")
|
|
||||||
add_subdirectory("square")
|
|
||||||
install(TARGETS app)
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user