Skip to content

Commit

Permalink
Adding Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshEngebretson committed Jan 26, 2015
1 parent 36322ba commit e925c9e
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -2,4 +2,5 @@
*.user
Bin/Atomic.d.ts
Source/Atomic/Javascript/Modules/*
AtomicEditor/*
AtomicEditor/*
Artifacts/*
Empty file added Artifacts/.gitkeep
Empty file.
2 changes: 1 addition & 1 deletion CMakeLists.txt
@@ -1,7 +1,7 @@

project (Atomic)

cmake_minimum_required (VERSION 3.1.0)
cmake_minimum_required (VERSION 3.0.0)

set (CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)

Expand Down
85 changes: 81 additions & 4 deletions Rakefile
Expand Up @@ -19,20 +19,97 @@ def get_os
)
end

puts get_os
$RAKE_ROOT = File.dirname(__FILE__)

namespace :build do
namespace :build_macosx do

CMAKE_BUILD_FOLDER = "#{$RAKE_ROOT}/Artifacts/MacOSX_Build"
PACKAGE_FOLDER = "#{$RAKE_ROOT}/Artifacts/MacOSX_Package"

task :clean do

if Dir.exists?("#{CMAKE_BUILD_FOLDER}")
sh "rm -rf #{CMAKE_BUILD_FOLDER}"
end

if Dir.exists?("#{CMAKE_BUILD_FOLDER}")
abort("Unable to clean #{$CMAKE_BUILD_FOLDER}")
end

if Dir.exists?("#{PACKAGE_FOLDER}")
sh "rm -rf #{PACKAGE_FOLDER}"
end

if Dir.exists?("#{PACKAGE_FOLDER}")
abort("Unable to clean #{$PACKAGE_FOLDER}")
end

end

task :cmake do

FileUtils.mkdir_p(CMAKE_BUILD_FOLDER)

Dir.chdir(CMAKE_BUILD_FOLDER) do
sh "cmake ../../ -DCMAKE_BUILD_TYPE=Debug"
end

end

task :jsbind do
task :generate_javascript_bindings => "build_macosx:cmake" do

Dir.chdir(CMAKE_BUILD_FOLDER) do
sh "make -j8 JSBind"
sh "./Source/Tools/JSBind/JSBind"
end

end

task :player do
task :player => "build_macosx:generate_javascript_bindings" do

Dir.chdir(CMAKE_BUILD_FOLDER) do
# add the generated JS bindings
sh "cmake ../../ -DCMAKE_BUILD_TYPE=Debug"
sh "make -j8 AtomicPlayer"
end

end

task :editor => "build_macosx:player" do

Dir.chdir(CMAKE_BUILD_FOLDER) do
# add the generated JS bindings
sh "make -j8 AtomicEditor"

PLAYER_APP_FOLDER = "#{CMAKE_BUILD_FOLDER}/Source/Tools/AtomicPlayer/AtomicPlayer.app"
EDITOR_APP_FOLDER = "#{CMAKE_BUILD_FOLDER}/AtomicEditor/AtomicEditor.app"
DEPLOYMENT_FOLDER = "#{EDITOR_APP_FOLDER}/Contents/Resources/Deployment/MacOS"

COREDATA_FOLDER = "#{$RAKE_ROOT}/Bin/CoreData"
DATA_FOLDER = "#{$RAKE_ROOT}/Bin/Data"
EDITORRESOURCES_FOLDER = "#{$RAKE_ROOT}/AtomicEditor/EditorResources"

if Dir.exists?("#{EDITOR_APP_FOLDER}/Contents/Resources")
sh "rm -rf #{EDITOR_APP_FOLDER}/Contents/Resources"
end

FileUtils.mkdir_p(DEPLOYMENT_FOLDER)

sh "cp -r #{COREDATA_FOLDER} #{EDITOR_APP_FOLDER}/Contents/Resources/CoreData"
sh "cp -r #{DATA_FOLDER} #{EDITOR_APP_FOLDER}/Contents/Resources/Data"
sh "cp -r #{EDITORRESOURCES_FOLDER} #{EDITOR_APP_FOLDER}/Contents/Resources/EditorResources"
sh "cp -r #{PLAYER_APP_FOLDER} #{DEPLOYMENT_FOLDER}/AtomicPlayer.app"

end

end

end

namespace :package_macosx do

task :editor => ['build_macosx:clean', 'build_macosx:editor'] do

end

end
2 changes: 1 addition & 1 deletion Source/Atomic/IO/FileSystem.cpp
Expand Up @@ -984,7 +984,7 @@ String FileSystem::GetAppBundleResourceFolder()

// Fix up to use the bundle layout
String programDir = GetProgramDir();
unsigned p = programDir.Find("/MacOS");
unsigned p = programDir.FindLast("/MacOS/");
if (p != String::NPOS)
{
programDir.Erase(p, programDir.Length() - p);
Expand Down
5 changes: 5 additions & 0 deletions Source/Tools/AtomicPlayer/AtomicPlayer.cpp
Expand Up @@ -156,6 +156,11 @@ void AtomicPlayer::Setup()
engineParameters_["WindowWidth"] = 1280;
engineParameters_["WindowHeight"] = 720;

#ifdef __APPLE__
engineParameters_["ResourcePrefixPath"] = "../Resources";
#endif


// Show usage if not found
if (scriptFileName_.Empty())
{
Expand Down
15 changes: 12 additions & 3 deletions Source/Tools/AtomicPlayer/CMakeLists.txt
Expand Up @@ -6,11 +6,20 @@ include_directories(${CMAKE_SOURCE_DIR}/Source/ThirdParty)
file (GLOB SOURCE_FILES *.cpp *.h )

if (MSVC)

set (EXE_TYPE WIN32)

set (EXE_TYPE WIN32)
else()
set (EXE_TYPE MACOSX_BUNDLE)
endif()

add_executable(AtomicPlayer ${EXE_TYPE} ${SOURCE_FILES})

target_link_libraries(AtomicPlayer ${ATOMIC_LINK_LIBRARIES})

if (APPLE)
set (TARGET_PROPERTIES MACOSX_BUNDLE_INFO_PLIST MacOSXBundleInfo.plist.template)
endif()

if (TARGET_PROPERTIES)
set_target_properties (AtomicPlayer PROPERTIES ${TARGET_PROPERTIES})
endif ()

0 comments on commit e925c9e

Please sign in to comment.