Permalink
Browse files

Added CMake file for samples, not tested on Windows, may be unflexibl…

…e right now.

Signed-off-by: Stefan <stefan@boxbox.org>
  • Loading branch information...
TankOs committed Aug 22, 2011
1 parent 3b4df0f commit 59ed2743689aac920ddad7a233ef5ceaddee3f23
Showing with 37 additions and 40 deletions.
  1. +0 −1 .gitignore
  2. +9 −0 CMakeLists.txt
  3. +6 −0 cmake/Samples.cmake
  4. +5 −0 samples/CMakeLists.txt
  5. +17 −0 samples/data/default.style
  6. 0 utils/__init__.py
  7. +0 −39 utils/codeblocks.py
View
@@ -3,4 +3,3 @@
*.os
*.so
/doc/html/
/samples/bin/
View
@@ -5,6 +5,11 @@ find_package( SFML 2.0 REQUIRED GRAPHICS WINDOW SYSTEM )
find_package( Boost 1.46 REQUIRED )
set( SFGUI_STATIC false CACHE BOOL "Build static library." )
set( BUILD_SAMPLES true CACHE BOOL "Build SFGUI sample applications." )
if( WINDOWS )
set( BIN_EXTENSION ".exe" )
endif()
set( SRC_DIR "${PROJECT_SOURCE_DIR}/src/" )
set( INC_DIR "${PROJECT_SOURCE_DIR}/include/" )
@@ -83,3 +88,7 @@ install(
FILES ${PROJECT_SOURCE_DIR}/cmake/FindSFGUI.cmake
DESTINATION ${CMAKE_ROOT}/Modules/
)
if( BUILD_SAMPLES )
add_subdirectory( "samples" )
endif()
View
@@ -0,0 +1,6 @@
function( build_sample SAMPLE_NAME SOURCES )
add_executable( ${SAMPLE_NAME} ${SOURCES} )
target_link_libraries( ${SAMPLE_NAME} sfgui sfml-graphics sfml-window sfml-system )
add_custom_command( TARGET ${SAMPLE_NAME} COMMAND cmake ARGS -E copy_if_different ${PROJECT_BINARY_DIR}/samples/${SAMPLE_NAME}${BIN_EXTENSION} ${PROJECT_SOURCE_DIR}/samples/${SAMPLE_NAME}${BIN_EXTENSION} )
endfunction()
View
@@ -0,0 +1,5 @@
cmake_minimum_required( VERSION 2.8 )
include( ../cmake/Samples.cmake )
build_sample( "test" "Test.cpp" )
View
@@ -0,0 +1,17 @@
# Example style file for the BREW render engine.
Button {
background-color: #aaaaaa;
text-color: #000000;
light-border-color: #bbbbbb;
dark-border-color: #999999;
border-width: 1;
}
Button:hover {
background-color: #bbbbbb;
}
Button:active {
}
View
No changes.
View
@@ -1,39 +0,0 @@
# -*- coding: utf-8 -*-
import os
def generate_codeblocks_project( target, source, env ):
header_template = """
<Unit filename="%s">
<Option compileVar=""/>
<Option compile="0"/>
<Option link="0"/>
<Option target="Debug"/>
<Option target="Release"/>
</Unit>"""
source_template = """
<Unit filename="%s">
<Option compileVar="CPP"/>
<Option target="Debug"/>
<Option target="Release"/>
</Unit>"""
xmlstr = []
rel_path = None if "cb_source_path_prefix" not in env else env["cb_source_path_prefix"]
for f in source:
filename = str( f )
if rel_path is not None:
filename = os.path.join( rel_path, filename )
if filename.endswith( ".hpp" ) or filename.endswith( ".inl" ):
xmlstr.append( header_template % filename )
else:
xmlstr.append( source_template % filename )
output = open( env["cb_template_filename"], "r" ).read()
output = output.replace( "__FILES__", "\n".join( xmlstr ) )
open( str( target[0] ), "w" ).write( output )
print "Code::Blocks project generated successfully."

0 comments on commit 59ed274

Please sign in to comment.