add basic cmake support, not tested on windows, and clean up premake scripts

This commit is contained in:
Thomas Fussell 2015-09-23 19:24:43 -04:00
parent 0a2e2f4ceb
commit 2831b25f09
7 changed files with 82 additions and 61 deletions

2
.gitignore vendored
View File

@ -1,6 +1,6 @@
bin/ bin/
lib/ lib/
build/*/ build/premake/*/
*.obj *.obj
*.sdf *.sdf
*.suo *.suo

View File

@ -0,0 +1,5 @@
cmake_minimum_required(VERSION 2.8.9)
project(xlnt)
add_subdirectory(xlnt)
add_subdirectory(xlnt.test)

View File

@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 2.8.9)
project(xlnt.test)
include_directories(../../../include)
include_directories(../../../third-party/pugixml/src)
include_directories(../../../third-party/cxxtest)
add_executable(xlnt.test ../../../tests/runner-autogen.cpp)
target_link_libraries(xlnt.test xlnt)

View File

@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 2.8.9)
project(xlnt)
include_directories(../../../include)
include_directories(../../../third-party/pugixml/src)
FILE(GLOB SOURCES ../../../source/*.cpp)
FILE(GLOB DETAIL_SOURCES ../../../source/detail/*.cpp)
add_library(xlnt STATIC ${SOURCES} ${DETAIL_SOURCES} ../../../third-party/pugixml/src/pugixml.cpp ../../../third-party/miniz/miniz.c)

View File

@ -9,19 +9,19 @@ project "xlnt.test"
kind "ConsoleApp" kind "ConsoleApp"
language "C++" language "C++"
targetname "xlnt.test" targetname "xlnt.test"
targetdir "../bin" targetdir "../../bin"
includedirs { includedirs {
"../include", "../../include",
"../third-party/pugixml/src", "../../third-party/pugixml/src",
"../third-party/miniz", "../../third-party/miniz",
"/usr/local/Cellar/cxxtest/4.3" "../../third-party/cxxtest"
} }
files { files {
"../tests/*.hpp", "../../tests/*.hpp",
"../tests/runner-autogen.cpp" "../../tests/runner-autogen.cpp"
} }
links { "xlnt" } links { "xlnt" }
prebuildcommands { "/usr/local/Cellar/cxxtest/4.3/bin/cxxtestgen --runner=ErrorPrinter -o ../../tests/runner-autogen.cpp ../../tests/*.hpp" } prebuildcommands { "../../../third-party/cxxtest/bin/cxxtestgen --runner=ErrorPrinter -o ../../../tests/runner-autogen.cpp ../../../tests/*.hpp" }
flags { "Unicode" } flags { "Unicode" }
configuration "windows" configuration "windows"
defines { "WIN32" } defines { "WIN32" }
@ -30,18 +30,18 @@ project "xlnt.test"
project "xlnt" project "xlnt"
kind "StaticLib" kind "StaticLib"
language "C++" language "C++"
targetdir "../lib/" targetdir "../../lib/"
includedirs { includedirs {
"../include", "../../include",
"../third-party/pugixml/src", "../../third-party/pugixml/src",
"../third-party/miniz" "../../third-party/miniz"
} }
files { files {
"../source/**.cpp", "../../source/**.cpp",
"../source/**.hpp", "../../source/**.hpp",
"../include/xlnt/**.hpp", "../../include/xlnt/**.hpp",
"../third-party/pugixml/src/pugixml.cpp", "../../third-party/pugixml/src/pugixml.cpp",
"../third-party/miniz/miniz.c" "../../third-party/miniz/miniz.c"
} }
flags { "Unicode" } flags { "Unicode" }
configuration "Debug" configuration "Debug"

View File

@ -12,19 +12,19 @@ project "xlnt.test"
kind "ConsoleApp" kind "ConsoleApp"
language "C++" language "C++"
targetname "xlnt.test" targetname "xlnt.test"
targetdir "../bin" targetdir "../../bin"
includedirs { includedirs {
"../include", "../../include",
"../third-party/pugixml/src", "../../third-party/pugixml/src",
"../third-party/miniz", "../../third-party/miniz",
"../third-party/cxxtest" "../../third-party/cxxtest"
} }
files { files {
"../tests/*.hpp", "../../tests/*.hpp",
"../tests/runner-autogen.cpp" "../../tests/runner-autogen.cpp"
} }
links { "xlnt" } links { "xlnt" }
prebuildcommands { "../../third-party/cxxtest/bin/cxxtestgen --runner=ErrorPrinter -o ../../tests/runner-autogen.cpp ../../tests/*.hpp" } prebuildcommands { "../../../third-party/cxxtest/bin/cxxtestgen --runner=ErrorPrinter -o ../../../tests/runner-autogen.cpp ../../../tests/*.hpp" }
flags { "Unicode" } flags { "Unicode" }
configuration "Release" configuration "Release"
flags { "LinkTimeOptimization" } flags { "LinkTimeOptimization" }
@ -36,18 +36,18 @@ project "xlnt"
kind "StaticLib" kind "StaticLib"
language "C++" language "C++"
warnings "Extra" warnings "Extra"
targetdir "../lib/" targetdir "../../lib/"
includedirs { includedirs {
"../include", "../../include",
"../third-party/miniz", "../../third-party/miniz",
"../third-party/pugixml/src" "../../third-party/pugixml/src"
} }
files { files {
"../source/**.cpp", "../../source/**.cpp",
"../source/**.hpp", "../../source/**.hpp",
"../include/xlnt/**.hpp", "../../include/xlnt/**.hpp",
"../third-party/miniz/miniz.c", "../../third-party/miniz/miniz.c",
"../third-party/pugixml/src/pugixml.cpp" "../../third-party/pugixml/src/pugixml.cpp"
} }
flags { "Unicode" } flags { "Unicode" }
configuration "Debug" configuration "Debug"

View File

@ -21,12 +21,12 @@ int main( int argc, char *argv[] ) {
return status; return status;
} }
bool suite_test_cell_init = false; bool suite_test_cell_init = false;
#include "/n/home08/tfussell/build/xlnt/tests/test_cell.hpp" #include "/Users/thomas/Development/xlnt/tests/test_cell.hpp"
static test_cell suite_test_cell; static test_cell suite_test_cell;
static CxxTest::List Tests_test_cell = { 0, 0 }; static CxxTest::List Tests_test_cell = { 0, 0 };
CxxTest::StaticSuiteDescription suiteDescription_test_cell( "../../tests/test_cell.hpp", 9, "test_cell", suite_test_cell, Tests_test_cell ); CxxTest::StaticSuiteDescription suiteDescription_test_cell( "../../../tests/test_cell.hpp", 9, "test_cell", suite_test_cell, Tests_test_cell );
static class TestDescription_suite_test_cell_test_coordinates : public CxxTest::RealTestDescription { static class TestDescription_suite_test_cell_test_coordinates : public CxxTest::RealTestDescription {
public: public:
@ -256,12 +256,12 @@ public:
void runTest() { suite_test_cell.test_cell_offset(); } void runTest() { suite_test_cell.test_cell_offset(); }
} testDescription_suite_test_cell_test_cell_offset; } testDescription_suite_test_cell_test_cell_offset;
#include "/n/home08/tfussell/build/xlnt/tests/test_chart.hpp" #include "/Users/thomas/Development/xlnt/tests/test_chart.hpp"
static test_chart suite_test_chart; static test_chart suite_test_chart;
static CxxTest::List Tests_test_chart = { 0, 0 }; static CxxTest::List Tests_test_chart = { 0, 0 };
CxxTest::StaticSuiteDescription suiteDescription_test_chart( "../../tests/test_chart.hpp", 8, "test_chart", suite_test_chart, Tests_test_chart ); CxxTest::StaticSuiteDescription suiteDescription_test_chart( "../../../tests/test_chart.hpp", 8, "test_chart", suite_test_chart, Tests_test_chart );
static class TestDescription_suite_test_chart_test_write_title : public CxxTest::RealTestDescription { static class TestDescription_suite_test_chart_test_write_title : public CxxTest::RealTestDescription {
public: public:
@ -347,12 +347,12 @@ public:
void runTest() { suite_test_chart.test_write_chart_scatter(); } void runTest() { suite_test_chart.test_write_chart_scatter(); }
} testDescription_suite_test_chart_test_write_chart_scatter; } testDescription_suite_test_chart_test_write_chart_scatter;
#include "/n/home08/tfussell/build/xlnt/tests/test_named_range.hpp" #include "/Users/thomas/Development/xlnt/tests/test_named_range.hpp"
static test_named_range suite_test_named_range; static test_named_range suite_test_named_range;
static CxxTest::List Tests_test_named_range = { 0, 0 }; static CxxTest::List Tests_test_named_range = { 0, 0 };
CxxTest::StaticSuiteDescription suiteDescription_test_named_range( "../../tests/test_named_range.hpp", 8, "test_named_range", suite_test_named_range, Tests_test_named_range ); CxxTest::StaticSuiteDescription suiteDescription_test_named_range( "../../../tests/test_named_range.hpp", 8, "test_named_range", suite_test_named_range, Tests_test_named_range );
static class TestDescription_suite_test_named_range_test_split : public CxxTest::RealTestDescription { static class TestDescription_suite_test_named_range_test_split : public CxxTest::RealTestDescription {
public: public:
@ -438,12 +438,12 @@ public:
void runTest() { suite_test_named_range.test_can_be_saved(); } void runTest() { suite_test_named_range.test_can_be_saved(); }
} testDescription_suite_test_named_range_test_can_be_saved; } testDescription_suite_test_named_range_test_can_be_saved;
#include "/n/home08/tfussell/build/xlnt/tests/test_number_format.hpp" #include "/Users/thomas/Development/xlnt/tests/test_number_format.hpp"
static test_number_format suite_test_number_format; static test_number_format suite_test_number_format;
static CxxTest::List Tests_test_number_format = { 0, 0 }; static CxxTest::List Tests_test_number_format = { 0, 0 };
CxxTest::StaticSuiteDescription suiteDescription_test_number_format( "../../tests/test_number_format.hpp", 8, "test_number_format", suite_test_number_format, Tests_test_number_format ); CxxTest::StaticSuiteDescription suiteDescription_test_number_format( "../../../tests/test_number_format.hpp", 8, "test_number_format", suite_test_number_format, Tests_test_number_format );
static class TestDescription_suite_test_number_format_test_convert_date_to_julian : public CxxTest::RealTestDescription { static class TestDescription_suite_test_number_format_test_convert_date_to_julian : public CxxTest::RealTestDescription {
public: public:
@ -541,12 +541,12 @@ public:
void runTest() { suite_test_number_format.test_mac_date(); } void runTest() { suite_test_number_format.test_mac_date(); }
} testDescription_suite_test_number_format_test_mac_date; } testDescription_suite_test_number_format_test_mac_date;
#include "/n/home08/tfussell/build/xlnt/tests/test_props.hpp" #include "/Users/thomas/Development/xlnt/tests/test_props.hpp"
static test_props suite_test_props; static test_props suite_test_props;
static CxxTest::List Tests_test_props = { 0, 0 }; static CxxTest::List Tests_test_props = { 0, 0 };
CxxTest::StaticSuiteDescription suiteDescription_test_props( "../../tests/test_props.hpp", 10, "test_props", suite_test_props, Tests_test_props ); CxxTest::StaticSuiteDescription suiteDescription_test_props( "../../../tests/test_props.hpp", 10, "test_props", suite_test_props, Tests_test_props );
static class TestDescription_suite_test_props_test_read_properties_core : public CxxTest::RealTestDescription { static class TestDescription_suite_test_props_test_read_properties_core : public CxxTest::RealTestDescription {
public: public:
@ -584,12 +584,12 @@ public:
void runTest() { suite_test_props.test_write_properties_app(); } void runTest() { suite_test_props.test_write_properties_app(); }
} testDescription_suite_test_props_test_write_properties_app; } testDescription_suite_test_props_test_write_properties_app;
#include "/n/home08/tfussell/build/xlnt/tests/test_read.hpp" #include "/Users/thomas/Development/xlnt/tests/test_read.hpp"
static test_read suite_test_read; static test_read suite_test_read;
static CxxTest::List Tests_test_read = { 0, 0 }; static CxxTest::List Tests_test_read = { 0, 0 };
CxxTest::StaticSuiteDescription suiteDescription_test_read( "../../tests/test_read.hpp", 10, "test_read", suite_test_read, Tests_test_read ); CxxTest::StaticSuiteDescription suiteDescription_test_read( "../../../tests/test_read.hpp", 10, "test_read", suite_test_read, Tests_test_read );
static class TestDescription_suite_test_read_test_read_standalone_worksheet : public CxxTest::RealTestDescription { static class TestDescription_suite_test_read_test_read_standalone_worksheet : public CxxTest::RealTestDescription {
public: public:
@ -777,12 +777,12 @@ public:
void runTest() { suite_test_read.test_bad_formats_no(); } void runTest() { suite_test_read.test_bad_formats_no(); }
} testDescription_suite_test_read_test_bad_formats_no; } testDescription_suite_test_read_test_bad_formats_no;
#include "/n/home08/tfussell/build/xlnt/tests/test_strings.hpp" #include "/Users/thomas/Development/xlnt/tests/test_strings.hpp"
static test_strings suite_test_strings; static test_strings suite_test_strings;
static CxxTest::List Tests_test_strings = { 0, 0 }; static CxxTest::List Tests_test_strings = { 0, 0 };
CxxTest::StaticSuiteDescription suiteDescription_test_strings( "../../tests/test_strings.hpp", 8, "test_strings", suite_test_strings, Tests_test_strings ); CxxTest::StaticSuiteDescription suiteDescription_test_strings( "../../../tests/test_strings.hpp", 8, "test_strings", suite_test_strings, Tests_test_strings );
static class TestDescription_suite_test_strings_test_create_string_table : public CxxTest::RealTestDescription { static class TestDescription_suite_test_strings_test_create_string_table : public CxxTest::RealTestDescription {
public: public:
@ -808,12 +808,12 @@ public:
void runTest() { suite_test_strings.test_formatted_string_table(); } void runTest() { suite_test_strings.test_formatted_string_table(); }
} testDescription_suite_test_strings_test_formatted_string_table; } testDescription_suite_test_strings_test_formatted_string_table;
#include "/n/home08/tfussell/build/xlnt/tests/test_style.hpp" #include "/Users/thomas/Development/xlnt/tests/test_style.hpp"
static test_style suite_test_style; static test_style suite_test_style;
static CxxTest::List Tests_test_style = { 0, 0 }; static CxxTest::List Tests_test_style = { 0, 0 };
CxxTest::StaticSuiteDescription suiteDescription_test_style( "../../tests/test_style.hpp", 8, "test_style", suite_test_style, Tests_test_style ); CxxTest::StaticSuiteDescription suiteDescription_test_style( "../../../tests/test_style.hpp", 8, "test_style", suite_test_style, Tests_test_style );
static class TestDescription_suite_test_style_test_create_style_table : public CxxTest::RealTestDescription { static class TestDescription_suite_test_style_test_create_style_table : public CxxTest::RealTestDescription {
public: public:
@ -917,12 +917,12 @@ public:
void runTest() { suite_test_style.test_protection(); } void runTest() { suite_test_style.test_protection(); }
} testDescription_suite_test_style_test_protection; } testDescription_suite_test_style_test_protection;
#include "/n/home08/tfussell/build/xlnt/tests/test_theme.hpp" #include "/Users/thomas/Development/xlnt/tests/test_theme.hpp"
static test_theme suite_test_theme; static test_theme suite_test_theme;
static CxxTest::List Tests_test_theme = { 0, 0 }; static CxxTest::List Tests_test_theme = { 0, 0 };
CxxTest::StaticSuiteDescription suiteDescription_test_theme( "../../tests/test_theme.hpp", 10, "test_theme", suite_test_theme, Tests_test_theme ); CxxTest::StaticSuiteDescription suiteDescription_test_theme( "../../../tests/test_theme.hpp", 10, "test_theme", suite_test_theme, Tests_test_theme );
static class TestDescription_suite_test_theme_test_write_theme : public CxxTest::RealTestDescription { static class TestDescription_suite_test_theme_test_write_theme : public CxxTest::RealTestDescription {
public: public:
@ -930,12 +930,12 @@ public:
void runTest() { suite_test_theme.test_write_theme(); } void runTest() { suite_test_theme.test_write_theme(); }
} testDescription_suite_test_theme_test_write_theme; } testDescription_suite_test_theme_test_write_theme;
#include "/n/home08/tfussell/build/xlnt/tests/test_workbook.hpp" #include "/Users/thomas/Development/xlnt/tests/test_workbook.hpp"
static test_workbook suite_test_workbook; static test_workbook suite_test_workbook;
static CxxTest::List Tests_test_workbook = { 0, 0 }; static CxxTest::List Tests_test_workbook = { 0, 0 };
CxxTest::StaticSuiteDescription suiteDescription_test_workbook( "../../tests/test_workbook.hpp", 10, "test_workbook", suite_test_workbook, Tests_test_workbook ); CxxTest::StaticSuiteDescription suiteDescription_test_workbook( "../../../tests/test_workbook.hpp", 10, "test_workbook", suite_test_workbook, Tests_test_workbook );
static class TestDescription_suite_test_workbook_test_get_active_sheet : public CxxTest::RealTestDescription { static class TestDescription_suite_test_workbook_test_get_active_sheet : public CxxTest::RealTestDescription {
public: public:
@ -1051,12 +1051,12 @@ public:
void runTest() { suite_test_workbook.test_write_regular_float(); } void runTest() { suite_test_workbook.test_write_regular_float(); }
} testDescription_suite_test_workbook_test_write_regular_float; } testDescription_suite_test_workbook_test_write_regular_float;
#include "/n/home08/tfussell/build/xlnt/tests/test_worksheet.hpp" #include "/Users/thomas/Development/xlnt/tests/test_worksheet.hpp"
static test_worksheet suite_test_worksheet; static test_worksheet suite_test_worksheet;
static CxxTest::List Tests_test_worksheet = { 0, 0 }; static CxxTest::List Tests_test_worksheet = { 0, 0 };
CxxTest::StaticSuiteDescription suiteDescription_test_worksheet( "../../tests/test_worksheet.hpp", 9, "test_worksheet", suite_test_worksheet, Tests_test_worksheet ); CxxTest::StaticSuiteDescription suiteDescription_test_worksheet( "../../../tests/test_worksheet.hpp", 9, "test_worksheet", suite_test_worksheet, Tests_test_worksheet );
static class TestDescription_suite_test_worksheet_test_new_worksheet : public CxxTest::RealTestDescription { static class TestDescription_suite_test_worksheet_test_new_worksheet : public CxxTest::RealTestDescription {
public: public:
@ -1292,12 +1292,12 @@ public:
void runTest() { suite_test_worksheet.test_page_options(); } void runTest() { suite_test_worksheet.test_page_options(); }
} testDescription_suite_test_worksheet_test_page_options; } testDescription_suite_test_worksheet_test_page_options;
#include "/n/home08/tfussell/build/xlnt/tests/test_write.hpp" #include "/Users/thomas/Development/xlnt/tests/test_write.hpp"
static test_write suite_test_write; static test_write suite_test_write;
static CxxTest::List Tests_test_write = { 0, 0 }; static CxxTest::List Tests_test_write = { 0, 0 };
CxxTest::StaticSuiteDescription suiteDescription_test_write( "../../tests/test_write.hpp", 11, "test_write", suite_test_write, Tests_test_write ); CxxTest::StaticSuiteDescription suiteDescription_test_write( "../../../tests/test_write.hpp", 11, "test_write", suite_test_write, Tests_test_write );
static class TestDescription_suite_test_write_test_write_empty_workbook : public CxxTest::RealTestDescription { static class TestDescription_suite_test_write_test_write_empty_workbook : public CxxTest::RealTestDescription {
public: public:
@ -1431,12 +1431,12 @@ public:
void runTest() { suite_test_write.test_short_number(); } void runTest() { suite_test_write.test_short_number(); }
} testDescription_suite_test_write_test_short_number; } testDescription_suite_test_write_test_short_number;
#include "/n/home08/tfussell/build/xlnt/tests/test_zip_file.hpp" #include "/Users/thomas/Development/xlnt/tests/test_zip_file.hpp"
static test_zip_file suite_test_zip_file; static test_zip_file suite_test_zip_file;
static CxxTest::List Tests_test_zip_file = { 0, 0 }; static CxxTest::List Tests_test_zip_file = { 0, 0 };
CxxTest::StaticSuiteDescription suiteDescription_test_zip_file( "../../tests/test_zip_file.hpp", 9, "test_zip_file", suite_test_zip_file, Tests_test_zip_file ); CxxTest::StaticSuiteDescription suiteDescription_test_zip_file( "../../../tests/test_zip_file.hpp", 9, "test_zip_file", suite_test_zip_file, Tests_test_zip_file );
static class TestDescription_suite_test_zip_file_test_load_file : public CxxTest::RealTestDescription { static class TestDescription_suite_test_zip_file_test_load_file : public CxxTest::RealTestDescription {
public: public: