Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Courses
DrawSVG
Commits
052a7244
Commit
052a7244
authored
Feb 16, 2021
by
TheNumbat
Browse files
improve build system
parent
2c6a0968
Changes
8
Show whitespace changes
Inline
Side-by-side
CMU462/CMakeLists.txt
View file @
052a7244
...
@@ -45,7 +45,7 @@ if(APPLE)
...
@@ -45,7 +45,7 @@ if(APPLE)
set
(
CLANG_CXX_FLAGS
"-std=c++11 -m64"
)
set
(
CLANG_CXX_FLAGS
"-std=c++11 -m64"
)
if
(
CMU462_BUILD_DEBUG
)
if
(
CMU462_BUILD_DEBUG
OR CMAKE_BUILD_TYPE MATCHES
"Debug"
)
set
(
CMAKE_BUILD_TYPE Debug
)
set
(
CMAKE_BUILD_TYPE Debug
)
else
(
CMU462_BUILD_DEBUG
)
else
(
CMU462_BUILD_DEBUG
)
set
(
CLANG_CXX_FLAGS
"
${
CLANG_CXX_FLAGS
}
-O3"
)
set
(
CLANG_CXX_FLAGS
"
${
CLANG_CXX_FLAGS
}
-O3"
)
...
@@ -63,7 +63,7 @@ if(APPLE)
...
@@ -63,7 +63,7 @@ if(APPLE)
set
(
GCC_CXX_FLAGS
"-std=gnu++11 -m64"
)
set
(
GCC_CXX_FLAGS
"-std=gnu++11 -m64"
)
if
(
CMU462_BUILD_DEBUG
)
if
(
CMU462_BUILD_DEBUG
OR CMAKE_BUILD_TYPE MATCHES
"Debug"
)
set
(
CMAKE_BUILD_TYPE Debug
)
set
(
CMAKE_BUILD_TYPE Debug
)
else
(
CMU462_BUILD_DEBUG
)
else
(
CMU462_BUILD_DEBUG
)
set
(
GCC_CXX_FLAGS
"
${
GCC_CXX_FLAGS
}
-O3"
)
set
(
GCC_CXX_FLAGS
"
${
GCC_CXX_FLAGS
}
-O3"
)
...
@@ -81,7 +81,10 @@ endif(APPLE)
...
@@ -81,7 +81,10 @@ endif(APPLE)
##################
##################
# Build on Linux #
# Build on Linux #
##################
##################
set
(
LINUX UNIX AND NOT APPLE
)
if
(
UNIX AND NOT APPLE
)
set
(
LINUX
)
endif
()
if
(
LINUX
)
if
(
LINUX
)
# GCC only
# GCC only
...
@@ -126,8 +129,6 @@ if(WIN32)
...
@@ -126,8 +129,6 @@ if(WIN32)
if
(
MSVC
)
if
(
MSVC
)
set
(
MSVC_CXX_FLAGS
"-std=gnu++11"
)
if
(
CMU462_BUILD_DEBUG
)
if
(
CMU462_BUILD_DEBUG
)
set
(
CMAKE_BUILD_TYPE Debug
)
set
(
CMAKE_BUILD_TYPE Debug
)
else
(
CMU462_BUILD_DEBUG
)
else
(
CMU462_BUILD_DEBUG
)
...
@@ -141,8 +142,6 @@ if(WIN32)
...
@@ -141,8 +142,6 @@ if(WIN32)
if
(
MINGW
)
if
(
MINGW
)
set
(
MSVC_CXX_FLAGS
"-std=gnu++11"
)
if
(
CMU462_BUILD_DEBUG
)
if
(
CMU462_BUILD_DEBUG
)
set
(
CMAKE_BUILD_TYPE Debug
)
set
(
CMAKE_BUILD_TYPE Debug
)
else
(
CMU462_BUILD_DEBUG
)
else
(
CMU462_BUILD_DEBUG
)
...
...
CMU462/deps/glew/CMakeLists.txt
View file @
052a7244
...
@@ -7,8 +7,7 @@ include_directories(${GLEW_HEADER_DIR})
...
@@ -7,8 +7,7 @@ include_directories(${GLEW_HEADER_DIR})
add_library
(
glew
add_library
(
glew
${
GLEW_SOURCE_DIR
}
/glew.c
${
GLEW_SOURCE_DIR
}
/glew.c
${
GLEW_SOURCE_DIR
}
/glewinfo.c
${
GLEW_SOURCE_DIR
}
/glewinfo.c
)
${
GLEW_SOURCE_DIR
}
/visualinfo.c
)
set
(
GLEW_LIBRARIES glew PARENT_SCOPE
)
set
(
GLEW_LIBRARIES glew PARENT_SCOPE
)
set
(
GLEW_INCLUDE_DIRS
${
GLEW_HEADER_DIR
}
PARENT_SCOPE
)
set
(
GLEW_INCLUDE_DIRS
${
GLEW_HEADER_DIR
}
PARENT_SCOPE
)
...
...
CMU462/deps/glfw/CMakeLists.txt
View file @
052a7244
...
@@ -21,10 +21,10 @@ set(LIB_SUFFIX "" CACHE STRING "Takes an empty string or 64. Directory where lib
...
@@ -21,10 +21,10 @@ set(LIB_SUFFIX "" CACHE STRING "Takes an empty string or 64. Directory where lib
set_property
(
GLOBAL PROPERTY USE_FOLDERS ON
)
set_property
(
GLOBAL PROPERTY USE_FOLDERS ON
)
option
(
BUILD_SHARED_LIBS
"Build shared libraries"
OFF
)
option
(
BUILD_SHARED_LIBS
"Build shared libraries"
OFF
)
option
(
GLFW_BUILD_EXAMPLES
"Build the GLFW example programs"
O
N
)
option
(
GLFW_BUILD_EXAMPLES
"Build the GLFW example programs"
O
FF
)
option
(
GLFW_BUILD_TESTS
"Build the GLFW test programs"
O
N
)
option
(
GLFW_BUILD_TESTS
"Build the GLFW test programs"
O
FF
)
option
(
GLFW_BUILD_DOCS
"Build the GLFW documentation"
O
N
)
option
(
GLFW_BUILD_DOCS
"Build the GLFW documentation"
O
FF
)
option
(
GLFW_INSTALL
"Generate installation target"
O
N
)
option
(
GLFW_INSTALL
"Generate installation target"
O
FF
)
option
(
GLFW_VULKAN_STATIC
"Use the Vulkan loader statically linked into application"
OFF
)
option
(
GLFW_VULKAN_STATIC
"Use the Vulkan loader statically linked into application"
OFF
)
option
(
GLFW_DOCUMENT_INTERNALS
"Include internals in documentation"
OFF
)
option
(
GLFW_DOCUMENT_INTERNALS
"Include internals in documentation"
OFF
)
...
...
CMU462/src/color.cpp
View file @
052a7244
...
@@ -14,11 +14,11 @@ const Color Color::White = Color(1,1,1,1);
...
@@ -14,11 +14,11 @@ const Color Color::White = Color(1,1,1,1);
const
Color
Color
::
Black
=
Color
(
0
,
0
,
0
,
1
);
const
Color
Color
::
Black
=
Color
(
0
,
0
,
0
,
1
);
Color
::
Color
(
const
unsigned
char
*
arr
)
{
Color
::
Color
(
const
unsigned
char
*
arr
)
{
float
inv
=
1.0
/
255.0
;
float
inv
=
1.0
f
/
255.0
f
;
r
=
arr
[
0
]
*
inv
;
r
=
arr
[
0
]
*
inv
;
g
=
arr
[
1
]
*
inv
;
g
=
arr
[
1
]
*
inv
;
b
=
arr
[
2
]
*
inv
;
b
=
arr
[
2
]
*
inv
;
a
=
1.0
;
a
=
1.0
f
;
}
}
Color
Color
::
fromHex
(
const
char
*
s
)
{
Color
Color
::
fromHex
(
const
char
*
s
)
{
...
@@ -44,18 +44,18 @@ Color Color::fromHex( const char* s ) {
...
@@ -44,18 +44,18 @@ Color Color::fromHex( const char* s ) {
// Extract 8-byte chunks and normalize.
// Extract 8-byte chunks and normalize.
Color
c
;
Color
c
;
c
.
r
=
(
float
)(
(
rgb
&
0xFF0000
)
>>
16
)
/
255.0
;
c
.
r
=
(
float
)(
(
rgb
&
0xFF0000
)
>>
16
)
/
255.0
f
;
c
.
g
=
(
float
)(
(
rgb
&
0x00FF00
)
>>
8
)
/
255.0
;
c
.
g
=
(
float
)(
(
rgb
&
0x00FF00
)
>>
8
)
/
255.0
f
;
c
.
b
=
(
float
)(
(
rgb
&
0x0000FF
)
>>
0
)
/
255.0
;
c
.
b
=
(
float
)(
(
rgb
&
0x0000FF
)
>>
0
)
/
255.0
f
;
c
.
a
=
1.0
;
// set alpha to 1 (opaque) by default
c
.
a
=
1.0
;
// set alpha to 1 (opaque) by default
return
c
;
return
c
;
}
}
string
Color
::
toHex
(
void
)
const
{
string
Color
::
toHex
(
void
)
const
{
int
R
=
(
unsigned
char
)
max
(
0.
,
min
(
255.0
,
255.0
*
r
));
int
R
=
(
unsigned
char
)
max
(
0.
f
,
min
(
255.0
f
,
255.0
f
*
r
));
int
G
=
(
unsigned
char
)
max
(
0.
,
min
(
255.0
,
255.0
*
g
));
int
G
=
(
unsigned
char
)
max
(
0.
f
,
min
(
255.0
f
,
255.0
f
*
g
));
int
B
=
(
unsigned
char
)
max
(
0.
,
min
(
255.0
,
255.0
*
b
));
int
B
=
(
unsigned
char
)
max
(
0.
f
,
min
(
255.0
f
,
255.0
f
*
b
));
stringstream
ss
;
stringstream
ss
;
ss
<<
hex
;
ss
<<
hex
;
...
...
CMakeLists.txt
View file @
052a7244
...
@@ -33,7 +33,7 @@ if(APPLE)
...
@@ -33,7 +33,7 @@ if(APPLE)
set
(
CLANG_CXX_FLAGS
"-std=c++11 -m64"
)
set
(
CLANG_CXX_FLAGS
"-std=c++11 -m64"
)
if
(
BUILD_DEBUG
)
if
(
BUILD_DEBUG
OR CMAKE_BUILD_TYPE MATCHES
"Debug"
)
set
(
CMAKE_BUILD_TYPE Debug
)
set
(
CMAKE_BUILD_TYPE Debug
)
else
(
BUILD_DEBUG
)
else
(
BUILD_DEBUG
)
set
(
CLANG_CXX_FLAGS
"
${
CLANG_CXX_FLAGS
}
-O3"
)
set
(
CLANG_CXX_FLAGS
"
${
CLANG_CXX_FLAGS
}
-O3"
)
...
@@ -67,7 +67,9 @@ endif(APPLE)
...
@@ -67,7 +67,9 @@ endif(APPLE)
##################
##################
# Build on Linux #
# Build on Linux #
##################
##################
set
(
LINUX UNIX AND NOT APPLE
)
if
(
UNIX AND NOT APPLE
)
set
(
LINUX
)
endif
()
if
(
LINUX
)
if
(
LINUX
)
# GCC only
# GCC only
...
@@ -112,7 +114,6 @@ if(WIN32)
...
@@ -112,7 +114,6 @@ if(WIN32)
if
(
MSVC
)
if
(
MSVC
)
set
(
MSVC_CXX_FLAGS
"-std=gnu++11"
)
set
(
CMAKE_CXX_FLAGS_RELEASE
"
${
CMAKE_CXX_FLAGS_RELEASE
}
/MD"
)
set
(
CMAKE_CXX_FLAGS_RELEASE
"
${
CMAKE_CXX_FLAGS_RELEASE
}
/MD"
)
set
(
CMAKE_CXX_FLAGS_DEBUG
"
${
CMAKE_CXX_FLAGS_DEBUG
}
/MD"
)
set
(
CMAKE_CXX_FLAGS_DEBUG
"
${
CMAKE_CXX_FLAGS_DEBUG
}
/MD"
)
...
...
runcmake_win.bat
View file @
052a7244
@echo
off
@echo
off
if
exist
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
(
call
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
>
NUL
2
>
NUL
call
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
>
NUL
2
>
NUL
)
else
if
exist
"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
(
call
"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
>
NUL
2
>
NUL
)
else
(
rem "Could not find visual studio C++ build environment."
)
mkdir
build
mkdir
build
pushd
build
pushd
build
cmake
..
cmake
-A
x64
..
if
"
%
1"
==
"configure"
exit
if
"
%
1"
==
"configure"
exit
if
[
%
1
]==[]
(
cmake
--build
.
--config
RelWithDebInfo
)
if
[
%
1
]==[]
(
cmake
--build
.
--config
RelWithDebInfo
)
if
not
[
%
1
]==[]
(
cmake
--build
.
--config
%
1
)
if
not
[
%
1
]==[]
(
cmake
--build
.
--config
%
1
)
...
...
src/CMakeLists.txt
View file @
052a7244
...
@@ -83,7 +83,19 @@ if (APPLE) # Frameworks required on osx
...
@@ -83,7 +83,19 @@ if (APPLE) # Frameworks required on osx
${
IOKIT_LIBRARIES
}
${
IOKIT_LIBRARIES
}
${
COREVIDEO_LIBRARIES
}
${
COREVIDEO_LIBRARIES
}
)
)
else
(
UNIX
)
#LINUX
endif
()
if
(
WIN32
)
target_link_libraries
(
drawsvg drawsvg_hdwr drawsvg_ref
${
CMU462_LIBRARIES
}
${
GLEW_LIBRARIES
}
${
GLFW_LIBRARIES
}
${
FREETYPE_LIBRARIES
}
${
OPENGL_LIBRARIES
}
)
endif
()
if
(
UNIX AND NOT APPLE
)
#LINUX
target_link_libraries
(
drawsvg drawsvg_hdwr drawsvg_ref
target_link_libraries
(
drawsvg drawsvg_hdwr drawsvg_ref
${
CMU462_LIBRARIES
}
${
CMU462_LIBRARIES
}
${
GLEW_LIBRARIES
}
${
GLEW_LIBRARIES
}
...
...
src/hardware/hardware_renderer.cpp
View file @
052a7244
...
@@ -63,16 +63,12 @@ void HardwareRenderer::draw_svg( SVG& svg ) {
...
@@ -63,16 +63,12 @@ void HardwareRenderer::draw_svg( SVG& svg ) {
Vector2D
c
=
transform
(
Vector2D
(
0
,
svg
.
height
));
c
.
x
--
;
c
.
y
++
;
Vector2D
c
=
transform
(
Vector2D
(
0
,
svg
.
height
));
c
.
x
--
;
c
.
y
++
;
Vector2D
d
=
transform
(
Vector2D
(
svg
.
width
,
svg
.
height
));
d
.
x
++
;
d
.
y
++
;
Vector2D
d
=
transform
(
Vector2D
(
svg
.
width
,
svg
.
height
));
d
.
x
++
;
d
.
y
++
;
rasterize_line
(
a
.
x
,
a
.
y
,
b
.
x
,
b
.
y
,
Color
::
Black
);
rasterize_line
((
float
)
a
.
x
,
(
float
)
a
.
y
,
(
float
)
b
.
x
,
(
float
)
b
.
y
,
Color
::
Black
);
rasterize_line
(
a
.
x
,
a
.
y
,
c
.
x
,
c
.
y
,
Color
::
Black
);
rasterize_line
((
float
)
a
.
x
,
(
float
)
a
.
y
,
(
float
)
c
.
x
,
(
float
)
c
.
y
,
Color
::
Black
);
rasterize_line
(
d
.
x
,
d
.
y
,
b
.
x
,
b
.
y
,
Color
::
Black
);
rasterize_line
((
float
)
d
.
x
,
(
float
)
d
.
y
,
(
float
)
b
.
x
,
(
float
)
b
.
y
,
Color
::
Black
);
rasterize_line
(
d
.
x
,
d
.
y
,
c
.
x
,
c
.
y
,
Color
::
Black
);
rasterize_line
((
float
)
d
.
x
,
(
float
)
d
.
y
,
(
float
)
c
.
x
,
(
float
)
c
.
y
,
Color
::
Black
);
// resolve and send to render target
// resolve();
leave2DDrawing
();
leave2DDrawing
();
}
}
void
HardwareRenderer
::
draw_element
(
SVGElement
*
element
)
{
void
HardwareRenderer
::
draw_element
(
SVGElement
*
element
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment